@tager/admin-export 1.0.4 → 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,159 +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;
165
+ return O(() => {
166
+ t();
167
+ }), {
168
+ columnDefs: [
169
+ {
170
+ id: 1,
171
+ name: "ID",
172
+ field: "id",
173
+ width: "50px"
174
+ },
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
+ }
216
230
  }
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
- }
237
- ];
238
- return {
239
- columnDefs,
240
- getExportFormUrl,
241
- rowData: exportList,
242
- isRowDataLoading: isExportListLoading,
243
- errorMessage,
244
- searchQuery,
245
- handleChange,
246
- pageSize,
247
- pageCount,
248
- 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
249
241
  };
250
242
  }
251
243
  });
252
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
253
- const _component_CellHistory = resolveComponent("CellHistory");
254
- const _component_DataTable = resolveComponent("DataTable");
255
- const _component_Page = resolveComponent("Page");
256
- return openBlock(), createBlock(_component_Page, {
257
- 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"),
258
248
  "header-buttons": [
259
249
  {
260
- text: _ctx.$i18n.t("export:newExport"),
261
- href: _ctx.getExportFormUrl({ exportId: "create" })
250
+ text: e.$i18n.t("export:newExport"),
251
+ href: e.getExportFormUrl({ exportId: "create" })
262
252
  }
263
253
  ]
264
254
  }, {
265
- default: withCtx(() => [
266
- createVNode(_component_DataTable, {
267
- "column-defs": _ctx.columnDefs,
268
- "row-data": _ctx.rowData,
269
- loading: _ctx.isRowDataLoading,
270
- "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,
271
261
  pagination: {
272
- pageSize: _ctx.pageSize,
273
- pageCount: _ctx.pageCount,
274
- pageNumber: _ctx.pageNumber,
275
- disabled: _ctx.isRowDataLoading
262
+ pageSize: e.pageSize,
263
+ pageCount: e.pageCount,
264
+ pageNumber: e.pageNumber,
265
+ disabled: e.isRowDataLoading
276
266
  },
277
- "use-search": false,
278
- onChange: _ctx.handleChange
267
+ "use-search": !1,
268
+ onChange: e.handleChange
279
269
  }, {
280
- "cell(history)": withCtx(({ row }) => [
281
- createVNode(_component_CellHistory, {
282
- history: row.history
270
+ "cell(history)": L(({ row: f }) => [
271
+ E(s, {
272
+ history: f.history
283
273
  }, null, 8, ["history"])
284
274
  ]),
285
275
  _: 1
@@ -288,35 +278,31 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
288
278
  _: 1
289
279
  }, 8, ["title", "header-buttons"]);
290
280
  }
291
- var ExportList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
292
- function replaceFileExtension(fileName, newExtension) {
293
- const dotIndex = fileName.lastIndexOf(".");
294
- const fileNameWithoutExtension = fileName.slice(0, dotIndex);
295
- if (newExtension) {
296
- return `${fileNameWithoutExtension}.${newExtension}`;
297
- }
298
- 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;
299
285
  }
300
- function convertExportFormValuesToCreationPayload(values, templateValues) {
301
- var _a, _b, _c, _d, _e, _f;
286
+ function we(e, t) {
287
+ var o, a, n;
302
288
  return {
303
- strategy: (_b = (_a = values.strategy) == null ? void 0 : _a.value) != null ? _b : "",
304
- filename: values.filename,
305
- format: (_d = (_c = values.format) == null ? void 0 : _c.value) != null ? _d : "",
306
- delimiter: (_f = (_e = values.delimiter) == null ? void 0 : _e.value) != null ? _f : "",
307
- params: templateValues.map((field) => ({
308
- name: field.config.name,
309
- 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)
310
296
  }))
311
297
  };
312
298
  }
313
- function convertStrategiesToStrategyOptionList(strategies) {
314
- return strategies.map((strategy) => ({
315
- label: strategy.name,
316
- value: strategy.id
299
+ function Re(e) {
300
+ return e.map((t) => ({
301
+ label: t.name,
302
+ value: t.id
317
303
  }));
318
304
  }
319
- const formatOptionList = [
305
+ const X = [
320
306
  { value: "CSV", label: "CSV" },
321
307
  { value: "XLS", label: "XLS" },
322
308
  { value: "XML", label: "XML" },
@@ -324,230 +310,209 @@ const formatOptionList = [
324
310
  { value: "JSON", label: "JSON" },
325
311
  { value: "TXT", label: "TXT" }
326
312
  ];
327
- function isCSVFormat(format) {
328
- return format === "CSV";
313
+ function _(e) {
314
+ return e === "CSV";
329
315
  }
330
- var ExportForm_vue_vue_type_style_index_0_scoped_true_lang = "";
331
- const _sfc_main = defineComponent({
316
+ const De = R({
332
317
  name: "ExportForm",
333
318
  components: {
334
- DynamicField,
335
- FormFooter,
336
- Page,
337
- FormField,
338
- FormFieldSelect
319
+ DynamicField: ie,
320
+ FormFooter: se,
321
+ Page: q,
322
+ FormField: ne,
323
+ FormFieldSelect: ae
339
324
  },
340
325
  setup() {
341
- var _a, _b;
342
- const { t } = useI18n();
343
- useRoute();
344
- const router = useRouter();
345
- const toast = useToast();
346
- const [
347
- fetchStrategies,
348
- { data: strategies, loading: isStrategiesLoading }
349
- ] = useResource({
350
- 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,
351
334
  initialValue: [],
352
335
  resourceName: "Strategies"
353
- });
354
- const strategyOptionList = computed(
355
- () => convertStrategiesToStrategyOptionList(strategies.value)
336
+ }), s = S(
337
+ () => Re(n.value)
356
338
  );
357
- onMounted(() => {
358
- fetchStrategies();
339
+ O(() => {
340
+ a();
359
341
  });
360
- const delimiterOptionList = computed(() => [
361
- { value: ",", label: t("export:comma") },
362
- { value: ";", label: t("export:semicolon") }
363
- ]);
364
- const defaultExtension = formatOptionList[0];
365
- const defaultDelimiter = delimiterOptionList.value[0];
366
- const errors = ref({});
367
- 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({
368
346
  strategy: null,
369
- filename: `export.${defaultExtension.value.toLowerCase()}`,
370
- format: defaultExtension,
371
- delimiter: defaultDelimiter
372
- });
373
- const isSubmitting = ref(false);
374
- const templateValues = ref([]);
375
- function updateTemplateValues() {
376
- var _a2;
377
- const selectedStrategy = strategies.value.find(
378
- (strategy) => {
379
- var _a3;
380
- 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);
381
356
  }
382
- );
383
- const fieldTemplateList = (_a2 = selectedStrategy == null ? void 0 : selectedStrategy.fields) != null ? _a2 : [];
384
- templateValues.value = fieldTemplateList.map(
385
- (fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
357
+ ), y = (l == null ? void 0 : l.fields) ?? [];
358
+ x.value = y.map(
359
+ (p) => J.createFormField(p, null)
386
360
  );
387
361
  }
388
- watch(
389
- () => values.value.strategy,
362
+ k(
363
+ () => r.value.strategy,
390
364
  () => {
391
- updateTemplateValues();
365
+ $();
392
366
  }
393
- );
394
- onMounted(() => {
395
- updateTemplateValues();
367
+ ), O(() => {
368
+ $();
396
369
  });
397
- const shouldDisplayDelimiter = ref(
398
- 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) ?? "")
399
372
  );
400
- watch(
401
- () => values.value.format,
373
+ k(
374
+ () => r.value.format,
402
375
  () => {
403
- var _a2, _b2, _c;
404
- const newExtension = (_a2 = values.value.format) == null ? void 0 : _a2.value.toLowerCase();
405
- values.value.filename = replaceFileExtension(
406
- values.value.filename,
407
- newExtension || ""
408
- );
409
- shouldDisplayDelimiter.value = isCSVFormat(
410
- (_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) ?? ""
411
383
  );
412
384
  }
413
385
  );
414
- function submitForm(event) {
415
- isSubmitting.value = true;
416
- const creationPayload = convertExportFormValuesToCreationPayload(
417
- values.value,
418
- templateValues.value
386
+ function j(l) {
387
+ v.value = !0;
388
+ const y = we(
389
+ r.value,
390
+ x.value
419
391
  );
420
- createExport(creationPayload).then(() => {
421
- errors.value = {};
422
- if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
423
- navigateBack(router, getExportListUrl());
424
- }
425
- 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({
426
394
  variant: "success",
427
- title: t("export:success"),
428
- body: t("export:createdSuccessMessage")
395
+ title: e("export:success"),
396
+ body: e("export:createdSuccessMessage")
429
397
  });
430
- }).catch((error) => {
431
- console.error(error);
432
- errors.value = convertRequestErrorToMap(error);
433
- toast.show({
398
+ }).catch((p) => {
399
+ console.error(p), g.value = Z(p), o.show({
434
400
  variant: "danger",
435
- title: t("export:error"),
436
- body: t("export:createdErrorMessage")
401
+ title: e("export:error"),
402
+ body: e("export:createdErrorMessage")
437
403
  });
438
404
  }).finally(() => {
439
- isSubmitting.value = false;
405
+ v.value = !1;
440
406
  });
441
407
  }
442
- const isContentLoading = computed(() => isStrategiesLoading.value);
408
+ const G = S(() => u.value);
443
409
  return {
444
- values,
445
- errors,
446
- isSubmitting,
447
- submitForm,
448
- getExportListUrl,
449
- strategyOptionList,
450
- formatOptionList,
451
- delimiterOptionList,
452
- isContentLoading,
453
- shouldDisplayDelimiter,
454
- 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
455
421
  };
456
422
  }
457
- });
458
- const _hoisted_1 = { class: "field" };
459
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
460
- const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
461
- const _component_FormField = resolveComponent("FormField");
462
- const _component_DynamicField = resolveComponent("DynamicField");
463
- const _component_FormFooter = resolveComponent("FormFooter");
464
- const _component_Page = resolveComponent("Page");
465
- return openBlock(), createBlock(_component_Page, {
466
- title: _ctx.$i18n.t("export:newExport"),
467
- "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
468
429
  }, {
469
- footer: withCtx(() => [
470
- createVNode(_component_FormFooter, {
471
- "back-href": _ctx.getExportListUrl(),
472
- onSubmit: _ctx.submitForm,
473
- "is-submitting": _ctx.isSubmitting,
474
- "is-creation": true
475
- }, 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"])
476
437
  ]),
477
- default: withCtx(() => [
478
- createElementVNode("form", {
438
+ default: L(() => [
439
+ C("form", {
479
440
  novalidate: "",
480
- onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
441
+ onSubmit: t[4] || (t[4] = te(() => {
481
442
  }, ["prevent"]))
482
443
  }, [
483
- createVNode(_component_FormFieldSelect, {
484
- value: _ctx.values.strategy,
485
- "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),
486
447
  name: "exportType",
487
- error: _ctx.errors.strategy,
488
- label: _ctx.$i18n.t("export:exportType"),
489
- options: _ctx.strategyOptionList
448
+ error: e.errors.strategy,
449
+ label: e.$i18n.t("export:exportType"),
450
+ options: e.strategyOptionList
490
451
  }, null, 8, ["value", "error", "label", "options"]),
491
- createElementVNode("div", _hoisted_1, [
492
- createVNode(_component_FormField, {
493
- value: _ctx.values.filename,
494
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.filename = $event),
495
- error: _ctx.errors.filename,
496
- 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"),
497
458
  name: "filename"
498
459
  }, null, 8, ["value", "error", "label"]),
499
- createVNode(_component_FormFieldSelect, {
500
- value: _ctx.values.format,
501
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.format = $event),
502
- options: _ctx.formatOptionList,
503
- error: _ctx.errors.format,
504
- 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"),
505
466
  name: "format"
506
467
  }, null, 8, ["value", "options", "error", "label"]),
507
- _ctx.shouldDisplayDelimiter ? (openBlock(), createBlock(_component_FormFieldSelect, {
468
+ e.shouldDisplayDelimiter ? (c(), b(s, {
508
469
  key: 0,
509
- value: _ctx.values.delimiter,
510
- "onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.delimiter = $event),
511
- options: _ctx.delimiterOptionList,
512
- error: _ctx.errors.delimiter,
513
- 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"),
514
475
  name: "delimiter"
515
- }, null, 8, ["value", "options", "error", "label"])) : createCommentVNode("", true)
476
+ }, null, 8, ["value", "options", "error", "label"])) : H("", !0)
516
477
  ]),
517
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templateValues, (field) => {
518
- return openBlock(), createBlock(_component_DynamicField, {
519
- key: field.config.name,
520
- field
521
- }, null, 8, ["field"]);
522
- }), 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))
523
482
  ], 32)
524
483
  ]),
525
484
  _: 1
526
485
  }, 8, ["title", "is-content-loading"]);
527
486
  }
528
- var ExportForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-559849fa"]]);
529
- const EXPORT_LIST_ROUTE = {
530
- path: EXPORT_ROUTE_PATHS.EXPORT_LIST,
531
- component: ExportList,
487
+ const Me = /* @__PURE__ */ D(De, [["render", Pe], ["__scopeId", "data-v-5784f168"]]), Ie = {
488
+ path: T.EXPORT_LIST,
489
+ component: Ce,
532
490
  name: "Export List",
533
491
  meta: {
534
- getBreadcrumbs: (route, i18n2) => [
535
- { url: "/", text: i18n2.t("export:home") },
536
- { 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") }
537
495
  ]
538
496
  }
539
- };
540
- const EXPORT_FORM_ROUTE = {
541
- path: EXPORT_ROUTE_PATHS.EXPORT_FORM,
542
- component: ExportForm,
497
+ }, ze = {
498
+ path: T.EXPORT_FORM,
499
+ component: Me,
543
500
  name: "Export Form",
544
501
  meta: {
545
- getBreadcrumbs: (route, i18n2) => [
546
- { url: "/", text: i18n2.t("export:home") },
547
- { url: EXPORT_LIST_ROUTE.path, text: i18n2.t("export:export") },
548
- { 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") }
549
506
  ]
550
507
  }
551
508
  };
552
- applyTranslations();
553
- 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
+ };