@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ColumnDefinition } from '@tager/admin-ui';
|
|
2
2
|
import { FileModel } from '../../typings/model';
|
|
3
3
|
import { getFilesFormUrl } from '../../utils/paths';
|
|
4
|
-
|
|
4
|
+
import UrlCell from './components/UrlCell';
|
|
5
|
+
declare const _default: import("vue").ComponentOptions<UrlCell, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
6
|
columnDefs: ColumnDefinition<FileModel>[];
|
|
6
7
|
getFilesFormUrl: typeof getFilesFormUrl;
|
|
7
8
|
rowData: import("@vue/composition-api").Ref<FileModel[]>;
|
|
@@ -16,7 +17,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
16
17
|
isDeleting: (entityId: string | number) => boolean;
|
|
17
18
|
}> & import("@vue/composition-api").Data, {}, {}, unknown, {
|
|
18
19
|
[x: string]: any;
|
|
19
|
-
}> & import("vue").VueConstructor<
|
|
20
|
+
}> & import("vue").VueConstructor<UrlCell> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
20
21
|
[x: string]: any;
|
|
21
22
|
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
22
23
|
columnDefs: ColumnDefinition<FileModel>[];
|
|
@@ -0,0 +1,169 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './UrlCell.vue';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tager/admin-files",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"yalc:clean": "yalc remove --all"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"filesize": "^7.0.0",
|
|
22
23
|
"lodash.kebabcase": "^4.1.1",
|
|
23
24
|
"path-to-regexp": "^6.1.0"
|
|
24
25
|
},
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"@rollup/plugin-node-resolve": "^8.1.0",
|
|
28
29
|
"@tager/admin-layout": "^0.5.1",
|
|
29
30
|
"@tager/admin-services": "^0.2.23",
|
|
30
|
-
"@tager/admin-ui": "^0.8.
|
|
31
|
+
"@tager/admin-ui": "^0.8.78",
|
|
31
32
|
"@types/lodash.kebabcase": "^4.1.6",
|
|
32
33
|
"@types/node": "12.x",
|
|
33
34
|
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
package/src/services/requests.ts
CHANGED
|
@@ -20,6 +20,6 @@ export function deleteFile(
|
|
|
20
20
|
return request.delete({ path: `/admin/userfiles/${fileId}` });
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function addFile(
|
|
24
|
-
return request.post({ path: '/admin/userfiles',
|
|
23
|
+
export function addFile(payload: { file: string }) {
|
|
24
|
+
return request.post({ path: '/admin/userfiles', body: payload });
|
|
25
25
|
}
|
|
@@ -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,27 +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
|
+
<template v-slot:cell(url)="{ row }">
|
|
26
|
+
<UrlCell :url="row.url"/>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
25
29
|
<template v-slot:cell(delete)="{ row }">
|
|
26
30
|
<base-button
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
variant="icon"
|
|
32
|
+
:title="$t('files:delete')"
|
|
33
|
+
:disabled="isDeleting(row.id)"
|
|
34
|
+
@click="handleResourceDelete(row.id)"
|
|
31
35
|
>
|
|
32
|
-
<svg-icon name="delete"
|
|
36
|
+
<svg-icon name="delete"/>
|
|
33
37
|
</base-button>
|
|
34
38
|
</template>
|
|
35
39
|
</data-table>
|
|
@@ -37,23 +41,29 @@
|
|
|
37
41
|
</template>
|
|
38
42
|
|
|
39
43
|
<script lang="ts">
|
|
40
|
-
import {
|
|
44
|
+
import {defineComponent, onMounted} from '@vue/composition-api';
|
|
45
|
+
import filesize from 'filesize';
|
|
41
46
|
|
|
42
47
|
import {
|
|
43
48
|
ColumnDefinition,
|
|
44
49
|
useDataTable,
|
|
45
50
|
useTranslation,
|
|
46
51
|
} from '@tager/admin-ui';
|
|
47
|
-
import {
|
|
52
|
+
import {useResourceDelete} from '@tager/admin-services';
|
|
48
53
|
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
54
|
+
import {deleteFile, getFilesList} from '../../services/requests';
|
|
55
|
+
import {FileModel} from '../../typings/model';
|
|
56
|
+
import {getFilesFormUrl} from '../../utils/paths';
|
|
57
|
+
|
|
58
|
+
import UrlCell from './components/UrlCell';
|
|
52
59
|
|
|
53
60
|
export default defineComponent({
|
|
54
61
|
name: 'FilesList',
|
|
62
|
+
components: {
|
|
63
|
+
UrlCell,
|
|
64
|
+
},
|
|
55
65
|
setup(props, context) {
|
|
56
|
-
const {
|
|
66
|
+
const {t} = useTranslation(context);
|
|
57
67
|
|
|
58
68
|
const {
|
|
59
69
|
fetchEntityList: fetchFilesList,
|
|
@@ -67,11 +77,11 @@ export default defineComponent({
|
|
|
67
77
|
pageNumber,
|
|
68
78
|
} = useDataTable<FileModel>({
|
|
69
79
|
fetchEntityList: (params) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
getFilesList({
|
|
81
|
+
query: params.searchQuery,
|
|
82
|
+
pageNumber: params.pageNumber,
|
|
83
|
+
pageSize: params.pageSize,
|
|
84
|
+
}),
|
|
75
85
|
initialValue: [],
|
|
76
86
|
context,
|
|
77
87
|
resourceName: 'Files list',
|
|
@@ -82,7 +92,7 @@ export default defineComponent({
|
|
|
82
92
|
fetchFilesList();
|
|
83
93
|
});
|
|
84
94
|
|
|
85
|
-
const {
|
|
95
|
+
const {handleResourceDelete, isDeleting} = useResourceDelete({
|
|
86
96
|
deleteResource: deleteFile,
|
|
87
97
|
resourceName: 'File',
|
|
88
98
|
onSuccess: fetchFilesList,
|
|
@@ -94,8 +104,8 @@ export default defineComponent({
|
|
|
94
104
|
id: 1,
|
|
95
105
|
name: 'ID',
|
|
96
106
|
field: 'id',
|
|
97
|
-
style: {
|
|
98
|
-
headStyle: {
|
|
107
|
+
style: {width: '50px', textAlign: 'center'},
|
|
108
|
+
headStyle: {width: '50px', textAlign: 'center'},
|
|
99
109
|
},
|
|
100
110
|
{
|
|
101
111
|
id: 2,
|
|
@@ -111,18 +121,21 @@ export default defineComponent({
|
|
|
111
121
|
id: 4,
|
|
112
122
|
name: t('files:fileSize'),
|
|
113
123
|
field: 'size',
|
|
124
|
+
format: ({row}) => filesize(row.size),
|
|
125
|
+
style: {whiteSpace: 'nowrap'},
|
|
126
|
+
headStyle: {whiteSpace: 'nowrap'},
|
|
114
127
|
},
|
|
115
128
|
{
|
|
116
129
|
id: 5,
|
|
117
130
|
name: 'URL',
|
|
118
|
-
field: 'url'
|
|
131
|
+
field: 'url'
|
|
119
132
|
},
|
|
120
133
|
{
|
|
121
134
|
id: 6,
|
|
122
135
|
name: t('files:delete'),
|
|
123
136
|
field: 'delete',
|
|
124
|
-
style: {
|
|
125
|
-
headStyle: {
|
|
137
|
+
style: {textAlign: 'center'},
|
|
138
|
+
headStyle: {textAlign: 'center'},
|
|
126
139
|
},
|
|
127
140
|
];
|
|
128
141
|
|
|
@@ -0,0 +1,68 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './UrlCell.vue';
|