@tager/admin-files 0.0.6 → 0.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.
File without changes
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { request, isAbsoluteUrl, useResourceDelete, convertRequestErrorToMap, i18n } from '@tager/admin-services';
1
+ import { request, useResourceDelete, convertRequestErrorToMap, i18n } from '@tager/admin-services';
2
2
  import { defineComponent, onMounted, ref } from '@vue/composition-api';
3
- import { useCopyToClipboard, useTranslation, useDataTable, FormFooter } from '@tager/admin-ui';
3
+ import { useTranslation, useDataTable, cutUrlOrigin, FormFooter } from '@tager/admin-ui';
4
4
  import { compile } from 'path-to-regexp';
5
5
 
6
6
  const EN = {
@@ -236,32 +236,88 @@ function getFilesFormUrl(params) {
236
236
  return compile(FILES_ROUTE_PATHS.FILES_FORM)(params);
237
237
  }
238
238
 
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);
239
+ var script$1 = defineComponent({
240
+ name: 'FilesList',
241
+ components: {},
242
+ setup(props, context) {
243
+ const { t } = useTranslation(context);
244
+ const { fetchEntityList: fetchFilesList, isLoading: isFilesListLoading, rowData: filesList, errorMessage, searchQuery, handleChange, pageSize, pageCount, pageNumber, } = useDataTable({
245
+ fetchEntityList: (params) => getFilesList({
246
+ query: params.searchQuery,
247
+ pageNumber: params.pageNumber,
248
+ pageSize: params.pageSize,
249
+ }),
250
+ initialValue: [],
251
+ context,
252
+ resourceName: 'Files list',
253
+ pageSize: 100,
254
+ });
255
+ onMounted(() => {
256
+ fetchFilesList();
257
+ });
258
+ const { handleResourceDelete, isDeleting } = useResourceDelete({
259
+ deleteResource: deleteFile,
260
+ resourceName: 'File',
261
+ onSuccess: fetchFilesList,
262
+ context,
263
+ });
264
+ const columnDefs = [
265
+ {
266
+ id: 1,
267
+ name: 'ID',
268
+ field: 'id',
269
+ style: { width: '50px', textAlign: 'center' },
270
+ headStyle: { width: '50px', textAlign: 'center' },
271
+ },
272
+ {
273
+ id: 2,
274
+ name: t('files:fileName'),
275
+ field: 'name',
276
+ },
277
+ {
278
+ id: 3,
279
+ name: t('files:fileType'),
280
+ field: 'type',
281
+ },
282
+ {
283
+ id: 4,
284
+ name: t('files:fileSize'),
285
+ field: 'size',
286
+ format: ({ row }) => filesize(row.size),
287
+ style: { whiteSpace: 'nowrap' },
288
+ headStyle: { whiteSpace: 'nowrap' },
289
+ },
290
+ {
291
+ id: 5,
292
+ name: 'URL',
293
+ type: 'link',
294
+ field: 'url',
295
+ format: ({ row }) => ({
296
+ url: row.url,
297
+ text: cutUrlOrigin(row.url)
298
+ }),
299
+ },
300
+ {
301
+ id: 6,
302
+ name: t('files:delete'),
303
+ field: 'delete',
304
+ style: { textAlign: 'center' },
305
+ headStyle: { textAlign: 'center' },
306
+ },
307
+ ];
261
308
  return {
262
- isCopied,
263
- handleCopy,
264
- cutUrlOrigin,
309
+ columnDefs,
310
+ getFilesFormUrl,
311
+ rowData: filesList,
312
+ isRowDataLoading: isFilesListLoading,
313
+ errorMessage: errorMessage,
314
+ searchQuery,
315
+ handleChange,
316
+ pageSize,
317
+ pageCount,
318
+ pageNumber,
319
+ handleResourceDelete,
320
+ isDeleting,
265
321
  };
266
322
  },
267
323
  });
@@ -341,222 +397,6 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
341
397
  return script;
342
398
  }
