@tager/admin-files 0.0.2 → 0.0.6
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/dist/index.esm.js +424 -131
- package/dist/index.umd.js +422 -129
- package/dist/node_modules/@tager/admin-ui/src/utils/common.d.ts +59 -0
- package/dist/services/requests.d.ts +1 -1
- package/dist/{dev.d.ts → src/dev.d.ts} +0 -0
- package/dist/{typings → src/typings}/model.d.ts +0 -0
- package/dist/views/FilesList/FilesList.vue.d.ts +3 -2
- package/dist/views/FilesList/components/UrlCell/UrlCell.vue.d.ts +169 -0
- package/dist/views/FilesList/components/UrlCell/index.d.ts +1 -0
- package/package.json +3 -2
- package/src/services/requests.ts +2 -2
- package/src/views/FilesList/FilesList.vue +44 -31
- package/src/views/FilesList/components/UrlCell/UrlCell.vue +68 -0
- package/src/views/FilesList/components/UrlCell/index.ts +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { request, useResourceDelete, convertRequestErrorToMap, i18n } from '@tager/admin-services';
|
|
1
|
+
import { request, isAbsoluteUrl, useResourceDelete, convertRequestErrorToMap, i18n } from '@tager/admin-services';
|
|
2
2
|
import { defineComponent, onMounted, ref } from '@vue/composition-api';
|
|
3
|
-
import { useTranslation, useDataTable, FormFooter } from '@tager/admin-ui';
|
|
3
|
+
import { useCopyToClipboard, useTranslation, useDataTable, FormFooter } from '@tager/admin-ui';
|
|
4
4
|
import { compile } from 'path-to-regexp';
|
|
5
5
|
|
|
6
6
|
const EN = {
|
|
@@ -41,6 +41,176 @@ const RU = {
|
|
|
41
41
|
add: 'Добавить',
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* filesize
|
|
46
|
+
*
|
|
47
|
+
* @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
48
|
+
* @license BSD-3-Clause
|
|
49
|
+
* @version 7.0.0
|
|
50
|
+
*/
|
|
51
|
+
const b = /^(b|B)$/,
|
|
52
|
+
symbol = {
|
|
53
|
+
iec: {
|
|
54
|
+
bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
|
|
55
|
+
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
|
56
|
+
},
|
|
57
|
+
jedec: {
|
|
58
|
+
bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
|
|
59
|
+
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
fullform = {
|
|
63
|
+
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
|
|
64
|
+
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
|
|
65
|
+
},
|
|
66
|
+
roundingFuncs = {
|
|
67
|
+
floor: Math.floor,
|
|
68
|
+
ceil: Math.ceil
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* filesize
|
|
73
|
+
*
|
|
74
|
+
* @method filesize
|
|
75
|
+
* @param {Mixed} arg String, Int or Float to transform
|
|
76
|
+
* @param {Object} descriptor [Optional] Flags
|
|
77
|
+
* @return {String} Readable file size String
|
|
78
|
+
*/
|
|
79
|
+
function filesize (arg, descriptor = {}) {
|
|
80
|
+
let result = [],
|
|
81
|
+
val = 0,
|
|
82
|
+
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, unix, separator, spacer, standard, symbols, roundingFunc, precision;
|
|
83
|
+
|
|
84
|
+
if (isNaN(arg)) {
|
|
85
|
+
throw new TypeError("Invalid number");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
bits = descriptor.bits === true;
|
|
89
|
+
unix = descriptor.unix === true;
|
|
90
|
+
pad = descriptor.pad === true;
|
|
91
|
+
base = descriptor.base || 2;
|
|
92
|
+
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
|
|
93
|
+
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
|
|
94
|
+
localeOptions = descriptor.localeOptions || {};
|
|
95
|
+
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
|
|
96
|
+
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
|
|
97
|
+
symbols = descriptor.symbols || {};
|
|
98
|
+
standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
|
|
99
|
+
output = descriptor.output || "string";
|
|
100
|
+
full = descriptor.fullform === true;
|
|
101
|
+
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
|
|
102
|
+
e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
|
|
103
|
+
roundingFunc = roundingFuncs[descriptor.roundingMethod] || Math.round;
|
|
104
|
+
num = Number(arg);
|
|
105
|
+
neg = num < 0;
|
|
106
|
+
ceil = base > 2 ? 1000 : 1024;
|
|
107
|
+
precision = isNaN(descriptor.precision) === false ? parseInt(descriptor.precision, 10) : 0;
|
|
108
|
+
|
|
109
|
+
// Flipping a negative number to determine the size
|
|
110
|
+
if (neg) {
|
|
111
|
+
num = -num;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Determining the exponent
|
|
115
|
+
if (e === -1 || isNaN(e)) {
|
|
116
|
+
e = Math.floor(Math.log(num) / Math.log(ceil));
|
|
117
|
+
|
|
118
|
+
if (e < 0) {
|
|
119
|
+
e = 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Exceeding supported length, time to reduce & multiply
|
|
124
|
+
if (e > 8) {
|
|
125
|
+
if (precision > 0) {
|
|
126
|
+
precision += 8 - e;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
e = 8;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (output === "exponent") {
|
|
133
|
+
return e;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Zero is now a special case because bytes divide by 1
|
|
137
|
+
if (num === 0) {
|
|
138
|
+
result[0] = 0;
|
|
139
|
+
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
|
|
140
|
+
} else {
|
|
141
|
+
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
|
|
142
|
+
|
|
143
|
+
if (bits) {
|
|
144
|
+
val = val * 8;
|
|
145
|
+
|
|
146
|
+
if (val >= ceil && e < 8) {
|
|
147
|
+
val = val / ceil;
|
|
148
|
+
e++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const p = Math.pow(10, e > 0 ? round : 0);
|
|
153
|
+
result[0] = roundingFunc(val * p) / p;
|
|
154
|
+
|
|
155
|
+
if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
|
|
156
|
+
result[0] = 1;
|
|
157
|
+
e++;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
u = result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
|
|
161
|
+
|
|
162
|
+
if (unix) {
|
|
163
|
+
result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
|
|
164
|
+
|
|
165
|
+
if (b.test(result[1])) {
|
|
166
|
+
result[0] = Math.floor(result[0]);
|
|
167
|
+
result[1] = "";
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Decorating a 'diff'
|
|
173
|
+
if (neg) {
|
|
174
|
+
result[0] = -result[0];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Setting optional precision
|
|
178
|
+
if (precision > 0) {
|
|
179
|
+
result[0] = result[0].toPrecision(precision);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Applying custom symbol
|
|
183
|
+
result[1] = symbols[result[1]] || result[1];
|
|
184
|
+
|
|
185
|
+
if (locale === true) {
|
|
186
|
+
result[0] = result[0].toLocaleString();
|
|
187
|
+
} else if (locale.length > 0) {
|
|
188
|
+
result[0] = result[0].toLocaleString(locale, localeOptions);
|
|
189
|
+
} else if (separator.length > 0) {
|
|
190
|
+
result[0] = result[0].toString().replace(".", separator);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (pad && Number.isInteger(result[0]) === false && round > 0) {
|
|
194
|
+
const x = separator || ".",
|
|
195
|
+
tmp = result[0].toString().split(x),
|
|
196
|
+
s = tmp[1] || "",
|
|
197
|
+
l = s.length,
|
|
198
|
+
n = round - l;
|
|
199
|
+
|
|
200
|
+
result[0] = `${tmp[0]}${x}${s.padEnd(l + n, "0")}`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (full) {
|
|
204
|
+
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Returning Array, Object, or String (default)
|
|
208
|
+
return output === "array" ? result : output === "object" ? {value: result[0], symbol: result[1], exponent: e, unit: u} : result.join(spacer);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Partial application for functional programming
|
|
212
|
+
filesize.partial = opt => arg => filesize(arg, opt);
|
|
213
|
+
|
|
44
214
|
function getFilesList(params) {
|
|
45
215
|
return request.get({ path: '/admin/userfiles', params });
|
|
46
216
|
}
|
|
@@ -50,8 +220,8 @@ function getFilesCount() {
|
|
|
50
220
|
function deleteFile(fileId) {
|
|
51
221
|
return request.delete({ path: `/admin/userfiles/${fileId}` });
|
|
52
222
|
}
|
|
53
|
-
function addFile(
|
|
54
|
-
return request.post({ path: '/admin/userfiles',
|
|
223
|
+
function addFile(payload) {
|
|
224
|
+
return request.post({ path: '/admin/userfiles', body: payload });
|
|
55
225
|
}
|
|
56
226
|
|
|
57
227
|
const FILES_ROUTE_PATHS = {
|
|
@@ -66,79 +236,32 @@ function getFilesFormUrl(params) {
|
|
|
66
236
|
return compile(FILES_ROUTE_PATHS.FILES_FORM)(params);
|
|
67
237
|
}
|
|
68
238
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
context,
|
|
92
|
-
});
|
|
93
|
-
const columnDefs = [
|
|
94
|
-
{
|
|
95
|
-
id: 1,
|
|
96
|
-
name: 'ID',
|
|
97
|
-
field: 'id',
|
|
98
|
-
style: { width: '50px', textAlign: 'center' },
|
|
99
|
-
headStyle: { width: '50px', textAlign: 'center' },
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: 2,
|
|
103
|
-
name: t('files:fileName'),
|
|
104
|
-
field: 'name',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: 3,
|
|
108
|
-
name: t('files:fileType'),
|
|
109
|
-
field: 'type',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: 4,
|
|
113
|
-
name: t('files:fileSize'),
|
|
114
|
-
field: 'size',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: 5,
|
|
118
|
-
name: 'URL',
|
|
119
|
-
field: 'url',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
id: 6,
|
|
123
|
-
name: t('files:delete'),
|
|
124
|
-
field: 'delete',
|
|
125
|
-
style: { textAlign: 'center' },
|
|
126
|
-
headStyle: { textAlign: 'center' },
|
|
127
|
-
},
|
|
128
|
-
];
|
|
239
|
+
/**
|
|
240
|
+
* Example:
|
|
241
|
+
* input: "https://ozitag.com/search?query=some_text"
|
|
242
|
+
* output: "/search?query=some_text"
|
|
243
|
+
*/
|
|
244
|
+
function cutUrlOrigin(url) {
|
|
245
|
+
if (!isAbsoluteUrl(url))
|
|
246
|
+
return url;
|
|
247
|
+
const urlObject = new URL(url);
|
|
248
|
+
return urlObject.href.slice(urlObject.origin.length);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
var script$2 = defineComponent({
|
|
252
|
+
name: 'UrlCell',
|
|
253
|
+
props: {
|
|
254
|
+
url: {
|
|
255
|
+
type: String,
|
|
256
|
+
default: '',
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
setup() {
|
|
260
|
+
const [isCopied, handleCopy] = useCopyToClipboard(500);
|
|
129
261
|
return {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
isRowDataLoading: isFilesListLoading,
|
|
134
|
-
errorMessage: errorMessage,
|
|
135
|
-
searchQuery,
|
|
136
|
-
handleChange,
|
|
137
|
-
pageSize,
|
|
138
|
-
pageCount,
|
|
139
|
-
pageNumber,
|
|
140
|
-
handleResourceDelete,
|
|
141
|
-
isDeleting,
|
|
262
|
+
isCopied,
|
|
263
|
+
handleCopy,
|
|
264
|
+
cutUrlOrigin,
|
|
142
265
|
};
|
|
143
266
|
},
|
|
144
267
|
});
|
|
@@ -218,6 +341,222 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
|
|
|
218
341
|
return script;
|
|
219
342
|
}
|
|
220
343
|
|
|
344
|
+
const isOldIE = typeof navigator !== 'undefined' &&
|
|
345
|
+
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
|
346
|
+
function createInjector(context) {
|
|
347
|
+
return (id, style) => addStyle(id, style);
|
|
348
|
+
}
|
|
349
|
+
let HEAD;
|
|
350
|
+
const styles = {};
|
|
351
|
+
function addStyle(id, css) {
|
|
352
|
+
const group = isOldIE ? css.media || 'default' : id;
|
|
353
|
+
const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
|
|
354
|
+
if (!style.ids.has(id)) {
|
|
355
|
+
style.ids.add(id);
|
|
356
|
+
let code = css.source;
|
|
357
|
+
if (css.map) {
|
|
358
|
+
// https://developer.chrome.com/devtools/docs/javascript-debugging
|
|
359
|
+
// this makes source maps inside style tags work properly in Chrome
|
|
360
|
+
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
|
|
361
|
+
// http://stackoverflow.com/a/26603875
|
|
362
|
+
code +=
|
|
363
|
+
'\n/*# sourceMappingURL=data:application/json;base64,' +
|
|
364
|
+
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
|
|
365
|
+
' */';
|
|
366
|
+
}
|
|
367
|
+
if (!style.element) {
|
|
368
|
+
style.element = document.createElement('style');
|
|
369
|
+
style.element.type = 'text/css';
|
|
370
|
+
if (css.media)
|
|
371
|
+
style.element.setAttribute('media', css.media);
|
|
372
|
+
if (HEAD === undefined) {
|
|
373
|
+
HEAD = document.head || document.getElementsByTagName('head')[0];
|
|
374
|
+
}
|
|
375
|
+
HEAD.appendChild(style.element);
|
|
376
|
+
}
|
|
377
|
+
if ('styleSheet' in style.element) {
|
|
378
|
+
style.styles.push(code);
|
|
379
|
+
style.element.styleSheet.cssText = style.styles
|
|
380
|
+
.filter(Boolean)
|
|
381
|
+
.join('\n');
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const index = style.ids.size - 1;
|
|
385
|
+
const textNode = document.createTextNode(code);
|
|
386
|
+
const nodes = style.element.childNodes;
|
|
387
|
+
if (nodes[index])
|
|
388
|
+
style.element.removeChild(nodes[index]);
|
|
389
|
+
if (nodes.length)
|
|
390
|
+
style.element.insertBefore(textNode, nodes[index]);
|
|
391
|
+
else
|
|
392
|
+
style.element.appendChild(textNode);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* script */
|
|
398
|
+
const __vue_script__$2 = script$2;
|
|
399
|
+
|
|
400
|
+
/* template */
|
|
401
|
+
var __vue_render__$2 = function () {
|
|
402
|
+
var _vm = this;
|
|
403
|
+
var _h = _vm.$createElement;
|
|
404
|
+
var _c = _vm._self._c || _h;
|
|
405
|
+
return _c(
|
|
406
|
+
"div",
|
|
407
|
+
{ staticClass: "url-cell" },
|
|
408
|
+
[
|
|
409
|
+
_c(
|
|
410
|
+
"a",
|
|
411
|
+
{ staticClass: "url-text", attrs: { href: _vm.url, target: "_blank" } },
|
|
412
|
+
[_vm._v(_vm._s(_vm.cutUrlOrigin(_vm.url)))]
|
|
413
|
+
),
|
|
414
|
+
_vm._v(" "),
|
|
415
|
+
_c(
|
|
416
|
+
"base-button",
|
|
417
|
+
{
|
|
418
|
+
staticClass: "copy-button",
|
|
419
|
+
attrs: { variant: "icon" },
|
|
420
|
+
on: {
|
|
421
|
+
click: function ($event) {
|
|
422
|
+
return _vm.handleCopy(_vm.url)
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
[
|
|
427
|
+
!_vm.isCopied
|
|
428
|
+
? _c("svg-icon", {
|
|
429
|
+
staticClass: "icon-size",
|
|
430
|
+
attrs: { name: "contentCopy" },
|
|
431
|
+
})
|
|
432
|
+
: _c("svg-icon", {
|
|
433
|
+
staticClass: "icon-size icon-color-green",
|
|
434
|
+
attrs: { name: "done" },
|
|
435
|
+
}),
|
|
436
|
+
],
|
|
437
|
+
1
|
|
438
|
+
),
|
|
439
|
+
],
|
|
440
|
+
1
|
|
441
|
+
)
|
|
442
|
+
};
|
|
443
|
+
var __vue_staticRenderFns__$2 = [];
|
|
444
|
+
__vue_render__$2._withStripped = true;
|
|
445
|
+
|
|
446
|
+
/* style */
|
|
447
|
+
const __vue_inject_styles__$2 = function (inject) {
|
|
448
|
+
if (!inject) return
|
|
449
|
+
inject("data-v-1551a39a_0", { source: ".url-cell[data-v-1551a39a] {\n display: flex;\n align-items: center;\n}\n.url-cell .url-text[data-v-1551a39a] {\n color: #007bff;\n}\n.url-cell .url-text[data-v-1551a39a]:hover {\n color: #0056b3;\n text-decoration: underline;\n}\n.url-cell .copy-button[data-v-1551a39a] {\n margin-left: 5px;\n}\n.url-cell .copy-button .icon-size[data-v-1551a39a] {\n width: 14px;\n height: 14px;\n}\n.url-cell .copy-button .icon-color-green[data-v-1551a39a] {\n color: #22863a;\n}\n\n/*# sourceMappingURL=UrlCell.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-files/tager-admin-files/src/views/FilesList/components/UrlCell/UrlCell.vue","UrlCell.vue"],"names":[],"mappings":"AAyCA;EACA,aAAA;EACA,mBAAA;ACxCA;AD0CA;EACA,cAAA;ACxCA;AD0CA;EACA,cAAA;EACA,0BAAA;ACxCA;AD4CA;EACA,gBAAA;AC1CA;AD4CA;EACA,WAAA;EACA,YAAA;AC1CA;AD6CA;EACA,cAAA;AC3CA;;AAEA,sCAAsC","file":"UrlCell.vue","sourcesContent":["<template>\n <div class=\"url-cell\">\n <a :href=\"url\" target=\"_blank\" class=\"url-text\">{{ cutUrlOrigin(url) }}</a>\n <base-button variant=\"icon\" class=\"copy-button\" @click=\"handleCopy(url)\">\n <svg-icon v-if=\"!isCopied\" name=\"contentCopy\" class=\"icon-size\" />\n <svg-icon v-else name=\"done\" class=\"icon-size icon-color-green\" />\n </base-button>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from '@vue/composition-api';\n\nimport { cutUrlOrigin } from '@tager/admin-ui/src/utils/common';\nimport { useCopyToClipboard } from '@tager/admin-ui';\n\ninterface Props {\n url: string;\n}\n\nexport default defineComponent<Props>({\n name: 'UrlCell',\n props: {\n url: {\n type: String,\n default: '',\n },\n },\n setup() {\n const [isCopied, handleCopy] = useCopyToClipboard(500);\n\n return {\n isCopied,\n handleCopy,\n cutUrlOrigin,\n };\n },\n});\n</script>\n\n<style lang=\"scss\" scoped>\n.url-cell {\n display: flex;\n align-items: center;\n\n .url-text {\n color: #007bff;\n\n &:hover {\n color: #0056b3;\n text-decoration: underline;\n }\n }\n\n .copy-button {\n margin-left: 5px;\n\n .icon-size {\n width: 14px;\n height: 14px;\n }\n\n .icon-color-green {\n color: #22863a;\n }\n }\n}\n</style>\n",".url-cell {\n display: flex;\n align-items: center;\n}\n.url-cell .url-text {\n color: #007bff;\n}\n.url-cell .url-text:hover {\n color: #0056b3;\n text-decoration: underline;\n}\n.url-cell .copy-button {\n margin-left: 5px;\n}\n.url-cell .copy-button .icon-size {\n width: 14px;\n height: 14px;\n}\n.url-cell .copy-button .icon-color-green {\n color: #22863a;\n}\n\n/*# sourceMappingURL=UrlCell.vue.map */"]}, media: undefined });
|
|
450
|
+
|
|
451
|
+
};
|
|
452
|
+
/* scoped */
|
|
453
|
+
const __vue_scope_id__$2 = "data-v-1551a39a";
|
|
454
|
+
/* module identifier */
|
|
455
|
+
const __vue_module_identifier__$2 = undefined;
|
|
456
|
+
/* functional template */
|
|
457
|
+
const __vue_is_functional_template__$2 = false;
|
|
458
|
+
/* style inject SSR */
|
|
459
|
+
|
|
460
|
+
/* style inject shadow dom */
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
|
|
465
|
+
{ render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
|
|
466
|
+
__vue_inject_styles__$2,
|
|
467
|
+
__vue_script__$2,
|
|
468
|
+
__vue_scope_id__$2,
|
|
469
|
+
__vue_is_functional_template__$2,
|
|
470
|
+
__vue_module_identifier__$2,
|
|
471
|
+
false,
|
|
472
|
+
createInjector,
|
|
473
|
+
undefined,
|
|
474
|
+
undefined
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
var script$1 = defineComponent({
|
|
478
|
+
name: 'FilesList',
|
|
479
|
+
components: {
|
|
480
|
+
UrlCell: __vue_component__$2,
|
|
481
|
+
},
|
|
482
|
+
setup(props, context) {
|
|
483
|
+
const { t } = useTranslation(context);
|
|
484
|
+
const { fetchEntityList: fetchFilesList, isLoading: isFilesListLoading, rowData: filesList, errorMessage, searchQuery, handleChange, pageSize, pageCount, pageNumber, } = useDataTable({
|
|
485
|
+
fetchEntityList: (params) => getFilesList({
|
|
486
|
+
query: params.searchQuery,
|
|
487
|
+
pageNumber: params.pageNumber,
|
|
488
|
+
pageSize: params.pageSize,
|
|
489
|
+
}),
|
|
490
|
+
initialValue: [],
|
|
491
|
+
context,
|
|
492
|
+
resourceName: 'Files list',
|
|
493
|
+
pageSize: 100,
|
|
494
|
+
});
|
|
495
|
+
onMounted(() => {
|
|
496
|
+
fetchFilesList();
|
|
497
|
+
});
|
|
498
|
+
const { handleResourceDelete, isDeleting } = useResourceDelete({
|
|
499
|
+
deleteResource: deleteFile,
|
|
500
|
+
resourceName: 'File',
|
|
501
|
+
onSuccess: fetchFilesList,
|
|
502
|
+
context,
|
|
503
|
+
});
|
|
504
|
+
const columnDefs = [
|
|
505
|
+
{
|
|
506
|
+
id: 1,
|
|
507
|
+
name: 'ID',
|
|
508
|
+
field: 'id',
|
|
509
|
+
style: { width: '50px', textAlign: 'center' },
|
|
510
|
+
headStyle: { width: '50px', textAlign: 'center' },
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
id: 2,
|
|
514
|
+
name: t('files:fileName'),
|
|
515
|
+
field: 'name',
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
id: 3,
|
|
519
|
+
name: t('files:fileType'),
|
|
520
|
+
field: 'type',
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
id: 4,
|
|
524
|
+
name: t('files:fileSize'),
|
|
525
|
+
field: 'size',
|
|
526
|
+
format: ({ row }) => filesize(row.size),
|
|
527
|
+
style: { whiteSpace: 'nowrap' },
|
|
528
|
+
headStyle: { whiteSpace: 'nowrap' },
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
id: 5,
|
|
532
|
+
name: 'URL',
|
|
533
|
+
field: 'url'
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
id: 6,
|
|
537
|
+
name: t('files:delete'),
|
|
538
|
+
field: 'delete',
|
|
539
|
+
style: { textAlign: 'center' },
|
|
540
|
+
headStyle: { textAlign: 'center' },
|
|
541
|
+
},
|
|
542
|
+
];
|
|
543
|
+
return {
|
|
544
|
+
columnDefs,
|
|
545
|
+
getFilesFormUrl,
|
|
546
|
+
rowData: filesList,
|
|
547
|
+
isRowDataLoading: isFilesListLoading,
|
|
548
|
+
errorMessage: errorMessage,
|
|
549
|
+
searchQuery,
|
|
550
|
+
handleChange,
|
|
551
|
+
pageSize,
|
|
552
|
+
pageCount,
|
|
553
|
+
pageNumber,
|
|
554
|
+
handleResourceDelete,
|
|
555
|
+
isDeleting,
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
|
|
221
560
|
/* script */
|
|
222
561
|
const __vue_script__$1 = script$1;
|
|
223
562
|
|
|
@@ -256,6 +595,13 @@ var __vue_render__$1 = function () {
|
|
|
256
595
|
},
|
|
257
596
|
on: { change: _vm.handleChange },
|
|
258
597
|
scopedSlots: _vm._u([
|
|
598
|
+
{
|
|
599
|
+
key: "cell(url)",
|
|
600
|
+
fn: function (ref) {
|
|
601
|
+
var row = ref.row;
|
|
602
|
+
return [_c("UrlCell", { attrs: { url: row.url } })]
|
|
603
|
+
},
|
|
604
|
+
},
|
|
259
605
|
{
|
|
260
606
|
key: "cell(delete)",
|
|
261
607
|
fn: function (ref) {
|
|
@@ -376,59 +722,6 @@ var script = defineComponent({
|
|
|
376
722
|
},
|
|
377
723
|
});
|
|
378
724
|
|
|
379
|
-
const isOldIE = typeof navigator !== 'undefined' &&
|
|
380
|
-
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
|
381
|
-
function createInjector(context) {
|
|
382
|
-
return (id, style) => addStyle(id, style);
|
|
383
|
-
}
|
|
384
|
-
let HEAD;
|
|
385
|
-
const styles = {};
|
|
386
|
-
function addStyle(id, css) {
|
|
387
|
-
const group = isOldIE ? css.media || 'default' : id;
|
|
388
|
-
const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
|
|
389
|
-
if (!style.ids.has(id)) {
|
|
390
|
-
style.ids.add(id);
|
|
391
|
-
let code = css.source;
|
|
392
|
-
if (css.map) {
|
|
393
|
-
// https://developer.chrome.com/devtools/docs/javascript-debugging
|
|
394
|
-
// this makes source maps inside style tags work properly in Chrome
|
|
395
|
-
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
|
|
396
|
-
// http://stackoverflow.com/a/26603875
|
|
397
|
-
code +=
|
|
398
|
-
'\n/*# sourceMappingURL=data:application/json;base64,' +
|
|
399
|
-
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
|
|
400
|
-
' */';
|
|
401
|
-
}
|
|
402
|
-
if (!style.element) {
|
|
403
|
-
style.element = document.createElement('style');
|
|
404
|
-
style.element.type = 'text/css';
|
|
405
|
-
if (css.media)
|
|
406
|
-
style.element.setAttribute('media', css.media);
|
|
407
|
-
if (HEAD === undefined) {
|
|
408
|
-
HEAD = document.head || document.getElementsByTagName('head')[0];
|
|
409
|
-
}
|
|
410
|
-
HEAD.appendChild(style.element);
|
|
411
|
-
}
|
|
412
|
-
if ('styleSheet' in style.element) {
|
|
413
|
-
style.styles.push(code);
|
|
414
|
-
style.element.styleSheet.cssText = style.styles
|
|
415
|
-
.filter(Boolean)
|
|
416
|
-
.join('\n');
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
const index = style.ids.size - 1;
|
|
420
|
-
const textNode = document.createTextNode(code);
|
|
421
|
-
const nodes = style.element.childNodes;
|
|
422
|
-
if (nodes[index])
|
|
423
|
-
style.element.removeChild(nodes[index]);
|
|
424
|
-
if (nodes.length)
|
|
425
|
-
style.element.insertBefore(textNode, nodes[index]);
|
|
426
|
-
else
|
|
427
|
-
style.element.appendChild(textNode);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
725
|
/* script */
|
|
433
726
|
const __vue_script__ = script;
|
|
434
727
|
|
|
@@ -501,11 +794,11 @@ __vue_render__._withStripped = true;
|
|
|
501
794
|
/* style */
|
|
502
795
|
const __vue_inject_styles__ = function (inject) {
|
|
503
796
|
if (!inject) return
|
|
504
|
-
inject("data-v-
|
|
797
|
+
inject("data-v-5f7d9380_0", { source: "\n\n/*# sourceMappingURL=FilesForm.vue.map */", map: {"version":3,"sources":["FilesForm.vue"],"names":[],"mappings":";;AAEA,wCAAwC","file":"FilesForm.vue"}, media: undefined });
|
|
505
798
|
|
|
506
799
|
};
|
|
507
800
|
/* scoped */
|
|
508
|
-
const __vue_scope_id__ = "data-v-
|
|
801
|
+
const __vue_scope_id__ = "data-v-5f7d9380";
|
|
509
802
|
/* module identifier */
|
|
510
803
|
const __vue_module_identifier__ = undefined;
|
|
511
804
|
/* functional template */
|