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