@tager/admin-import 0.1.1 → 1.0.0

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 (49) 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 +5 -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 +439 -0
  8. package/dist/locales/apply.d.ts +1 -0
  9. package/dist/locales/en.d.ts +19 -20
  10. package/dist/locales/ru.d.ts +2 -3
  11. package/dist/main.d.ts +3 -3
  12. package/dist/services/requests.d.ts +8 -8
  13. package/dist/style.css +1 -0
  14. package/dist/typings/model.d.ts +33 -26
  15. package/dist/utils/paths.d.ts +4 -4
  16. package/dist/views/ImportForm/ImportForm.helpers.d.ts +9 -7
  17. package/dist/views/ImportForm/ImportForm.vue.d.ts +2688 -70
  18. package/dist/views/ImportForm/index.d.ts +1 -1
  19. package/dist/views/ImportList/ImportList.vue.d.ts +16 -41
  20. package/dist/views/ImportList/components/CellHistory/CellHistory.helpers.d.ts +1 -0
  21. package/dist/views/ImportList/components/CellHistory/CellHistory.vue.d.ts +19 -0
  22. package/dist/views/ImportList/components/CellHistory/index.d.ts +1 -0
  23. package/dist/views/ImportList/index.d.ts +1 -1
  24. package/package.json +49 -47
  25. package/src/constants/routes.ts +10 -10
  26. package/src/dev/App.vue +38 -0
  27. package/src/dev/config.ts +23 -0
  28. package/src/dev/env.ts +17 -0
  29. package/src/dev/main.ts +36 -0
  30. package/src/locales/apply.ts +9 -0
  31. package/src/locales/en.ts +2 -4
  32. package/src/locales/ru.ts +19 -21
  33. package/src/main.ts +2 -6
  34. package/src/typings/model.ts +14 -1
  35. package/src/views/ImportForm/ImportForm.helpers.ts +17 -2
  36. package/src/views/ImportForm/ImportForm.vue +109 -69
  37. package/src/views/ImportList/ImportList.vue +60 -63
  38. package/src/views/ImportList/components/CellHistory/CellHistory.helpers.ts +13 -0
  39. package/src/views/ImportList/components/CellHistory/CellHistory.vue +38 -0
  40. package/src/views/ImportList/components/CellHistory/index.ts +1 -0
  41. package/README.md +0 -1
  42. package/dist/dev.d.ts +0 -1
  43. package/dist/index.esm.js +0 -618
  44. package/dist/index.umd.js +0 -629
  45. package/src/dev.ts +0 -41
  46. package/src/typings/sfc.d.ts +0 -12
  47. package/src/typings/shims-tsx.d.ts +0 -13
  48. package/src/typings/shims-vue.d.ts +0 -11
  49. package/src/views/App.vue +0 -36
