@tager/admin-files 0.0.7 → 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.
Files changed (43) hide show
  1. package/dist/constants/paths.d.ts +4 -4
  2. package/dist/constants/routes.d.ts +3 -3
  3. package/dist/dev/App.vue.d.ts +6 -0
  4. package/dist/dev/config.d.ts +2 -0
  5. package/dist/dev/env.d.ts +1 -0
  6. package/dist/dev/main.d.ts +3 -0
  7. package/dist/index.mjs +315 -0
  8. package/dist/locales/apply.d.ts +1 -0
  9. package/dist/locales/en.d.ts +18 -19
  10. package/dist/locales/ru.d.ts +2 -3
  11. package/dist/main.d.ts +3 -3
  12. package/dist/services/requests.d.ts +16 -16
  13. package/dist/typings/model.d.ts +14 -14
  14. package/dist/utils/paths.d.ts +4 -4
  15. package/dist/views/FilesForm/FilesForm.helpers.d.ts +2 -2
  16. package/dist/views/FilesForm/FilesForm.vue.d.ts +23 -50
  17. package/dist/views/FilesForm/index.d.ts +1 -1
  18. package/dist/views/FilesList/FilesList.vue.d.ts +19 -37
  19. package/dist/views/FilesList/index.d.ts +1 -1
  20. package/package.json +47 -49
  21. package/src/constants/routes.ts +10 -10
  22. package/src/dev/App.vue +38 -0
  23. package/src/dev/config.ts +23 -0
  24. package/src/dev/env.ts +17 -0
  25. package/src/dev/main.ts +36 -0
  26. package/src/locales/apply.ts +9 -0
  27. package/src/locales/en.ts +1 -3
  28. package/src/locales/ru.ts +2 -4
  29. package/src/main.ts +2 -6
  30. package/src/services/requests.ts +2 -2
  31. package/src/typings/model.ts +1 -1
  32. package/src/views/FilesForm/FilesForm.helpers.ts +1 -1
  33. package/src/views/FilesForm/FilesForm.vue +32 -26
  34. package/src/views/FilesList/FilesList.vue +51 -49
  35. package/README.md +0 -1
  36. package/dist/dev.d.ts +0 -1
  37. package/dist/index.esm.js +0 -738
  38. package/dist/index.umd.js +0 -750
  39. package/src/dev.ts +0 -41
  40. package/src/typings/sfc.d.ts +0 -12
  41. package/src/typings/shims-tsx.d.ts +0 -13
  42. package/src/typings/shims-vue.d.ts +0 -11
  43. package/src/views/App.vue +0 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tager/admin-files",
3
- "version": "0.0.7",
3
+ "version": "1.0.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -10,63 +10,61 @@
10
10
  "typings",
11
11
  "src"
12
12
  ],
13
+ "exports": {
14
+ ".": "./dist/index.mjs"
15
+ },
13
16
  "scripts": {
14
- "start": "vue-cli-service serve",
15
- "lint": "vue-cli-service lint",
16
- "build": "rollup --config",
17
- "prepare": "vue-docgen-web-types && yarn build",
18
- "tager:update": "node scripts/tager-update.js",
19
- "yalc:clean": "yalc remove --all"
17
+ "build:js": "vite build",
18
+ "build:package": "yarn build:js && (yarn emit-declarations || echo 'vue-tsc: type errors found, declarations emitted anyway')",
19
+ "emit-declarations": "vue-tsc --project tsconfig.json --emitDeclarationOnly",
20
+ "start": "vite",
21
+ "prepare": "yarn build:package",
22
+ "tager:update": "yarn upgrade --latest --scope @tager",
23
+ "lint": "eslint .",
24
+ "format": "prettier --write src"
20
25
  },
21
26
  "dependencies": {
22
- "filesize": "^7.0.0",
27
+ "filesize": "^9.0.11",
28
+ "lodash.isequal": "^4.5.0",
23
29
  "lodash.kebabcase": "^4.1.1",
30
+ "lodash.pick": "^4.4.0",
24
31
  "path-to-regexp": "^6.1.0"
25
32
  },