343
399
 
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
-
560
400
  /* script */
561
401
  const __vue_script__$1 = script$1;
562
402
 
@@ -595,13 +435,6 @@ var __vue_render__$1 = function () {
595
435
  },
596
436
  on: { change: _vm.handleChange },
597
437
  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
- },
605
438
  {
606
439
  key: "cell(delete)",
607
440
  fn: function (ref) {
@@ -722,6 +555,59 @@ var script = defineComponent({
722
555
  },
723
556
  });
724
557
 
558
+ const isOldIE = typeof navigator !== 'undefined' &&
559
+ /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
560
+ function createInjector(context) {
561
+ return (id, style) => addStyle(id, style);
562
+ }
563
+ let HEAD;
564
+ const styles = {};
565
+ function addStyle(id, css) {
566
+ const group = isOldIE ? css.media || 'default' : id;
567
+ const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
568
+ if (!style.ids.has(id)) {
569
+ style.ids.add(id);
570
+ let code = css.source;
571
+ if (css.map) {
572
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
573
+ // this makes source maps inside style tags work properly in Chrome
574
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
575
+ // http://stackoverflow.com/a/26603875
576
+ code +=
577
+ '\n/*# sourceMappingURL=data:application/json;base64,' +
578
+ btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
579
+ ' */';
580
+ }
581
+ if (!style.element) {
582
+ style.element = document.createElement('style');
583
+ style.element.type = 'text/css';
584
+ if (css.media)
585
+ style.element.setAttribute('media', css.media);
586
+ if (HEAD === undefined) {
587
+ HEAD = document.head || document.getElementsByTagName('head')[0];
588
+ }
589
+ HEAD.appendChild(style.element);
590
+ }
591
+ if ('styleSheet' in style.element) {
592
+ style.styles.push(code);
593
+ style.element.styleSheet.cssText = style.styles
594
+ .filter(Boolean)
595
+ .join('\n');
596
+ }
597
+ else {
598
+ const index = style.ids.size - 1;
599
+ const textNode = document.createTextNode(code);
600
+ const nodes = style.element.childNodes;
601
+ if (nodes[index])
602
+ style.element.removeChild(nodes[index]);
603
+ if (nodes.length)
604
+ style.element.insertBefore(textNode, nodes[index]);
605
+ else
606
+ style.element.appendChild(textNode);
607
+ }
608
+ }
609
+ }
610
+
725
611
  /* script */
726
612
  const __vue_script__ = script;
727
613
 
package/dist/index.umd.js CHANGED
@@ -237,32 +237,88 @@
237
237
  return pathToRegexp.compile(FILES_ROUTE_PATHS.FILES_FORM)(params);
238
238
  }
