@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.
@@ -1,5 +1,6 @@
1
- import { MenuItemType } from "@tager/admin-layout";
2
- declare const _default: import("vue").DefineComponent<{}, {
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, resolveComponent, openBlock, createBlock, withCtx, createVNode, ref, createElementVNode, withModifiers } from "vue";
3
- import filesize from "filesize";
4
- import { DataTable, BaseButton, DeleteIcon, useDataTable, cutUrlOrigin, FormFieldFileInput, FormFooter } from "@tager/admin-ui";
5
- import { Page } from "@tager/admin-layout";
6
- import { compile } from "path-to-regexp";
7
- import { useRouter } from "vue-router";
8
- const EN = {
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
- const RU = {
27
- home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
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 getFilesList(params) {
49
- return request.get({ path: "/admin/userfiles", params });
46
+ function J(e) {
47
+ return F.get({ path: "/admin/userfiles", params: e });
50
48
  }
51
- function getFilesCount() {
52
- return request.get({ path: "/admin/userfiles/count" });
49
+ function me() {
50
+ return F.get({ path: "/admin/userfiles/count" });
53
51
  }
54
- function deleteFile(fileId) {
55
- return request.delete({ path: `/admin/userfiles/${fileId}` });
52
+ function K(e) {
53
+ return F.delete({ path: `/admin/userfiles/${e}` });
56
54
  }
57
- function addFile(payload) {
58
- return request.post({ path: "/admin/userfiles", body: payload });
55
+ function W(e) {
56
+ return F.post({ path: "/admin/userfiles", body: e });
59
57
  }
60
- const FILES_ROUTE_PATHS = {
58
+ const g = {
61
59
  FILES_LIST: "/files",
62
60
  FILES_FORM: "/files/:fileId"
63
61
  };
64
- function getFilesListUrl() {
65
- return FILES_ROUTE_PATHS.FILES_LIST;
62
+ function b() {
63
+ return g.FILES_LIST;
66
64
  }
67
- function getFilesFormUrl(params) {
68
- return compile(FILES_ROUTE_PATHS.FILES_FORM)(params);
65
+ function X(e) {
66
+ return V(g.FILES_FORM)(e);
69
67
  }
70
- var _export_sfc = (sfc, props) => {
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 } = useI18n();
82
- const {
83
- fetchEntityList: fetchFilesList,
84
- isLoading: isFilesListLoading,
85
- rowData: filesList,
86
- errorMessage,
87
- searchQuery,
88
- handleChange,
89
- pageSize,
90
- pageCount,
91
- pageNumber
92
- } = useDataTable({
93
- fetchEntityList: (params) => getFilesList({
94
- query: params.searchQuery,
95
- pageNumber: params.pageNumber,
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
- onMounted(() => {
103
- fetchFilesList();
92
+ $(() => {
93
+ t();
104
94
  });
105
- const { handleResourceDelete, isDeleting } = useResourceDelete({
106
- deleteResource: deleteFile,
95
+ const { handleResourceDelete: p, isDeleting: S } = _({
96
+ deleteResource: K,
107
97
  resourceName: "File",
108
- onSuccess: fetchFilesList
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
- getFilesFormUrl,
157
- rowData: filesList,
158
- isRowDataLoading: isFilesListLoading,
159
- errorMessage,
160
- searchQuery,
161
- handleChange,
162
- pageSize,
163
- pageCount,
164
- pageNumber,
165
- handleResourceDelete,
166
- isDeleting
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
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
171
- const _component_DeleteIcon = resolveComponent("DeleteIcon");
172
- const _component_BaseButton = resolveComponent("BaseButton");
173
- const _component_DataTable = resolveComponent("DataTable");
174
- const _component_Page = resolveComponent("Page");
175
- return openBlock(), createBlock(_component_Page, {
176
- title: _ctx.$i18n.t("files:filesList"),
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: _ctx.$i18n.t("files:createFile"),
180
- href: _ctx.getFilesFormUrl({ fileId: "create" })
170
+ text: e.$i18n.t("files:createFile"),
171
+ href: e.getFilesFormUrl({ fileId: "create" })
181
172
  }
182
173
  ]
183
174
  }, {
184
- default: withCtx(() => [
185
- createVNode(_component_DataTable, {
186
- "column-defs": _ctx.columnDefs,
187
- "row-data": _ctx.rowData,
188
- loading: _ctx.isRowDataLoading,
189
- "error-message": _ctx.errorMessage,
190
- "search-query": _ctx.searchQuery,
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: _ctx.pageSize,
193
- pageCount: _ctx.pageCount,
194
- pageNumber: _ctx.pageNumber,
195
- disabled: _ctx.isRowDataLoading
183
+ pageSize: e.pageSize,
184
+ pageCount: e.pageCount,
185
+ pageNumber: e.pageNumber,
186
+ disabled: e.isRowDataLoading
196
187
  },
197
- onChange: _ctx.handleChange
188
+ onChange: e.handleChange
198
189
  }, {
199
- "cell(delete)": withCtx(({ row }) => [
200
- createVNode(_component_BaseButton, {
190
+ "cell(delete)": d(({ row: p }) => [
191
+ m(i, {
201
192
  variant: "icon",
202
- title: _ctx.$i18n.t("files:delete"),
203
- disabled: _ctx.isDeleting(row.id),
204
- onClick: ($event) => _ctx.handleResourceDelete(row.id)
193
+ title: e.$i18n.t("files:delete"),
194
+ disabled: e.isDeleting(p.id),
195
+ onClick: (S) => e.handleResourceDelete(p.id)
205
196
  }, {
206
- default: withCtx(() => [
207
- createVNode(_component_DeleteIcon)
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
- var FilesList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
219
- function convertFilesFormValuesToCreationPayload(values) {
220
- var _a, _b;
209
+ const x = /* @__PURE__ */ E(Y, [["render", Z]]);
210
+ function ee(e) {
211
+ var t;
221
212
  return {
222
- file: (_b = (_a = values.file) == null ? void 0 : _a.file.id) != null ? _b : ""
213
+ file: ((t = e.file) == null ? void 0 : t.file.id) ?? ""
223
214
  };
224
215
  }
225
- const _sfc_main = defineComponent({
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 } = useI18n();
230
- const toast = useToast();
231
- const router = useRouter();
232
- const errors = ref({});
233
- const values = ref({ file: null });
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
- addFile(creationPayload).then(() => {
241
- errors.value = {};
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: t("files:success"),
248
- body: t("files:createdSuccessMessage")
229
+ title: e("files:success"),
230
+ body: e("files:createdSuccessMessage")
249
231
  });
250
- }).catch((error) => {
251
- console.error(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: t("files:error"),
256
- body: t("files:createdErrorMessage")
235
+ title: e("files:error"),
236
+ body: e("files:createdErrorMessage")
257
237
  });
258
238
  }).finally(() => {
259
- isSubmitting.value = false;
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 _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
272
- const _component_FormFieldFileInput = resolveComponent("FormFieldFileInput");
273
- const _component_FormFooter = resolveComponent("FormFooter");
274
- const _component_Page = resolveComponent("Page");
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: withCtx(() => [
279
- createVNode(_component_FormFooter, {
280
- "back-href": _ctx.getFilesListUrl(),
281
- "is-submitting": _ctx.isSubmitting,
282
- "is-creation": true,
283
- "submit-label": "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C",
284
- onSubmit: _ctx.submitForm
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: withCtx(() => [
288
- createElementVNode("form", {
265
+ default: d(() => [
266
+ M("form", {
289
267
  novalidate: "",
290
- onSubmit: _cache[1] || (_cache[1] = withModifiers(() => {
268
+ onSubmit: t[1] || (t[1] = z(() => {
291
269
  }, ["prevent"]))
292
270
  }, [
293
- createVNode(_component_FormFieldFileInput, {
294
- value: _ctx.values.file,
295
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.file = $event),
296
- error: _ctx.errors.file,
297
- label: _ctx.$i18n.t("files:file"),
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
- var FilesForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
306
- const FILES_LIST_ROUTE = {
307
- path: FILES_ROUTE_PATHS.FILES_LIST,
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: (route, i18n2) => [
312
- { url: "/", text: i18n2.t("files:home") },
313
- { url: route.path, text: i18n2.t("files:filesList") }
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
- const FILES_FORM_ROUTE = {
318
- path: FILES_ROUTE_PATHS.FILES_FORM,
319
- component: FilesForm,
293
+ }, pe = {
294
+ path: g.FILES_FORM,
295
+ component: se,
320
296
  name: "Files Form",
321
297
  meta: {
322
- getBreadcrumbs: (route, i18n2) => [
323
- { url: "/", text: i18n2.t("files:home") },
324
- { url: FILES_LIST_ROUTE.path, text: i18n2.t("files:filesList") },
325
- { url: route.path, text: i18n2.t("files:filesForm") }
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
- applyTranslations();
330
- export { FILES_FORM_ROUTE, FILES_LIST_ROUTE, addFile, deleteFile, getFilesCount, getFilesFormUrl, getFilesList, getFilesListUrl };
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;
@@ -1,4 +1,4 @@
1
- import { SingleFileInputValueType } from '@tager/admin-ui';
1
+ import { type SingleFileInputValueType } from '@tager/admin-ui';
2
2
  export interface FileModel {
3
3
  id: number;
4
4
  name: string;
@@ -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: import("vue").DefineComponent<{}, {
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: import("vue").DefineComponent<{}, {
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.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": "concurrently --success first \"yarn build:js\" \"yarn emit-declarations\"",
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": "vue-cli-service serve",
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
- "@babel/core": "^7.17.9",
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
- "@typescript-eslint/eslint-plugin": "^5.21.0",
45
- "@typescript-eslint/parser": "^5.21.0",
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": "^8.14.0",
55
- "eslint-config-prettier": "^8.5.0",
56
- "eslint-plugin-import": "^2.26.0",
57
- "eslint-plugin-prettier": "^4.0.0",
58
- "eslint-plugin-vue": "^8.7.1",
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": "^4.6.3",
62
- "vite": "^2.9.6",
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": "^0.34.10"
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
- import {MenuItemType, PageLayout} from "@tager/admin-layout";
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: process.env.VUE_APP_PUBLIC_PATH,
6
- appEnv: process.env.VUE_APP_ENV,
7
- apiUrl: process.env.VUE_APP_API_URL,
8
- accessToken: process.env.VUE_APP_ACCESS_TOKEN,
9
- websiteUrl: process.env.VUE_APP_WEBSITE_URL,
10
- websiteButtonUrl: process.env.VUE_APP_WEBSITE_BUTTON_URL,
11
- sentryDsn: process.env.VUE_APP_SENTRY_DSN,
12
- sentryEnv: process.env.VUE_APP_SENTRY_ENVIRONMENT,
13
- baseUrl: process.env.BASE_URL,
14
- nodeEnv: process.env.NODE_ENV,
15
- version: process.env.VUE_APP_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
  }
@@ -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;
@@ -1,4 +1,4 @@
1
- import { SingleFileInputValueType } from '@tager/admin-ui';
1
+ import { type SingleFileInputValueType } from '@tager/admin-ui';
2
2
 
3
3
  export interface FileModel {
4
4
  id: number;
@@ -1,4 +1,4 @@
1
- import { FilesCreatePayload, FormValues } from '../../typings/model';
1
+ import { type FilesCreatePayload, type FormValues } from '../../typings/model';
2
2
 
3
3
  export function convertFilesFormValuesToCreationPayload(
4
4
  values: FormValues
@@ -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({