26
33
  "devDependencies": {
27
- "@rollup/plugin-commonjs": "^14.0.0",
28
- "@rollup/plugin-node-resolve": "^8.1.0",
29
- "@tager/admin-layout": "^0.5.1",
30
- "@tager/admin-services": "^0.2.23",
31
- "@tager/admin-ui": "^0.8.78",
32
- "@types/lodash.kebabcase": "^4.1.6",
33
- "@types/node": "12.x",
34
- "@typescript-eslint/eslint-plugin": "^2.26.0",
35
- "@typescript-eslint/parser": "^2.26.0",
36
- "@vue/cli-plugin-babel": "~4.4.6",
37
- "@vue/cli-plugin-eslint": "~4.4.6",
38
- "@vue/cli-plugin-router": "~4.4.6",
39
- "@vue/cli-plugin-typescript": "~4.4.6",
40
- "@vue/cli-service": "~4.4.6",
41
- "@vue/composition-api": "^1.0.0-beta.14",
42
- "@vue/eslint-config-prettier": "^6.0.0",
43
- "@vue/eslint-config-typescript": "^5.0.2",
44
- "babel-eslint": "^10.1.0",
45
- "core-js": "^3.6.5",
46
- "eslint": "^6.7.2",
47
- "eslint-plugin-import": "^2.22.0",
48
- "eslint-plugin-prettier": "^3.1.4",
49
- "eslint-plugin-vue": "^6.2.2",
50
- "prettier": "^2.0.5",
51
- "rollup": "^2.23.1",
52
- "rollup-plugin-typescript2": "^0.27.2",
53
- "rollup-plugin-vue": "^5.1.9",
54
- "sass-loader": "^9.0.3",
55
- "typescript": "~3.9.6",
56
- "vue": "2.6.x",
57
- "vue-docgen-web-types": "^0.1.6",
58
- "vue-router": "^3.5.1",
59
- "vue-template-compiler": "^2.6.11"
34
+ "@eslint/js": "^9.39.5",
35
+ "@tager/admin-dynamic-field": "^1.0.0",
36
+ "@tager/admin-layout": "^1.0.0",
37
+ "@tager/admin-services": "^1.0.0",
38
+ "@tager/admin-ui": "^1.0.1",
39
+ "@types/filesize": "^5.0.0",
40
+ "@types/lodash.isequal": "^4.5.6",
41
+ "@types/lodash.pick": "^4.4.7",
42
+ "@types/node": "16.x",
43
+ "@vitejs/plugin-vue": "^5.2.4",
44
+ "@vue/eslint-config-typescript": "^14.9.0",
45
+ "core-js": "^3.22.3",
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",
53
+ "sass": "^1.51.0",
54
+ "sass-loader": "^12.6.0",
55
+ "typescript": "^5.9.3",
56
+ "vite": "^6.4.5",
57
+ "vue": "^3.2.31",
58
+ "vue-eslint-parser": "^10.4.1",
59
+ "vue-router": "^4.0.14",
60
+ "vue-tsc": "^3.3.14"
60
61
  },
61
62
  "peerDependencies": {
62
- "@tager/admin-layout": ">=0.4.2",
63
- "@tager/admin-services": ">=0.2.11",
64
- "@tager/admin-ui": ">=0.7.5",
65
- "@vue/composition-api": ">=1.0.0-beta.14",
66
- "vue": "2.6.x"
67
- },
68
- "resolutions": {
69
- "prettier": "2.x"
63
+ "@tager/admin-layout": "^1.0.0",
64
+ "@tager/admin-services": "^1.0.0",
65
+ "@tager/admin-ui": "^1.0.1",
66
+ "vue": "^3.2.31",
67
+ "vue-router": "^4.0.14"
70
68
  },
