@tager/admin-export 0.1.3 → 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 (54) 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 +506 -0
  8. package/dist/locales/apply.d.ts +1 -0
  9. package/dist/locales/en.d.ts +23 -22
  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 +26 -23
  15. package/dist/utils/common.d.ts +1 -1
  16. package/dist/utils/paths.d.ts +4 -4
  17. package/dist/views/ExportForm/ExportForm.helpers.d.ts +11 -8
  18. package/dist/views/ExportForm/ExportForm.types.d.ts +7 -0
  19. package/dist/views/ExportForm/ExportForm.vue.d.ts +2693 -60
  20. package/dist/views/ExportForm/index.d.ts +1 -1
  21. package/dist/views/ExportList/ExportList.vue.d.ts +16 -41
  22. package/dist/views/ExportList/components/CellHistory/CellHistory.helpers.d.ts +1 -0
  23. package/dist/views/ExportList/components/CellHistory/CellHistory.vue.d.ts +19 -0
  24. package/dist/views/ExportList/components/CellHistory/index.d.ts +1 -0
  25. package/dist/views/ExportList/index.d.ts +1 -1
  26. package/package.json +49 -47
  27. package/src/constants/routes.ts +10 -10
  28. package/src/dev/App.vue +38 -0
  29. package/src/dev/config.ts +23 -0
  30. package/src/dev/env.ts +17 -0
  31. package/src/dev/main.ts +36 -0
  32. package/src/locales/apply.ts +9 -0
  33. package/src/locales/en.ts +4 -4
  34. package/src/locales/ru.ts +5 -5
  35. package/src/main.ts +2 -6
  36. package/src/services/requests.ts +1 -1
  37. package/src/typings/model.ts +9 -1
  38. package/src/views/ExportForm/ExportForm.helpers.ts +32 -7
  39. package/src/views/ExportForm/ExportForm.types.ts +8 -0
  40. package/src/views/ExportForm/ExportForm.vue +157 -94
  41. package/src/views/ExportList/ExportList.vue +47 -63
  42. package/src/views/ExportList/components/CellHistory/CellHistory.helpers.ts +12 -0
  43. package/src/views/ExportList/components/CellHistory/CellHistory.vue +38 -0
  44. package/src/views/ExportList/components/CellHistory/index.ts +1 -0
  45. package/README +0 -0
  46. package/dist/dev.d.ts +0 -1
  47. package/dist/index.esm.js +0 -668
  48. package/dist/index.umd.js +0 -679
  49. package/src/config/config.json +0 -20
  50. package/src/dev.ts +0 -41
  51. package/src/typings/sfc.d.ts +0 -12
  52. package/src/typings/shims-tsx.d.ts +0 -13
  53. package/src/typings/shims-vue.d.ts +0 -11
  54. package/src/views/App.vue +0 -36
