@tager/admin-files 1.0.0 → 1.0.1
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/dev/App.vue.d.ts +4 -3
- package/dist/index.mjs +216 -231
- package/dist/services/requests.d.ts +2 -2
- package/dist/typings/model.d.ts +1 -1
- package/dist/views/FilesForm/FilesForm.helpers.d.ts +1 -1
- package/dist/views/FilesForm/FilesForm.vue.d.ts +4 -3
- package/dist/views/FilesList/FilesList.vue.d.ts +5 -4
- package/package.json +20 -25
- package/src/dev/App.vue +4 -4
- package/src/dev/env.ts +11 -11
- package/src/services/requests.ts +2 -2
- package/src/typings/model.ts +1 -1
- package/src/views/FilesForm/FilesForm.helpers.ts +1 -1
- package/src/views/FilesForm/FilesForm.vue +2 -4
- package/src/views/FilesList/FilesList.vue +2 -2
package/dist/dev/App.vue.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MenuItemType } from "@tager/admin-layout";
|
|
2
|
-
declare const _default:
|
|
1
|
+
import { type MenuItemType } from "@tager/admin-layout";
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
3
5
|
sidebarMenuList: MenuItemType[];
|
|
4
6
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
5
|
-
export default _default;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { i18n, request, useI18n, useResourceDelete, useToast, navigateBack, convertRequestErrorToMap } from "@tager/admin-services";
|
|
2
|
-
import { defineComponent, onMounted
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Page } from "@tager/admin-layout";
|
|
6
|
-
import { compile } from "path-to-regexp";
|
|
7
|
-
import { useRouter } from "vue-router";
|
|
8
|
-
const
|
|
1
|
+
import { i18n as L, request as F, useI18n as y, useResourceDelete as _, useToast as C, navigateBack as R, convertRequestErrorToMap as w } from "@tager/admin-services";
|
|
2
|
+
import { defineComponent as D, onMounted as $, resolveComponent as c, openBlock as I, createBlock as T, withCtx as d, createVNode as m, ref as h, createElementVNode as M, withModifiers as z } from "vue";
|
|
3
|
+
import N from "filesize";
|
|
4
|
+
import { DeleteIcon as B, BaseButton as U, DataTable as k, useDataTable as O, cutUrlOrigin as P, FormFooter as A, FormFieldFileInput as q } from "@tager/admin-ui";
|
|
5
|
+
import { Page as v } from "@tager/admin-layout";
|
|
6
|
+
import { compile as V } from "path-to-regexp";
|
|
7
|
+
import { useRouter as Q } from "vue-router";
|
|
8
|
+
const H = {
|
|
9
9
|
home: "Home",
|
|
10
10
|
success: "Success",
|
|
11
11
|
error: "Error",
|
|
@@ -22,189 +22,180 @@ const EN = {
|
|
|
22
22
|
fileSize: "Size",
|
|
23
23
|
delete: "Delete",
|
|
24
24
|
add: "Add"
|
|
25
|
+
}, j = {
|
|
26
|
+
home: "Главная",
|
|
27
|
+
success: "Успех",
|
|
28
|
+
error: "Ошибка",
|
|
29
|
+
createdSuccessMessage: "Файл был успешно добавлен",
|
|
30
|
+
createdErrorMessage: "Не удалось добавить файл",
|
|
31
|
+
files: "Файлы",
|
|
32
|
+
filesList: "Список файлов",
|
|
33
|
+
filesForm: "Форма файлов",
|
|
34
|
+
createFile: "Создать файл",
|
|
35
|
+
fileCreation: "Создание файла",
|
|
36
|
+
file: "Файл",
|
|
37
|
+
fileName: "Имя файла",
|
|
38
|
+
fileType: "Тип файла",
|
|
39
|
+
fileSize: "Размер",
|
|
40
|
+
delete: "Удалить",
|
|
41
|
+
add: "Добавить"
|
|
25
42
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
success: "\u0423\u0441\u043F\u0435\u0445",
|
|
29
|
-
error: "\u041E\u0448\u0438\u0431\u043A\u0430",
|
|
30
|
-
createdSuccessMessage: "\u0424\u0430\u0439\u043B \u0431\u044B\u043B \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D",
|
|
31
|
-
createdErrorMessage: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0444\u0430\u0439\u043B",
|
|
32
|
-
files: "\u0424\u0430\u0439\u043B\u044B",
|
|
33
|
-
filesList: "\u0421\u043F\u0438\u0441\u043E\u043A \u0444\u0430\u0439\u043B\u043E\u0432",
|
|
34
|
-
filesForm: "\u0424\u043E\u0440\u043C\u0430 \u0444\u0430\u0439\u043B\u043E\u0432",
|
|
35
|
-
createFile: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0444\u0430\u0439\u043B",
|
|
36
|
-
fileCreation: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u0430",
|
|
37
|
-
file: "\u0424\u0430\u0439\u043B",
|
|
38
|
-
fileName: "\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430",
|
|
39
|
-
fileType: "\u0422\u0438\u043F \u0444\u0430\u0439\u043B\u0430",
|
|
40
|
-
fileSize: "\u0420\u0430\u0437\u043C\u0435\u0440",
|
|
41
|
-
delete: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
42
|
-
add: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C"
|
|
43
|
-
};
|
|
44
|
-
function applyTranslations() {
|
|
45
|
-
i18n.addTranslations("en", "files", EN);
|
|
46
|
-
i18n.addTranslations("ru", "files", RU);
|
|
43
|
+
function G() {
|
|
44
|
+
L.addTranslations("en", "files", H), L.addTranslations("ru", "files", j);
|
|
47
45
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
46
|
+
function J(e) {
|
|
47
|
+
return F.get({ path: "/admin/userfiles", params: e });
|
|
50
48
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
49
|
+
function me() {
|
|
50
|
+
return F.get({ path: "/admin/userfiles/count" });
|
|
53
51
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
52
|
+
function K(e) {
|
|
53
|
+
return F.delete({ path: `/admin/userfiles/${e}` });
|
|
56
54
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
55
|
+
function W(e) {
|
|
56
|
+
return F.post({ path: "/admin/userfiles", body: e });
|
|
59
57
|
}
|
|
60
|
-
const
|
|
58
|
+
const g = {
|
|
61
59
|
FILES_LIST: "/files",
|
|
62
60
|
FILES_FORM: "/files/:fileId"
|
|
63
61
|
};
|
|
64
|
-
function
|
|
65
|
-
return
|
|
62
|
+
function b() {
|
|
63
|
+
return g.FILES_LIST;
|
|
66
64
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
65
|
+
function X(e) {
|
|
66
|
+
return V(g.FILES_FORM)(e);
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
const target = sfc.__vccOpts || sfc;
|
|
72
|
-
for (const [key, val] of props) {
|
|
73
|
-
target[key] = val;
|
|
74
|
-
}
|
|
75
|
-
return target;
|
|
76
|
-
};
|
|
77
|
-
const _sfc_main$1 = defineComponent({
|
|
68
|
+
const Y = D({
|
|
78
69
|
name: "FilesList",
|
|
79
|
-
components: { DataTable, BaseButton, DeleteIcon, Page },
|
|
70
|
+
components: { DataTable: k, BaseButton: U, DeleteIcon: B, Page: v },
|
|
80
71
|
setup() {
|
|
81
|
-
const { t } =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
pageSize: params.pageSize
|
|
72
|
+
const { t: e } = y(), {
|
|
73
|
+
fetchEntityList: t,
|
|
74
|
+
isLoading: o,
|
|
75
|
+
rowData: s,
|
|
76
|
+
errorMessage: l,
|
|
77
|
+
searchQuery: n,
|
|
78
|
+
handleChange: u,
|
|
79
|
+
pageSize: i,
|
|
80
|
+
pageCount: f,
|
|
81
|
+
pageNumber: r
|
|
82
|
+
} = O({
|
|
83
|
+
fetchEntityList: (a) => J({
|
|
84
|
+
query: a.searchQuery,
|
|
85
|
+
pageNumber: a.pageNumber,
|
|
86
|
+
pageSize: a.pageSize
|
|
97
87
|
}),
|
|
98
88
|
initialValue: [],
|
|
99
89
|
resourceName: "Files list",
|
|
100
90
|
pageSize: 100
|
|
101
91
|
});
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
$(() => {
|
|
93
|
+
t();
|
|
104
94
|
});
|
|
105
|
-
const { handleResourceDelete, isDeleting } =
|
|
106
|
-
deleteResource:
|
|
95
|
+
const { handleResourceDelete: p, isDeleting: S } = _({
|
|
96
|
+
deleteResource: K,
|
|
107
97
|
resourceName: "File",
|
|
108
|
-
onSuccess:
|
|
98
|
+
onSuccess: t
|
|
109
99
|
});
|
|
110
|
-
const columnDefs = [
|
|
111
|
-
{
|
|
112
|
-
id: 1,
|
|
113
|
-
name: "ID",
|
|
114
|
-
field: "id",
|
|
115
|
-
style: { width: "50px", textAlign: "center" },
|
|
116
|
-
headStyle: { width: "50px", textAlign: "center" }
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: 2,
|
|
120
|
-
name: t("files:fileName"),
|
|
121
|
-
field: "name"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: 3,
|
|
125
|
-
name: t("files:fileType"),
|
|
126
|
-
field: "type"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: 4,
|
|
130
|
-
name: t("files:fileSize"),
|
|
131
|
-
field: "size",
|
|
132
|
-
format: ({ row }) => filesize(row.size),
|
|
133
|
-
style: { whiteSpace: "nowrap" },
|
|
134
|
-
headStyle: { whiteSpace: "nowrap" }
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: 5,
|
|
138
|
-
name: "URL",
|
|
139
|
-
type: "link",
|
|
140
|
-
field: "url",
|
|
141
|
-
format: ({ row }) => ({
|
|
142
|
-
url: row.url,
|
|
143
|
-
text: cutUrlOrigin(row.url)
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: 6,
|
|
148
|
-
name: t("files:delete"),
|
|
149
|
-
field: "delete",
|
|
150
|
-
style: { textAlign: "center" },
|
|
151
|
-
headStyle: { textAlign: "center" }
|
|
152
|
-
}
|
|
153
|
-
];
|
|
154
100
|
return {
|
|
155
|
-
columnDefs
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
101
|
+
columnDefs: [
|
|
102
|
+
{
|
|
103
|
+
id: 1,
|
|
104
|
+
name: "ID",
|
|
105
|
+
field: "id",
|
|
106
|
+
style: { width: "50px", textAlign: "center" },
|
|
107
|
+
headStyle: { width: "50px", textAlign: "center" }
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 2,
|
|
111
|
+
name: e("files:fileName"),
|
|
112
|
+
field: "name"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 3,
|
|
116
|
+
name: e("files:fileType"),
|
|
117
|
+
field: "type"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 4,
|
|
121
|
+
name: e("files:fileSize"),
|
|
122
|
+
field: "size",
|
|
123
|
+
format: ({ row: a }) => N(a.size),
|
|
124
|
+
style: { whiteSpace: "nowrap" },
|
|
125
|
+
headStyle: { whiteSpace: "nowrap" }
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 5,
|
|
129
|
+
name: "URL",
|
|
130
|
+
type: "link",
|
|
131
|
+
field: "url",
|
|
132
|
+
format: ({ row: a }) => ({
|
|
133
|
+
url: a.url,
|
|
134
|
+
text: P(a.url)
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 6,
|
|
139
|
+
name: e("files:delete"),
|
|
140
|
+
field: "delete",
|
|
141
|
+
style: { textAlign: "center" },
|
|
142
|
+
headStyle: { textAlign: "center" }
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
getFilesFormUrl: X,
|
|
146
|
+
rowData: s,
|
|
147
|
+
isRowDataLoading: o,
|
|
148
|
+
errorMessage: l,
|
|
149
|
+
searchQuery: n,
|
|
150
|
+
handleChange: u,
|
|
151
|
+
pageSize: i,
|
|
152
|
+
pageCount: f,
|
|
153
|
+
pageNumber: r,
|
|
154
|
+
handleResourceDelete: p,
|
|
155
|
+
isDeleting: S
|
|
167
156
|
};
|
|
168
157
|
}
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
}), E = (e, t) => {
|
|
159
|
+
const o = e.__vccOpts || e;
|
|
160
|
+
for (const [s, l] of t)
|
|
161
|
+
o[s] = l;
|
|
162
|
+
return o;
|
|
163
|
+
};
|
|
164
|
+
function Z(e, t, o, s, l, n) {
|
|
165
|
+
const u = c("DeleteIcon"), i = c("BaseButton"), f = c("DataTable"), r = c("Page");
|
|
166
|
+
return I(), T(r, {
|
|
167
|
+
title: e.$i18n.t("files:filesList"),
|
|
177
168
|
"header-buttons": [
|
|
178
169
|
{
|
|
179
|
-
text:
|
|
180
|
-
href:
|
|
170
|
+
text: e.$i18n.t("files:createFile"),
|
|
171
|
+
href: e.getFilesFormUrl({ fileId: "create" })
|
|
181
172
|
}
|
|
182
173
|
]
|
|
183
174
|
}, {
|
|
184
|
-
default:
|
|
185
|
-
|
|
186
|
-
"column-defs":
|
|
187
|
-
"row-data":
|
|
188
|
-
loading:
|
|
189
|
-
"error-message":
|
|
190
|
-
"search-query":
|
|
175
|
+
default: d(() => [
|
|
176
|
+
m(f, {
|
|
177
|
+
"column-defs": e.columnDefs,
|
|
178
|
+
"row-data": e.rowData,
|
|
179
|
+
loading: e.isRowDataLoading,
|
|
180
|
+
"error-message": e.errorMessage,
|
|
181
|
+
"search-query": e.searchQuery,
|
|
191
182
|
pagination: {
|
|
192
|
-
pageSize:
|
|
193
|
-
pageCount:
|
|
194
|
-
pageNumber:
|
|
195
|
-
disabled:
|
|
183
|
+
pageSize: e.pageSize,
|
|
184
|
+
pageCount: e.pageCount,
|
|
185
|
+
pageNumber: e.pageNumber,
|
|
186
|
+
disabled: e.isRowDataLoading
|
|
196
187
|
},
|
|
197
|
-
onChange:
|
|
188
|
+
onChange: e.handleChange
|
|
198
189
|
}, {
|
|
199
|
-
"cell(delete)":
|
|
200
|
-
|
|
190
|
+
"cell(delete)": d(({ row: p }) => [
|
|
191
|
+
m(i, {
|
|
201
192
|
variant: "icon",
|
|
202
|
-
title:
|
|
203
|
-
disabled:
|
|
204
|
-
onClick: (
|
|
193
|
+
title: e.$i18n.t("files:delete"),
|
|
194
|
+
disabled: e.isDeleting(p.id),
|
|
195
|
+
onClick: (S) => e.handleResourceDelete(p.id)
|
|
205
196
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
|
|
197
|
+
default: d(() => [
|
|
198
|
+
m(u)
|
|
208
199
|
]),
|
|
209
200
|
_: 2
|
|
210
201
|
}, 1032, ["title", "disabled", "onClick"])
|
|
@@ -215,86 +206,73 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
215
206
|
_: 1
|
|
216
207
|
}, 8, ["title", "header-buttons"]);
|
|
217
208
|
}
|
|
218
|
-
|
|
219
|
-
function
|
|
220
|
-
var
|
|
209
|
+
const x = /* @__PURE__ */ E(Y, [["render", Z]]);
|
|
210
|
+
function ee(e) {
|
|
211
|
+
var t;
|
|
221
212
|
return {
|
|
222
|
-
file: (
|
|
213
|
+
file: ((t = e.file) == null ? void 0 : t.file.id) ?? ""
|
|
223
214
|
};
|
|
224
215
|
}
|
|
225
|
-
const
|
|
216
|
+
const te = D({
|
|
226
217
|
name: "FilesForm",
|
|
227
|
-
components: { Page, FormFieldFileInput, FormFooter },
|
|
218
|
+
components: { Page: v, FormFieldFileInput: q, FormFooter: A },
|
|
228
219
|
setup() {
|
|
229
|
-
const { t } =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const isSubmitting = ref(false);
|
|
235
|
-
function submitForm(event) {
|
|
236
|
-
isSubmitting.value = true;
|
|
237
|
-
const creationPayload = convertFilesFormValuesToCreationPayload(
|
|
238
|
-
values.value
|
|
220
|
+
const { t: e } = y(), t = C(), o = Q(), s = h({}), l = h({ file: null }), n = h(!1);
|
|
221
|
+
function u(i) {
|
|
222
|
+
n.value = !0;
|
|
223
|
+
const f = ee(
|
|
224
|
+
l.value
|
|
239
225
|
);
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
|
|
243
|
-
navigateBack(router, getFilesListUrl());
|
|
244
|
-
}
|
|
245
|
-
toast.show({
|
|
226
|
+
W(f).then(() => {
|
|
227
|
+
s.value = {}, (i.type === "create" || i.type === "save" || i.type === "create_exit" || i.type === "save_exit") && R(o, b()), t.show({
|
|
246
228
|
variant: "success",
|
|
247
|
-
title:
|
|
248
|
-
body:
|
|
229
|
+
title: e("files:success"),
|
|
230
|
+
body: e("files:createdSuccessMessage")
|
|
249
231
|
});
|
|
250
|
-
}).catch((
|
|
251
|
-
console.error(
|
|
252
|
-
errors.value = convertRequestErrorToMap(error);
|
|
253
|
-
toast.show({
|
|
232
|
+
}).catch((r) => {
|
|
233
|
+
console.error(r), s.value = w(r), t.show({
|
|
254
234
|
variant: "danger",
|
|
255
|
-
title:
|
|
256
|
-
body:
|
|
235
|
+
title: e("files:error"),
|
|
236
|
+
body: e("files:createdErrorMessage")
|
|
257
237
|
});
|
|
258
238
|
}).finally(() => {
|
|
259
|
-
|
|
239
|
+
n.value = !1;
|
|
260
240
|
});
|
|
261
241
|
}
|
|
262
242
|
return {
|
|
263
|
-
values,
|
|
264
|
-
errors,
|
|
265
|
-
isSubmitting,
|
|
266
|
-
submitForm,
|
|
267
|
-
getFilesListUrl
|
|
243
|
+
values: l,
|
|
244
|
+
errors: s,
|
|
245
|
+
isSubmitting: n,
|
|
246
|
+
submitForm: u,
|
|
247
|
+
getFilesListUrl: b
|
|
268
248
|
};
|
|
269
249
|
}
|
|
270
250
|
});
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return openBlock(), createBlock(_component_Page, {
|
|
276
|
-
title: _ctx.$i18n.t("files:fileCreation")
|
|
251
|
+
function ie(e, t, o, s, l, n) {
|
|
252
|
+
const u = c("FormFieldFileInput"), i = c("FormFooter"), f = c("Page");
|
|
253
|
+
return I(), T(f, {
|
|
254
|
+
title: e.$i18n.t("files:fileCreation")
|
|
277
255
|
}, {
|
|
278
|
-
footer:
|
|
279
|
-
|
|
280
|
-
"back-href":
|
|
281
|
-
"is-submitting":
|
|
282
|
-
"is-creation":
|
|
283
|
-
"submit-label": "
|
|
284
|
-
onSubmit:
|
|
256
|
+
footer: d(() => [
|
|
257
|
+
m(i, {
|
|
258
|
+
"back-href": e.getFilesListUrl(),
|
|
259
|
+
"is-submitting": e.isSubmitting,
|
|
260
|
+
"is-creation": !0,
|
|
261
|
+
"submit-label": "Добавить",
|
|
262
|
+
onSubmit: e.submitForm
|
|
285
263
|
}, null, 8, ["back-href", "is-submitting", "onSubmit"])
|
|
286
264
|
]),
|
|
287
|
-
default:
|
|
288
|
-
|
|
265
|
+
default: d(() => [
|
|
266
|
+
M("form", {
|
|
289
267
|
novalidate: "",
|
|
290
|
-
onSubmit:
|
|
268
|
+
onSubmit: t[1] || (t[1] = z(() => {
|
|
291
269
|
}, ["prevent"]))
|
|
292
270
|
}, [
|
|
293
|
-
|
|
294
|
-
value:
|
|
295
|
-
"onUpdate:value":
|
|
296
|
-
error:
|
|
297
|
-
label:
|
|
271
|
+
m(u, {
|
|
272
|
+
value: e.values.file,
|
|
273
|
+
"onUpdate:value": t[0] || (t[0] = (r) => e.values.file = r),
|
|
274
|
+
error: e.errors.file,
|
|
275
|
+
label: e.$i18n.t("files:file"),
|
|
298
276
|
name: "file"
|
|
299
277
|
}, null, 8, ["value", "error", "label"])
|
|
300
278
|
], 32)
|
|
@@ -302,29 +280,36 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
302
280
|
_: 1
|
|
303
281
|
}, 8, ["title"]);
|
|
304
282
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
component: FilesList,
|
|
283
|
+
const se = /* @__PURE__ */ E(te, [["render", ie]]), oe = {
|
|
284
|
+
path: g.FILES_LIST,
|
|
285
|
+
component: x,
|
|
309
286
|
name: "Files List",
|
|
310
287
|
meta: {
|
|
311
|
-
getBreadcrumbs: (
|
|
312
|
-
{ url: "/", text:
|
|
313
|
-
{ url:
|
|
288
|
+
getBreadcrumbs: (e, t) => [
|
|
289
|
+
{ url: "/", text: t.t("files:home") },
|
|
290
|
+
{ url: e.path, text: t.t("files:filesList") }
|
|
314
291
|
]
|
|
315
292
|
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
component: FilesForm,
|
|
293
|
+
}, pe = {
|
|
294
|
+
path: g.FILES_FORM,
|
|
295
|
+
component: se,
|
|
320
296
|
name: "Files Form",
|
|
321
297
|
meta: {
|
|
322
|
-
getBreadcrumbs: (
|
|
323
|
-
{ url: "/", text:
|
|
324
|
-
{ url:
|
|
325
|
-
{ url:
|
|
298
|
+
getBreadcrumbs: (e, t) => [
|
|
299
|
+
{ url: "/", text: t.t("files:home") },
|
|
300
|
+
{ url: oe.path, text: t.t("files:filesList") },
|
|
301
|
+
{ url: e.path, text: t.t("files:filesForm") }
|
|
326
302
|
]
|
|
327
303
|
}
|
|
328
304
|
};
|
|
329
|
-
|
|
330
|
-
export {
|
|
305
|
+
G();
|
|
306
|
+
export {
|
|
307
|
+
pe as FILES_FORM_ROUTE,
|
|
308
|
+
oe as FILES_LIST_ROUTE,
|
|
309
|
+
W as addFile,
|
|
310
|
+
K as deleteFile,
|
|
311
|
+
me as getFilesCount,
|
|
312
|
+
X as getFilesFormUrl,
|
|
313
|
+
J as getFilesList,
|
|
314
|
+
b as getFilesListUrl
|
|
315
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResponseBody } from '@tager/admin-services';
|
|
2
|
-
import { FileModel } from '../typings/model';
|
|
1
|
+
import { type ResponseBody } from '@tager/admin-services';
|
|
2
|
+
import { type FileModel } from '../typings/model';
|
|
3
3
|
export declare function getFilesList(params?: {
|
|
4
4
|
query?: string;
|
|
5
5
|
pageNumber?: number;
|
package/dist/typings/model.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FilesCreatePayload, FormValues } from '../../typings/model';
|
|
1
|
+
import { type FilesCreatePayload, type FormValues } from '../../typings/model';
|
|
2
2
|
export declare function convertFilesFormValuesToCreationPayload(values: FormValues): FilesCreatePayload;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TagerFormSubmitEvent } from '@tager/admin-ui';
|
|
1
|
+
import { type TagerFormSubmitEvent } from '@tager/admin-ui';
|
|
2
2
|
import { getFilesListUrl } from '../../utils/paths';
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
6
|
values: import("vue").Ref<{
|
|
5
7
|
file: {
|
|
6
8
|
id: string;
|
|
@@ -19,4 +21,3 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
19
21
|
submitForm: (event: TagerFormSubmitEvent) => void;
|
|
20
22
|
getFilesListUrl: typeof getFilesListUrl;
|
|
21
23
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
22
|
-
export default _default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ColumnDefinition } from '@tager/admin-ui';
|
|
2
|
-
import { FileModel } from '../../typings/model';
|
|
1
|
+
import { type ColumnDefinition } from '@tager/admin-ui';
|
|
2
|
+
import { type FileModel } from '../../typings/model';
|
|
3
3
|
import { getFilesFormUrl } from '../../utils/paths';
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: typeof __VLS_export;
|
|
5
|
+
export default _default;
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
5
7
|
columnDefs: ColumnDefinition<FileModel>[];
|
|
6
8
|
getFilesFormUrl: typeof getFilesFormUrl;
|
|
7
9
|
rowData: import("vue").Ref<FileModel[]>;
|
|
@@ -15,4 +17,3 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
15
17
|
handleResourceDelete: (entityId: string | number) => void;
|
|
16
18
|
isDeleting: (entityId: string | number) => boolean;
|
|
17
19
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
18
|
-
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tager/admin-files",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
"src"
|
|
12
12
|
],
|
|
13
13
|
"exports": {
|
|
14
|
-
"./css": "./dist/style.css",
|
|
15
14
|
".": "./dist/index.mjs"
|
|
16
15
|
},
|
|
17
16
|
"scripts": {
|
|
18
17
|
"build:js": "vite build",
|
|
19
|
-
"build:package": "
|
|
18
|
+
"build:package": "yarn build:js && (yarn emit-declarations || echo 'vue-tsc: type errors found, declarations emitted anyway')",
|
|
20
19
|
"emit-declarations": "vue-tsc --project tsconfig.json --emitDeclarationOnly",
|
|
21
|
-
"start": "
|
|
20
|
+
"start": "vite",
|
|
22
21
|
"prepare": "yarn build:package",
|
|
23
|
-
"tager:update": "yarn upgrade --latest --scope @tager"
|
|
22
|
+
"tager:update": "yarn upgrade --latest --scope @tager",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"format": "prettier --write src"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"filesize": "^9.0.11",
|
|
@@ -30,9 +31,7 @@
|
|
|
30
31
|
"path-to-regexp": "^6.1.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@babel/eslint-parser": "^7.17.0",
|
|
35
|
-
"@rushstack/eslint-patch": "^1.1.2",
|
|
34
|
+
"@eslint/js": "^9.39.5",
|
|
36
35
|
"@tager/admin-dynamic-field": "^1.0.0",
|
|
37
36
|
"@tager/admin-layout": "^1.0.0",
|
|
38
37
|
"@tager/admin-services": "^1.0.0",
|
|
@@ -41,28 +40,24 @@
|
|
|
41
40
|
"@types/lodash.isequal": "^4.5.6",
|
|
42
41
|
"@types/lodash.pick": "^4.4.7",
|
|
43
42
|
"@types/node": "16.x",
|
|
44
|
-
"@
|
|
45
|
-
"@typescript
|
|
46
|
-
"@vitejs/plugin-vue": "^2.3.1",
|
|
47
|
-
"@vue/cli-plugin-babel": "^5.0.4",
|
|
48
|
-
"@vue/cli-plugin-typescript": "^5.0.4",
|
|
49
|
-
"@vue/cli-service": "~5.0.0",
|
|
50
|
-
"@vue/eslint-config-prettier": "^7.0.0",
|
|
51
|
-
"@vue/eslint-config-typescript": "^10.0.0",
|
|
52
|
-
"concurrently": "^7.1.0",
|
|
43
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
44
|
+
"@vue/eslint-config-typescript": "^14.9.0",
|
|
53
45
|
"core-js": "^3.22.3",
|
|
54
|
-
"eslint": "^
|
|
55
|
-
"eslint-config-prettier": "^
|
|
56
|
-
"eslint-
|
|
57
|
-
"eslint-plugin-
|
|
58
|
-
"eslint-plugin-vue": "^
|
|
46
|
+
"eslint": "^9.39.5",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
49
|
+
"eslint-plugin-import": "^2.32.0",
|
|
50
|
+
"eslint-plugin-vue": "^10.12.0",
|
|
51
|
+
"globals": "^16.5.0",
|
|
52
|
+
"prettier": "^3.9.10",
|
|
59
53
|
"sass": "^1.51.0",
|
|
60
54
|
"sass-loader": "^12.6.0",
|
|
61
|
-
"typescript": "^
|
|
62
|
-
"vite": "^
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"vite": "^6.4.5",
|
|
63
57
|
"vue": "^3.2.31",
|
|
58
|
+
"vue-eslint-parser": "^10.4.1",
|
|
64
59
|
"vue-router": "^4.0.14",
|
|
65
|
-
"vue-tsc": "^
|
|
60
|
+
"vue-tsc": "^3.3.14"
|
|
66
61
|
},
|
|
67
62
|
"peerDependencies": {
|
|
68
63
|
"@tager/admin-layout": "^1.0.0",
|
package/src/dev/App.vue
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import {defineComponent} from 'vue';
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
import {type MenuItemType, PageLayout} from "@tager/admin-layout";
|
|
10
11
|
import {ViewListIcon} from "@tager/admin-ui";
|
|
11
|
-
import {getFilesListUrl} from '../utils/paths';
|
|
12
12
|
import {useI18n} from "@tager/admin-services";
|
|
13
13
|
|
|
14
|
+
import {getFilesListUrl} from '../utils/paths';
|
|
15
|
+
|
|
14
16
|
export default defineComponent({
|
|
15
17
|
name: 'App',
|
|
16
18
|
components: {
|
|
@@ -34,5 +36,3 @@ export default defineComponent({
|
|
|
34
36
|
},
|
|
35
37
|
});
|
|
36
38
|
</script>
|
|
37
|
-
|
|
38
|
-
<style scoped lang="scss"></style>
|
package/src/dev/env.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { initializeEnvironment } from '@tager/admin-services';
|
|
|
2
2
|
|
|
3
3
|
export function populateEnvironment() {
|
|
4
4
|
initializeEnvironment({
|
|
5
|
-
publicPath:
|
|
6
|
-
appEnv:
|
|
7
|
-
apiUrl:
|
|
8
|
-
accessToken:
|
|
9
|
-
websiteUrl:
|
|
10
|
-
websiteButtonUrl:
|
|
11
|
-
sentryDsn:
|
|
12
|
-
sentryEnv:
|
|
13
|
-
baseUrl:
|
|
14
|
-
nodeEnv:
|
|
15
|
-
version:
|
|
5
|
+
publicPath: import.meta.env.VUE_APP_PUBLIC_PATH,
|
|
6
|
+
appEnv: import.meta.env.VUE_APP_ENV,
|
|
7
|
+
apiUrl: import.meta.env.VUE_APP_API_URL,
|
|
8
|
+
accessToken: import.meta.env.VUE_APP_ACCESS_TOKEN,
|
|
9
|
+
websiteUrl: import.meta.env.VUE_APP_WEBSITE_URL,
|
|
10
|
+
websiteButtonUrl: import.meta.env.VUE_APP_WEBSITE_BUTTON_URL,
|
|
11
|
+
sentryDsn: import.meta.env.VUE_APP_SENTRY_DSN,
|
|
12
|
+
sentryEnv: import.meta.env.VUE_APP_SENTRY_ENVIRONMENT,
|
|
13
|
+
baseUrl: import.meta.env.BASE_URL,
|
|
14
|
+
nodeEnv: import.meta.env.MODE,
|
|
15
|
+
version: import.meta.env.VUE_APP_VERSION,
|
|
16
16
|
});
|
|
17
17
|
}
|
package/src/services/requests.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { request, ResponseBody } from '@tager/admin-services';
|
|
1
|
+
import { request, type ResponseBody } from '@tager/admin-services';
|
|
2
2
|
|
|
3
|
-
import { FileModel } from '../typings/model';
|
|
3
|
+
import { type FileModel } from '../typings/model';
|
|
4
4
|
|
|
5
5
|
export function getFilesList(params?: {
|
|
6
6
|
query?: string;
|
package/src/typings/model.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { defineComponent, ref } from 'vue';
|
|
|
26
26
|
import { useRouter } from 'vue-router';
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
|
-
TagerFormSubmitEvent,
|
|
29
|
+
type TagerFormSubmitEvent,
|
|
30
30
|
FormFooter,
|
|
31
31
|
FormField,
|
|
32
32
|
FormFieldFileInput,
|
|
@@ -42,7 +42,7 @@ import { Page } from '@tager/admin-layout';
|
|
|
42
42
|
|
|
43
43
|
import { addFile } from '../../services/requests';
|
|
44
44
|
import { getFilesListUrl } from '../../utils/paths';
|
|
45
|
-
import { FormValues } from '../../typings/model';
|
|
45
|
+
import { type FormValues } from '../../typings/model';
|
|
46
46
|
|
|
47
47
|
import { convertFilesFormValuesToCreationPayload } from './FilesForm.helpers';
|
|
48
48
|
|
|
@@ -110,5 +110,3 @@ export default defineComponent({
|
|
|
110
110
|
},
|
|
111
111
|
});
|
|
112
112
|
</script>
|
|
113
|
-
|
|
114
|
-
<style lang="scss" scoped></style>
|
|
@@ -41,7 +41,7 @@ import { defineComponent, onMounted } from 'vue';
|
|
|
41
41
|
import filesize from 'filesize';
|
|
42
42
|
|
|
43
43
|
import {
|
|
44
|
-
ColumnDefinition,
|
|
44
|
+
type ColumnDefinition,
|
|
45
45
|
useDataTable,
|
|
46
46
|
DataTable,
|
|
47
47
|
BaseButton,
|
|
@@ -52,7 +52,7 @@ import { useI18n, useResourceDelete } from '@tager/admin-services';
|
|
|
52
52
|
import { Page } from '@tager/admin-layout';
|
|
53
53
|
|
|
54
54
|
import { deleteFile, getFilesList } from '../../services/requests';
|
|
55
|
-
import { FileModel } from '../../typings/model';
|
|
55
|
+
import { type FileModel } from '../../typings/model';
|
|
56
56
|
import { getFilesFormUrl } from '../../utils/paths';
|
|
57
57
|
|
|
58
58
|
export default defineComponent({
|