@tager/admin-export 0.1.4 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/paths.d.ts +4 -4
- package/dist/constants/routes.d.ts +3 -3
- package/dist/dev/App.vue.d.ts +5 -0
- package/dist/dev/config.d.ts +2 -0
- package/dist/dev/env.d.ts +1 -0
- package/dist/dev/main.d.ts +3 -0
- package/dist/index.mjs +512 -0
- package/dist/locales/apply.d.ts +1 -0
- package/dist/locales/en.d.ts +23 -25
- package/dist/locales/ru.d.ts +2 -3
- package/dist/main.d.ts +3 -3
- package/dist/services/requests.d.ts +8 -8
- package/dist/style.css +1 -0
- package/dist/typings/model.d.ts +26 -24
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/paths.d.ts +4 -4
- package/dist/views/ExportForm/ExportForm.helpers.d.ts +11 -9
- package/dist/views/ExportForm/ExportForm.types.d.ts +7 -0
- package/dist/views/ExportForm/ExportForm.vue.d.ts +2693 -74
- package/dist/views/ExportForm/index.d.ts +1 -1
- package/dist/views/ExportList/ExportList.vue.d.ts +16 -41
- package/dist/views/ExportList/components/CellHistory/CellHistory.helpers.d.ts +1 -0
- package/dist/views/ExportList/components/CellHistory/CellHistory.vue.d.ts +19 -0
- package/dist/views/ExportList/components/CellHistory/index.d.ts +1 -0
- package/dist/views/ExportList/index.d.ts +1 -1
- package/package.json +49 -47
- package/src/constants/routes.ts +10 -10
- package/src/dev/App.vue +38 -0
- package/src/dev/config.ts +23 -0
- package/src/dev/env.ts +17 -0
- package/src/dev/main.ts +36 -0
- package/src/locales/apply.ts +9 -0
- package/src/locales/en.ts +1 -4
- package/src/locales/ru.ts +2 -5
- package/src/main.ts +2 -6
- package/src/services/requests.ts +1 -1
- package/src/typings/model.ts +8 -1
- package/src/views/ExportForm/ExportForm.helpers.ts +31 -8
- package/src/views/ExportForm/ExportForm.types.ts +8 -0
- package/src/views/ExportForm/ExportForm.vue +143 -118
- package/src/views/ExportList/ExportList.vue +47 -63
- package/src/views/ExportList/components/CellHistory/CellHistory.helpers.ts +12 -0
- package/src/views/ExportList/components/CellHistory/CellHistory.vue +38 -0
- package/src/views/ExportList/components/CellHistory/index.ts +1 -0
- package/README.md +0 -0
- package/dist/dev.d.ts +0 -1
- package/dist/index.esm.js +0 -714
- package/dist/index.umd.js +0 -725
- package/src/config/config.json +0 -20
- package/src/dev.ts +0 -41
- package/src/typings/sfc.d.ts +0 -12
- package/src/typings/shims-tsx.d.ts +0 -13
- package/src/typings/shims-vue.d.ts +0 -11
- 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 {
|
|
2
|
-
export declare const EXPORT_LIST_ROUTE:
|
|
3
|
-
export declare const EXPORT_FORM_ROUTE:
|
|
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 @@
|
|
|
1
|
+
export declare function populateEnvironment(): void;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
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 date = new Date(value);
|
|
79
|
+
return new Intl.DateTimeFormat("ru-RU", {
|
|
80
|
+
year: "numeric",
|
|
81
|
+
month: "numeric",
|
|
82
|
+
day: "numeric",
|
|
83
|
+
hour: "numeric",
|
|
84
|
+
minute: "numeric",
|
|
85
|
+
second: "numeric"
|
|
86
|
+
}).format(date);
|
|
87
|
+
}
|
|
88
|
+
var CellHistory_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
89
|
+
var _export_sfc = (sfc, props) => {
|
|
90
|
+
const target = sfc.__vccOpts || sfc;
|
|
91
|
+
for (const [key, val] of props) {
|
|
92
|
+
target[key] = val;
|
|
93
|
+
}
|
|
94
|
+
return target;
|
|
95
|
+
};
|
|
96
|
+
const _sfc_main$2 = defineComponent({
|
|
97
|
+
name: "CellHistory",
|
|
98
|
+
props: {
|
|
99
|
+
history: {
|
|
100
|
+
type: Array,
|
|
101
|
+
default: () => []
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
setup() {
|
|
105
|
+
return {
|
|
106
|
+
dateTimeFormat
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const _hoisted_1$1 = { key: 0 };
|
|
111
|
+
const _hoisted_2 = { class: "name" };
|
|
112
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
113
|
+
return _ctx.history.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
|
|
114
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.history, (history, index) => {
|
|
115
|
+
return openBlock(), createElementBlock("li", { key: index }, [
|
|
116
|
+
createElementVNode("span", _hoisted_2, toDisplayString(history.status), 1),
|
|
117
|
+
createTextVNode(" " + toDisplayString(_ctx.dateTimeFormat(history.datetime)), 1)
|
|
118
|
+
]);
|
|
119
|
+
}), 128))
|
|
120
|
+
])) : createCommentVNode("", true);
|
|
121
|
+
}
|
|
122
|
+
var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-82dd6750"]]);
|
|
123
|
+
const _sfc_main$1 = defineComponent({
|
|
124
|
+
name: "ExportList",
|
|
125
|
+
components: {
|
|
126
|
+
Page,
|
|
127
|
+
CellHistory,
|
|
128
|
+
DataTable
|
|
129
|
+
},
|
|
130
|
+
setup() {
|
|
131
|
+
const { t } = useI18n();
|
|
132
|
+
const {
|
|
133
|
+
fetchEntityList: fetchExportList,
|
|
134
|
+
isLoading: isExportListLoading,
|
|
135
|
+
rowData: exportList,
|
|
136
|
+
errorMessage,
|
|
137
|
+
searchQuery,
|
|
138
|
+
handleChange,
|
|
139
|
+
pageSize,
|
|
140
|
+
pageCount,
|
|
141
|
+
pageNumber
|
|
142
|
+
} = useDataTable({
|
|
143
|
+
fetchEntityList: (params) => getExportList({
|
|
144
|
+
pageNumber: params.pageNumber,
|
|
145
|
+
pageSize: params.pageSize
|
|
146
|
+
}),
|
|
147
|
+
initialValue: [],
|
|
148
|
+
resourceName: "Export list",
|
|
149
|
+
pageSize: 100
|
|
150
|
+
});
|
|
151
|
+
onMounted(() => {
|
|
152
|
+
fetchExportList();
|
|
153
|
+
});
|
|
154
|
+
const columnDefs = [
|
|
155
|
+
{
|
|
156
|
+
id: 1,
|
|
157
|
+
name: "ID",
|
|
158
|
+
field: "id",
|
|
159
|
+
style: { width: "50px", textAlign: "center" },
|
|
160
|
+
headStyle: { width: "50px", textAlign: "center" }
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 2,
|
|
164
|
+
name: t("export:type"),
|
|
165
|
+
field: "strategy",
|
|
166
|
+
style: { width: "15%" },
|
|
167
|
+
headStyle: { width: "15%" }
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 3,
|
|
171
|
+
name: t("export:status"),
|
|
172
|
+
field: "status",
|
|
173
|
+
style: { width: "15%" },
|
|
174
|
+
headStyle: { width: "15%" }
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 4,
|
|
178
|
+
name: t("export:message"),
|
|
179
|
+
field: "message"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 5,
|
|
183
|
+
name: t("export:log"),
|
|
184
|
+
field: "history",
|
|
185
|
+
style: { width: "25%", whiteSpace: "nowrap" },
|
|
186
|
+
headStyle: { width: "25%" }
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 6,
|
|
190
|
+
name: t("export:file"),
|
|
191
|
+
field: "file",
|
|
192
|
+
type: "file",
|
|
193
|
+
style: { width: "150px", textAlign: "center" },
|
|
194
|
+
headStyle: { width: "150px", textAlign: "center" }
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
return {
|
|
198
|
+
columnDefs,
|
|
199
|
+
getExportFormUrl,
|
|
200
|
+
rowData: exportList,
|
|
201
|
+
isRowDataLoading: isExportListLoading,
|
|
202
|
+
errorMessage,
|
|
203
|
+
searchQuery,
|
|
204
|
+
handleChange,
|
|
205
|
+
pageSize,
|
|
206
|
+
pageCount,
|
|
207
|
+
pageNumber
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
212
|
+
const _component_CellHistory = resolveComponent("CellHistory");
|
|
213
|
+
const _component_DataTable = resolveComponent("DataTable");
|
|
214
|
+
const _component_Page = resolveComponent("Page");
|
|
215
|
+
return openBlock(), createBlock(_component_Page, {
|
|
216
|
+
title: _ctx.$i18n.t("export:export"),
|
|
217
|
+
"header-buttons": [
|
|
218
|
+
{
|
|
219
|
+
text: _ctx.$i18n.t("export:newExport"),
|
|
220
|
+
href: _ctx.getExportFormUrl({ exportId: "create" })
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}, {
|
|
224
|
+
default: withCtx(() => [
|
|
225
|
+
createVNode(_component_DataTable, {
|
|
226
|
+
"column-defs": _ctx.columnDefs,
|
|
227
|
+
"row-data": _ctx.rowData,
|
|
228
|
+
loading: _ctx.isRowDataLoading,
|
|
229
|
+
"error-message": _ctx.errorMessage,
|
|
230
|
+
pagination: {
|
|
231
|
+
pageSize: _ctx.pageSize,
|
|
232
|
+
pageCount: _ctx.pageCount,
|
|
233
|
+
pageNumber: _ctx.pageNumber,
|
|
234
|
+
disabled: _ctx.isRowDataLoading
|
|
235
|
+
},
|
|
236
|
+
"use-search": false,
|
|
237
|
+
onChange: _ctx.handleChange
|
|
238
|
+
}, {
|
|
239
|
+
"cell(history)": withCtx(({ row }) => [
|
|
240
|
+
createVNode(_component_CellHistory, {
|
|
241
|
+
history: row.history
|
|
242
|
+
}, null, 8, ["history"])
|
|
243
|
+
]),
|
|
244
|
+
_: 1
|
|
245
|
+
}, 8, ["column-defs", "row-data", "loading", "error-message", "pagination", "onChange"])
|
|
246
|
+
]),
|
|
247
|
+
_: 1
|
|
248
|
+
}, 8, ["title", "header-buttons"]);
|
|
249
|
+
}
|
|
250
|
+
var ExportList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
251
|
+
function replaceFileExtension(fileName, newExtension) {
|
|
252
|
+
const dotIndex = fileName.lastIndexOf(".");
|
|
253
|
+
const fileNameWithoutExtension = fileName.slice(0, dotIndex);
|
|
254
|
+
if (newExtension) {
|
|
255
|
+
return `${fileNameWithoutExtension}.${newExtension}`;
|
|
256
|
+
}
|
|
257
|
+
return fileNameWithoutExtension;
|
|
258
|
+
}
|
|
259
|
+
function convertExportFormValuesToCreationPayload(values, templateValues) {
|
|
260
|
+
var _a, _b, _c, _d, _e, _f;
|
|
261
|
+
return {
|
|
262
|
+
strategy: (_b = (_a = values.strategy) == null ? void 0 : _a.value) != null ? _b : "",
|
|
263
|
+
filename: values.filename,
|
|
264
|
+
format: (_d = (_c = values.format) == null ? void 0 : _c.value) != null ? _d : "",
|
|
265
|
+
delimiter: (_f = (_e = values.delimiter) == null ? void 0 : _e.value) != null ? _f : "",
|
|
266
|
+
params: templateValues.map((field) => ({
|
|
267
|
+
name: field.config.name,
|
|
268
|
+
value: universalFieldUtils.getOutgoingValue(field)
|
|
269
|
+
}))
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function convertStrategiesToStrategyOptionList(strategies) {
|
|
273
|
+
return strategies.map((strategy) => ({
|
|
274
|
+
label: strategy.name,
|
|
275
|
+
value: strategy.id
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
const formatOptionList = [
|
|
279
|
+
{ value: "CSV", label: "CSV" },
|
|
280
|
+
{ value: "XLS", label: "XLS" },
|
|
281
|
+
{ value: "XML", label: "XML" },
|
|
282
|
+
{ value: "YAML", label: "YAML" },
|
|
283
|
+
{ value: "JSON", label: "JSON" },
|
|
284
|
+
{ value: "TXT", label: "TXT" }
|
|
285
|
+
];
|
|
286
|
+
function isCSVFormat(format) {
|
|
287
|
+
return format === "CSV";
|
|
288
|
+
}
|
|
289
|
+
var ExportForm_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
290
|
+
const _sfc_main = defineComponent({
|
|
291
|
+
name: "ExportForm",
|
|
292
|
+
components: {
|
|
293
|
+
DynamicField,
|
|
294
|
+
FormFooter,
|
|
295
|
+
Page,
|
|
296
|
+
FormField,
|
|
297
|
+
FormFieldSelect
|
|
298
|
+
},
|
|
299
|
+
setup() {
|
|
300
|
+
var _a, _b;
|
|
301
|
+
const { t } = useI18n();
|
|
302
|
+
useRoute();
|
|
303
|
+
const router = useRouter();
|
|
304
|
+
const toast = useToast();
|
|
305
|
+
const [
|
|
306
|
+
fetchStrategies,
|
|
307
|
+
{ data: strategies, loading: isStrategiesLoading }
|
|
308
|
+
] = useResource({
|
|
309
|
+
fetchResource: getStrategies,
|
|
310
|
+
initialValue: [],
|
|
311
|
+
resourceName: "Strategies"
|
|
312
|
+
});
|
|
313
|
+
const strategyOptionList = computed(
|
|
314
|
+
() => convertStrategiesToStrategyOptionList(strategies.value)
|
|
315
|
+
);
|
|
316
|
+
onMounted(() => {
|
|
317
|
+
fetchStrategies();
|
|
318
|
+
});
|
|
319
|
+
const delimiterOptionList = computed(() => [
|
|
320
|
+
{ value: ",", label: t("export:comma") },
|
|
321
|
+
{ value: ";", label: t("export:semicolon") }
|
|
322
|
+
]);
|
|
323
|
+
const defaultExtension = formatOptionList[0];
|
|
324
|
+
const defaultDelimiter = delimiterOptionList.value[0];
|
|
325
|
+
const errors = ref({});
|
|
326
|
+
const values = ref({
|
|
327
|
+
strategy: null,
|
|
328
|
+
filename: `export.${defaultExtension.value.toLowerCase()}`,
|
|
329
|
+
format: defaultExtension,
|
|
330
|
+
delimiter: defaultDelimiter
|
|
331
|
+
});
|
|
332
|
+
const isSubmitting = ref(false);
|
|
333
|
+
const templateValues = ref([]);
|
|
334
|
+
function updateTemplateValues() {
|
|
335
|
+
var _a2;
|
|
336
|
+
const selectedStrategy = strategies.value.find(
|
|
337
|
+
(strategy) => {
|
|
338
|
+
var _a3;
|
|
339
|
+
return strategy.id === ((_a3 = values.value.strategy) == null ? void 0 : _a3.value);
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
const fieldTemplateList = (_a2 = selectedStrategy == null ? void 0 : selectedStrategy.fields) != null ? _a2 : [];
|
|
343
|
+
templateValues.value = fieldTemplateList.map(
|
|
344
|
+
(fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
watch(
|
|
348
|
+
() => values.value.strategy,
|
|
349
|
+
() => {
|
|
350
|
+
updateTemplateValues();
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
onMounted(() => {
|
|
354
|
+
updateTemplateValues();
|
|
355
|
+
});
|
|
356
|
+
const shouldDisplayDelimiter = ref(
|
|
357
|
+
isCSVFormat((_b = (_a = values.value.format) == null ? void 0 : _a.value) != null ? _b : "")
|
|
358
|
+
);
|
|
359
|
+
watch(
|
|
360
|
+
() => values.value.format,
|
|
361
|
+
() => {
|
|
362
|
+
var _a2, _b2, _c;
|
|
363
|
+
const newExtension = (_a2 = values.value.format) == null ? void 0 : _a2.value.toLowerCase();
|
|
364
|
+
values.value.filename = replaceFileExtension(
|
|
365
|
+
values.value.filename,
|
|
366
|
+
newExtension || ""
|
|
367
|
+
);
|
|
368
|
+
shouldDisplayDelimiter.value = isCSVFormat(
|
|
369
|
+
(_c = (_b2 = values.value.format) == null ? void 0 : _b2.value) != null ? _c : ""
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
function submitForm(event) {
|
|
374
|
+
isSubmitting.value = true;
|
|
375
|
+
const creationPayload = convertExportFormValuesToCreationPayload(
|
|
376
|
+
values.value,
|
|
377
|
+
templateValues.value
|
|
378
|
+
);
|
|
379
|
+
createExport(creationPayload).then(() => {
|
|
380
|
+
errors.value = {};
|
|
381
|
+
if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
|
|
382
|
+
navigateBack(router, getExportListUrl());
|
|
383
|
+
}
|
|
384
|
+
toast.show({
|
|
385
|
+
variant: "success",
|
|
386
|
+
title: t("export:success"),
|
|
387
|
+
body: t("export:createdSuccessMessage")
|
|
388
|
+
});
|
|
389
|
+
}).catch((error) => {
|
|
390
|
+
console.error(error);
|
|
391
|
+
errors.value = convertRequestErrorToMap(error);
|
|
392
|
+
toast.show({
|
|
393
|
+
variant: "danger",
|
|
394
|
+
title: t("export:error"),
|
|
395
|
+
body: t("export:createdErrorMessage")
|
|
396
|
+
});
|
|
397
|
+
}).finally(() => {
|
|
398
|
+
isSubmitting.value = false;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
const isContentLoading = computed(() => isStrategiesLoading.value);
|
|
402
|
+
return {
|
|
403
|
+
values,
|
|
404
|
+
errors,
|
|
405
|
+
isSubmitting,
|
|
406
|
+
submitForm,
|
|
407
|
+
getExportListUrl,
|
|
408
|
+
strategyOptionList,
|
|
409
|
+
formatOptionList,
|
|
410
|
+
delimiterOptionList,
|
|
411
|
+
isContentLoading,
|
|
412
|
+
shouldDisplayDelimiter,
|
|
413
|
+
templateValues
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
const _hoisted_1 = { class: "field" };
|
|
418
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
419
|
+
const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
|
|
420
|
+
const _component_FormField = resolveComponent("FormField");
|
|
421
|
+
const _component_DynamicField = resolveComponent("DynamicField");
|
|
422
|
+
const _component_FormFooter = resolveComponent("FormFooter");
|
|
423
|
+
const _component_Page = resolveComponent("Page");
|
|
424
|
+
return openBlock(), createBlock(_component_Page, {
|
|
425
|
+
title: _ctx.$i18n.t("export:newExport"),
|
|
426
|
+
"is-content-loading": _ctx.isContentLoading
|
|
427
|
+
}, {
|
|
428
|
+
footer: withCtx(() => [
|
|
429
|
+
createVNode(_component_FormFooter, {
|
|
430
|
+
"back-href": _ctx.getExportListUrl(),
|
|
431
|
+
onSubmit: _ctx.submitForm,
|
|
432
|
+
"is-submitting": _ctx.isSubmitting,
|
|
433
|
+
"is-creation": true
|
|
434
|
+
}, null, 8, ["back-href", "onSubmit", "is-submitting"])
|
|
435
|
+
]),
|
|
436
|
+
default: withCtx(() => [
|
|
437
|
+
createElementVNode("form", {
|
|
438
|
+
novalidate: "",
|
|
439
|
+
onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
440
|
+
}, ["prevent"]))
|
|
441
|
+
}, [
|
|
442
|
+
createVNode(_component_FormFieldSelect, {
|
|
443
|
+
value: _ctx.values.strategy,
|
|
444
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.strategy = $event),
|
|
445
|
+
name: "exportType",
|
|
446
|
+
error: _ctx.errors.strategy,
|
|
447
|
+
label: _ctx.$i18n.t("export:exportType"),
|
|
448
|
+
options: _ctx.strategyOptionList
|
|
449
|
+
}, null, 8, ["value", "error", "label", "options"]),
|
|
450
|
+
createElementVNode("div", _hoisted_1, [
|
|
451
|
+
createVNode(_component_FormField, {
|
|
452
|
+
value: _ctx.values.filename,
|
|
453
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.filename = $event),
|
|
454
|
+
error: _ctx.errors.filename,
|
|
455
|
+
label: _ctx.$i18n.t("export:filename"),
|
|
456
|
+
name: "filename"
|
|
457
|
+
}, null, 8, ["value", "error", "label"]),
|
|
458
|
+
createVNode(_component_FormFieldSelect, {
|
|
459
|
+
value: _ctx.values.format,
|
|
460
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.format = $event),
|
|
461
|
+
options: _ctx.formatOptionList,
|
|
462
|
+
error: _ctx.errors.format,
|
|
463
|
+
label: _ctx.$i18n.t("export:format"),
|
|
464
|
+
name: "format"
|
|
465
|
+
}, null, 8, ["value", "options", "error", "label"]),
|
|
466
|
+
_ctx.shouldDisplayDelimiter ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
467
|
+
key: 0,
|
|
468
|
+
value: _ctx.values.delimiter,
|
|
469
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.delimiter = $event),
|
|
470
|
+
options: _ctx.delimiterOptionList,
|
|
471
|
+
error: _ctx.errors.delimiter,
|
|
472
|
+
label: _ctx.$i18n.t("export:delimiter"),
|
|
473
|
+
name: "delimiter"
|
|
474
|
+
}, null, 8, ["value", "options", "error", "label"])) : createCommentVNode("", true)
|
|
475
|
+
]),
|
|
476
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templateValues, (field) => {
|
|
477
|
+
return openBlock(), createBlock(_component_DynamicField, {
|
|
478
|
+
key: field.config.name,
|
|
479
|
+
field
|
|
480
|
+
}, null, 8, ["field"]);
|
|
481
|
+
}), 128))
|
|
482
|
+
], 32)
|
|
483
|
+
]),
|
|
484
|
+
_: 1
|
|
485
|
+
}, 8, ["title", "is-content-loading"]);
|
|
486
|
+
}
|
|
487
|
+
var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-559849fa"]]);
|
|
488
|
+
const EXPORT_LIST_ROUTE = {
|
|
489
|
+
path: EXPORT_ROUTE_PATHS.EXPORT_LIST,
|
|
490
|
+
component: ExportList,
|
|
491
|
+
name: "Export List",
|
|
492
|
+
meta: {
|
|
493
|
+
getBreadcrumbs: (route, i18n2) => [
|
|
494
|
+
{ url: "/", text: i18n2.t("export:home") },
|
|
495
|
+
{ url: route.path, text: i18n2.t("export:export") }
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const EXPORT_FORM_ROUTE = {
|
|
500
|
+
path: EXPORT_ROUTE_PATHS.EXPORT_FORM,
|
|
501
|
+
component: ExportForm,
|
|
502
|
+
name: "Export Form",
|
|
503
|
+
meta: {
|
|
504
|
+
getBreadcrumbs: (route, i18n2) => [
|
|
505
|
+
{ url: "/", text: i18n2.t("export:home") },
|
|
506
|
+
{ url: EXPORT_LIST_ROUTE.path, text: i18n2.t("export:export") },
|
|
507
|
+
{ url: route.path, text: i18n2.t("export:newExport") }
|
|
508
|
+
]
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
applyTranslations();
|
|
512
|
+
export { EXPORT_FORM_ROUTE, EXPORT_LIST_ROUTE, createExport, getExportFormUrl, getExportList, getExportListUrl, getStrategies };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyTranslations(): void;
|
package/dist/locales/en.d.ts
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
declare const EN: {
|
|
2
|
-
home: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
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
|
+
};
|
package/dist/locales/ru.d.ts
CHANGED
|
@@ -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
|
|
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}
|