239
239
 
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);
240
+ var script$1 = compositionApi.defineComponent({
241
+ name: 'FilesList',
242
+ components: {},
243
+ setup(props, context) {
244
+ const { t } = adminUi.useTranslation(context);
245
+ const { fetchEntityList: fetchFilesList, isLoading: isFilesListLoading, rowData: filesList, errorMessage, searchQuery, handleChange, pageSize, pageCount, pageNumber, } = adminUi.useDataTable({
246
+ fetchEntityList: (params) => getFilesList({
247
+ query: params.searchQuery,
248
+ pageNumber: params.pageNumber,
249
+ pageSize: params.pageSize,
250
+ }),
251
+ initialValue: [],
252
+ context,
253
+ resourceName: 'Files list',
254
+ pageSize: 100,
255
+ });
256
+ compositionApi.onMounted(() => {
257
+ fetchFilesList();
258
+ });
259
+ const { handleResourceDelete, isDeleting } = adminServices.useResourceDelete({
260
+ deleteResource: deleteFile,
261
+ resourceName: 'File',
262
+ onSuccess: fetchFilesList,
263
+ context,
264
+ });
265
+ const columnDefs = [
266
+ {
267
+ id: 1,
268
+ name: 'ID',
269
+ field: 'id',
270
+ style: { width: '50px', textAlign: 'center' },
271
+ headStyle: { width: '50px', textAlign: 'center' },
272
+ },
273
+ {
274
+ id: 2,
275
+ name: t('files:fileName'),
276
+ field: 'name',
277
+ },
278
+ {
279
+ id: 3,
280
+ name: t('files:fileType'),
281
+ field: 'type',
282
+ },
283
+ {
284
+ id: 4,
285
+ name: t('files:fileSize'),
286
+ field: 'size',
287
+ format: ({ row }) => filesize(row.size),
288
+ style: { whiteSpace: 'nowrap' },
289
+ headStyle: { whiteSpace: 'nowrap' },
290
+ },
291
+ {
292
+ id: 5,
293
+ name: 'URL',
294
+ type: 'link',
295
+ field: 'url',
296
+ format: ({ row }) => ({
297
+ url: row.url,
298
+ text: adminUi.cutUrlOrigin(row.url)
299
+ }),
300
+ },
301
+ {
302
+ id: 6,
303
+ name: t('files:delete'),
304
+ field: 'delete',
305
+ style: { textAlign: 'center' },
306
+ headStyle: { textAlign: 'center' },
307
+ },
308
+ ];
262
309
  return {
263
- isCopied,
264
- handleCopy,
265
- cutUrlOrigin,
310
+ columnDefs,
311
+ getFilesFormUrl,
312
+ rowData: filesList,
313
+ isRowDataLoading: isFilesListLoading,
314
+ errorMessage: errorMessage,
315
+ searchQuery,
316
+ handleChange,
317
+ pageSize,
318
+ pageCount,
319
+ pageNumber,
320
+ handleResourceDelete,
321
+ isDeleting,
266
322
  };
267
323
  },
268
324
  });
@@ -342,222 +398,6 @@
342
398
  return script;
343
399
  }
344
400
 
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
-
561
401
  /* script */
562
402
  const __vue_script__$1 = script$1;
563
403
 
@@ -596,13 +436,6 @@
596
436
  },
597
437
  on: { change: _vm.handleChange },
598
438
  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
- },
606
439
  {
607
440
  key: "cell(delete)",
608
441
  fn: function (ref) {
@@ -723,6 +556,59 @@
723
556
  },
724
557
  });
725
558
 
559
+ const isOldIE = typeof navigator !== 'undefined' &&
560
+ /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
561
+ function createInjector(context) {
562
+ return (id, style) => addStyle(id, style);
563
+ }
564
+ let HEAD;
565
+ const styles = {};
566
+ function addStyle(id, css) {
567
+ const group = isOldIE ? css.media || 'default' : id;
568
+ const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
569
+ if (!style.ids.has(id)) {
570
+ style.ids.add(id);
571
+ let code = css.source;
572
+ if (css.map) {
573
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
574
+ // this makes source maps inside style tags work properly in Chrome
575
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
576
+ // http://stackoverflow.com/a/26603875
577
+ code +=
578
+ '\n/*# sourceMappingURL=data:application/json;base64,' +
579
+ btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
580
+ ' */';
581
+ }
582
+ if (!style.element) {
583
+ style.element = document.createElement('style');
584
+ style.element.type = 'text/css';
585
+ if (css.media)
586
+ style.element.setAttribute('media', css.media);
587
+ if (HEAD === undefined) {
588
+ HEAD = document.head || document.getElementsByTagName('head')[0];
589
+ }
590
+ HEAD.appendChild(style.element);
591
+ }
592
+ if ('styleSheet' in style.element) {
593
+ style.styles.push(code);
594
+ style.element.styleSheet.cssText = style.styles
595
+ .filter(Boolean)
596
+ .join('\n');
597
+ }
598
+ else {
599
+ const index = style.ids.size - 1;
600
+ const textNode = document.createTextNode(code);
601
+ const nodes = style.element.childNodes;
602
+ if (nodes[index])
603
+ style.element.removeChild(nodes[index]);
604
+ if (nodes.length)
605
+ style.element.insertBefore(textNode, nodes[index]);
606
+ else
607
+ style.element.appendChild(textNode);
608
+ }
609
+ }
610
+ }
611
+
726
612
  /* script */
