@tager/admin-export 1.0.5 → 1.0.6

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/index.mjs CHANGED
@@ -1,11 +1,11 @@
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 = {
1
+ import { i18n as N, request as w, useI18n as A, useToast as Q, useResource as W, navigateBack as K, convertRequestErrorToMap as Z } from "@tager/admin-services";
2
+ import { defineComponent as R, openBlock as c, createElementBlock as F, Fragment as z, renderList as B, createElementVNode as C, toDisplayString as U, createTextVNode as ee, createCommentVNode as H, onMounted as O, resolveComponent as d, createBlock as b, withCtx as L, createVNode as E, computed as S, ref as h, watch as k, withModifiers as te } from "vue";
3
+ import { Page as q } from "@tager/admin-layout";
4
+ import { DataTable as re, useDataTable as oe, FormFieldSelect as ae, FormField as ne, FormFooter as se } from "@tager/admin-ui";
5
+ import { universalFieldUtils as J, DynamicField as ie } from "@tager/admin-dynamic-field";
6
+ import { compile as le } from "path-to-regexp";
7
+ import { useRoute as ue, useRouter as pe } from "vue-router";
8
+ const me = {
9
9
  home: "Home",
10
10
  export: "Export",
11
11
  exportList: "Export List",
@@ -32,71 +32,58 @@ const EN = {
32
32
  statusInProgress: "In Progress",
33
33
  statusCompleted: "Completed",
34
34
  statusFailure: "Failed"
35
+ }, de = {
36
+ home: "Главная",
37
+ export: "Экспорт",
38
+ exportList: "Список экспортов",
39
+ exportForm: "Форма экспорта",
40
+ type: "Тип",
41
+ params: "Параметры",
42
+ exportType: "Тип экспорта",
43
+ status: "Статус",
44
+ message: "Сообщение",
45
+ log: "Лог",
46
+ file: "Файл",
47
+ newExport: "Новый экспорт",
48
+ exportCreation: "Создание экспорта",
49
+ success: "Успех",
50
+ error: "Ошибка",
51
+ createdSuccessMessage: "Экспорт была успешно создан",
52
+ createdErrorMessage: "Создание экспорта не удалось",
53
+ filename: "Имя файла",
54
+ format: "Формат",
55
+ delimiter: "Разделитель",
56
+ comma: "Запятая",
57
+ semicolon: "Точка с запятой",
58
+ statusCreated: "Создан",
59
+ statusInProgress: "В процессе",
60
+ statusCompleted: "Завершен",
61
+ statusFailure: "Ошибка"
35
62
  };
36
- const RU = {
37
- home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
38
- export: "\u042D\u043A\u0441\u043F\u043E\u0440\u0442",
39
- exportList: "\u0421\u043F\u0438\u0441\u043E\u043A \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u043E\u0432",
40
- exportForm: "\u0424\u043E\u0440\u043C\u0430 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
41
- type: "\u0422\u0438\u043F",
42
- params: "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
43
- exportType: "\u0422\u0438\u043F \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
44
- status: "\u0421\u0442\u0430\u0442\u0443\u0441",
45
- message: "\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",
46
- log: "\u041B\u043E\u0433",
47
- file: "\u0424\u0430\u0439\u043B",
48
- newExport: "\u041D\u043E\u0432\u044B\u0439 \u044D\u043A\u0441\u043F\u043E\u0440\u0442",
49
- exportCreation: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0430",
50
- success: "\u0423\u0441\u043F\u0435\u0445",
51
- error: "\u041E\u0448\u0438\u0431\u043A\u0430",
52
- 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",
53
- 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",
54
- filename: "\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430",
55
- format: "\u0424\u043E\u0440\u043C\u0430\u0442",
56
- delimiter: "\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C",
57
- comma: "\u0417\u0430\u043F\u044F\u0442\u0430\u044F",
58
- semicolon: "\u0422\u043E\u0447\u043A\u0430 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439",
59
- statusCreated: "\u0421\u043E\u0437\u0434\u0430\u043D",
60
- statusInProgress: "\u0412 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435",
61
- statusCompleted: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D",
62
- statusFailure: "\u041E\u0448\u0438\u0431\u043A\u0430"
63
- };
64
- function applyTranslations() {
65
- i18n.addTranslations("en", "export", EN);
66
- i18n.addTranslations("ru", "export", RU);
63
+ function ce() {
64
+ N.addTranslations("en", "export", me), N.addTranslations("ru", "export", de);
67
65
  }
68
- function getExportList(params) {
69
- return request.get({ path: "/admin/tager/export", params });
66
+ function fe(e) {
67
+ return w.get({ path: "/admin/tager/export", params: e });
70
68
  }
71
- function getStrategies() {
72
- return request.get({ path: "/admin/tager/export/strategies" });
69
+ function ge() {
70
+ return w.get({ path: "/admin/tager/export/strategies" });
73
71
  }
74
- function createExport(payload) {
75
- return request.post({ path: "/admin/tager/export", body: payload });
72
+ function ve(e) {
73
+ return w.post({ path: "/admin/tager/export", body: e });
76
74
  }
77
- const EXPORT_ROUTE_PATHS = {
75
+ const T = {
78
76
  EXPORT_LIST: "/export",
79
77
  EXPORT_FORM: "/export/:exportId"
80
78
  };
81
- function getExportListUrl() {
82
- return EXPORT_ROUTE_PATHS.EXPORT_LIST;
83
- }
84
- function getExportFormUrl(params) {
85
- return compile(EXPORT_ROUTE_PATHS.EXPORT_FORM)(params);
79
+ function V() {
80
+ return T.EXPORT_LIST;
86
81
  }
87
- function dateTimeFormat(value) {
88
- const date = new Date(value);
89
- return new Intl.DateTimeFormat("ru-RU", {
90
- year: "numeric",
91
- month: "numeric",
92
- day: "numeric",
93
- hour: "numeric",
94
- minute: "numeric",
95
- second: "numeric"
96
- }).format(date);
82
+ function xe(e) {
83
+ return le(T.EXPORT_FORM)(e);
97
84
  }
98
- function getExportStatusLabel(status, t) {
99
- switch (status) {
85
+ function Y(e, t) {
86
+ switch (e) {
100
87
  case "CREATED":
101
88
  return t("export:statusCreated");
102
89
  case "IN_PROGRESS":
@@ -109,15 +96,18 @@ function getExportStatusLabel(status, t) {
109
96
  return "Unknown";
110
97
  }
111
98
  }
112
- var CellHistory_vue_vue_type_style_index_0_scoped_true_lang = "";
113
- var _export_sfc = (sfc, props) => {
114
- const target = sfc.__vccOpts || sfc;
115
- for (const [key, val] of props) {
116
- target[key] = val;
117
- }
118
- return target;
119
- };
120
- const _sfc_main$2 = defineComponent({
99
+ function ye(e) {
100
+ const t = new Date(e);
101
+ return new Intl.DateTimeFormat("ru-RU", {
102
+ year: "numeric",
103
+ month: "numeric",
104
+ day: "numeric",
105
+ hour: "numeric",
106
+ minute: "numeric",
107
+ second: "numeric"
108
+ }).format(t);
109
+ }
110
+ const Ee = R({
121
111
  name: "CellHistory",
122
112
  props: {
123
113
  history: {
@@ -127,165 +117,159 @@ const _sfc_main$2 = defineComponent({
127
117
  },
128
118
  setup() {
129
119
  return {
130
- dateTimeFormat,
131
- getExportStatusLabel
120
+ dateTimeFormat: ye,
121
+ getExportStatusLabel: Y
132
122
  };
133
123
  }
134
- });
135
- const _hoisted_1$1 = { key: 0 };
136
- const _hoisted_2 = { class: "name" };
137
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
138
- return _ctx.history.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
139
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.history, (history, index) => {
140
- return openBlock(), createElementBlock("li", { key: index }, [
141
- createElementVNode("span", _hoisted_2, toDisplayString(_ctx.getExportStatusLabel(history.status, _ctx.$i18n.t)), 1),
142
- createTextVNode(" " + toDisplayString(_ctx.dateTimeFormat(history.datetime)), 1)
143
- ]);
144
- }), 128))
145
- ])) : createCommentVNode("", true);
124
+ }), D = (e, t) => {
125
+ const o = e.__vccOpts || e;
126
+ for (const [a, n] of t)
127
+ o[a] = n;
128
+ return o;
129
+ }, he = { key: 0 }, Fe = { class: "name" };
130
+ function be(e, t, o, a, n, u) {
131
+ return e.history.length > 0 ? (c(), F("ul", he, [
132
+ (c(!0), F(z, null, B(e.history, (s, i) => (c(), F("li", { key: i }, [
133
+ C("span", Fe, U(e.getExportStatusLabel(s.status, e.$i18n.t)), 1),
134
+ ee(" " + U(e.dateTimeFormat(s.datetime)), 1)
135
+ ]))), 128))
136
+ ])) : H("", !0);
146
137
  }
147
- var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-2c813c30"]]);
148
- const _sfc_main$1 = defineComponent({
138
+ const Le = /* @__PURE__ */ D(Ee, [["render", be], ["__scopeId", "data-v-0a48f212"]]), Te = R({
149
139
  name: "ExportList",
150
140
  components: {
151
- Page,
152
- CellHistory,
153
- DataTable
141
+ Page: q,
142
+ CellHistory: Le,
143
+ DataTable: re
154
144
  },
155
145
  setup() {
156
- const { t } = useI18n();
157
- const {
158
- fetchEntityList: fetchExportList,
159
- isLoading: isExportListLoading,
160
- rowData: exportList,
161
- errorMessage,
162
- searchQuery,
163
- handleChange,
164
- pageSize,
165
- pageCount,
166
- pageNumber
167
- } = useDataTable({
168
- fetchEntityList: (params) => getExportList({
169
- pageNumber: params.pageNumber,
170
- pageSize: params.pageSize
146
+ const { t: e } = A(), {
147
+ fetchEntityList: t,
148
+ isLoading: o,
149
+ rowData: a,
150
+ errorMessage: n,
151
+ searchQuery: u,
152
+ handleChange: s,
153
+ pageSize: i,
154
+ pageCount: m,
155
+ pageNumber: f
156
+ } = oe({
157
+ fetchEntityList: (r) => fe({
158
+ pageNumber: r.pageNumber,
159
+ pageSize: r.pageSize
171
160
  }),
172
161
  initialValue: [],
173
162
  resourceName: "Export list",
174
163
  pageSize: 100
175
164
  });
176
- onMounted(() => {
177
- fetchExportList();
178
- });
179
- const columnDefs = [
180
- {
181
- id: 1,
182
- name: "ID",
183
- field: "id",
184
- width: "50px"
185
- },
186
- {
187
- id: 2,
188
- name: t("export:status"),
189
- field: "status",
190
- width: "120px",
191
- format: ({ row }) => getExportStatusLabel(row.status, t)
192
- },
193
- {
194
- id: 3,
195
- name: t("export:type"),
196
- field: "strategy",
197
- width: "200px",
198
- options: {
199
- maxLength: 24
200
- }
201
- },
202
- {
203
- id: 4,
204
- name: t("export:params"),
205
- field: "params",
206
- type: "key-value",
207
- format: ({ row }) => {
208
- const result = [];
209
- Object.keys(row.params).forEach((param) => {
210
- result.push({
211
- key: param,
212
- value: row.params[param]
213
- });
214
- });
215
- return result;
216
- }
217
- },
218
- {
219
- id: 5,
220
- name: t("export:message"),
221
- field: "message",
222
- width: "200px"
223
- },
224
- {
225
- id: 6,
226
- name: t("export:log"),
227
- field: "history",
228
- width: "300px"
229
- },
230
- {
231
- id: 7,
232
- name: t("export:file"),
233
- field: "file",
234
- type: "file",
235
- width: "100px",
236
- style: {
237
- textAlign: "center"
165
+ return O(() => {
166
+ t();
167
+ }), {
168
+ columnDefs: [
169
+ {
170
+ id: 1,
171
+ name: "ID",
172
+ field: "id",
173
+ width: "50px"
238
174
  },
239
- headStyle: {
240
- textAlign: "center"
175
+ {
176
+ id: 2,
177
+ name: e("export:status"),
178
+ field: "status",
179
+ width: "120px",
180
+ format: ({ row: r }) => Y(r.status, e)
181
+ },
182
+ {
183
+ id: 3,
184
+ name: e("export:type"),
185
+ field: "strategy",
186
+ width: "200px",
187
+ options: {
188
+ maxLength: 24
189
+ }
190
+ },
191
+ {
192
+ id: 4,
193
+ name: e("export:params"),
194
+ field: "params",
195
+ type: "key-value",
196
+ format: ({ row: r }) => {
197
+ const v = [];
198
+ return Object.keys(r.params).forEach((x) => {
199
+ v.push({
200
+ key: x,
201
+ value: r.params[x]
202
+ });
203
+ }), v;
204
+ }
205
+ },
206
+ {
207
+ id: 5,
208
+ name: e("export:message"),
209
+ field: "message",
210
+ width: "200px"
211
+ },
212
+ {
213
+ id: 6,
214
+ name: e("export:log"),
215
+ field: "history",
216
+ width: "300px"
217
+ },
218
+ {
219
+ id: 7,
220
+ name: e("export:file"),
221
+ field: "file",
222
+ type: "file",
223
+ width: "100px",
224
+ style: {
225
+ textAlign: "center"
226
+ },
227
+ headStyle: {
228
+ textAlign: "center"
229
+ }
241
230
  }
242
- }
243
- ];
244
- return {
245
- columnDefs,
246
- getExportFormUrl,
247
- rowData: exportList,
248
- isRowDataLoading: isExportListLoading,
249
- errorMessage,
250
- searchQuery,
251
- handleChange,
252
- pageSize,
253
- pageCount,
254
- pageNumber
231
+ ],
232
+ getExportFormUrl: xe,
233
+ rowData: a,
234
+ isRowDataLoading: o,
235
+ errorMessage: n,
236
+ searchQuery: u,
237
+ handleChange: s,
238
+ pageSize: i,
239
+ pageCount: m,
240
+ pageNumber: f
255
241
  };
256
242
  }
257
243
  });
258
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
259
- const _component_CellHistory = resolveComponent("CellHistory");
260
- const _component_DataTable = resolveComponent("DataTable");
261
- const _component_Page = resolveComponent("Page");
262
- return openBlock(), createBlock(_component_Page, {
263
- title: _ctx.$i18n.t("export:export"),
244
+ function Se(e, t, o, a, n, u) {
245
+ const s = d("CellHistory"), i = d("DataTable"), m = d("Page");
246
+ return c(), b(m, {
247
+ title: e.$i18n.t("export:export"),
264
248
  "header-buttons": [
265
249
  {
266
- text: _ctx.$i18n.t("export:newExport"),
267
- href: _ctx.getExportFormUrl({ exportId: "create" })
250
+ text: e.$i18n.t("export:newExport"),
251
+ href: e.getExportFormUrl({ exportId: "create" })
268
252
  }
269
253
  ]
270
254
  }, {
271
- default: withCtx(() => [
272
- createVNode(_component_DataTable, {
273
- "column-defs": _ctx.columnDefs,
274
- "row-data": _ctx.rowData,
275
- loading: _ctx.isRowDataLoading,
276
- "error-message": _ctx.errorMessage,
255
+ default: L(() => [
256
+ E(i, {
257
+ "column-defs": e.columnDefs,
258
+ "row-data": e.rowData,
259
+ loading: e.isRowDataLoading,
260
+ "error-message": e.errorMessage,
277
261
  pagination: {
278
- pageSize: _ctx.pageSize,
279
- pageCount: _ctx.pageCount,
280
- pageNumber: _ctx.pageNumber,
281
- disabled: _ctx.isRowDataLoading
262
+ pageSize: e.pageSize,
263
+ pageCount: e.pageCount,
264
+ pageNumber: e.pageNumber,
265
+ disabled: e.isRowDataLoading
282
266
  },
283
- "use-search": false,
284
- onChange: _ctx.handleChange
267
+ "use-search": !1,
268
+ onChange: e.handleChange
285
269
  }, {
286
- "cell(history)": withCtx(({ row }) => [
287
- createVNode(_component_CellHistory, {
288
- history: row.history
270
+ "cell(history)": L(({ row: f }) => [
271
+ E(s, {
272
+ history: f.history
289
273
  }, null, 8, ["history"])
290
274
  ]),
291
275
  _: 1
@@ -294,35 +278,31 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
294
278
  _: 1
295
279
  }, 8, ["title", "header-buttons"]);
296
280
  }
297
- var ExportList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
298
- function replaceFileExtension(fileName, newExtension) {
299
- const dotIndex = fileName.lastIndexOf(".");
300
- const fileNameWithoutExtension = fileName.slice(0, dotIndex);
301
- if (newExtension) {
302
- return `${fileNameWithoutExtension}.${newExtension}`;
303
- }
304
- return fileNameWithoutExtension;
281
+ const Ce = /* @__PURE__ */ D(Te, [["render", Se]]);
282
+ function Oe(e, t) {
283
+ const o = e.lastIndexOf("."), a = e.slice(0, o);
284
+ return t ? `${a}.${t}` : a;
305
285
  }
306
- function convertExportFormValuesToCreationPayload(values, templateValues) {
307
- var _a, _b, _c, _d, _e, _f;
286
+ function we(e, t) {
287
+ var o, a, n;
308
288
  return {
309
- strategy: (_b = (_a = values.strategy) == null ? void 0 : _a.value) != null ? _b : "",
310
- filename: values.filename,
311
- format: (_d = (_c = values.format) == null ? void 0 : _c.value) != null ? _d : "",
312
- delimiter: (_f = (_e = values.delimiter) == null ? void 0 : _e.value) != null ? _f : "",
313
- params: templateValues.map((field) => ({
314
- name: field.config.name,
315
- value: universalFieldUtils.getOutgoingValue(field)
289
+ strategy: ((o = e.strategy) == null ? void 0 : o.value) ?? "",
290
+ filename: e.filename,
291
+ format: ((a = e.format) == null ? void 0 : a.value) ?? "",
292
+ delimiter: ((n = e.delimiter) == null ? void 0 : n.value) ?? "",
293
+ params: t.map((u) => ({
294
+ name: u.config.name,
295
+ value: J.getOutgoingValue(u)
316
296
  }))
317
297
  };
318
298
  }
319
- function convertStrategiesToStrategyOptionList(strategies) {
320
- return strategies.map((strategy) => ({
321
- label: strategy.name,
322
- value: strategy.id
299
+ function Re(e) {
300
+ return e.map((t) => ({
301
+ label: t.name,
302
+ value: t.id
323
303
  }));
324
304
  }
325
- const formatOptionList = [
305
+ const X = [
326
306
  { value: "CSV", label: "CSV" },
327
307
  { value: "XLS", label: "XLS" },
328
308
  { value: "XML", label: "XML" },
@@ -330,230 +310,209 @@ const formatOptionList = [
330
310
  { value: "JSON", label: "JSON" },
331
311
  { value: "TXT", label: "TXT" }
332
312
  ];
333
- function isCSVFormat(format) {
334
- return format === "CSV";
313
+ function _(e) {
314
+ return e === "CSV";
335
315
  }
336
- var ExportForm_vue_vue_type_style_index_0_scoped_true_lang = "";
337
- const _sfc_main = defineComponent({
316
+ const De = R({
338
317
  name: "ExportForm",
339
318
  components: {
340
- DynamicField,
341
- FormFooter,
342
- Page,
343
- FormField,
344
- FormFieldSelect
319
+ DynamicField: ie,
320
+ FormFooter: se,
321
+ Page: q,
322
+ FormField: ne,
323
+ FormFieldSelect: ae
345
324
  },
346
325
  setup() {
347
- var _a, _b;
348
- const { t } = useI18n();
349
- useRoute();
350
- const router = useRouter();
351
- const toast = useToast();
352
- const [
353
- fetchStrategies,
354
- { data: strategies, loading: isStrategiesLoading }
355
- ] = useResource({
356
- fetchResource: getStrategies,
326
+ var M;
327
+ const { t: e } = A();
328
+ ue();
329
+ const t = pe(), o = Q(), [
330
+ a,
331
+ { data: n, loading: u }
332
+ ] = W({
333
+ fetchResource: ge,
357
334
  initialValue: [],
358
335
  resourceName: "Strategies"
359
- });
360
- const strategyOptionList = computed(
361
- () => convertStrategiesToStrategyOptionList(strategies.value)
336
+ }), s = S(
337
+ () => Re(n.value)
362
338
  );
363
- onMounted(() => {
364
- fetchStrategies();
339
+ O(() => {
340
+ a();
365
341
  });
366
- const delimiterOptionList = computed(() => [
367
- { value: ",", label: t("export:comma") },
368
- { value: ";", label: t("export:semicolon") }
369
- ]);
370
- const defaultExtension = formatOptionList[0];
371
- const defaultDelimiter = delimiterOptionList.value[0];
372
- const errors = ref({});
373
- const values = ref({
342
+ const i = S(() => [
343
+ { value: ",", label: e("export:comma") },
344
+ { value: ";", label: e("export:semicolon") }
345
+ ]), m = X[0], f = i.value[0], g = h({}), r = h({
374
346
  strategy: null,
375
- filename: `export.${defaultExtension.value.toLowerCase()}`,
376
- format: defaultExtension,
377
- delimiter: defaultDelimiter
378
- });
379
- const isSubmitting = ref(false);
380
- const templateValues = ref([]);
381
- function updateTemplateValues() {
382
- var _a2;
383
- const selectedStrategy = strategies.value.find(
384
- (strategy) => {
385
- var _a3;
386
- return strategy.id === ((_a3 = values.value.strategy) == null ? void 0 : _a3.value);
347
+ filename: `export.${m.value.toLowerCase()}`,
348
+ format: m,
349
+ delimiter: f
350
+ }), v = h(!1), x = h([]);
351
+ function $() {
352
+ const l = n.value.find(
353
+ (p) => {
354
+ var I;
355
+ return p.id === ((I = r.value.strategy) == null ? void 0 : I.value);
387
356
  }
388
- );
389
- const fieldTemplateList = (_a2 = selectedStrategy == null ? void 0 : selectedStrategy.fields) != null ? _a2 : [];
390
- templateValues.value = fieldTemplateList.map(
391
- (fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
357
+ ), y = (l == null ? void 0 : l.fields) ?? [];
358
+ x.value = y.map(
359
+ (p) => J.createFormField(p, null)
392
360
  );
393
361
  }
394
- watch(
395
- () => values.value.strategy,
362
+ k(
363
+ () => r.value.strategy,
396
364
  () => {
397
- updateTemplateValues();
365
+ $();
398
366
  }
399
- );
400
- onMounted(() => {
401
- updateTemplateValues();
367
+ ), O(() => {
368
+ $();
402
369
  });
403
- const shouldDisplayDelimiter = ref(
404
- isCSVFormat((_b = (_a = values.value.format) == null ? void 0 : _a.value) != null ? _b : "")
370
+ const P = h(
371
+ _(((M = r.value.format) == null ? void 0 : M.value) ?? "")
405
372
  );
406
- watch(
407
- () => values.value.format,
373
+ k(
374
+ () => r.value.format,
408
375
  () => {
409
- var _a2, _b2, _c;
410
- const newExtension = (_a2 = values.value.format) == null ? void 0 : _a2.value.toLowerCase();
411
- values.value.filename = replaceFileExtension(
412
- values.value.filename,
413
- newExtension || ""
414
- );
415
- shouldDisplayDelimiter.value = isCSVFormat(
416
- (_c = (_b2 = values.value.format) == null ? void 0 : _b2.value) != null ? _c : ""
376
+ var y, p;
377
+ const l = (y = r.value.format) == null ? void 0 : y.value.toLowerCase();
378
+ r.value.filename = Oe(
379
+ r.value.filename,
380
+ l || ""
381
+ ), P.value = _(
382
+ ((p = r.value.format) == null ? void 0 : p.value) ?? ""
417
383
  );
418
384
  }
419
385
  );
420
- function submitForm(event) {
421
- isSubmitting.value = true;
422
- const creationPayload = convertExportFormValuesToCreationPayload(
423
- values.value,
424
- templateValues.value
386
+ function j(l) {
387
+ v.value = !0;
388
+ const y = we(
389
+ r.value,
390
+ x.value
425
391
  );
426
- createExport(creationPayload).then(() => {
427
- errors.value = {};
428
- if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
429
- navigateBack(router, getExportListUrl());
430
- }
431
- toast.show({
392
+ ve(y).then(() => {
393
+ g.value = {}, (l.type === "create" || l.type === "save" || l.type === "create_exit" || l.type === "save_exit") && K(t, V()), o.show({
432
394
  variant: "success",
433
- title: t("export:success"),
434
- body: t("export:createdSuccessMessage")
395
+ title: e("export:success"),
396
+ body: e("export:createdSuccessMessage")
435
397
  });
436
- }).catch((error) => {
437
- console.error(error);
438
- errors.value = convertRequestErrorToMap(error);
439
- toast.show({
398
+ }).catch((p) => {
399
+ console.error(p), g.value = Z(p), o.show({
440
400
  variant: "danger",
441
- title: t("export:error"),
442
- body: t("export:createdErrorMessage")
401
+ title: e("export:error"),
402
+ body: e("export:createdErrorMessage")
443
403
  });
444
404
  }).finally(() => {
445
- isSubmitting.value = false;
405
+ v.value = !1;
446
406
  });
447
407
  }
448
- const isContentLoading = computed(() => isStrategiesLoading.value);
408
+ const G = S(() => u.value);
449
409
  return {
450
- values,
451
- errors,
452
- isSubmitting,
453
- submitForm,
454
- getExportListUrl,
455
- strategyOptionList,
456
- formatOptionList,
457
- delimiterOptionList,
458
- isContentLoading,
459
- shouldDisplayDelimiter,
460
- templateValues
410
+ values: r,
411
+ errors: g,
412
+ isSubmitting: v,
413
+ submitForm: j,
414
+ getExportListUrl: V,
415
+ strategyOptionList: s,
416
+ formatOptionList: X,
417
+ delimiterOptionList: i,
418
+ isContentLoading: G,
419
+ shouldDisplayDelimiter: P,
420
+ templateValues: x
461
421
  };
462
422
  }
463
- });
464
- const _hoisted_1 = { class: "field" };
465
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
466
- const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
467
- const _component_FormField = resolveComponent("FormField");
468
- const _component_DynamicField = resolveComponent("DynamicField");
469
- const _component_FormFooter = resolveComponent("FormFooter");
470
- const _component_Page = resolveComponent("Page");
471
- return openBlock(), createBlock(_component_Page, {
472
- title: _ctx.$i18n.t("export:newExport"),
473
- "is-content-loading": _ctx.isContentLoading
423
+ }), $e = { class: "field" };
424
+ function Pe(e, t, o, a, n, u) {
425
+ const s = d("FormFieldSelect"), i = d("FormField"), m = d("DynamicField"), f = d("FormFooter"), g = d("Page");
426
+ return c(), b(g, {
427
+ title: e.$i18n.t("export:newExport"),
428
+ "is-content-loading": e.isContentLoading
474
429
  }, {
475
- footer: withCtx(() => [
476
- createVNode(_component_FormFooter, {
477
- "back-href": _ctx.getExportListUrl(),
478
- onSubmit: _ctx.submitForm,
479
- "is-submitting": _ctx.isSubmitting,
480
- "is-creation": true
481
- }, null, 8, ["back-href", "onSubmit", "is-submitting"])
430
+ footer: L(() => [
431
+ E(f, {
432
+ "back-href": e.getExportListUrl(),
433
+ "is-submitting": e.isSubmitting,
434
+ "is-creation": !0,
435
+ onSubmit: e.submitForm
436
+ }, null, 8, ["back-href", "is-submitting", "onSubmit"])
482
437
  ]),
483
- default: withCtx(() => [
484
- createElementVNode("form", {
438
+ default: L(() => [
439
+ C("form", {
485
440
  novalidate: "",
486
- onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
441
+ onSubmit: t[4] || (t[4] = te(() => {
487
442
  }, ["prevent"]))
488
443
  }, [
489
- createVNode(_component_FormFieldSelect, {
490
- value: _ctx.values.strategy,
491
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.strategy = $event),
444
+ E(s, {
445
+ value: e.values.strategy,
446
+ "onUpdate:value": t[0] || (t[0] = (r) => e.values.strategy = r),
492
447
  name: "exportType",
493
- error: _ctx.errors.strategy,
494
- label: _ctx.$i18n.t("export:exportType"),
495
- options: _ctx.strategyOptionList
448
+ error: e.errors.strategy,
449
+ label: e.$i18n.t("export:exportType"),
450
+ options: e.strategyOptionList
496
451
  }, null, 8, ["value", "error", "label", "options"]),
497
- createElementVNode("div", _hoisted_1, [
498
- createVNode(_component_FormField, {
499
- value: _ctx.values.filename,
500
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.filename = $event),
501
- error: _ctx.errors.filename,
502
- label: _ctx.$i18n.t("export:filename"),
452
+ C("div", $e, [
453
+ E(i, {
454
+ value: e.values.filename,
455
+ "onUpdate:value": t[1] || (t[1] = (r) => e.values.filename = r),
456
+ error: e.errors.filename,
457
+ label: e.$i18n.t("export:filename"),
503
458
  name: "filename"
504
459
  }, null, 8, ["value", "error", "label"]),
505
- createVNode(_component_FormFieldSelect, {
506
- value: _ctx.values.format,
507
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.format = $event),
508
- options: _ctx.formatOptionList,
509
- error: _ctx.errors.format,
510
- label: _ctx.$i18n.t("export:format"),
460
+ E(s, {
461
+ value: e.values.format,
462
+ "onUpdate:value": t[2] || (t[2] = (r) => e.values.format = r),
463
+ options: e.formatOptionList,
464
+ error: e.errors.format,
465
+ label: e.$i18n.t("export:format"),
511
466
  name: "format"
512
467
  }, null, 8, ["value", "options", "error", "label"]),
513
- _ctx.shouldDisplayDelimiter ? (openBlock(), createBlock(_component_FormFieldSelect, {
468
+ e.shouldDisplayDelimiter ? (c(), b(s, {
514
469
  key: 0,
515
- value: _ctx.values.delimiter,
516
- "onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.delimiter = $event),
517
- options: _ctx.delimiterOptionList,
518
- error: _ctx.errors.delimiter,
519
- label: _ctx.$i18n.t("export:delimiter"),
470
+ value: e.values.delimiter,
471
+ "onUpdate:value": t[3] || (t[3] = (r) => e.values.delimiter = r),
472
+ options: e.delimiterOptionList,
473
+ error: e.errors.delimiter,
474
+ label: e.$i18n.t("export:delimiter"),
520
475
  name: "delimiter"
521
- }, null, 8, ["value", "options", "error", "label"])) : createCommentVNode("", true)
476
+ }, null, 8, ["value", "options", "error", "label"])) : H("", !0)
522
477
  ]),
523
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templateValues, (field) => {
524
- return openBlock(), createBlock(_component_DynamicField, {
525
- key: field.config.name,
526
- field
527
- }, null, 8, ["field"]);
528
- }), 128))
478
+ (c(!0), F(z, null, B(e.templateValues, (r) => (c(), b(m, {
479
+ key: r.config.name,
480
+ field: r
481
+ }, null, 8, ["field"]))), 128))
529
482
  ], 32)
530
483
  ]),
531
484
  _: 1
532
485
  }, 8, ["title", "is-content-loading"]);
533
486
  }
534
- var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-559849fa"]]);
535
- const EXPORT_LIST_ROUTE = {
536
- path: EXPORT_ROUTE_PATHS.EXPORT_LIST,
537
- component: ExportList,
487
+ const Me = /* @__PURE__ */ D(De, [["render", Pe], ["__scopeId", "data-v-5784f168"]]), Ie = {
488
+ path: T.EXPORT_LIST,
489
+ component: Ce,
538
490
  name: "Export List",
539
491
  meta: {
540
- getBreadcrumbs: (route, i18n2) => [
541
- { url: "/", text: i18n2.t("export:home") },
542
- { url: route.path, text: i18n2.t("export:export") }
492
+ getBreadcrumbs: (e, t) => [
493
+ { url: "/", text: t.t("export:home") },
494
+ { url: e.path, text: t.t("export:export") }
543
495
  ]
544
496
  }
545
- };
546
- const EXPORT_FORM_ROUTE = {
547
- path: EXPORT_ROUTE_PATHS.EXPORT_FORM,
548
- component: ExportForm,
497
+ }, ze = {
498
+ path: T.EXPORT_FORM,
499
+ component: Me,
549
500
  name: "Export Form",
550
501
  meta: {
551
- getBreadcrumbs: (route, i18n2) => [
552
- { url: "/", text: i18n2.t("export:home") },
553
- { url: EXPORT_LIST_ROUTE.path, text: i18n2.t("export:export") },
554
- { url: route.path, text: i18n2.t("export:newExport") }
502
+ getBreadcrumbs: (e, t) => [
503
+ { url: "/", text: t.t("export:home") },
504
+ { url: Ie.path, text: t.t("export:export") },
505
+ { url: e.path, text: t.t("export:newExport") }
555
506
  ]
556
507
  }
557
508
  };
558
- applyTranslations();
559
- export { EXPORT_FORM_ROUTE, EXPORT_LIST_ROUTE, createExport, getExportFormUrl, getExportList, getExportListUrl, getStrategies };
509
+ ce();
510
+ export {
511
+ ze as EXPORT_FORM_ROUTE,
512
+ Ie as EXPORT_LIST_ROUTE,
513
+ ve as createExport,
514
+ xe as getExportFormUrl,
515
+ fe as getExportList,
516
+ V as getExportListUrl,
517
+ ge as getStrategies
518
+ };