@tager/admin-files 0.0.5 → 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 +8 -6
- package/dist/index.umd.js +8 -6
- package/package.json +1 -1
- package/src/views/FilesList/FilesList.vue +36 -34
- package/dist/dev.d.ts +0 -1
- package/dist/typings/model.d.ts +0 -14
package/dist/index.esm.js
CHANGED
|
@@ -446,11 +446,11 @@ __vue_render__$2._withStripped = true;
|
|
|
446
446
|
/* style */
|
|
447
447
|
const __vue_inject_styles__$2 = function (inject) {
|
|
448
448
|
if (!inject) return
|
|
449
|
-
inject("data-v-
|
|
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
450
|
|
|
451
451
|
};
|
|
452
452
|
/* scoped */
|
|
453
|
-
const __vue_scope_id__$2 = "data-v-
|
|
453
|
+
const __vue_scope_id__$2 = "data-v-1551a39a";
|
|
454
454
|
/* module identifier */
|
|
455
455
|
const __vue_module_identifier__$2 = undefined;
|
|
456
456
|
/* functional template */
|
|
@@ -504,7 +504,7 @@ var script$1 = defineComponent({
|
|
|
504
504
|
const columnDefs = [
|
|
505
505
|
{
|
|
506
506
|
id: 1,
|
|
507
|
-
name: '
|
|
507
|
+
name: 'ID',
|
|
508
508
|
field: 'id',
|
|
509
509
|
style: { width: '50px', textAlign: 'center' },
|
|
510
510
|
headStyle: { width: '50px', textAlign: 'center' },
|
|
@@ -524,11 +524,13 @@ var script$1 = defineComponent({
|
|
|
524
524
|
name: t('files:fileSize'),
|
|
525
525
|
field: 'size',
|
|
526
526
|
format: ({ row }) => filesize(row.size),
|
|
527
|
+
style: { whiteSpace: 'nowrap' },
|
|
528
|
+
headStyle: { whiteSpace: 'nowrap' },
|
|
527
529
|
},
|
|
528
530
|
{
|
|
529
531
|
id: 5,
|
|
530
532
|
name: 'URL',
|
|
531
|
-
field: 'url'
|
|
533
|
+
field: 'url'
|
|
532
534
|
},
|
|
533
535
|
{
|
|
534
536
|
id: 6,
|
|
@@ -792,11 +794,11 @@ __vue_render__._withStripped = true;
|
|
|
792
794
|
/* style */
|
|
793
795
|
const __vue_inject_styles__ = function (inject) {
|
|
794
796
|
if (!inject) return
|
|
795
|
-
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 });
|
|
796
798
|
|
|
797
799
|
};
|
|
798
800
|
/* scoped */
|
|
799
|
-
const __vue_scope_id__ = "data-v-
|
|
801
|
+
const __vue_scope_id__ = "data-v-5f7d9380";
|
|
800
802
|
/* module identifier */
|
|
801
803
|
const __vue_module_identifier__ = undefined;
|
|
802
804
|
/* functional template */
|
package/dist/index.umd.js
CHANGED
|
@@ -447,11 +447,11 @@
|
|
|
447
447
|
/* style */
|
|
448
448
|
const __vue_inject_styles__$2 = function (inject) {
|
|
449
449
|
if (!inject) return
|
|
450
|
-
inject("data-v-
|
|
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
451
|
|
|
452
452
|
};
|
|
453
453
|
/* scoped */
|
|
454
|
-
const __vue_scope_id__$2 = "data-v-
|
|
454
|
+
const __vue_scope_id__$2 = "data-v-1551a39a";
|
|
455
455
|
/* module identifier */
|
|
456
456
|
const __vue_module_identifier__$2 = undefined;
|
|
457
457
|
/* functional template */
|
|
@@ -505,7 +505,7 @@
|
|
|
505
505
|
const columnDefs = [
|
|
506
506
|
{
|
|
507
507
|
id: 1,
|
|
508
|
-
name: '
|
|
508
|
+
name: 'ID',
|
|
509
509
|
field: 'id',
|
|
510
510
|
style: { width: '50px', textAlign: 'center' },
|
|
511
511
|
headStyle: { width: '50px', textAlign: 'center' },
|
|
@@ -525,11 +525,13 @@
|
|
|
525
525
|
name: t('files:fileSize'),
|
|
526
526
|
field: 'size',
|
|
527
527
|
format: ({ row }) => filesize(row.size),
|
|
528
|
+
style: { whiteSpace: 'nowrap' },
|
|
529
|
+
headStyle: { whiteSpace: 'nowrap' },
|
|
528
530
|
},
|
|
529
531
|
{
|
|
530
532
|
id: 5,
|
|
531
533
|
name: 'URL',
|
|
532
|
-
field: 'url'
|
|
534
|
+
field: 'url'
|
|
533
535
|
},
|
|
534
536
|
{
|
|
535
537
|
id: 6,
|
|
@@ -793,11 +795,11 @@
|
|
|
793
795
|
/* style */
|
|
794
796
|
const __vue_inject_styles__ = function (inject) {
|
|
795
797
|
if (!inject) return
|
|
796
|
-
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 });
|
|
797
799
|
|
|
798
800
|
};
|
|
799
801
|
/* scoped */
|
|
800
|
-
const __vue_scope_id__ = "data-v-
|
|
802
|
+
const __vue_scope_id__ = "data-v-5f7d9380";
|
|
801
803
|
/* module identifier */
|
|
802
804
|
const __vue_module_identifier__ = undefined;
|
|
803
805
|
/* functional template */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<page
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
:title="$t('files:filesList')"
|
|
4
|
+
:header-buttons="[
|
|
5
5
|
{
|
|
6
6
|
text: $t('files:createFile'),
|
|
7
7
|
href: getFilesFormUrl({ fileId: 'create' }),
|
|
@@ -9,31 +9,31 @@
|
|
|
9
9
|
]"
|
|
10
10
|
>
|
|
11
11
|
<data-table
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
:column-defs="columnDefs"
|
|
13
|
+
:row-data="rowData"
|
|
14
|
+
:loading="isRowDataLoading"
|
|
15
|
+
:error-message="errorMessage"
|
|
16
|
+
:search-query="searchQuery"
|
|
17
|
+
:pagination="{
|
|
18
18
|
pageSize,
|
|
19
19
|
pageCount,
|
|
20
20
|
pageNumber,
|
|
21
21
|
disabled: isRowDataLoading,
|
|
22
22
|
}"
|
|
23
|
-
|
|
23
|
+
@change="handleChange"
|
|
24
24
|
>
|
|
25
25
|
<template v-slot:cell(url)="{ row }">
|
|
26
|
-
<UrlCell :url="row.url"
|
|
26
|
+
<UrlCell :url="row.url"/>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<template v-slot:cell(delete)="{ row }">
|
|
30
30
|
<base-button
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
variant="icon"
|
|
32
|
+
:title="$t('files:delete')"
|
|
33
|
+
:disabled="isDeleting(row.id)"
|
|
34
|
+
@click="handleResourceDelete(row.id)"
|
|
35
35
|
>
|
|
36
|
-
<svg-icon name="delete"
|
|
36
|
+
<svg-icon name="delete"/>
|
|
37
37
|
</base-button>
|
|
38
38
|
</template>
|
|
39
39
|
</data-table>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<script lang="ts">
|
|
44
|
-
import {
|
|
44
|
+
import {defineComponent, onMounted} from '@vue/composition-api';
|
|
45
45
|
import filesize from 'filesize';
|
|
46
46
|
|
|
47
47
|
import {
|
|
@@ -49,11 +49,11 @@ import {
|
|
|
49
49
|
useDataTable,
|
|
50
50
|
useTranslation,
|
|
51
51
|
} from '@tager/admin-ui';
|
|
52
|
-
import {
|
|
52
|
+
import {useResourceDelete} from '@tager/admin-services';
|
|
53
53
|
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
54
|
+
import {deleteFile, getFilesList} from '../../services/requests';
|
|
55
|
+
import {FileModel} from '../../typings/model';
|
|
56
|
+
import {getFilesFormUrl} from '../../utils/paths';
|
|
57
57
|
|
|
58
58
|
import UrlCell from './components/UrlCell';
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ export default defineComponent({
|
|
|
63
63
|
UrlCell,
|
|
64
64
|
},
|
|
65
65
|
setup(props, context) {
|
|
66
|
-
const {
|
|
66
|
+
const {t} = useTranslation(context);
|
|
67
67
|
|
|
68
68
|
const {
|
|
69
69
|
fetchEntityList: fetchFilesList,
|
|
@@ -77,11 +77,11 @@ export default defineComponent({
|
|
|
77
77
|
pageNumber,
|
|
78
78
|
} = useDataTable<FileModel>({
|
|
79
79
|
fetchEntityList: (params) =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
getFilesList({
|
|
81
|
+
query: params.searchQuery,
|
|
82
|
+
pageNumber: params.pageNumber,
|
|
83
|
+
pageSize: params.pageSize,
|
|
84
|
+
}),
|
|
85
85
|
initialValue: [],
|
|
86
86
|
context,
|
|
87
87
|
resourceName: 'Files list',
|
|
@@ -92,7 +92,7 @@ export default defineComponent({
|
|
|
92
92
|
fetchFilesList();
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
const {
|
|
95
|
+
const {handleResourceDelete, isDeleting} = useResourceDelete({
|
|
96
96
|
deleteResource: deleteFile,
|
|
97
97
|
resourceName: 'File',
|
|
98
98
|
onSuccess: fetchFilesList,
|
|
@@ -102,10 +102,10 @@ export default defineComponent({
|
|
|
102
102
|
const columnDefs: Array<ColumnDefinition<FileModel>> = [
|
|
103
103
|
{
|
|
104
104
|
id: 1,
|
|
105
|
-
name: '
|
|
105
|
+
name: 'ID',
|
|
106
106
|
field: 'id',
|
|
107
|
-
style: {
|
|
108
|
-
headStyle: {
|
|
107
|
+
style: {width: '50px', textAlign: 'center'},
|
|
108
|
+
headStyle: {width: '50px', textAlign: 'center'},
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
id: 2,
|
|
@@ -121,19 +121,21 @@ export default defineComponent({
|
|
|
121
121
|
id: 4,
|
|
122
122
|
name: t('files:fileSize'),
|
|
123
123
|
field: 'size',
|
|
124
|
-
format: ({
|
|
124
|
+
format: ({row}) => filesize(row.size),
|
|
125
|
+
style: {whiteSpace: 'nowrap'},
|
|
126
|
+
headStyle: {whiteSpace: 'nowrap'},
|
|
125
127
|
},
|
|
126
128
|
{
|
|
127
129
|
id: 5,
|
|
128
130
|
name: 'URL',
|
|
129
|
-
field: 'url'
|
|
131
|
+
field: 'url'
|
|
130
132
|
},
|
|
131
133
|
{
|
|
132
134
|
id: 6,
|
|
133
135
|
name: t('files:delete'),
|
|
134
136
|
field: 'delete',
|
|
135
|
-
style: {
|
|
136
|
-
headStyle: {
|
|
137
|
+
style: {textAlign: 'center'},
|
|
138
|
+
headStyle: {textAlign: 'center'},
|
|
137
139
|
},
|
|
138
140
|
];
|
|
139
141
|
|
package/dist/dev.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@tager/admin-ui/dist/admin-ui.css';
|
package/dist/typings/model.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SingleFileInputValueType } from '@tager/admin-ui';
|
|
2
|
-
export interface FileModel {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
size: number;
|
|
7
|
-
url: string;
|
|
8
|
-
}
|
|
9
|
-
export interface FormValues {
|
|
10
|
-
file: SingleFileInputValueType | null;
|
|
11
|
-
}
|
|
12
|
-
export interface FilesCreatePayload {
|
|
13
|
-
file: string;
|
|
14
|
-
}
|