727
613
  const __vue_script__ = script;
728
614
 
File without changes
@@ -1,8 +1,7 @@
1
1
  import { ColumnDefinition } from '@tager/admin-ui';
2
2
  import { FileModel } from '../../typings/model';
3
3
  import { getFilesFormUrl } from '../../utils/paths';
4
- import UrlCell from './components/UrlCell';
5
- declare const _default: import("vue").ComponentOptions<UrlCell, import("@vue/composition-api").ShallowUnwrapRef<{
4
+ declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
6
5
  columnDefs: ColumnDefinition<FileModel>[];
7
6
  getFilesFormUrl: typeof getFilesFormUrl;
8
7
  rowData: import("@vue/composition-api").Ref<FileModel[]>;
@@ -17,7 +16,7 @@ declare const _default: import("vue").ComponentOptions<UrlCell, import("@vue/com
17
16
  isDeleting: (entityId: string | number) => boolean;
18
17
  }> & import("@vue/composition-api").Data, {}, {}, unknown, {
19
18
  [x: string]: any;
20
- }> & import("vue").VueConstructor<UrlCell> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
19
+ }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
21
20
  [x: string]: any;
22
21
  }, import("@vue/composition-api").ShallowUnwrapRef<{
23
22
  columnDefs: ColumnDefinition<FileModel>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tager/admin-files",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -22,10 +22,6 @@
22
22
  }"
23
23
  @change="handleChange"
24
24
  >
25
- <template v-slot:cell(url)="{ row }">
26
- <UrlCell :url="row.url"/>
27
- </template>
28
-
29
25
  <template v-slot:cell(delete)="{ row }">
30
26
  <base-button
31
27
  variant="icon"
@@ -45,7 +41,7 @@ import {defineComponent, onMounted} from '@vue/composition-api';
45
41
  import filesize from 'filesize';
46
42
 
47
43
  import {
48
- ColumnDefinition,
44
+ ColumnDefinition, cutUrlOrigin,
49
45
  useDataTable,
50
46
  useTranslation,
51
47
  } from '@tager/admin-ui';
@@ -55,13 +51,9 @@ import {deleteFile, getFilesList} from '../../services/requests';
55
51
  import {FileModel} from '../../typings/model';
56
52
  import {getFilesFormUrl} from '../../utils/paths';
57
53
 