@@ -1,4 +1,4 @@
1
- export declare const EXPORT_ROUTE_PATHS: {
2
- readonly EXPORT_LIST: "/export";
3
- readonly EXPORT_FORM: "/export/:exportId";
4
- };
1
+ export declare const EXPORT_ROUTE_PATHS: {
2
+ readonly EXPORT_LIST: "/export";
3
+ readonly EXPORT_FORM: "/export/:exportId";
4
+ };
@@ -1,3 +1,3 @@
1
- import { CustomRouteConfig } from '@tager/admin-layout';
2
- export declare const EXPORT_LIST_ROUTE: CustomRouteConfig;
3
- export declare const EXPORT_FORM_ROUTE: CustomRouteConfig;
1
+ import type { RouteRecordRaw } from 'vue-router';
2
+ export declare const EXPORT_LIST_ROUTE: RouteRecordRaw;
3
+ export declare const EXPORT_FORM_ROUTE: RouteRecordRaw;
@@ -0,0 +1,5 @@
1
+ import { MenuItemType } from "@tager/admin-layout";
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ sidebarMenuList: MenuItemType[];
4
+ }, {}, {}, {}, 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;
@@ -0,0 +1,2 @@
1
+ import type { AppConfigType } from '@tager/admin-services';
2
+ export declare const OZITAG_CONFIG: AppConfigType;
@@ -0,0 +1 @@
1
+ export declare function populateEnvironment(): void;
@@ -0,0 +1,3 @@
1
+ import '@tager/admin-ui/css';
2
+ import '@tager/admin-layout/css';
3
+ import '@tager/admin-dynamic-field/css';
package/dist/index.mjs ADDED
@@ -0,0 +1,506 @@
1
+ import { i18n, request, useI18n, useToast, useResource, navigateBack, convertRequestErrorToMap } from "@tager/admin-services";
2
+ import { defineComponent, openBlock, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, createTextVNode, createCommentVNode, onMounted, resolveComponent, createBlock, withCtx, createVNode, computed, ref, watch, withModifiers } from "vue";
3
+ import { Page } from "@tager/admin-layout";
4
+ import { DataTable, useDataTable, FormFooter, FormField, FormFieldSelect } from "@tager/admin-ui";
5
+ import { universalFieldUtils, DynamicField } from "@tager/admin-dynamic-field";
6
+ import { compile } from "path-to-regexp";
7
+ import { useRoute, useRouter } from "vue-router";
8
+ const EN = {
9
+ home: "Home",
10
+ export: "Export",
11
+ exportList: "Export List",
12
+ exportForm: "Export Form",
13
+ type: "Type",
14
+ exportType: "Export type",
15
+ status: "status",
16
+ message: "Message",
17
+ log: "Log",
18
+ file: "file",
19
+ newExport: "New export",
20
+ exportCreation: "Export creation",
21
+ success: "Success",
22
+ error: "Error",
23
+ createdSuccessMessage: "Export has been successfully created",
24
+ createdErrorMessage: "Export creation has been failed",
25
+ filename: "File name",
26
+ format: "Format",
27
+ delimiter: "Delimiter",
28
+ comma: "Comma",
29
+ semicolon: "Semicolon"
30
+ };
31
+ const RU = {
32
+ home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
33
+ export: "\u042D\u043A\u0441\u043F\u043E\u0440\u0442",
34
+ exportList: "\u0421\u043F\u0438\u0441\u043E\u043A \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u043E\u0432",
35
+ exportForm: "\u0424\u043E\u0440\u043C\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
36
+ type: "\u0422\u0438\u043F",
37
+ exportType: "\u0422\u0438\u043F \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
38
+ status: "\u0421\u0442\u0430\u0442\u0443\u0441",
39
+ message: "\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",
40
+ log: "\u041B\u043E\u0433",
41
+ file: "\u0424\u0430\u0439\u043B",
42
+ newExport: "\u041D\u043E\u0432\u044B\u0439 \u044D\u043A\u0441\u043F\u043E\u0440\u0442",
43
+ exportCreation: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
44
+ success: "\u0423\u0441\u043F\u0435\u0445",
45
+ error: "\u041E\u0448\u0438\u0431\u043A\u0430",
46
+ createdSuccessMessage: "\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0431\u044B\u043B\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D",
47
+ createdErrorMessage: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C",
48
+ filename: "\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430",
49
+ format: "\u0424\u043E\u0440\u043C\u0430\u0442",
50
+ delimiter: "\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C",
51
+ comma: "\u0417\u0430\u043F\u044F\u0442\u0430\u044F",
52
+ semicolon: "\u0422\u043E\u0447\u043A\u0430 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439"
53
+ };
54
+ function applyTranslations() {
55
+ i18n.addTranslations("en", "export", EN);
56
+ i18n.addTranslations("ru", "export", RU);
57
+ }
58
+ function getExportList(params) {
59
+ return request.get({ path: "/admin/tager/export", params });
60
+ }
61
+ function getStrategies() {
62
+ return request.get({ path: "/admin/tager/export/strategies" });
63
+ }
64
+ function createExport(payload) {
65
+ return request.post({ path: "/admin/tager/export", body: payload });
66
+ }
67
+ const EXPORT_ROUTE_PATHS = {
68
+ EXPORT_LIST: "/export",
69
+ EXPORT_FORM: "/export/:exportId"
70
+ };
71
+ function getExportListUrl() {
72
+ return EXPORT_ROUTE_PATHS.EXPORT_LIST;
73
+ }
74
+ function getExportFormUrl(params) {
75
+ return compile(EXPORT_ROUTE_PATHS.EXPORT_FORM)(params);
76
+ }
77
+ function dateTimeFormat(value) {
78
+ const options = {};
79
+ const date = new Date(value);
80
+ return new Intl.DateTimeFormat("ru-RU", options).format(date);
81
+ }
82
+ var CellHistory_vue_vue_type_style_index_0_scoped_true_lang = "";
83
+ var _export_sfc = (sfc, props) => {
84
+ const target = sfc.__vccOpts || sfc;
85
+ for (const [key, val] of props) {
86
+ target[key] = val;
87
+ }
88
+ return target;
89
+ };
90
+ const _sfc_main$2 = defineComponent({
91
+ name: "CellHistory",
92
+ props: {
93
+ history: {
94
+ type: Array,
95
+ default: () => []
96
+ }
97
+ },
98
+ setup() {
99
+ return {
100
+ dateTimeFormat
101
+ };
102
+ }
103
+ });
104
+ const _hoisted_1$1 = { key: 0 };
105
+ const _hoisted_2 = { class: "name" };
106
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
107
+ return _ctx.history.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
108
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.history, (history, index) => {
109
+ return openBlock(), createElementBlock("li", { key: index }, [
110
+ createElementVNode("span", _hoisted_2, toDisplayString(history.status), 1),
111
+ createTextVNode(" " + toDisplayString(_ctx.dateTimeFormat(history.datetime)), 1)
112
+ ]);
113
+ }), 128))
114
+ ])) : createCommentVNode("", true);
115
+ }
116
+ var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-82dd6750"]]);
117
+ const _sfc_main$1 = defineComponent({
118
+ name: "ExportList",
119
+ components: {
120
+ Page,
121
+ CellHistory,
122
+ DataTable
123
+ },
124
+ setup() {
125
+ const { t } = useI18n();
126
+ const {
127
+ fetchEntityList: fetchExportList,
128
+ isLoading: isExportListLoading,
129
+ rowData: exportList,
130
+ errorMessage,
131
+ searchQuery,
132
+ handleChange,
133
+ pageSize,
134
+ pageCount,
135
+ pageNumber
136
+ } = useDataTable({
137
+ fetchEntityList: (params) => getExportList({
138
+ pageNumber: params.pageNumber,
139
+ pageSize: params.pageSize
140
+ }),
141
+ initialValue: [],
142
+ resourceName: "Export list",
143
+ pageSize: 100
144
+ });
145
+ onMounted(() => {
146
+ fetchExportList();
147
+ });
148
+ const columnDefs = [
149
+ {
150
+ id: 1,
151
+ name: "ID",
152
+ field: "id",
153
+ style: { width: "50px", textAlign: "center" },
154
+ headStyle: { width: "50px", textAlign: "center" }
155
+ },
156
+ {
157
+ id: 2,
158
+ name: t("export:type"),
159
+ field: "strategy",
160
+ style: { width: "15%" },
161
+ headStyle: { width: "15%" }
162
+ },
163
+ {
164
+ id: 3,
165
+ name: t("export:status"),
166
+ field: "status",
167
+ style: { width: "15%" },
168
+ headStyle: { width: "15%" }
169
+ },
170
+ {
171
+ id: 4,
172
+ name: t("export:message"),
173
+ field: "message"
174
+ },
175
+ {
176
+ id: 5,
177
+ name: t("export:log"),
178
+ field: "history",
179
+ style: { width: "25%" },
180
+ headStyle: { width: "25%" }
181
+ },
182
+ {
183
+ id: 6,
184
+ name: t("export:file"),
185
+ field: "file",
186
+ type: "file",
187
+ style: { width: "150px", textAlign: "center" },
188
+ headStyle: { width: "150px", textAlign: "center" }
189
+ }
190
+ ];
191
+ return {
192
+ columnDefs,
193
+ getExportFormUrl,
194
+ rowData: exportList,
195
+ isRowDataLoading: isExportListLoading,
196
+ errorMessage,
197
+ searchQuery,
198
+ handleChange,
199
+ pageSize,
200
+ pageCount,
201
+ pageNumber
202
+ };
203
+ }
204
+ });
205
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
206
+ const _component_CellHistory = resolveComponent("CellHistory");
207
+ const _component_DataTable = resolveComponent("DataTable");
208
+ const _component_Page = resolveComponent("Page");
209
+ return openBlock(), createBlock(_component_Page, {
210
+ title: _ctx.$i18n.t("export:export"),
211
+ "header-buttons": [
212
+ {
213
+ text: _ctx.$i18n.t("export:newExport"),
214
+ href: _ctx.getExportFormUrl({ exportId: "create" })
215
+ }
216
+ ]
217
+ }, {
218
+ default: withCtx(() => [
219
+ createVNode(_component_DataTable, {
220
+ "column-defs": _ctx.columnDefs,
221
+ "row-data": _ctx.rowData,
222
+ loading: _ctx.isRowDataLoading,
223
+ "error-message": _ctx.errorMessage,
224
+ pagination: {
225
+ pageSize: _ctx.pageSize,
226
+ pageCount: _ctx.pageCount,
227
+ pageNumber: _ctx.pageNumber,
228
+ disabled: _ctx.isRowDataLoading
229
+ },
230
+ "use-search": false,
231
+ onChange: _ctx.handleChange
232
+ }, {
233
+ "cell(history)": withCtx(({ row }) => [
234
+ createVNode(_component_CellHistory, {
235
+ history: row.history
236
+ }, null, 8, ["history"])
237
+ ]),
238
+ _: 1
239
+ }, 8, ["column-defs", "row-data", "loading", "error-message", "pagination", "onChange"])
240
+ ]),
241
+ _: 1
242
+ }, 8, ["title", "header-buttons"]);
243
+ }
244
+ var ExportList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
245
+ function replaceFileExtension(fileName, newExtension) {
246
+ const dotIndex = fileName.lastIndexOf(".");
247
+ const fileNameWithoutExtension = fileName.slice(0, dotIndex);
248
+ if (newExtension) {
249
+ return `${fileNameWithoutExtension}.${newExtension}`;
250
+ }
251
+ return fileNameWithoutExtension;
252
+ }
253
+ function convertExportFormValuesToCreationPayload(values, templateValues) {
254
+ var _a, _b, _c, _d, _e, _f;
255
+ return {
256
+ strategy: (_b = (_a = values.strategy) == null ? void 0 : _a.value) != null ? _b : "",
257
+ filename: values.filename,
258
+ format: (_d = (_c = values.format) == null ? void 0 : _c.value) != null ? _d : "",
259
+ delimiter: (_f = (_e = values.delimiter) == null ? void 0 : _e.value) != null ? _f : "",
260
+ params: templateValues.map((field) => ({
261
+ name: field.config.name,
262
+ value: universalFieldUtils.getOutgoingValue(field)
263
+ }))
264
+ };
265
+ }
266
+ function convertStrategiesToStrategyOptionList(strategies) {
267
+ return strategies.map((strategy) => ({
268
+ label: strategy.name,
269
+ value: strategy.id
270
+ }));
271
+ }
272
+ const formatOptionList = [
273
+ { value: "CSV", label: "CSV" },
274
+ { value: "XLS", label: "XLS" },
275
+ { value: "XML", label: "XML" },
276
+ { value: "YAML", label: "YAML" },
277
+ { value: "JSON", label: "JSON" },
278
+ { value: "TXT", label: "TXT" }
279
+ ];
280
+ function isCSVFormat(format) {
281
+ return format === "CSV";
282
+ }
283
+ var ExportForm_vue_vue_type_style_index_0_scoped_true_lang = "";
284
+ const _sfc_main = defineComponent({
285
+ name: "ExportForm",
286
+ components: {
287
+ DynamicField,
288
+ FormFooter,
289
+ Page,
290
+ FormField,
291
+ FormFieldSelect
292
+ },
293
+ setup() {
294
+ var _a, _b;
295
+ const { t } = useI18n();
296
+ useRoute();
297
+ const router = useRouter();
298
+ const toast = useToast();
299
+ const [
300
+ fetchStrategies,
301
+ { data: strategies, loading: isStrategiesLoading }
302
+ ] = useResource({
303
+ fetchResource: getStrategies,
304
+ initialValue: [],
305
+ resourceName: "Strategies"
306
+ });
307
+ const strategyOptionList = computed(
308
+ () => convertStrategiesToStrategyOptionList(strategies.value)
309
+ );
310
+ onMounted(() => {
311
+ fetchStrategies();
312
+ });
313
+ const delimiterOptionList = computed(() => [
314
+ { value: ",", label: t("export:comma") },
315
+ { value: ";", label: t("export:semicolon") }
316
+ ]);
317
+ const defaultExtension = formatOptionList[0];
318
+ const defaultDelimiter = delimiterOptionList.value[0];
319
+ const errors = ref({});
320
+ const values = ref({
321
+ strategy: null,
322
+ filename: `export.${defaultExtension.value.toLowerCase()}`,
323
+ format: defaultExtension,
324
+ delimiter: defaultDelimiter
325
+ });
326
+ const isSubmitting = ref(false);
327
+ const templateValues = ref([]);
328
+ function updateTemplateValues() {
329
+ var _a2;
330
+ const selectedStrategy = strategies.value.find(
331
+ (strategy) => {
332
+ var _a3;
333
+ return strategy.id === ((_a3 = values.value.strategy) == null ? void 0 : _a3.value);
334
+ }
335
+ );
336
+ const fieldTemplateList = (_a2 = selectedStrategy == null ? void 0 : selectedStrategy.fields) != null ? _a2 : [];
337
+ templateValues.value = fieldTemplateList.map(
338
+ (fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
339
+ );
340
+ }
341
+ watch(
342
+ () => values.value.strategy,
343
+ () => {
344
+ updateTemplateValues();
345
+ }
346
+ );
347
+ onMounted(() => {
348
+ updateTemplateValues();
349
+ });
350
+ const shouldDisplayDelimiter = ref(
351
+ isCSVFormat((_b = (_a = values.value.format) == null ? void 0 : _a.value) != null ? _b : "")
352
+ );
353
+ watch(
354
+ () => values.value.format,
355
+ () => {
356
+ var _a2, _b2, _c;
357
+ const newExtension = (_a2 = values.value.format) == null ? void 0 : _a2.value.toLowerCase();
358
+ values.value.filename = replaceFileExtension(
359
+ values.value.filename,
360
+ newExtension || ""
361
+ );
362
+ shouldDisplayDelimiter.value = isCSVFormat(
363
+ (_c = (_b2 = values.value.format) == null ? void 0 : _b2.value) != null ? _c : ""
364
+ );
365
+ }
366
+ );
367
+ function submitForm(event) {
368
+ isSubmitting.value = true;
369
+ const creationPayload = convertExportFormValuesToCreationPayload(
370
+ values.value,
371
+ templateValues.value
372
+ );
373
+ createExport(creationPayload).then(() => {
374
+ errors.value = {};
375
+ if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
376
+ navigateBack(router, getExportListUrl());
377
+ }
378
+ toast.show({
379
+ variant: "success",
380
+ title: t("export:success"),
381
+ body: t("export:createdSuccessMessage")
382
+ });
383
+ }).catch((error) => {
384
+ console.error(error);
385
+ errors.value = convertRequestErrorToMap(error);
386
+ toast.show({
387
+ variant: "danger",
388
+ title: t("export:error"),
389
+ body: t("export:createdErrorMessage")
390
+ });
391
+ }).finally(() => {
392
+ isSubmitting.value = false;
393
+ });
394
+ }
395
+ const isContentLoading = computed(() => isStrategiesLoading.value);
396
+ return {
397
+ values,
398
+ errors,
399
+ isSubmitting,
400
+ submitForm,
401
+ getExportListUrl,
402
+ strategyOptionList,
403
+ formatOptionList,
404
+ delimiterOptionList,
405
+ isContentLoading,
406
+ shouldDisplayDelimiter,
407
+ templateValues
408
+ };
409
+ }
410
+ });
411
+ const _hoisted_1 = { class: "field" };
412
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
413
+ const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
414
+ const _component_FormField = resolveComponent("FormField");
415
+ const _component_DynamicField = resolveComponent("DynamicField");
416
+ const _component_FormFooter = resolveComponent("FormFooter");
417
+ const _component_Page = resolveComponent("Page");
418
+ return openBlock(), createBlock(_component_Page, {
419
+ title: _ctx.$i18n.t("export:newExport"),
420
+ "is-content-loading": _ctx.isContentLoading
421
+ }, {
422
+ footer: withCtx(() => [
423
+ createVNode(_component_FormFooter, {
424
+ "back-href": _ctx.getExportListUrl(),
425
+ onSubmit: _ctx.submitForm,
426
+ "is-submitting": _ctx.isSubmitting,
427
+ "is-creation": true
428
+ }, null, 8, ["back-href", "onSubmit", "is-submitting"])
429
+ ]),
430
+ default: withCtx(() => [
431
+ createElementVNode("form", {
432
+ novalidate: "",
433
+ onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
434
+ }, ["prevent"]))
435
+ }, [
436
+ createVNode(_component_FormFieldSelect, {
437
+ value: _ctx.values.strategy,
438
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.strategy = $event),
439
+ name: "exportType",
440
+ error: _ctx.errors.strategy,
441
+ label: _ctx.$i18n.t("export:exportType"),
442
+ options: _ctx.strategyOptionList
443
+ }, null, 8, ["value", "error", "label", "options"]),
444
+ createElementVNode("div", _hoisted_1, [
445
+ createVNode(_component_FormField, {
446
+ value: _ctx.values.filename,
447
+ "onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.filename = $event),
448
+ error: _ctx.errors.filename,
449
+ label: _ctx.$i18n.t("export:filename"),
450
+ name: "filename"
451
+ }, null, 8, ["value", "error", "label"]),
452
+ createVNode(_component_FormFieldSelect, {
453
+ value: _ctx.values.format,
454
+ "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.format = $event),
455
+ options: _ctx.formatOptionList,
456
+ error: _ctx.errors.format,
457
+ label: _ctx.$i18n.t("export:format"),
458
+ name: "format"
459
+ }, null, 8, ["value", "options", "error", "label"]),
460
+ _ctx.shouldDisplayDelimiter ? (openBlock(), createBlock(_component_FormFieldSelect, {
461
+ key: 0,
462
+ value: _ctx.values.delimiter,
463
+ "onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.delimiter = $event),
464
+ options: _ctx.delimiterOptionList,
465
+ error: _ctx.errors.delimiter,
466
+ label: _ctx.$i18n.t("export:delimiter"),
467
+ name: "delimiter"
468
+ }, null, 8, ["value", "options", "error", "label"])) : createCommentVNode("", true)
469
+ ]),
470
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templateValues, (field) => {
471
+ return openBlock(), createBlock(_component_DynamicField, {
472
+ key: field.config.name,
473
+ field
474
+ }, null, 8, ["field"]);
475
+ }), 128))
476
+ ], 32)
477
+ ]),
478
+ _: 1
479
+ }, 8, ["title", "is-content-loading"]);
480
+ }
481
+ var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-559849fa"]]);
482
+ const EXPORT_LIST_ROUTE = {
483
+ path: EXPORT_ROUTE_PATHS.EXPORT_LIST,
484
+ component: ExportList,
485
+ name: "Export List",
486
+ meta: {
487
+ getBreadcrumbs: (route, i18n2) => [
488
+ { url: "/", text: i18n2.t("export:home") },
489
+ { url: route.path, text: i18n2.t("export:export") }
490
+ ]
491
+ }
492
+ };
493
+ const EXPORT_FORM_ROUTE = {
494
+ path: EXPORT_ROUTE_PATHS.EXPORT_FORM,
495
+ component: ExportForm,
496
+ name: "Export Form",
497
+ meta: {
498
+ getBreadcrumbs: (route, i18n2) => [
499
+ { url: "/", text: i18n2.t("export:home") },
500
+ { url: EXPORT_LIST_ROUTE.path, text: i18n2.t("export:export") },
501
+ { url: route.path, text: i18n2.t("export:newExport") }
502
+ ]
503
+ }
504
+ };
505
+ applyTranslations();
506
+ export { EXPORT_FORM_ROUTE, EXPORT_LIST_ROUTE, createExport, getExportFormUrl, getExportList, getExportListUrl, getStrategies };
@@ -0,0 +1 @@
1
+ export declare function applyTranslations(): void;
@@ -1,22 +1,23 @@
1
- declare const EN: {
2
- home: string;
3
- exportAndImport: string;
4
- export: string;
5
- exportList: string;
6
- exportForm: string;
7
- type: string;
8
- exportType: string;
9
- status: string;
10
- message: string;
11
- log: string;
12
- file: string;
13
- newExport: string;
14
- exportCreation: string;
15
- success: string;
16
- error: string;
17
- createdSuccessMessage: string;
18
- createdErrorMessage: string;
19
- filename: string;
20
- format: string;
21
- };
22
- export default EN;
1
+ export declare const EN: {
2
+ home: string;
3
+ export: string;
4
+ exportList: string;
5
+ exportForm: string;
6
+ type: string;
7
+ exportType: string;
8
+ status: string;
9
+ message: string;
10
+ log: string;
11
+ file: string;
12
+ newExport: string;
13
+ exportCreation: string;
14
+ success: string;
15
+ error: string;
16
+ createdSuccessMessage: string;
17
+ createdErrorMessage: string;
18
+ filename: string;
19
+ format: string;
20
+ delimiter: string;
21
+ comma: string;
22
+ semicolon: string;
23
+ };
@@ -1,3 +1,2 @@
1
- import EN from './en';
2
- declare const RU: typeof EN;
3
- export default RU;
1
+ import { EN } from './en';
2
+ export declare const RU: typeof EN;
package/dist/main.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './constants/routes';
2
- export * from './utils/paths';
3
- export * from './services/requests';
1
+ export * from './constants/routes';
2
+ export * from './utils/paths';
3
+ export * from './services/requests';
@@ -1,8 +1,8 @@
1
- import { ResponseBody } from '@tager/admin-services';
2
- import { StrategyType, ExportCreatePayload, ExportType } from '../typings/model';
3
- export declare function getExportList(params?: {
4
- pageNumber?: number;
5
- pageSize?: number;
6
- }): Promise<ResponseBody<Array<ExportType>>>;
7
- export declare function getStrategyList(): Promise<ResponseBody<Array<StrategyType>>>;
8
- export declare function createExport(payload: ExportCreatePayload): Promise<ResponseBody<ExportType>>;
1
+ import { ResponseBody } from '@tager/admin-services';
2
+ import { StrategyType, ExportCreatePayload, ExportType } from '../typings/model';
3
+ export declare function getExportList(params?: {
4
+ pageNumber?: number;
5
+ pageSize?: number;
6
+ }): Promise<ResponseBody<Array<ExportType>>>;
7
+ export declare function getStrategies(): Promise<ResponseBody<Array<StrategyType>>>;
8
+ export declare function createExport(payload: ExportCreatePayload): Promise<ResponseBody<ExportType>>;
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .name[data-v-82dd6750]{display:inline-block;width:100px}.field[data-v-559849fa]{display:grid;grid-template-columns:repeat(2,1fr);column-gap:20px}
@@ -1,23 +1,26 @@
1
- import { FileType } from '@tager/admin-services';
2
- interface HistoryType {
3
- readonly datetime: string;
4
- readonly status: string;
5
- }
6
- export interface ExportType {
7
- readonly id: number;
8
- readonly strategy: string;
9
- readonly status: string;
10
- readonly message: string | null;
11
- readonly history: Array<HistoryType>;
12
- readonly file: FileType | null;
13
- }
14
- export interface StrategyType {
15
- id: string;
16
- name: string;
17
- }
18
- export interface ExportCreatePayload {
19
- strategy: string;
20
- filename: string;
21
- format: string;
22
- }
23
- export {};
1
+ import { FileType } from '@tager/admin-services';
2
+ import { FieldConfigUnion, FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
3
+ export interface HistoryType {
4
+ readonly datetime: string;
5
+ readonly status: string;
6
+ }
7
+ export interface ExportType {
8
+ readonly id: number;
9
+ readonly strategy: string;
10
+ readonly status: string;
11
+ readonly message: string | null;
12
+ readonly history: Array<HistoryType>;
13
+ readonly file: FileType | null;
14
+ }
15
+ export interface StrategyType {
16
+ id: string;
17
+ name: string;
18
+ fields: Array<FieldConfigUnion>;
19
+ }
20
+ export interface ExportCreatePayload {
21
+ strategy: string;
22
+ filename: string;
23
+ format: string;
24
+ delimiter: string;
25
+ params: Array<FieldShortType<OutgoingValueUnion>>;
26
+ }
@@ -1 +1 @@
1
- export declare function replaceFileExtension(fileName: string, newExtension: string): string;
1
+ export declare function replaceFileExtension(fileName: string, newExtension: string): string;