@@ -1 +1 @@
1
- export { default } from './ImportForm.vue';
1
+ export { default } from './ImportForm.vue';
@@ -1,41 +1,16 @@
1
- import { ColumnDefinition } from '@tager/admin-ui';
2
- import { ImportType } from '../../typings/model';
3
- import { getImportFormUrl } from '../../utils/paths';
4
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
5
- columnDefs: ColumnDefinition<ImportType>[];
6
- getImportFormUrl: typeof getImportFormUrl;
7
- rowData: import("@vue/composition-api").Ref<ImportType[]>;
8
- isRowDataLoading: import("@vue/composition-api").ComputedRef<boolean>;
9
- errorMessage: import("@vue/composition-api").Ref<import("@tager/admin-services").Nullable<string>>;
10
- searchQuery: import("@vue/composition-api").Ref<string>;
11
- handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
12
- pageSize: import("@vue/composition-api").Ref<number>;
13
- pageCount: import("@vue/composition-api").ComputedRef<number>;
14
- pageNumber: import("@vue/composition-api").Ref<number>;
15
- t: import("i18next").TFunction;
16
- dateTimeFormat: (value: number | string | Date) => string;
17
- }> & {
18
- [key: string]: unknown;
19
- }, {}, {}, unknown, {
20
- [x: string]: any;
21
- }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
22
- [x: string]: any;
23
- }, import("@vue/composition-api").ShallowUnwrapRef<{
24
- columnDefs: ColumnDefinition<ImportType>[];
25
- getImportFormUrl: typeof getImportFormUrl;
26
- rowData: import("@vue/composition-api").Ref<ImportType[]>;
27
- isRowDataLoading: import("@vue/composition-api").ComputedRef<boolean>;
28
- errorMessage: import("@vue/composition-api").Ref<import("@tager/admin-services").Nullable<string>>;
29
- searchQuery: import("@vue/composition-api").Ref<string>;
30
- handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
31
- pageSize: import("@vue/composition-api").Ref<number>;
32
- pageCount: import("@vue/composition-api").ComputedRef<number>;
33
- pageNumber: import("@vue/composition-api").Ref<number>;
34
- t: import("i18next").TFunction;
35
- dateTimeFormat: (value: number | string | Date) => string;
36
- }>, {
37
- [x: string]: any;
38
- }, {}, {}, {
39
- [x: string]: any;
40
- }>);
41
- export default _default;
1
+ import { ColumnDefinition } from '@tager/admin-ui';
2
+ import { ImportType } from '../../typings/model';
3
+ import { getImportFormUrl } from '../../utils/paths';
4
+ declare const _default: import("vue").DefineComponent<{}, {
5
+ columnDefs: ColumnDefinition<ImportType>[];
6
+ getImportFormUrl: typeof getImportFormUrl;
7
+ rowData: import("vue").Ref<ImportType[]>;
8
+ isRowDataLoading: import("vue").ComputedRef<boolean>;
9
+ errorMessage: import("vue").Ref<import("@tager/admin-services").Nullable<string>>;
10
+ searchQuery: import("vue").Ref<string>;
11
+ handleChange: (event: import("@tager/admin-ui/dist/components/DataTable/DataTable.types").TableChangeEvent) => void;
12
+ pageSize: import("vue").Ref<number>;
13
+ pageCount: import("vue").ComputedRef<number>;
14
+ pageNumber: import("vue").Ref<number>;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
16
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare function dateTimeFormat(value: number | string | Date): string;
@@ -0,0 +1,19 @@
1
+ import { PropType } from "vue";
2
+ import { dateTimeFormat } from './CellHistory.helpers';
3
+ import { HistoryType } from "../../../../typings/model";
4
+ declare const _default: import("vue").DefineComponent<{
5
+ history: {
6
+ type: PropType<HistoryType[]>;
7
+ default: () => never[];
8
+ };
9
+ }, {
10
+ dateTimeFormat: typeof dateTimeFormat;
11
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
+ history: {
13
+ type: PropType<HistoryType[]>;
14
+ default: () => never[];
15
+ };
16
+ }>>, {
17
+ history: HistoryType[];
18
+ }>;
19
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as CellHistory } from './CellHistory.vue';
@@ -1 +1 @@
1
- export { default } from './ImportList.vue';
1
+ export { default } from './ImportList.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tager/admin-import",
3
- "version": "0.1.1",
3
+ "version": "1.0.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -10,62 +10,64 @@
10
10
  "typings",
11
11
  "src"
12
12
  ],
13
+ "exports": {
14
+ "./css": "./dist/style.css",
15
+ ".": "./dist/index.mjs"
16
+ },
13
17
  "scripts": {
18
+ "build:js": "vite build",
19
+ "build:package": "concurrently --success first \"yarn build:js\" \"yarn emit-declarations\"",
20
+ "emit-declarations": "vue-tsc --project tsconfig.json --emitDeclarationOnly",
14
21
  "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"
22
+ "prepare": "yarn build:package",
23
+ "tager:update": "yarn upgrade --latest --scope @tager"
20
24
  },
21
25
  "dependencies": {
26
+ "lodash.isequal": "^4.5.0",
22
27
  "lodash.kebabcase": "^4.1.1",
28
+ "lodash.pick": "^4.4.0",
23
29
  "path-to-regexp": "^6.1.0"
24
30
  },