58
- import UrlCell from './components/UrlCell';
59
-
60
54
  export default defineComponent({
61
55
  name: 'FilesList',
62
- components: {
63
- UrlCell,
64
- },
56
+ components: {},
65
57
  setup(props, context) {
66
58
  const {t} = useTranslation(context);
67
59
 
@@ -128,7 +120,12 @@ export default defineComponent({
128
120
  {
129
121
  id: 5,
130
122
  name: 'URL',
131
- field: 'url'
123
+ type: 'link',
124
+ field: 'url',
125
+ format: ({row}) => ({
126
+ url: row.url,
127
+ text: cutUrlOrigin(row.url)
128
+ }),
132
129
  },
133
130
  {
134
131
  id: 6,
@@ -1,59 +0,0 @@
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 {};
@@ -1,169 +0,0 @@
1
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data> & import("@vue/composition-api").Data, {}, {}, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, ({
2
- [x: number]: string;
3
- } & {
4
- length?: number | undefined;
5
- toString?: string | undefined;
6
- toLocaleString?: string | undefined;
7
- pop?: string | undefined;
8
- push?: number | undefined;
9
- concat?: string[] | undefined;
10
- join?: string | undefined;
11
- reverse?: string[] | undefined;
12
- shift?: string | undefined;
13
- slice?: string[] | undefined;
14
- sort?: string[] | undefined;
15
- splice?: {
16
- (start: number, deleteCount?: number | undefined): string[];
17
- (start: number, deleteCount: number, ...items: string[]): string[];
18
- } | undefined;
19
- unshift?: number | undefined;
20
- indexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
21
- lastIndexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
22
- every?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
23
- some?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
24
- forEach?: ((callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void) | undefined;
25
- map?: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | undefined;
26
- filter?: {
27
- <S extends string>(callbackfn: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
28
- (callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
29
- } | undefined;
30
- reduce?: {
31
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
32
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
33
- <U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
34
- } | undefined;
35
- reduceRight?: {
36
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
37
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
38
- <U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
39
- } | undefined;
40
- find?: {
41
- <S_1 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_1, thisArg?: any): S_1 | undefined;
42
- (predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
43
- } | undefined;
44
- findIndex?: ((predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any) => number) | undefined;
45
- fill?: ((value: string, start?: number | undefined, end?: number | undefined) => string[]) | undefined;
46
- copyWithin?: ((target: number, start: number, end?: number | undefined) => string[]) | undefined;
47
- entries?: IterableIterator<[number, string]> | undefined;
48
- keys?: IterableIterator<number> | undefined;
49
- values?: IterableIterator<string> | undefined;
50
- includes?: ((searchElement: string, fromIndex?: number | undefined) => boolean) | undefined;
51
- flatMap?: (<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined) => U_3[]) | undefined;
52
- flat?: unknown[] | undefined;
53
- }) | ({} & {
54
- [x: string]: any;
55
- [x: number]: any;
56
- })> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<({
57
- [x: number]: string;
58
- } & {
59
- length?: number | undefined;
60
- toString?: string | undefined;
61
- toLocaleString?: string | undefined;
62
- pop?: string | undefined;
63
- push?: number | undefined;
64
- concat?: string[] | undefined;
65
- join?: string | undefined;
66
- reverse?: string[] | undefined;
67
- shift?: string | undefined;
68
- slice?: string[] | undefined;
69
- sort?: string[] | undefined;
70
- splice?: {
71
- (start: number, deleteCount?: number | undefined): string[];
72
- (start: number, deleteCount: number, ...items: string[]): string[];
73
- } | undefined;
74
- unshift?: number | undefined;
75
- indexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
76
- lastIndexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
77
- every?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
78
- some?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
79
- forEach?: ((callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void) | undefined;
80
- map?: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | undefined;
81
- filter?: {
82
- <S extends string>(callbackfn: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
83
- (callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
84
- } | undefined;
85
- reduce?: {
86
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
87
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
88
- <U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
89
- } | undefined;
90
- reduceRight?: {
91
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
92
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
93
- <U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
94
- } | undefined;
95
- find?: {
96
- <S_1 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_1, thisArg?: any): S_1 | undefined;
97
- (predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
98
- } | undefined;
99
- findIndex?: ((predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any) => number) | undefined;
100
- fill?: ((value: string, start?: number | undefined, end?: number | undefined) => string[]) | undefined;
101
- copyWithin?: ((target: number, start: number, end?: number | undefined) => string[]) | undefined;
102
- entries?: IterableIterator<[number, string]> | undefined;
103
- keys?: IterableIterator<number> | undefined;
104
- values?: IterableIterator<string> | undefined;
105
- includes?: ((searchElement: string, fromIndex?: number | undefined) => boolean) | undefined;
106
- flatMap?: (<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined) => U_3[]) | undefined;
107
- flat?: unknown[] | undefined;
108
- }) | ({} & {
109
- [x: string]: any;
110
- [x: number]: any;
111
- }), import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data>, import("@vue/composition-api").Data, {}, {}, ({
112
- [x: number]: string;
113
- } & {
114
- length?: number | undefined;
115
- toString?: string | undefined;
116
- toLocaleString?: string | undefined;
117
- pop?: string | undefined;
118
- push?: number | undefined;
119
- concat?: string[] | undefined;
120
- join?: string | undefined;
121
- reverse?: string[] | undefined;
122
- shift?: string | undefined;
123
- slice?: string[] | undefined;
124
- sort?: string[] | undefined;
125
- splice?: {
126
- (start: number, deleteCount?: number | undefined): string[];
127
- (start: number, deleteCount: number, ...items: string[]): string[];
128
- } | undefined;
129
- unshift?: number | undefined;
130
- indexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
131
- lastIndexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
132
- every?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
133
- some?: ((callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean) | undefined;
134
- forEach?: ((callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void) | undefined;
135
- map?: (<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | undefined;
136
- filter?: {
137
- <S extends string>(callbackfn: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
138
- (callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
139
- } | undefined;
140
- reduce?: {
141
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
142
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
143
- <U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
144
- } | undefined;
145
- reduceRight?: {
146
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
147
- (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
148
- <U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
149
- } | undefined;
150
- find?: {
151
- <S_1 extends string>(predicate: (this: void, value: string, index: number, obj: string[]) => value is S_1, thisArg?: any): S_1 | undefined;
152
- (predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
153
- } | undefined;
154
- findIndex?: ((predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any) => number) | undefined;
155
- fill?: ((value: string, start?: number | undefined, end?: number | undefined) => string[]) | undefined;
156
- copyWithin?: ((target: number, start: number, end?: number | undefined) => string[]) | undefined;
157
- entries?: IterableIterator<[number, string]> | undefined;
158
- keys?: IterableIterator<number> | undefined;
159
- values?: IterableIterator<string> | undefined;
160
- includes?: ((searchElement: string, fromIndex?: number | undefined) => boolean) | undefined;
161
- flatMap?: (<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined) => U_3[]) | undefined;
162
- flat?: unknown[] | undefined;
163
- }) | ({} & {
164
- [x: string]: any;
165
- [x: number]: any;
166
- }), {
167
- [x: number]: string;
168
- } | {}, true>);
169
- export default _default;
@@ -1 +0,0 @@
1
- export { default } from './UrlCell.vue';
@@ -1,68 +0,0 @@
1
- <template>
2
- <div class="url-cell">
3
- <a :href="url" target="_blank" class="url-text">{{ cutUrlOrigin(url) }}</a>
4
- <base-button variant="icon" class="copy-button" @click="handleCopy(url)">
5
- <svg-icon v-if="!isCopied" name="contentCopy" class="icon-size" />
6
- <svg-icon v-else name="done" class="icon-size icon-color-green" />
7
- </base-button>
8
- </div>
9
- </template>
10
-
11
- <script lang="ts">
12
- import { defineComponent } from '@vue/composition-api';
13
-
14
- import { cutUrlOrigin } from '@tager/admin-ui/src/utils/common';
15
- import { useCopyToClipboard } from '@tager/admin-ui';
16
-
17
- interface Props {
18
- url: string;
19
- }
20
-
21
- export default defineComponent<Props>({
22
- name: 'UrlCell',
23
- props: {
24
- url: {
25
- type: String,
26
- default: '',
27
- },
28
- },
29
- setup() {
30
- const [isCopied, handleCopy] = useCopyToClipboard(500);
31
-
32
- return {
33
- isCopied,
34
- handleCopy,
35
- cutUrlOrigin,
36
- };
37
- },
38
- });
39
- </script>
40
-
41
- <style lang="scss" scoped>
42
- .url-cell {
43
- display: flex;
44
- align-items: center;
45
-
46
- .url-text {
47
- color: #007bff;
48
-
49
- &:hover {
50
- color: #0056b3;
51
- text-decoration: underline;
52
- }
53
- }
54
-
55
- .copy-button {
56
- margin-left: 5px;
57
-
58
- .icon-size {
59
- width: 14px;
60
- height: 14px;
61
- }
62
-
63
- .icon-color-green {
64
- color: #22863a;
65
- }
66
- }
67
- }
68
- </style>
@@ -1 +0,0 @@
1
- export { default } from './UrlCell.vue';