71
69
  "publishConfig": {
72
70
  "access": "public"
@@ -1,31 +1,31 @@
1
- import { CustomRouteConfig } from '@tager/admin-layout';
1
+ import type { RouteRecordRaw } from 'vue-router';
2
2
 
3
3
  import FilesList from '../views/FilesList';
4
4
  import FilesForm from '../views/FilesForm';
5
5
 
6
6
  import { FILES_ROUTE_PATHS } from './paths';
7
7
 
8
- export const FILES_LIST_ROUTE: CustomRouteConfig = {
8
+ export const FILES_LIST_ROUTE: RouteRecordRaw = {
9
9
  path: FILES_ROUTE_PATHS.FILES_LIST,
10
10
  component: FilesList,
11
11
  name: 'Files List',
12
12
  meta: {
13
- getBreadcrumbs: (route, t) => [
14
- { url: '/', text: t('files:home') },
15
- { url: route.path, text: t('files:filesList') },
13
+ getBreadcrumbs: (route, i18n) => [
14
+ { url: '/', text: i18n.t('files:home') },
15
+ { url: route.path, text: i18n.t('files:filesList') },
16
16
  ],
17
17
  },
18
18
  };
19
19
 
20
- export const FILES_FORM_ROUTE: CustomRouteConfig = {
20
+ export const FILES_FORM_ROUTE: RouteRecordRaw = {
21
21
  path: FILES_ROUTE_PATHS.FILES_FORM,
22
22
  component: FilesForm,
23
23
  name: 'Files Form',
24
24
  meta: {
25
- getBreadcrumbs: (route, t) => [
26
- { url: '/', text: t('files:home') },
27
- { url: FILES_LIST_ROUTE.path, text: t('files:filesList') },
28
- { url: route.path, text: t('files:filesForm') },
25
+ getBreadcrumbs: (route, i18n) => [
26
+ { url: '/', text: i18n.t('files:home') },
27
+ { url: FILES_LIST_ROUTE.path, text: i18n.t('files:filesList') },
28
+ { url: route.path, text: i18n.t('files:filesForm') },
29
29
  ],
30
30
  },
31
31
  };
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <PageLayout :sidebar-menu-list="sidebarMenuList">
3
+ <router-view/>
4
+ </PageLayout>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import {defineComponent} from 'vue';
9
+
10
+ import {type MenuItemType, PageLayout} from "@tager/admin-layout";
11
+ import {ViewListIcon} from "@tager/admin-ui";
12
+ import {useI18n} from "@tager/admin-services";
13
+
14
+ import {getFilesListUrl} from '../utils/paths';
15
+
16
+ export default defineComponent({
17
+ name: 'App',
18
+ components: {
19
+ PageLayout,
20
+ },
21
+ setup() {
22
+ const i18n = useI18n();
23
+
24
+ const sidebarMenuList: Array<MenuItemType> = [
25
+ {
26
+ id: 'files',
27
+ text: i18n.t('files:files'),
28
+ icon: ViewListIcon,
29
+ children: [{text: i18n.t('files:files'), url: getFilesListUrl()}],
30
+ },
31
+ ];
32
+
33
+ return {
34
+ sidebarMenuList,
35
+ };
36
+ },
37
+ });
38
+ </script>
@@ -0,0 +1,23 @@
1
+ import type { AppConfigType } from '@tager/admin-services';
2
+
3
+ export const OZITAG_CONFIG: AppConfigType = {
4
+ APP_NAME: 'OZiTAG_ADMIN',
5
+ TITLE_TEMPLATE: 'OZiTAG Admin - {{title}}',
6
+ LANGUAGE: 'EN',
7
+ BRAND: {
8
+ small: {
9
+ logo: 'logo-small.svg',
10
+ },
11
+ large: {
12
+ logo: 'logo.svg',
13
+ label: 'OZiTAG',
14
+ 'label-color': '#DD6900',
15
+ },
16
+ subtitle: '',
17
+ },
18
+ SPLASH_SCREEN: {
19
+ enabled: true,
20
+ logo: 'logo-white.svg',
21
+ background: '#1e1e1e',
22
+ },
23
+ };
package/src/dev/env.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { initializeEnvironment } from '@tager/admin-services';
2
+
3
+ export function populateEnvironment() {
4
+ initializeEnvironment({
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
+ });
17
+ }
@@ -0,0 +1,36 @@
1
+ import {createApp} from 'vue';
2
+
3
+ import {configStore, i18n, i18nPlugin} from '@tager/admin-services';
4
+ import {createRouter} from '@tager/admin-layout';
5
+ import '@tager/admin-ui/css';
6
+ import '@tager/admin-layout/css';
7
+ import '@tager/admin-dynamic-field/css';
8
+
9
+ import {applyTranslations} from '../locales/apply';
10
+ import {FILES_LIST_ROUTE, FILES_FORM_ROUTE} from '../constants/routes';
11
+
12
+ import {OZITAG_CONFIG} from './config';
13
+ import App from './App.vue';
14
+ import {populateEnvironment} from './env';
15
+
16
+ populateEnvironment();
17
+
18
+ configStore.setConfig(OZITAG_CONFIG);
19
+
20
+ const router = createRouter(
21
+ {
22
+ routes: [FILES_LIST_ROUTE, FILES_FORM_ROUTE],
23
+ },
24
+ {useTitleSync: false}
25
+ );
26
+
27
+ const app = createApp(App);
28
+
29
+ app.use(router);
30
+ app.use(i18nPlugin);
31
+
32
+ applyTranslations();
33
+
34
+ i18n.init({debug: true, lng: 'ru'}).then(() => {
35
+ app.mount('#app');
36
+ });
@@ -0,0 +1,9 @@
1
+ import { i18n } from '@tager/admin-services';
2
+
3
+ import { EN } from './en';
4
+ import { RU } from './ru';
5
+
6
+ export function applyTranslations() {
7
+ i18n.addTranslations('en', 'files', EN);
8
+ i18n.addTranslations('ru', 'files', RU);
9
+ }
package/src/locales/en.ts CHANGED
@@ -1,4 +1,4 @@
1
- const EN = {
1
+ export const EN = {
2
2
  home: 'Home',
3
3
  success: 'Success',
4
4
  error: 'Error',
@@ -17,5 +17,3 @@ const EN = {
17
17
  delete: 'Delete',
18
18
  add: 'Add',
19
19
  };
20
-
21
- export default EN;
package/src/locales/ru.ts CHANGED
@@ -1,6 +1,6 @@
1
- import EN from './en';
1
+ import {EN} from './en';
2
2
 
3
- const RU: typeof EN = {
3
+ export const RU: typeof EN = {
4
4
  home: 'Главная',
5
5
  success: 'Успех',
6
6
  error: 'Ошибка',
@@ -19,5 +19,3 @@ const RU: typeof EN = {
19
19
  delete: 'Удалить',
20
20
  add: 'Добавить',
21
21
  };
22
-
23
- export default RU;
package/src/main.ts CHANGED
@@ -1,10 +1,6 @@
1
- import { i18n } from '@tager/admin-services';
1
+ import { applyTranslations } from './locales/apply';
2
2
 
3
- import EN from './locales/en';
4
- import RU from './locales/ru';
5
-
6
- i18n.addTranslations('en', 'files', EN);
7
- i18n.addTranslations('ru', 'files', RU);
3
+ applyTranslations();
8
4
 
9
5
  export * from './constants/routes';
10
6
  export * from './utils/paths';
@@ -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
@@ -1,50 +1,58 @@
1
1
  <template>
2
- <page :title="$t('files:fileCreation')">
2
+ <Page :title="$i18n.t('files:fileCreation')">
3
3
  <form novalidate @submit.prevent>
4
- <template>
5
- <form-field-file-input
6
- v-model="values.file"
7
- :error="errors.file"
8
- :label="$t('files:file')"
9
- name="file"
10
- />
11
- </template>
4
+ <FormFieldFileInput
5
+ v-model:value="values.file"
6
+ :error="errors.file"
7
+ :label="$i18n.t('files:file')"
8
+ name="file"
9
+ />
12
10
  </form>
13
11
 
14
- <template v-slot:footer>
12
+ <template #footer>
15
13
  <FormFooter
16
14
  :back-href="getFilesListUrl()"
17
- :on-submit="submitForm"
18
15
  :is-submitting="isSubmitting"
19
16
  :is-creation="true"
20
17
  submit-label="Добавить"
18
+ @submit="submitForm"
21
19
  />
22
20
  </template>
23
- </page>
21
+ </Page>
24
22
  </template>
25
23
 
26
24
  <script lang="ts">
27
- import { defineComponent } from '@vue/composition-api';
28
- import { ref } from '@vue/composition-api';
25
+ import { defineComponent, ref } from 'vue';
26
+ import { useRouter } from 'vue-router';
29
27
 
30
- import { convertRequestErrorToMap } from '@tager/admin-services';
31
28
  import {
32
- TagerFormSubmitEvent,
29
+ type TagerFormSubmitEvent,
33
30
  FormFooter,
34
- useTranslation,
31
+ FormField,
32
+ FormFieldFileInput,
35
33
  } from '@tager/admin-ui';
34
+ import {
35
+ convertRequestErrorToMap,
36
+ navigateBack,
37
+ useI18n,
38
+ useResource,
39
+ useToast,
40
+ } from '@tager/admin-services';
41
+ import { Page } from '@tager/admin-layout';
36
42
 
37
43
  import { addFile } from '../../services/requests';
38
44
  import { getFilesListUrl } from '../../utils/paths';
39
- import { FormValues } from '../../typings/model';
45
+ import { type FormValues } from '../../typings/model';
40
46
 
41
47
  import { convertFilesFormValuesToCreationPayload } from './FilesForm.helpers';
42
48
 
43
49
  export default defineComponent({
44
50
  name: 'FilesForm',
45
- components: { FormFooter },
46
- setup(props, context) {
47
- const { t } = useTranslation(context);
51
+ components: { Page, FormFieldFileInput, FormFooter },
52
+ setup() {
53
+ const { t } = useI18n();
54
+ const toast = useToast();
55
+ const router = useRouter();
48
56
 
49
57
  /** Form state */
50
58
 
@@ -69,10 +77,10 @@ export default defineComponent({
69
77
  event.type === 'create_exit' ||
70
78
  event.type === 'save_exit'
71
79
  ) {
72
- context.root.$router.push(getFilesListUrl());
80
+ navigateBack(router, getFilesListUrl());
73
81
  }
74
82
 
75
- context.root.$toast({
83
+ toast.show({
76
84
  variant: 'success',
77
85
  title: t('files:success'),
78
86
  body: t('files:createdSuccessMessage'),
@@ -81,7 +89,7 @@ export default defineComponent({
81
89
  .catch((error) => {
82
90
  console.error(error);
83
91
  errors.value = convertRequestErrorToMap(error);
84
- context.root.$toast({
92
+ toast.show({
85
93
  variant: 'danger',
86
94
  title: t('files:error'),
87
95
  body: t('files:createdErrorMessage'),
@@ -102,5 +110,3 @@ export default defineComponent({
102
110
  },
103
111
  });
104
112
  </script>
105
-
106
- <style lang="scss" scoped></style>
@@ -1,61 +1,65 @@
1
1
  <template>
2
- <page
3
- :title="$t('files:filesList')"
4
- :header-buttons="[
2
+ <Page
3
+ :title="$i18n.t('files:filesList')"
4
+ :header-buttons="[
5
5
  {
6
- text: $t('files:createFile'),
6
+ text: $i18n.t('files:createFile'),
7
7
  href: getFilesFormUrl({ fileId: 'create' }),
8
8
  },
9
9
  ]"
10
10
  >
11
- <data-table
12
- :column-defs="columnDefs"
13
- :row-data="rowData"
14
- :loading="isRowDataLoading"
15
- :error-message="errorMessage"
16
- :search-query="searchQuery"
17
- :pagination="{
11
+ <DataTable
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
- @change="handleChange"
23
+ @change="handleChange"
24
24
  >
25
- <template v-slot:cell(delete)="{ row }">
26
- <base-button
27
- variant="icon"
28
- :title="$t('files:delete')"
29
- :disabled="isDeleting(row.id)"
30
- @click="handleResourceDelete(row.id)"
25
+ <template #cell(delete)="{ row }">
26
+ <BaseButton
27
+ variant="icon"
28
+ :title="$i18n.t('files:delete')"
29
+ :disabled="isDeleting(row.id)"
30
+ @click="handleResourceDelete(row.id)"
31
31
  >
32
- <svg-icon name="delete"/>
33
- </base-button>
32
+ <DeleteIcon />
33
+ </BaseButton>
34
34
  </template>
35
- </data-table>
36
- </page>
35
+ </DataTable>
36
+ </Page>
37
37
  </template>
38
38
 
39
39
  <script lang="ts">
40
- import {defineComponent, onMounted} from '@vue/composition-api';
40
+ import { defineComponent, onMounted } from 'vue';
41
41
  import filesize from 'filesize';
42
42
 
43
43
  import {
44
- ColumnDefinition, cutUrlOrigin,
44
+ type ColumnDefinition,
45
45
  useDataTable,
46
- useTranslation,
46
+ DataTable,
47
+ BaseButton,
48
+ DeleteIcon,
49
+ cutUrlOrigin,
47
50
  } from '@tager/admin-ui';
48
- import {useResourceDelete} from '@tager/admin-services';
51
+ import { useI18n, useResourceDelete } from '@tager/admin-services';
52
+ import { Page } from '@tager/admin-layout';
49
53
 
50
- import {deleteFile, getFilesList} from '../../services/requests';
51
- import {FileModel} from '../../typings/model';
52
- import {getFilesFormUrl} from '../../utils/paths';
54
+ import { deleteFile, getFilesList } from '../../services/requests';
55
+ import { type FileModel } from '../../typings/model';
56
+ import { getFilesFormUrl } from '../../utils/paths';
53
57
 
54
58
  export default defineComponent({
55
59
  name: 'FilesList',
56
- components: {},
57
- setup(props, context) {
58
- const {t} = useTranslation(context);
60
+ components: { DataTable, BaseButton, DeleteIcon, Page },
61
+ setup() {
62
+ const { t } = useI18n();
59
63
 
60
64
  const {
61
65
  fetchEntityList: fetchFilesList,
@@ -69,13 +73,12 @@ export default defineComponent({
69
73
  pageNumber,
70
74
  } = useDataTable<FileModel>({
71
75
  fetchEntityList: (params) =>
72
- getFilesList({
73
- query: params.searchQuery,
74
- pageNumber: params.pageNumber,
75
- pageSize: params.pageSize,
76
- }),
76
+ getFilesList({
77
+ query: params.searchQuery,
78
+ pageNumber: params.pageNumber,
79
+ pageSize: params.pageSize,
80
+ }),
77
81
  initialValue: [],
78
- context,
79
82
  resourceName: 'Files list',
80
83
  pageSize: 100,
81
84
  });
@@ -84,11 +87,10 @@ export default defineComponent({
84
87
  fetchFilesList();
85
88
  });
86
89
 
87
- const {handleResourceDelete, isDeleting} = useResourceDelete({
90
+ const { handleResourceDelete, isDeleting } = useResourceDelete({
88
91
  deleteResource: deleteFile,
89
92
  resourceName: 'File',
90
93
  onSuccess: fetchFilesList,
91
- context,
92
94
  });
93
95
 
94
96
  const columnDefs: Array<ColumnDefinition<FileModel>> = [
@@ -96,8 +98,8 @@ export default defineComponent({
96
98
  id: 1,
97
99
  name: 'ID',
98
100
  field: 'id',
99
- style: {width: '50px', textAlign: 'center'},
100
- headStyle: {width: '50px', textAlign: 'center'},
101
+ style: { width: '50px', textAlign: 'center' },
102
+ headStyle: { width: '50px', textAlign: 'center' },
101
103
  },
102
104
  {
103
105
  id: 2,
@@ -113,26 +115,26 @@ export default defineComponent({
113
115
  id: 4,
114
116
  name: t('files:fileSize'),
115
117
  field: 'size',
116
- format: ({row}) => filesize(row.size),
117
- style: {whiteSpace: 'nowrap'},
118
- headStyle: {whiteSpace: 'nowrap'},
118
+ format: ({ row }) => filesize(row.size),
119
+ style: { whiteSpace: 'nowrap' },
120
+ headStyle: { whiteSpace: 'nowrap' },
119
121
  },
120
122
  {
121
123
  id: 5,
122
124
  name: 'URL',
123
125
  type: 'link',
124
126
  field: 'url',
125
- format: ({row}) => ({
127
+ format: ({ row }) => ({
126
128
  url: row.url,
127
- text: cutUrlOrigin(row.url)
129
+ text: cutUrlOrigin(row.url),
128
130
  }),
129
131
  },
130
132
  {
131
133
  id: 6,
132
134
  name: t('files:delete'),
133
135
  field: 'delete',
134
- style: {textAlign: 'center'},
135
- headStyle: {textAlign: 'center'},
136
+ style: { textAlign: 'center' },
137
+ headStyle: { textAlign: 'center' },
136
138
  },
137
139
  ];
138
140
 
package/README.md DELETED
@@ -1 +0,0 @@
1
- # tager-admin-files
package/dist/dev.d.ts DELETED
@@ -1 +0,0 @@
1
- import '@tager/admin-ui/dist/admin-ui.css';