25
31
  "devDependencies": {
26
- "@rollup/plugin-commonjs": "^14.0.0",
27
- "@rollup/plugin-node-resolve": "^8.1.0",
28
- "@tager/admin-layout": "^0.5.1",
29
- "@tager/admin-services": "^0.2.23",
30
- "@tager/admin-ui": "^0.8.58",
31
- "@types/lodash.kebabcase": "^4.1.6",
32
- "@types/node": "12.x",
33
- "@typescript-eslint/eslint-plugin": "^2.26.0",
34
- "@typescript-eslint/parser": "^2.26.0",
35
- "@vue/cli-plugin-babel": "~4.4.6",
36
- "@vue/cli-plugin-eslint": "~4.4.6",
37
- "@vue/cli-plugin-router": "~4.4.6",
38
- "@vue/cli-plugin-typescript": "~4.4.6",
39
- "@vue/cli-service": "~4.4.6",
40
- "@vue/composition-api": "^1.0.0-beta.14",
41
- "@vue/eslint-config-prettier": "^6.0.0",
42
- "@vue/eslint-config-typescript": "^5.0.2",
43
- "babel-eslint": "^10.1.0",
44
- "core-js": "^3.6.5",
45
- "eslint": "^6.7.2",
46
- "eslint-plugin-import": "^2.22.0",
47
- "eslint-plugin-prettier": "^3.1.4",
48
- "eslint-plugin-vue": "^6.2.2",
49
- "prettier": "^2.0.5",
50
- "rollup": "^2.23.1",
51
- "rollup-plugin-typescript2": "^0.27.2",
52
- "rollup-plugin-vue": "^5.1.9",
53
- "sass-loader": "^9.0.3",
54
- "typescript": "~3.9.6",
55
- "vue": "2.6.x",
56
- "vue-docgen-web-types": "^0.1.6",
57
- "vue-router": "^3.5.1",
58
- "vue-template-compiler": "^2.6.11"
32
+ "@babel/core": "^7.17.9",
33
+ "@babel/eslint-parser": "^7.17.0",
34
+ "@rushstack/eslint-patch": "^1.1.2",
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/lodash.isequal": "^4.5.6",
40
+ "@types/lodash.pick": "^4.4.7",
41
+ "@types/node": "16.x",
42
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
43
+ "@typescript-eslint/parser": "^5.21.0",
44
+ "@vitejs/plugin-vue": "^2.3.1",
45
+ "@vue/cli-plugin-babel": "^5.0.4",
46
+ "@vue/cli-plugin-typescript": "^5.0.4",
47
+ "@vue/cli-service": "~5.0.0",
48
+ "@vue/eslint-config-prettier": "^7.0.0",
49
+ "@vue/eslint-config-typescript": "^10.0.0",
50
+ "concurrently": "^7.1.0",
51
+ "core-js": "^3.22.3",
52
+ "eslint": "^8.14.0",
53
+ "eslint-config-prettier": "^8.5.0",
54
+ "eslint-plugin-import": "^2.26.0",
55
+ "eslint-plugin-prettier": "^4.0.0",
56
+ "eslint-plugin-vue": "^8.7.1",
57
+ "sass": "^1.51.0",
58
+ "sass-loader": "^12.6.0",
59
+ "typescript": "^4.6.3",
60
+ "vite": "^2.9.6",
61
+ "vue": "^3.2.31",
62
+ "vue-router": "^4.0.14",
63
+ "vue-tsc": "^0.34.10"
59
64
  },
60
65
  "peerDependencies": {
61
- "@tager/admin-layout": ">=0.4.2",
62
- "@tager/admin-services": ">=0.2.11",
63
- "@tager/admin-ui": ">=0.7.5",
64
- "@vue/composition-api": ">=1.0.0-beta.14",
65
- "vue": "2.6.x"
66
- },
67
- "resolutions": {
68
- "prettier": "2.x"
66
+ "@tager/admin-layout": "^1.0.0",
67
+ "@tager/admin-services": "^1.0.0",
68
+ "@tager/admin-ui": "^1.0.1",
69
+ "vue": "^3.2.31",
70
+ "vue-router": "^4.0.14"
69
71
  },
70
72
  "publishConfig": {
71
73
  "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 ImportList from '../views/ImportList';
4
4
  import ImportForm from '../views/ImportForm';
5
5
 
6
6
  import { IMPORT_ROUTE_PATHS } from './paths';
7
7
 
8
- export const IMPORT_LIST_ROUTE: CustomRouteConfig = {
8
+ export const IMPORT_LIST_ROUTE: RouteRecordRaw = {
9
9
  path: IMPORT_ROUTE_PATHS.IMPORT_LIST,
10
10
  component: ImportList,
11
11
  name: 'Import List',
12
12
  meta: {
13
- getBreadcrumbs: (route, t) => [
14
- { url: '/', text: t('import:home') },
15
- { url: route.path, text: t('import:importList') },
13
+ getBreadcrumbs: (route, i18n) => [
14
+ { url: '/', text: i18n.t('import:home') },
15
+ { url: route.path, text: i18n.t('import:importList') },
16
16
  ],
17
17
  },
18
18
  };
19
19
 
20
- export const IMPORT_FORM_ROUTE: CustomRouteConfig = {
20
+ export const IMPORT_FORM_ROUTE: RouteRecordRaw = {
21
21
  path: IMPORT_ROUTE_PATHS.IMPORT_FORM,
22
22
  component: ImportForm,
23
23
  name: 'Import Form',
24
24
  meta: {
25
- getBreadcrumbs: (route, t) => [
26
- { url: '/', text: t('import:home') },
27
- { url: IMPORT_LIST_ROUTE.path, text: t('import:importList') },
28
- { url: route.path, text: t('import:importForm') },
25
+ getBreadcrumbs: (route, i18n) => [
26
+ { url: '/', text: i18n.t('import:home') },
27
+ { url: IMPORT_LIST_ROUTE.path, text: i18n.t('import:importList') },
28
+ { url: route.path, text: i18n.t('import:importForm') },
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
+ import {MenuItemType, PageLayout} from "@tager/admin-layout";
10
+ import {ViewListIcon} from "@tager/admin-ui";
11
+ import {getImportListUrl} from '../utils/paths';
12
+ import {useI18n} from "@tager/admin-services";
13
+
14
+ export default defineComponent({
15
+ name: 'App',
16
+ components: {
17
+ PageLayout,
18
+ },
19
+ setup() {
20
+ const i18n = useI18n();
21
+
22
+ const sidebarMenuList: Array<MenuItemType> = [
23
+ {
24
+ id: 'import',
25
+ text: i18n.t('import:import'),
26
+ icon: ViewListIcon,
27
+ children: [{text: i18n.t('import:import'), url: getImportListUrl()}],
28
+ },
29
+ ];
30
+
31
+ return {
32
+ sidebarMenuList,
33
+ };
34
+ },
35
+ });
36
+ </script>
37
+
38
+ <style scoped lang="scss"></style>
@@ -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: 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,
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 {IMPORT_LIST_ROUTE, IMPORT_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: [IMPORT_LIST_ROUTE, IMPORT_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', 'import', EN);
8
+ i18n.addTranslations('ru', 'import', RU);
9
+ }
package/src/locales/en.ts CHANGED
@@ -1,6 +1,5 @@
1
- const EN = {
1
+ export const EN = {
2
2
  home: 'Home',
3
- exportAndImport: 'Export / Import',
4
3
  import: 'Import',
5
4
  importList: 'Import List',
6
5
  importForm: 'Import Form',
@@ -9,6 +8,7 @@ const EN = {
9
8
  status: 'status',
10
9
  message: 'Message',
11
10
  log: 'Log',
11
+ params: 'Params',
12
12
  file: 'file',
13
13
  newImport: 'New import',
14
14
  importCreation: 'Import creation',
@@ -17,5 +17,3 @@ const EN = {
17
17
  createdSuccessMessage: 'Import has been successfully created',
18
18
  createdErrorMessage: 'Import creation has been failed',
19
19
  };
20
-
21
- export default EN;
package/src/locales/ru.ts CHANGED
@@ -1,23 +1,21 @@
1
- import EN from './en';
1
+ import {EN} from './en';
2
2
 
3
- const RU: typeof EN = {
4
- home: 'Главная',
5
- exportAndImport: 'Экспорт / Импорт',
6
- import: 'Импорт',
7
- importList: 'Список импортов',
8
- importForm: 'Форма импорта',
9
- type: 'Тип',
10
- importType: 'Тип импорта',
11
- status: 'Статус',
12
- message: 'Сообщение',
13
- log: 'Лог',
14
- file: 'Файл',
15
- newImport: 'Новый импорт',
16
- importCreation: 'Создание импорта',
17
- success: 'Успех',
18
- error: 'Ошибка',
19
- createdSuccessMessage: 'Импорт была успешно создан',
20
- createdErrorMessage: 'Создание импорта не удалось',
3
+ export const RU: typeof EN = {
4
+ home: 'Главная',
5
+ import: 'Импорт',
6
+ importList: 'Список импортов',
7
+ importForm: 'Форма импорта',
8
+ type: 'Тип',
9
+ importType: 'Тип импорта',
10
+ status: 'Статус',
11
+ message: 'Сообщение',
12
+ log: 'Лог',
13
+ params: 'Параметры',
14
+ file: 'Файл',
15
+ newImport: 'Новый импорт',
16
+ importCreation: 'Создание импорта',
17
+ success: 'Успех',
18
+ error: 'Ошибка',
19
+ createdSuccessMessage: 'Импорт была успешно создан',
20
+ createdErrorMessage: 'Создание импорта не удалось',
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', 'import', EN);
7
- i18n.addTranslations('ru', 'import', RU);
3
+ applyTranslations();
8
4
 
9
5
  export * from './constants/routes';
10
6
  export * from './utils/paths';
@@ -1,22 +1,34 @@
1
1
  import { FileType } from '@tager/admin-services';
2
+ import {
3
+ FieldConfigUnion,
4
+ FieldShortType,
5
+ OutgoingValueUnion,
6
+ } from '@tager/admin-dynamic-field';
2
7
 
3
- interface HistoryType {
8
+ export interface HistoryType {
4
9
  readonly datetime: string;
5
10
  readonly status: string;
6
11
  }
7
12
 
13
+ export interface ParamType {
14
+ readonly label: string;
15
+ readonly value: string;
16
+ }
17
+
8
18
  export interface ImportType {
9
19
  readonly id: number;
10
20
  readonly strategy: string;
11
21
  readonly status: string;
12
22
  readonly message: string | null;
13
23
  readonly history: Array<HistoryType>;
24
+ readonly params: Array<ParamType> | null;
14
25
  readonly file: FileType | null;
15
26
  }
16
27
 
17
28
  export interface StrategyType {
18
29
  readonly id: string;
19
30
  readonly name: string;
31
+ readonly fields: Array<FieldConfigUnion>;
20
32
  }
21
33
 
22
34
  export interface ModuleInfoType {
@@ -27,4 +39,5 @@ export interface ModuleInfoType {
27
39
  export interface ImportCreatePayload {
28
40
  strategy: string;
29
41
  file: string;
42
+ params: Array<FieldShortType<OutgoingValueUnion>>;
30
43
  }
@@ -1,6 +1,7 @@
1
1
  import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
2
+ import { FieldUnion, universalFieldUtils } from '@tager/admin-dynamic-field';
2
3
 
3
- import { ImportCreatePayload } from '../../typings/model';
4
+ import { ImportCreatePayload, StrategyType } from '../../typings/model';
4
5
 
5
6
  export type FormValues = {
6
7
  strategy: OptionType | null;
@@ -8,10 +9,24 @@ export type FormValues = {
8
9
  };
9
10
 
10
11
  export function convertImportFormValuesToCreationPayload(
11
- values: FormValues
12
+ values: FormValues,
13
+ templateValues: Array<FieldUnion>
12
14
  ): ImportCreatePayload {
13
15
  return {
14
16
  strategy: values.strategy?.value ?? '',
15
17
  file: values.file?.file.id ?? '',
18
+ params: templateValues.map((field) => ({
19
+ name: field.config.name,
20
+ value: universalFieldUtils.getOutgoingValue(field),
21
+ })),
16
22
  };
17
23
  }
24
+
25
+ export function convertStrategiesToStrategyOptionList(
26
+ strategies: Array<StrategyType>
27
+ ): Array<OptionType> {
28
+ return strategies.map((strategy) => ({
29
+ value: strategy.id,
30
+ label: strategy.name,
31
+ }));
32
+ }