@tager/admin-export 0.1.5 → 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 (52) 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 -25
  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 -26
  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 -11
  18. package/dist/views/ExportForm/ExportForm.types.d.ts +7 -7
  19. package/dist/views/ExportForm/ExportForm.vue.d.ts +2693 -9248
  20. package/dist/views/ExportForm/index.d.ts +1 -1
  21. package/dist/views/ExportList/ExportList.vue.d.ts +16 -38
  22. package/dist/views/ExportList/components/CellHistory/CellHistory.helpers.d.ts +1 -1
  23. package/dist/views/ExportList/components/CellHistory/CellHistory.vue.d.ts +19 -230
  24. package/dist/views/ExportList/components/CellHistory/index.d.ts +1 -1
  25. package/dist/views/ExportList/index.d.ts +1 -1
  26. package/package.json +49 -48
  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 +1 -4
  34. package/src/locales/ru.ts +2 -5
  35. package/src/main.ts +2 -6
  36. package/src/views/ExportForm/ExportForm.helpers.ts +0 -2
  37. package/src/views/ExportForm/ExportForm.vue +111 -106
  38. package/src/views/ExportList/ExportList.vue +46 -43
  39. package/src/views/ExportList/components/CellHistory/CellHistory.helpers.ts +2 -2
  40. package/src/views/ExportList/components/CellHistory/CellHistory.vue +4 -7
  41. package/README.md +0 -0
  42. package/dist/dev.d.ts +0 -1
  43. package/dist/index.esm.js +0 -3702
  44. package/dist/index.umd.js +0 -3714
  45. package/dist/views/ExportList/components/CellHistory/CellHistory.types.d.ts +0 -4
  46. package/src/config/config.json +0 -20
  47. package/src/dev.ts +0 -41
  48. package/src/typings/sfc.d.ts +0 -12
  49. package/src/typings/shims-tsx.d.ts +0 -13
  50. package/src/typings/shims-vue.d.ts +0 -11
  51. package/src/views/App.vue +0 -36
  52. package/src/views/ExportList/components/CellHistory/CellHistory.types.ts +0 -5
package/dist/index.esm.js DELETED
@@ -1,3702 +0,0 @@
1
- import { request, createId, isNotNullish, useResource, convertRequestErrorToMap, i18n } from '@tager/admin-services';
2
- import { defineComponent, onMounted, ref, computed, watch } from '@vue/composition-api';
3
- import { useTranslation, useDataTable, BaseTable, BaseButton, SvgIcon, useLocalStorage, FormFieldFileInput, MapField, ButtonField, FormFieldColorInput, FormFieldMultiSelect, AjaxSelect, FormFieldSelect, FormFieldCheckbox, FormFieldRichTextInput, FormField, FormFieldNumberInput, DateTimeInput, FormFooter } from '@tager/admin-ui';
4
- import { compile } from 'path-to-regexp';
5
- import Vue from 'vue';
6
- import kebabCase from 'lodash.kebabcase';
7
-
8
- const EN = {
9
- home: 'Home',
10
- exportAndImport: 'Export / Import',
11
- export: 'Export',
12
- exportList: 'Export List',
13
- exportForm: 'Export Form',
14
- type: 'Type',
15
- exportType: 'Export type',
16
- status: 'status',
17
- message: 'Message',
18
- log: 'Log',
19
- file: 'file',
20
- newExport: 'New export',
21
- exportCreation: 'Export creation',
22
- success: 'Success',
23
- error: 'Error',
24
- createdSuccessMessage: 'Export has been successfully created',
25
- createdErrorMessage: 'Export creation has been failed',
26
- filename: 'File name',
27
- format: 'Format',
28
- delimiter: 'Delimiter',
29
- comma: 'Comma',
30
- semicolon: 'Semicolon',
31
- };
32
-
33
- const RU = {
34
- home: 'Главная',
35
- exportAndImport: 'Экспорт / Импорт',
36
- export: 'Экспорт',
37
- exportList: 'Список экспортов',
38
- exportForm: 'Форма экспорта',
39
- type: 'Тип',
40
- exportType: 'Тип экспорта',
41
- status: 'Статус',
42
- message: 'Сообщение',
43
- log: 'Лог',
44
- file: 'Файл',
45
- newExport: 'Новый экспорт',
46
- exportCreation: 'Создание экспорта',
47
- success: 'Успех',
48
- error: 'Ошибка',
49
- createdSuccessMessage: 'Экспорт была успешно создан',
50
- createdErrorMessage: 'Создание экспорта не удалось',
51
- filename: 'Имя файла',
52
- format: 'Формат',
53
- delimiter: 'Разделитель',
54
- comma: 'Запятая',
55
- semicolon: 'Точка с запятой',
56
- };
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
-
68
- const EXPORT_ROUTE_PATHS = {
69
- EXPORT_LIST: '/export',
70
- EXPORT_FORM: '/export/:exportId',
71
- };
72
-
73
- function getExportListUrl() {
74
- return EXPORT_ROUTE_PATHS.EXPORT_LIST;
75
- }
76
- function getExportFormUrl(params) {
77
- return compile(EXPORT_ROUTE_PATHS.EXPORT_FORM)(params);
78
- }
79
-
80
- function dateTimeFormat(value) {
81
- const options = {
82
- year: 'numeric',
83
- month: 'numeric',
84
- day: 'numeric',
85
- hour: 'numeric',
86
- minute: 'numeric',
87
- second: 'numeric',
88
- };
89
- const date = new Date(value);
90
- return new Intl.DateTimeFormat('ru-RU', options).format(date);
91
- }
92
-
93
- var script = defineComponent({
94
- name: 'CellHistory',
95
- props: {
96
- history: {
97
- type: Array,
98
- default: () => [],
99
- },
100
- },
101
- setup() {
102
- return {
103
- dateTimeFormat,
104
- };
105
- },
106
- });
107
-
108
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
109
- if (typeof shadowMode !== 'boolean') {
110
- createInjectorSSR = createInjector;
111
- createInjector = shadowMode;
112
- shadowMode = false;
113
- }
114
- // Vue.extend constructor export interop.
115
- const options = typeof script === 'function' ? script.options : script;
116
- // render functions
117
- if (template && template.render) {
118
- options.render = template.render;
119
- options.staticRenderFns = template.staticRenderFns;
120
- options._compiled = true;
121
- // functional template
122
- if (isFunctionalTemplate) {
123
- options.functional = true;
124
- }
125
- }
126
- // scopedId
127
- if (scopeId) {
128
- options._scopeId = scopeId;
129
- }
130
- let hook;
131
- if (moduleIdentifier) {
132
- // server build
133
- hook = function (context) {
134
- // 2.3 injection
135
- context =
136
- context || // cached call
137
- (this.$vnode && this.$vnode.ssrContext) || // stateful
138
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
139
- // 2.2 with runInNewContext: true
140
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
141
- context = __VUE_SSR_CONTEXT__;
142
- }
143
- // inject component styles
144
- if (style) {
145
- style.call(this, createInjectorSSR(context));
146
- }
147
- // register component module identifier for async chunk inference
148
- if (context && context._registeredComponents) {
149
- context._registeredComponents.add(moduleIdentifier);
150
- }
151
- };
152
- // used by ssr in case component is cached and beforeCreate
153
- // never gets called
154
- options._ssrRegister = hook;
155
- }
156
- else if (style) {
157
- hook = shadowMode
158
- ? function (context) {
159
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
160
- }
161
- : function (context) {
162
- style.call(this, createInjector(context));
163
- };
164
- }
165
- if (hook) {
166
- if (options.functional) {
167
- // register for functional component in vue file
168
- const originalRender = options.render;
169
- options.render = function renderWithStyleInjection(h, context) {
170
- hook.call(context);
171
- return originalRender(h, context);
172
- };
173
- }
174
- else {
175
- // inject component registration as beforeCreate hook
176
- const existing = options.beforeCreate;
177
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
178
- }
179
- }
180
- return script;
181
- }
182
-
183
- const isOldIE = typeof navigator !== 'undefined' &&
184
- /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
185
- function createInjector(context) {
186
- return (id, style) => addStyle(id, style);
187
- }
188
- let HEAD;
189
- const styles = {};
190
- function addStyle(id, css) {
191
- const group = isOldIE ? css.media || 'default' : id;
192
- const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
193
- if (!style.ids.has(id)) {
194
- style.ids.add(id);
195
- let code = css.source;
196
- if (css.map) {
197
- // https://developer.chrome.com/devtools/docs/javascript-debugging
198
- // this makes source maps inside style tags work properly in Chrome
199
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
200
- // http://stackoverflow.com/a/26603875
201
- code +=
202
- '\n/*# sourceMappingURL=data:application/json;base64,' +
203
- btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
204
- ' */';
205
- }
206
- if (!style.element) {
207
- style.element = document.createElement('style');
208
- style.element.type = 'text/css';
209
- if (css.media)
210
- style.element.setAttribute('media', css.media);
211
- if (HEAD === undefined) {
212
- HEAD = document.head || document.getElementsByTagName('head')[0];
213
- }
214
- HEAD.appendChild(style.element);
215
- }
216
- if ('styleSheet' in style.element) {
217
- style.styles.push(code);
218
- style.element.styleSheet.cssText = style.styles
219
- .filter(Boolean)
220
- .join('\n');
221
- }
222
- else {
223
- const index = style.ids.size - 1;
224
- const textNode = document.createTextNode(code);
225
- const nodes = style.element.childNodes;
226
- if (nodes[index])
227
- style.element.removeChild(nodes[index]);
228
- if (nodes.length)
229
- style.element.insertBefore(textNode, nodes[index]);
230
- else
231
- style.element.appendChild(textNode);
232
- }
233
- }
234
- }
235
-
236
- /* script */
237
- const __vue_script__ = script;
238
-
239
- /* template */
240
- var __vue_render__ = function () {
241
- var _vm = this;
242
- var _h = _vm.$createElement;
243
- var _c = _vm._self._c || _h;
244
- return _vm.history.length > 0
245
- ? _c(
246
- "ul",
247
- _vm._l(_vm.history, function (history, index) {
248
- return _c("li", { key: index }, [
249
- _c("span", { staticClass: "name" }, [
250
- _vm._v("\n " + _vm._s(history.status) + "\n "),
251
- ]),
252
- _vm._v(
253
- "\n " + _vm._s(_vm.dateTimeFormat(history.datetime)) + "\n "
254
- ),
255
- ])
256
- }),
257
- 0
258
- )
259
- : _vm._e()
260
- };
261
- var __vue_staticRenderFns__ = [];
262
- __vue_render__._withStripped = true;
263
-
264
- /* style */
265
- const __vue_inject_styles__ = function (inject) {
266
- if (!inject) return
267
- inject("data-v-0859f4f6_0", { source: ".name[data-v-0859f4f6] {\n display: inline-block;\n width: 100px;\n}\n\n/*# sourceMappingURL=CellHistory.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-export/tager-admin-export/src/views/ExportList/components/CellHistory/CellHistory.vue","CellHistory.vue"],"names":[],"mappings":"AAoCA;EACA,qBAAA;EACA,YAAA;ACnCA;;AAEA,0CAA0C","file":"CellHistory.vue","sourcesContent":["<template>\n <ul v-if=\"history.length > 0\">\n <li v-for=\"(history, index) of history\" :key=\"index\">\n <span class=\"name\">\n {{ history.status }}\n </span>\n {{ dateTimeFormat(history.datetime) }}\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from '@vue/composition-api';\n\nimport { HistoryType } from '../../../../typings/model';\n\nimport { Props } from './CellHistory.types';\nimport { dateTimeFormat } from './CellHistory.helpers';\n\nexport default defineComponent<Props>({\n name: 'CellHistory',\n props: {\n history: {\n type: Array as PropType<HistoryType[]>,\n default: () => [],\n },\n },\n setup() {\n return {\n dateTimeFormat,\n };\n },\n});\n</script>\n\n<style lang=\"scss\" scoped>\n.name {\n display: inline-block;\n width: 100px;\n}\n</style>\n",".name {\n display: inline-block;\n width: 100px;\n}\n\n/*# sourceMappingURL=CellHistory.vue.map */"]}, media: undefined });
268
-
269
- };
270
- /* scoped */
271
- const __vue_scope_id__ = "data-v-0859f4f6";
272
- /* module identifier */
273
- const __vue_module_identifier__ = undefined;
274
- /* functional template */
275
- const __vue_is_functional_template__ = false;
276
- /* style inject SSR */
277
-
278
- /* style inject shadow dom */
279
-
280
-
281
-
282
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
283
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
284
- __vue_inject_styles__,
285
- __vue_script__,
286
- __vue_scope_id__,
287
- __vue_is_functional_template__,
288
- __vue_module_identifier__,
289
- false,
290
- createInjector,
291
- undefined,
292
- undefined
293
- );
294
-
295
- var script$1 = defineComponent({
296
- name: 'ExportList',
297
- components: { CellHistory: __vue_component__ },
298
- setup(props, context) {
299
- const { t } = useTranslation(context);
300
- const { fetchEntityList: fetchExportList, isLoading: isExportListLoading, rowData: exportList, errorMessage, searchQuery, handleChange, pageSize, pageCount, pageNumber, } = useDataTable({
301
- fetchEntityList: (params) => getExportList({
302
- pageNumber: params.pageNumber,
303
- pageSize: params.pageSize,
304
- }),
305
- initialValue: [],
306
- context,
307
- resourceName: 'Export list',
308
- pageSize: 100,
309
- });
310
- onMounted(() => {
311
- fetchExportList();
312
- });
313
- const columnDefs = [
314
- {
315
- id: 1,
316
- name: 'ID',
317
- field: 'id',
318
- style: { width: '50px', textAlign: 'center' },
319
- headStyle: { width: '50px', textAlign: 'center' },
320
- },
321
- {
322
- id: 2,
323
- name: t('export:type'),
324
- field: 'strategy',
325
- style: { width: '15%' },
326
- headStyle: { width: '15%' },
327
- },
328
- {
329
- id: 3,
330
- name: t('export:status'),
331
- field: 'status',
332
- style: { width: '15%' },
333
- headStyle: { width: '15%' },
334
- },
335
- {
336
- id: 4,
337
- name: t('export:message'),
338
- field: 'message',
339
- },
340
- {
341
- id: 5,
342
- name: t('export:log'),
343
- field: 'history',
344
- style: { width: '25%' },
345
- headStyle: { width: '25%' },
346
- },
347
- {
348
- id: 6,
349
- name: t('export:file'),
350
- field: 'file',
351
- type: 'file',
352
- style: { width: '150px', textAlign: 'center' },
353
- headStyle: { width: '150px', textAlign: 'center' },
354
- },
355
- ];
356
- return {
357
- columnDefs,
358
- getExportFormUrl,
359
- rowData: exportList,
360
- isRowDataLoading: isExportListLoading,
361
- errorMessage: errorMessage,
362
- searchQuery,
363
- handleChange,
364
- pageSize,
365
- pageCount,
366
- pageNumber,
367
- };
368
- },
369
- });
370
-
371
- /* script */
372
- const __vue_script__$1 = script$1;
373
-
374
- /* template */
375
- var __vue_render__$1 = function () {
376
- var _vm = this;
377
- var _h = _vm.$createElement;
378
- var _c = _vm._self._c || _h;
379
- return _c(
380
- "page",
381
- {
382
- attrs: {
383
- title: _vm.$t("export:export"),
384
- "header-buttons": [
385
- {
386
- text: _vm.$t("export:newExport"),
387
- href: _vm.getExportFormUrl({ exportId: "create" }),
388
- },
389
- ],
390
- },
391
- },
392
- [
393
- _c("data-table", {
394
- attrs: {
395
- "column-defs": _vm.columnDefs,
396
- "row-data": _vm.rowData,
397
- loading: _vm.isRowDataLoading,
398
- "error-message": _vm.errorMessage,
399
- pagination: {
400
- pageSize: _vm.pageSize,
401
- pageCount: _vm.pageCount,
402
- pageNumber: _vm.pageNumber,
403
- disabled: _vm.isRowDataLoading,
404
- },
405
- "use-search": false,
406
- },
407
- on: { change: _vm.handleChange },
408
- scopedSlots: _vm._u([
409
- {
410
- key: "cell(history)",
411
- fn: function (ref) {
412
- var row = ref.row;
413
- return [_c("CellHistory", { attrs: { history: row.history } })]
414
- },
415
- },
416
- ]),
417
- }),
418
- ],
419
- 1
420
- )
421
- };
422
- var __vue_staticRenderFns__$1 = [];
423
- __vue_render__$1._withStripped = true;
424
-
425
- /* style */
426
- const __vue_inject_styles__$1 = undefined;
427
- /* scoped */
428
- const __vue_scope_id__$1 = undefined;
429
- /* module identifier */
430
- const __vue_module_identifier__$1 = undefined;
431
- /* functional template */
432
- const __vue_is_functional_template__$1 = false;
433
- /* style inject */
434
-
435
- /* style inject SSR */
436
-
437
- /* style inject shadow dom */
438
-
439
-
440
-
441
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
442
- { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
443
- __vue_inject_styles__$1,
444
- __vue_script__$1,
445
- __vue_scope_id__$1,
446
- __vue_is_functional_template__$1,
447
- __vue_module_identifier__$1,
448
- false,
449
- undefined,
450
- undefined,
451
- undefined
452
- );
453
-
454
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
455
- try {
456
- var info = gen[key](arg);
457
- var value = info.value;
458
- } catch (error) {
459
- reject(error);
460
- return;
461
- }
462
-
463
- if (info.done) {
464
- resolve(value);
465
- } else {
466
- Promise.resolve(value).then(_next, _throw);
467
- }
468
- }
469
-
470
- function _asyncToGenerator(fn) {
471
- return function () {
472
- var self = this,
473
- args = arguments;
474
- return new Promise(function (resolve, reject) {
475
- var gen = fn.apply(self, args);
476
-
477
- function _next(value) {
478
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
479
- }
480
-
481
- function _throw(err) {
482
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
483
- }
484
-
485
- _next(undefined);
486
- });
487
- };
488
- }
489
-
490
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
491
-
492
- function createCommonjsModule(fn, basedir, module) {
493
- return module = {
494
- path: basedir,
495
- exports: {},
496
- require: function (path, base) {
497
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
498
- }
499
- }, fn(module, module.exports), module.exports;
500
- }
501
-
502
- function commonjsRequire () {
503
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
504
- }
505
-
506
- var check = function (it) {
507
- return it && it.Math == Math && it;
508
- }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
509
-
510
-
511
- var global_1 = // eslint-disable-next-line no-undef
512
- check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func
513
- Function('return this')();
514
-
515
- // iterable DOM collections
516
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
517
- var domIterables = {
518
- CSSRuleList: 0,
519
- CSSStyleDeclaration: 0,
520
- CSSValueList: 0,
521
- ClientRectList: 0,
522
- DOMRectList: 0,
523
- DOMStringList: 0,
524
- DOMTokenList: 1,
525
- DataTransferItemList: 0,
526
- FileList: 0,
527
- HTMLAllCollection: 0,
528
- HTMLCollection: 0,
529
- HTMLFormElement: 0,
530
- HTMLSelectElement: 0,
531
- MediaList: 0,
532
- MimeTypeArray: 0,
533
- NamedNodeMap: 0,
534
- NodeList: 1,
535
- PaintRequestList: 0,
536
- Plugin: 0,
537
- PluginArray: 0,
538
- SVGLengthList: 0,
539
- SVGNumberList: 0,
540
- SVGPathSegList: 0,
541
- SVGPointList: 0,
542
- SVGStringList: 0,
543
- SVGTransformList: 0,
544
- SourceBufferList: 0,
545
- StyleSheetList: 0,
546
- TextTrackCueList: 0,
547
- TextTrackList: 0,
548
- TouchList: 0
549
- };
550
-
551
- var fails = function (exec) {
552
- try {
553
- return !!exec();
554
- } catch (error) {
555
- return true;
556
- }
557
- };
558
-
559
- var toString = {}.toString;
560
-
561
- var classofRaw = function (it) {
562
- return toString.call(it).slice(8, -1);
563
- };
564
-
565
- var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings
566
-
567
- var indexedObject = fails(function () {
568
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
569
- // eslint-disable-next-line no-prototype-builtins
570
- return !Object('z').propertyIsEnumerable(0);
571
- }) ? function (it) {
572
- return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
573
- } : Object;
574
-
575
- // `RequireObjectCoercible` abstract operation
576
- // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
577
- var requireObjectCoercible = function (it) {
578
- if (it == undefined) throw TypeError("Can't call method on " + it);
579
- return it;
580
- };
581
-
582
- var toIndexedObject = function (it) {
583
- return indexedObject(requireObjectCoercible(it));
584
- };
585
-
586
- var descriptors = !fails(function () {
587
- return Object.defineProperty({}, 1, {
588
- get: function () {
589
- return 7;
590
- }
591
- })[1] != 7;
592
- });
593
-
594
- var isObject = function (it) {
595
- return typeof it === 'object' ? it !== null : typeof it === 'function';
596
- };
597
-
598
- var document$1 = global_1.document; // typeof document.createElement is 'object' in old IE
599
-
600
- var EXISTS = isObject(document$1) && isObject(document$1.createElement);
601
-
602
- var documentCreateElement = function (it) {
603
- return EXISTS ? document$1.createElement(it) : {};
604
- };
605
-
606
- var ie8DomDefine = !descriptors && !fails(function () {
607
- return Object.defineProperty(documentCreateElement('div'), 'a', {
608
- get: function () {
609
- return 7;
610
- }
611
- }).a != 7;
612
- });
613
-
614
- var anObject = function (it) {
615
- if (!isObject(it)) {
616
- throw TypeError(String(it) + ' is not an object');
617
- }
618
-
619
- return it;
620
- };
621
-
622
- // https://tc39.github.io/ecma262/#sec-toprimitive
623
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
624
- // and the second argument - flag - preferred type is a string
625
-
626
- var toPrimitive = function (input, PREFERRED_STRING) {
627
- if (!isObject(input)) return input;
628
- var fn, val;
629
- if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
630
- if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
631
- if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
632
- throw TypeError("Can't convert object to primitive value");
633
- };
634
-
635
- var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method
636
- // https://tc39.github.io/ecma262/#sec-object.defineproperty
637
-
638
- var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
639
- anObject(O);
640
- P = toPrimitive(P, true);
641
- anObject(Attributes);
642
- if (ie8DomDefine) try {
643
- return nativeDefineProperty(O, P, Attributes);
644
- } catch (error) {
645
- /* empty */
646
- }
647
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
648
- if ('value' in Attributes) O[P] = Attributes.value;
649
- return O;
650
- };
651
- var objectDefineProperty = {
652
- f: f
653
- };
654
-
655
- var createPropertyDescriptor = function (bitmap, value) {
656
- return {
657
- enumerable: !(bitmap & 1),
658
- configurable: !(bitmap & 2),
659
- writable: !(bitmap & 4),
660
- value: value
661
- };
662
- };
663
-
664
- var createNonEnumerableProperty = descriptors ? function (object, key, value) {
665
- return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
666
- } : function (object, key, value) {
667
- object[key] = value;
668
- return object;
669
- };
670
-
671
- var setGlobal = function (key, value) {
672
- try {
673
- createNonEnumerableProperty(global_1, key, value);
674
- } catch (error) {
675
- global_1[key] = value;
676
- }
677
-
678
- return value;
679
- };
680
-
681
- var SHARED = '__core-js_shared__';
682
- var store = global_1[SHARED] || setGlobal(SHARED, {});
683
- var sharedStore = store;
684
-
685
- var shared = createCommonjsModule(function (module) {
686
- (module.exports = function (key, value) {
687
- return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
688
- })('versions', []).push({
689
- version: '3.6.5',
690
- mode: 'global',
691
- copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
692
- });
693
- });
694
-
695
- var hasOwnProperty = {}.hasOwnProperty;
696
-
697
- var has = function (it, key) {
698
- return hasOwnProperty.call(it, key);
699
- };
700
-
701
- var id = 0;
702
- var postfix = Math.random();
703
-
704
- var uid = function (key) {
705
- return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
706
- };
707
-
708
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
709
- // Chrome 38 Symbol has incorrect toString conversion
710
- // eslint-disable-next-line no-undef
711
- return !String(Symbol());
712
- });
713
-
714
- var useSymbolAsUid = nativeSymbol // eslint-disable-next-line no-undef
715
- && !Symbol.sham // eslint-disable-next-line no-undef
716
- && typeof Symbol.iterator == 'symbol';
717
-
718
- var WellKnownSymbolsStore = shared('wks');
719
- var Symbol$1 = global_1.Symbol;
720
- var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
721
-
722
- var wellKnownSymbol = function (name) {
723
- if (!has(WellKnownSymbolsStore, name)) {
724
- if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
725
- }
726
-
727
- return WellKnownSymbolsStore[name];
728
- };
729
-
730
- var ceil = Math.ceil;
731
- var floor = Math.floor; // `ToInteger` abstract operation
732
- // https://tc39.github.io/ecma262/#sec-tointeger
733
-
734
- var toInteger = function (argument) {
735
- return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
736
- };
737
-
738
- var min = Math.min; // `ToLength` abstract operation
739
- // https://tc39.github.io/ecma262/#sec-tolength
740
-
741
- var toLength = function (argument) {
742
- return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
743
- };
744
-
745
- var max = Math.max;
746
- var min$1 = Math.min; // Helper for a popular repeating case of the spec:
747
- // Let integer be ? ToInteger(index).
748
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
749
-
750
- var toAbsoluteIndex = function (index, length) {
751
- var integer = toInteger(index);
752
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
753
- };
754
-
755
- var createMethod = function (IS_INCLUDES) {
756
- return function ($this, el, fromIndex) {
757
- var O = toIndexedObject($this);
758
- var length = toLength(O.length);
759
- var index = toAbsoluteIndex(fromIndex, length);
760
- var value; // Array#includes uses SameValueZero equality algorithm
761
- // eslint-disable-next-line no-self-compare
762
-
763
- if (IS_INCLUDES && el != el) while (length > index) {
764
- value = O[index++]; // eslint-disable-next-line no-self-compare
765
-
766
- if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not
767
- } else for (; length > index; index++) {
768
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
769
- }
770
- return !IS_INCLUDES && -1;
771
- };
772
- };
773
-
774
- var arrayIncludes = {
775
- // `Array.prototype.includes` method
776
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
777
- includes: createMethod(true),
778
- // `Array.prototype.indexOf` method
779
- // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
780
- indexOf: createMethod(false)
781
- };
782
-
783
- var hiddenKeys = {};
784
-
785
- var indexOf = arrayIncludes.indexOf;
786
-
787
- var objectKeysInternal = function (object, names) {
788
- var O = toIndexedObject(object);
789
- var i = 0;
790
- var result = [];
791
- var key;
792
-
793
- for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys
794
-
795
-
796
- while (names.length > i) if (has(O, key = names[i++])) {
797
- ~indexOf(result, key) || result.push(key);
798
- }
799
-
800
- return result;
801
- };
802
-
803
- // IE8- don't enum bug keys
804
- var enumBugKeys = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
805
-
806
- // https://tc39.github.io/ecma262/#sec-object.keys
807
-
808
- var objectKeys = Object.keys || function keys(O) {
809
- return objectKeysInternal(O, enumBugKeys);
810
- };
811
-
812
- // https://tc39.github.io/ecma262/#sec-object.defineproperties
813
-
814
- var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
815
- anObject(O);
816
- var keys = objectKeys(Properties);
817
- var length = keys.length;
818
- var index = 0;
819
- var key;
820
-
821
- while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
822
-
823
- return O;
824
- };
825
-
826
- var path = global_1;
827
-
828
- var aFunction = function (variable) {
829
- return typeof variable == 'function' ? variable : undefined;
830
- };
831
-
832
- var getBuiltIn = function (namespace, method) {
833
- return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
834
- };
835
-
836
- var html = getBuiltIn('document', 'documentElement');
837
-
838
- var keys = shared('keys');
839
-
840
- var sharedKey = function (key) {
841
- return keys[key] || (keys[key] = uid(key));
842
- };
843
-
844
- var GT = '>';
845
- var LT = '<';
846
- var PROTOTYPE = 'prototype';
847
- var SCRIPT = 'script';
848
- var IE_PROTO = sharedKey('IE_PROTO');
849
-
850
- var EmptyConstructor = function () {
851
- /* empty */
852
- };
853
-
854
- var scriptTag = function (content) {
855
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
856
- }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
857
-
858
-
859
- var NullProtoObjectViaActiveX = function (activeXDocument) {
860
- activeXDocument.write(scriptTag(''));
861
- activeXDocument.close();
862
- var temp = activeXDocument.parentWindow.Object;
863
- activeXDocument = null; // avoid memory leak
864
-
865
- return temp;
866
- }; // Create object with fake `null` prototype: use iframe Object with cleared prototype
867
-
868
-
869
- var NullProtoObjectViaIFrame = function () {
870
- // Thrash, waste and sodomy: IE GC bug
871
- var iframe = documentCreateElement('iframe');
872
- var JS = 'java' + SCRIPT + ':';
873
- var iframeDocument;
874
- iframe.style.display = 'none';
875
- html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475
876
-
877
- iframe.src = String(JS);
878
- iframeDocument = iframe.contentWindow.document;
879
- iframeDocument.open();
880
- iframeDocument.write(scriptTag('document.F=Object'));
881
- iframeDocument.close();
882
- return iframeDocument.F;
883
- }; // Check for document.domain and active x support
884
- // No need to use active x approach when document.domain is not set
885
- // see https://github.com/es-shims/es5-shim/issues/150
886
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
887
- // avoid IE GC bug
888
-
889
-
890
- var activeXDocument;
891
-
892
- var NullProtoObject = function () {
893
- try {
894
- /* global ActiveXObject */
895
- activeXDocument = document.domain && new ActiveXObject('htmlfile');
896
- } catch (error) {
897
- /* ignore */
898
- }
899
-
900
- NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
901
- var length = enumBugKeys.length;
902
-
903
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
904
-
905
- return NullProtoObject();
906
- };
907
-
908
- hiddenKeys[IE_PROTO] = true; // `Object.create` method
909
- // https://tc39.github.io/ecma262/#sec-object.create
910
-
911
- var objectCreate = Object.create || function create(O, Properties) {
912
- var result;
913
-
914
- if (O !== null) {
915
- EmptyConstructor[PROTOTYPE] = anObject(O);
916
- result = new EmptyConstructor();
917
- EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill
918
-
919
- result[IE_PROTO] = O;
920
- } else result = NullProtoObject();
921
-
922
- return Properties === undefined ? result : objectDefineProperties(result, Properties);
923
- };
924
-
925
- var UNSCOPABLES = wellKnownSymbol('unscopables');
926
- var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables]
927
- // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
928
-
929
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
930
- objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
931
- configurable: true,
932
- value: objectCreate(null)
933
- });
934
- } // add a key to Array.prototype[@@unscopables]
935
-
936
-
937
- var addToUnscopables = function (key) {
938
- ArrayPrototype[UNSCOPABLES][key] = true;
939
- };
940
-
941
- var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
942
-
943
- if (typeof sharedStore.inspectSource != 'function') {
944
- sharedStore.inspectSource = function (it) {
945
- return functionToString.call(it);
946
- };
947
- }
948
-
949
- var inspectSource = sharedStore.inspectSource;
950
-
951
- var WeakMap = global_1.WeakMap;
952
- var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
953
-
954
- var WeakMap$1 = global_1.WeakMap;
955
- var set, get, has$1;
956
-
957
- var enforce = function (it) {
958
- return has$1(it) ? get(it) : set(it, {});
959
- };
960
-
961
- var getterFor = function (TYPE) {
962
- return function (it) {
963
- var state;
964
-
965
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
966
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
967
- }
968
-
969
- return state;
970
- };
971
- };
972
-
973
- if (nativeWeakMap) {
974
- var store$1 = new WeakMap$1();
975
- var wmget = store$1.get;
976
- var wmhas = store$1.has;
977
- var wmset = store$1.set;
978
-
979
- set = function (it, metadata) {
980
- wmset.call(store$1, it, metadata);
981
- return metadata;
982
- };
983
-
984
- get = function (it) {
985
- return wmget.call(store$1, it) || {};
986
- };
987
-
988
- has$1 = function (it) {
989
- return wmhas.call(store$1, it);
990
- };
991
- } else {
992
- var STATE = sharedKey('state');
993
- hiddenKeys[STATE] = true;
994
-
995
- set = function (it, metadata) {
996
- createNonEnumerableProperty(it, STATE, metadata);
997
- return metadata;
998
- };
999
-
1000
- get = function (it) {
1001
- return has(it, STATE) ? it[STATE] : {};
1002
- };
1003
-
1004
- has$1 = function (it) {
1005
- return has(it, STATE);
1006
- };
1007
- }
1008
-
1009
- var internalState = {
1010
- set: set,
1011
- get: get,
1012
- has: has$1,
1013
- enforce: enforce,
1014
- getterFor: getterFor
1015
- };
1016
-
1017
- var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
1018
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug
1019
-
1020
- var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({
1021
- 1: 2
1022
- }, 1); // `Object.prototype.propertyIsEnumerable` method implementation
1023
- // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
1024
-
1025
- var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
1026
- var descriptor = getOwnPropertyDescriptor(this, V);
1027
- return !!descriptor && descriptor.enumerable;
1028
- } : nativePropertyIsEnumerable;
1029
- var objectPropertyIsEnumerable = {
1030
- f: f$1
1031
- };
1032
-
1033
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method
1034
- // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
1035
-
1036
- var f$2 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
1037
- O = toIndexedObject(O);
1038
- P = toPrimitive(P, true);
1039
- if (ie8DomDefine) try {
1040
- return nativeGetOwnPropertyDescriptor(O, P);
1041
- } catch (error) {
1042
- /* empty */
1043
- }
1044
- if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
1045
- };
1046
- var objectGetOwnPropertyDescriptor = {
1047
- f: f$2
1048
- };
1049
-
1050
- var redefine = createCommonjsModule(function (module) {
1051
- var getInternalState = internalState.get;
1052
- var enforceInternalState = internalState.enforce;
1053
- var TEMPLATE = String(String).split('String');
1054
- (module.exports = function (O, key, value, options) {
1055
- var unsafe = options ? !!options.unsafe : false;
1056
- var simple = options ? !!options.enumerable : false;
1057
- var noTargetGet = options ? !!options.noTargetGet : false;
1058
-
1059
- if (typeof value == 'function') {
1060
- if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
1061
- enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
1062
- }
1063
-
1064
- if (O === global_1) {
1065
- if (simple) O[key] = value;else setGlobal(key, value);
1066
- return;
1067
- } else if (!unsafe) {
1068
- delete O[key];
1069
- } else if (!noTargetGet && O[key]) {
1070
- simple = true;
1071
- }
1072
-
1073
- if (simple) O[key] = value;else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1074
- })(Function.prototype, 'toString', function toString() {
1075
- return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
1076
- });
1077
- });
1078
-
1079
- var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method
1080
- // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
1081
-
1082
- var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1083
- return objectKeysInternal(O, hiddenKeys$1);
1084
- };
1085
-
1086
- var objectGetOwnPropertyNames = {
1087
- f: f$3
1088
- };
1089
-
1090
- var f$4 = Object.getOwnPropertySymbols;
1091
- var objectGetOwnPropertySymbols = {
1092
- f: f$4
1093
- };
1094
-
1095
- var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
1096
- var keys = objectGetOwnPropertyNames.f(anObject(it));
1097
- var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
1098
- return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
1099
- };
1100
-
1101
- var copyConstructorProperties = function (target, source) {
1102
- var keys = ownKeys(source);
1103
- var defineProperty = objectDefineProperty.f;
1104
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1105
-
1106
- for (var i = 0; i < keys.length; i++) {
1107
- var key = keys[i];
1108
- if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1109
- }
1110
- };
1111
-
1112
- var replacement = /#|\.prototype\./;
1113
-
1114
- var isForced = function (feature, detection) {
1115
- var value = data[normalize(feature)];
1116
- return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
1117
- };
1118
-
1119
- var normalize = isForced.normalize = function (string) {
1120
- return String(string).replace(replacement, '.').toLowerCase();
1121
- };
1122
-
1123
- var data = isForced.data = {};
1124
- var NATIVE = isForced.NATIVE = 'N';
1125
- var POLYFILL = isForced.POLYFILL = 'P';
1126
- var isForced_1 = isForced;
1127
-
1128
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1129
- /*
1130
- options.target - name of the target object
1131
- options.global - target is the global object
1132
- options.stat - export as static methods of target
1133
- options.proto - export as prototype methods of target
1134
- options.real - real prototype method for the `pure` version
1135
- options.forced - export even if the native feature is available
1136
- options.bind - bind methods to the target, required for the `pure` version
1137
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1138
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
1139
- options.sham - add a flag to not completely full polyfills
1140
- options.enumerable - export as enumerable property
1141
- options.noTargetGet - prevent calling a getter on target
1142
- */
1143
-
1144
- var _export = function (options, source) {
1145
- var TARGET = options.target;
1146
- var GLOBAL = options.global;
1147
- var STATIC = options.stat;
1148
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1149
-
1150
- if (GLOBAL) {
1151
- target = global_1;
1152
- } else if (STATIC) {
1153
- target = global_1[TARGET] || setGlobal(TARGET, {});
1154
- } else {
1155
- target = (global_1[TARGET] || {}).prototype;
1156
- }
1157
-
1158
- if (target) for (key in source) {
1159
- sourceProperty = source[key];
1160
-
1161
- if (options.noTargetGet) {
1162
- descriptor = getOwnPropertyDescriptor$1(target, key);
1163
- targetProperty = descriptor && descriptor.value;
1164
- } else targetProperty = target[key];
1165
-
1166
- FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target
1167
-
1168
- if (!FORCED && targetProperty !== undefined) {
1169
- if (typeof sourceProperty === typeof targetProperty) continue;
1170
- copyConstructorProperties(sourceProperty, targetProperty);
1171
- } // add a flag to not completely full polyfills
1172
-
1173
-
1174
- if (options.sham || targetProperty && targetProperty.sham) {
1175
- createNonEnumerableProperty(sourceProperty, 'sham', true);
1176
- } // extend global
1177
-
1178
-
1179
- redefine(target, key, sourceProperty, options);
1180
- }
1181
- };
1182
-
1183
- // https://tc39.github.io/ecma262/#sec-toobject
1184
-
1185
- var toObject = function (argument) {
1186
- return Object(requireObjectCoercible(argument));
1187
- };
1188
-
1189
- var correctPrototypeGetter = !fails(function () {
1190
- function F() {
1191
- /* empty */
1192
- }
1193
-
1194
- F.prototype.constructor = null;
1195
- return Object.getPrototypeOf(new F()) !== F.prototype;
1196
- });
1197
-
1198
- var IE_PROTO$1 = sharedKey('IE_PROTO');
1199
- var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method
1200
- // https://tc39.github.io/ecma262/#sec-object.getprototypeof
1201
-
1202
- var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
1203
- O = toObject(O);
1204
- if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
1205
-
1206
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
1207
- return O.constructor.prototype;
1208
- }
1209
-
1210
- return O instanceof Object ? ObjectPrototype : null;
1211
- };
1212
-
1213
- var ITERATOR = wellKnownSymbol('iterator');
1214
- var BUGGY_SAFARI_ITERATORS = false;
1215
-
1216
- var returnThis = function () {
1217
- return this;
1218
- }; // `%IteratorPrototype%` object
1219
- // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
1220
-
1221
-
1222
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
1223
-
1224
- if ([].keys) {
1225
- arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`
1226
-
1227
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;else {
1228
- PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
1229
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1230
- }
1231
- }
1232
-
1233
- if (IteratorPrototype == undefined) IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
1234
-
1235
- if ( !has(IteratorPrototype, ITERATOR)) {
1236
- createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
1237
- }
1238
-
1239
- var iteratorsCore = {
1240
- IteratorPrototype: IteratorPrototype,
1241
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
1242
- };
1243
-
1244
- var defineProperty = objectDefineProperty.f;
1245
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1246
-
1247
- var setToStringTag = function (it, TAG, STATIC) {
1248
- if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
1249
- defineProperty(it, TO_STRING_TAG, {
1250
- configurable: true,
1251
- value: TAG
1252
- });
1253
- }
1254
- };
1255
-
1256
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1257
-
1258
- var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
1259
- var TO_STRING_TAG = NAME + ' Iterator';
1260
- IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, {
1261
- next: createPropertyDescriptor(1, next)
1262
- });
1263
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
1264
- return IteratorConstructor;
1265
- };
1266
-
1267
- var aPossiblePrototype = function (it) {
1268
- if (!isObject(it) && it !== null) {
1269
- throw TypeError("Can't set " + String(it) + ' as a prototype');
1270
- }
1271
-
1272
- return it;
1273
- };
1274
-
1275
- // https://tc39.github.io/ecma262/#sec-object.setprototypeof
1276
- // Works with __proto__ only. Old v8 can't work with null proto objects.
1277
-
1278
- /* eslint-disable no-proto */
1279
-
1280
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1281
- var CORRECT_SETTER = false;
1282
- var test = {};
1283
- var setter;
1284
-
1285
- try {
1286
- setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
1287
- setter.call(test, []);
1288
- CORRECT_SETTER = test instanceof Array;
1289
- } catch (error) {
1290
- /* empty */
1291
- }
1292
-
1293
- return function setPrototypeOf(O, proto) {
1294
- anObject(O);
1295
- aPossiblePrototype(proto);
1296
- if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
1297
- return O;
1298
- };
1299
- }() : undefined);
1300
-
1301
- var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1302
- var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
1303
- var ITERATOR$1 = wellKnownSymbol('iterator');
1304
- var KEYS = 'keys';
1305
- var VALUES = 'values';
1306
- var ENTRIES = 'entries';
1307
-
1308
- var returnThis$1 = function () {
1309
- return this;
1310
- };
1311
-
1312
- var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1313
- createIteratorConstructor(IteratorConstructor, NAME, next);
1314
-
1315
- var getIterationMethod = function (KIND) {
1316
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1317
- if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
1318
-
1319
- switch (KIND) {
1320
- case KEYS:
1321
- return function keys() {
1322
- return new IteratorConstructor(this, KIND);
1323
- };
1324
-
1325
- case VALUES:
1326
- return function values() {
1327
- return new IteratorConstructor(this, KIND);
1328
- };
1329
-
1330
- case ENTRIES:
1331
- return function entries() {
1332
- return new IteratorConstructor(this, KIND);
1333
- };
1334
- }
1335
-
1336
- return function () {
1337
- return new IteratorConstructor(this);
1338
- };
1339
- };
1340
-
1341
- var TO_STRING_TAG = NAME + ' Iterator';
1342
- var INCORRECT_VALUES_NAME = false;
1343
- var IterablePrototype = Iterable.prototype;
1344
- var nativeIterator = IterablePrototype[ITERATOR$1] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
1345
- var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
1346
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1347
- var CurrentIteratorPrototype, methods, KEY; // fix native
1348
-
1349
- if (anyNativeIterator) {
1350
- CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
1351
-
1352
- if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
1353
- if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1354
- if (objectSetPrototypeOf) {
1355
- objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
1356
- } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
1357
- createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
1358
- }
1359
- } // Set @@toStringTag to native iterators
1360
-
1361
-
1362
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1363
- }
1364
- } // fix Array#{values, @@iterator}.name in V8 / FF
1365
-
1366
-
1367
- if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1368
- INCORRECT_VALUES_NAME = true;
1369
-
1370
- defaultIterator = function values() {
1371
- return nativeIterator.call(this);
1372
- };
1373
- } // define iterator
1374
-
1375
-
1376
- if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
1377
- createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
1378
- }
1379
-
1380
- if (DEFAULT) {
1381
- methods = {
1382
- values: getIterationMethod(VALUES),
1383
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1384
- entries: getIterationMethod(ENTRIES)
1385
- };
1386
- if (FORCED) for (KEY in methods) {
1387
- if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1388
- redefine(IterablePrototype, KEY, methods[KEY]);
1389
- }
1390
- } else _export({
1391
- target: NAME,
1392
- proto: true,
1393
- forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME
1394
- }, methods);
1395
- }
1396
-
1397
- return methods;
1398
- };
1399
-
1400
- var ARRAY_ITERATOR = 'Array Iterator';
1401
- var setInternalState = internalState.set;
1402
- var getInternalState = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method
1403
- // https://tc39.github.io/ecma262/#sec-array.prototype.entries
1404
- // `Array.prototype.keys` method
1405
- // https://tc39.github.io/ecma262/#sec-array.prototype.keys
1406
- // `Array.prototype.values` method
1407
- // https://tc39.github.io/ecma262/#sec-array.prototype.values
1408
- // `Array.prototype[@@iterator]` method
1409
- // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
1410
- // `CreateArrayIterator` internal method
1411
- // https://tc39.github.io/ecma262/#sec-createarrayiterator
1412
-
1413
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1414
- setInternalState(this, {
1415
- type: ARRAY_ITERATOR,
1416
- target: toIndexedObject(iterated),
1417
- // target
1418
- index: 0,
1419
- // next index
1420
- kind: kind // kind
1421
-
1422
- }); // `%ArrayIteratorPrototype%.next` method
1423
- // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
1424
- }, function () {
1425
- var state = getInternalState(this);
1426
- var target = state.target;
1427
- var kind = state.kind;
1428
- var index = state.index++;
1429
-
1430
- if (!target || index >= target.length) {
1431
- state.target = undefined;
1432
- return {
1433
- value: undefined,
1434
- done: true
1435
- };
1436
- }
1437
-
1438
- if (kind == 'keys') return {
1439
- value: index,
1440
- done: false
1441
- };
1442
- if (kind == 'values') return {
1443
- value: target[index],
1444
- done: false
1445
- };
1446
- return {
1447
- value: [index, target[index]],
1448
- done: false
1449
- };
1450
- }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
1451
-
1452
- addToUnscopables('keys');
1453
- addToUnscopables('values');
1454
- addToUnscopables('entries');
1455
-
1456
- var ITERATOR$2 = wellKnownSymbol('iterator');
1457
- var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1458
- var ArrayValues = es_array_iterator.values;
1459
-
1460
- for (var COLLECTION_NAME in domIterables) {
1461
- var Collection = global_1[COLLECTION_NAME];
1462
- var CollectionPrototype = Collection && Collection.prototype;
1463
-
1464
- if (CollectionPrototype) {
1465
- // some Chrome versions have non-configurable methods on DOMTokenList
1466
- if (CollectionPrototype[ITERATOR$2] !== ArrayValues) try {
1467
- createNonEnumerableProperty(CollectionPrototype, ITERATOR$2, ArrayValues);
1468
- } catch (error) {
1469
- CollectionPrototype[ITERATOR$2] = ArrayValues;
1470
- }
1471
-
1472
- if (!CollectionPrototype[TO_STRING_TAG$1]) {
1473
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$1, COLLECTION_NAME);
1474
- }
1475
-
1476
- if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
1477
- // some Chrome versions have non-configurable methods on DOMTokenList
1478
- if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
1479
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
1480
- } catch (error) {
1481
- CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
1482
- }
1483
- }
1484
- }
1485
- }
1486
-
1487
- var defineProperty$1 = Object.defineProperty;
1488
- var cache = {};
1489
-
1490
- var thrower = function (it) {
1491
- throw it;
1492
- };
1493
-
1494
- var arrayMethodUsesToLength = function (METHOD_NAME, options) {
1495
- if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
1496
- if (!options) options = {};
1497
- var method = [][METHOD_NAME];
1498
- var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
1499
- var argument0 = has(options, 0) ? options[0] : thrower;
1500
- var argument1 = has(options, 1) ? options[1] : undefined;
1501
- return cache[METHOD_NAME] = !!method && !fails(function () {
1502
- if (ACCESSORS && !descriptors) return true;
1503
- var O = {
1504
- length: -1
1505
- };
1506
- if (ACCESSORS) defineProperty$1(O, 1, {
1507
- enumerable: true,
1508
- get: thrower
1509
- });else O[1] = 1;
1510
- method.call(O, argument0, argument1);
1511
- });
1512
- };
1513
-
1514
- var $includes = arrayIncludes.includes;
1515
- var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', {
1516
- ACCESSORS: true,
1517
- 1: 0
1518
- }); // `Array.prototype.includes` method
1519
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
1520
-
1521
- _export({
1522
- target: 'Array',
1523
- proto: true,
1524
- forced: !USES_TO_LENGTH
1525
- }, {
1526
- includes: function includes(el
1527
- /* , fromIndex = 0 */
1528
- ) {
1529
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1530
- }
1531
- }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
1532
-
1533
- addToUnscopables('includes');
1534
-
1535
- var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation
1536
- // https://tc39.github.io/ecma262/#sec-isregexp
1537
-
1538
- var isRegexp = function (it) {
1539
- var isRegExp;
1540
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
1541
- };
1542
-
1543
- var notARegexp = function (it) {
1544
- if (isRegexp(it)) {
1545
- throw TypeError("The method doesn't accept regular expressions");
1546
- }
1547
-
1548
- return it;
1549
- };
1550
-
1551
- var MATCH$1 = wellKnownSymbol('match');
1552
-
1553
- var correctIsRegexpLogic = function (METHOD_NAME) {
1554
- var regexp = /./;
1555
-
1556
- try {
1557
- '/./'[METHOD_NAME](regexp);
1558
- } catch (e) {
1559
- try {
1560
- regexp[MATCH$1] = false;
1561
- return '/./'[METHOD_NAME](regexp);
1562
- } catch (f) {
1563
- /* empty */
1564
- }
1565
- }
1566
-
1567
- return false;
1568
- };
1569
-
1570
- // https://tc39.github.io/ecma262/#sec-string.prototype.includes
1571
-
1572
-
1573
- _export({
1574
- target: 'String',
1575
- proto: true,
1576
- forced: !correctIsRegexpLogic('includes')
1577
- }, {
1578
- includes: function includes(searchString
1579
- /* , position = 0 */
1580
- ) {
1581
- return !!~String(requireObjectCoercible(this)).indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
1582
- }
1583
- });
1584
-
1585
- const stringFieldUtils = {
1586
- type: 'STRING',
1587
-
1588
- getDefaultFormFieldValue() {
1589
- return '';
1590
- },
1591
-
1592
- createFormField(fieldConfig, incomingValue) {
1593
- return {
1594
- id: createId(),
1595
- config: fieldConfig,
1596
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1597
- };
1598
- },
1599
-
1600
- getOutgoingValue(field) {
1601
- return field.value;
1602
- }
1603
-
1604
- };
1605
- const urlFieldUtils = {
1606
- type: 'URL',
1607
-
1608
- getDefaultFormFieldValue() {
1609
- return '';
1610
- },
1611
-
1612
- createFormField(fieldConfig, incomingValue) {
1613
- return {
1614
- id: createId(),
1615
- config: fieldConfig,
1616
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1617
- };
1618
- },
1619
-
1620
- getOutgoingValue(field) {
1621
- return field.value;
1622
- }
1623
-
1624
- };
1625
- const dateFieldUtils = {
1626
- type: 'DATE',
1627
-
1628
- getDefaultFormFieldValue() {
1629
- return '';
1630
- },
1631
-
1632
- createFormField(fieldConfig, incomingValue) {
1633
- return {
1634
- id: createId(),
1635
- config: fieldConfig,
1636
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1637
- };
1638
- },
1639
-
1640
- getOutgoingValue(field) {
1641
- return field.value;
1642
- }
1643
-
1644
- };
1645
- const dateTimeFieldUtils = {
1646
- type: 'DATETIME',
1647
-
1648
- getDefaultFormFieldValue() {
1649
- return '';
1650
- },
1651
-
1652
- createFormField(fieldConfig, incomingValue) {
1653
- return {
1654
- id: createId(),
1655
- config: fieldConfig,
1656
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1657
- };
1658
- },
1659
-
1660
- getOutgoingValue(field) {
1661
- return field.value;
1662
- }
1663
-
1664
- };
1665
- const textFieldUtils = {
1666
- type: 'TEXT',
1667
-
1668
- getDefaultFormFieldValue() {
1669
- return '';
1670
- },
1671
-
1672
- createFormField(fieldConfig, incomingValue) {
1673
- return {
1674
- id: createId(),
1675
- config: fieldConfig,
1676
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1677
- };
1678
- },
1679
-
1680
- getOutgoingValue(field) {
1681
- return field.value;
1682
- }
1683
-
1684
- };
1685
- const numberFieldUtils = {
1686
- type: 'NUMBER',
1687
-
1688
- getDefaultFormFieldValue() {
1689
- return '';
1690
- },
1691
-
1692
- createFormField(fieldConfig, incomingValue) {
1693
- return {
1694
- id: createId(),
1695
- config: fieldConfig,
1696
- value: isNotNullish(incomingValue) ? String(incomingValue) : this.getDefaultFormFieldValue()
1697
- };
1698
- },
1699
-
1700
- getOutgoingValue(field) {
1701
- return field.value;
1702
- }
1703
-
1704
- };
1705
- const booleanFieldUtils = {
1706
- type: 'TRUE_FALSE',
1707
-
1708
- getDefaultFormFieldValue(config) {
1709
- var _a;
1710
-
1711
- return (_a = config === null || config === void 0 ? void 0 : config.meta.defaultValue) !== null && _a !== void 0 ? _a : false;
1712
- },
1713
-
1714
- createFormField(fieldConfig, incomingValue) {
1715
- return {
1716
- id: createId(),
1717
- config: fieldConfig,
1718
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue(fieldConfig)
1719
- };
1720
- },
1721
-
1722
- getOutgoingValue(field) {
1723
- return field.value;
1724
- }
1725
-
1726
- };
1727
- /** SELECT **/
1728
-
1729
- const selectFieldUtils = {
1730
- type: 'SELECT',
1731
-
1732
- getDefaultFormFieldValue() {
1733
- return null;
1734
- },
1735
-
1736
- createFormField(fieldConfig, incomingValue) {
1737
- var _a;
1738
-
1739
- const options = (_a = fieldConfig.meta.options) !== null && _a !== void 0 ? _a : [];
1740
- const selectedOption = options.find(option => option.value === incomingValue);
1741
- return {
1742
- id: createId(),
1743
- config: fieldConfig,
1744
- value: selectedOption !== null && selectedOption !== void 0 ? selectedOption : null
1745
- };
1746
- },
1747
-
1748
- getOutgoingValue(field) {
1749
- var _a, _b;
1750
-
1751
- return (_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
1752
- }
1753
-
1754
- };
1755
- const ajaxSelectFieldUtils = {
1756
- type: 'AJAX_SELECT',
1757
-
1758
- getDefaultFormFieldValue() {
1759
- return null;
1760
- },
1761
-
1762
- createFormField(fieldConfig, incomingValue) {
1763
- return {
1764
- id: createId(),
1765
- config: fieldConfig,
1766
- value: incomingValue
1767
- };
1768
- },
1769
-
1770
- getOutgoingValue(field) {
1771
- var _a, _b;
1772
-
1773
- return (_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;
1774
- }
1775
-
1776
- };
1777
- const multiSelectFieldUtils = {
1778
- type: 'MULTI_SELECT',
1779
-
1780
- getDefaultFormFieldValue() {
1781
- return [];
1782
- },
1783
-
1784
- createFormField(fieldConfig, incomingValue) {
1785
- var _a;
1786
-
1787
- const options = (_a = fieldConfig.meta.options) !== null && _a !== void 0 ? _a : [];
1788
- const selectedValues = incomingValue !== null && incomingValue !== void 0 ? incomingValue : [];
1789
- const selectedOptions = options.filter(option => selectedValues.includes(option.value));
1790
- return {
1791
- id: createId(),
1792
- config: fieldConfig,
1793
- value: selectedOptions
1794
- };
1795
- },
1796
-
1797
- getOutgoingValue(field) {
1798
- return field.value.map(option => option.value);
1799
- }
1800
-
1801
- };
1802
- const colorFieldUtils = {
1803
- type: 'COLOR',
1804
-
1805
- getDefaultFormFieldValue() {
1806
- return '#000000';
1807
- },
1808
-
1809
- createFormField(fieldConfig, incomingValue) {
1810
- return {
1811
- id: createId(),
1812
- config: fieldConfig,
1813
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1814
- };
1815
- },
1816
-
1817
- getOutgoingValue(field) {
1818
- return field.value;
1819
- }
1820
-
1821
- };
1822
- const buttonFieldUtils = {
1823
- type: 'BUTTON',
1824
-
1825
- getDefaultFormFieldValue() {
1826
- return null;
1827
- },
1828
-
1829
- createFormField(fieldConfig, incomingValue) {
1830
- return {
1831
- id: createId(),
1832
- config: fieldConfig,
1833
- value: incomingValue
1834
- };
1835
- },
1836
-
1837
- getOutgoingValue(field) {
1838
- return field.value;
1839
- }
1840
-
1841
- };
1842
- const mapFieldUtils = {
1843
- type: 'MAP',
1844
-
1845
- getDefaultFormFieldValue() {
1846
- return null;
1847
- },
1848
-
1849
- createFormField(fieldConfig, incomingValue) {
1850
- return {
1851
- id: createId(),
1852
- config: fieldConfig,
1853
- value: incomingValue
1854
- };
1855
- },
1856
-
1857
- getOutgoingValue(field) {
1858
- return field.value;
1859
- }
1860
-
1861
- };
1862
- const htmlFieldUtils = {
1863
- type: 'HTML',
1864
-
1865
- getDefaultFormFieldValue() {
1866
- return '';
1867
- },
1868
-
1869
- createFormField(fieldConfig, incomingValue) {
1870
- return {
1871
- id: createId(),
1872
- config: fieldConfig,
1873
- value: incomingValue !== null && incomingValue !== void 0 ? incomingValue : this.getDefaultFormFieldValue()
1874
- };
1875
- },
1876
-
1877
- getOutgoingValue(field) {
1878
- return field.value;
1879
- }
1880
-
1881
- };
1882
- const imageFieldUtils = {
1883
- type: 'IMAGE',
1884
-
1885
- getDefaultFormFieldValue() {
1886
- return null;
1887
- },
1888
-
1889
- createFormField(fieldConfig, incomingValue) {
1890
- return {
1891
- id: createId(),
1892
- config: fieldConfig,
1893
- value: incomingValue ? {
1894
- id: createId(),
1895
- file: incomingValue,
1896
- caption: null
1897
- } : this.getDefaultFormFieldValue()
1898
- };
1899
- },
1900
-
1901
- getOutgoingValue(field) {
1902
- return field.value ? field.value.file.id : null;
1903
- }
1904
-
1905
- };
1906
- const fileFieldUtils = {
1907
- type: 'FILE',
1908
-
1909
- getDefaultFormFieldValue() {
1910
- return null;
1911
- },
1912
-
1913
- createFormField(fieldConfig, incomingValue) {
1914
- return {
1915
- id: createId(),
1916
- config: fieldConfig,
1917
- value: incomingValue ? {
1918
- id: createId(),
1919
- file: incomingValue,
1920
- caption: null
1921
- } : this.getDefaultFormFieldValue()
1922
- };
1923
- },
1924
-
1925
- getOutgoingValue(field) {
1926
- return field.value ? field.value.file.id : null;
1927
- }
1928
-
1929
- };
1930
- const galleryFieldUtils = {
1931
- type: 'GALLERY',
1932
-
1933
- getDefaultFormFieldValue() {
1934
- return [];
1935
- },
1936
-
1937
- createFormField(fieldConfig, incomingValue) {
1938
- return {
1939
- id: createId(),
1940
- config: fieldConfig,
1941
- value: incomingValue ? incomingValue.map(({
1942
- file,
1943
- caption
1944
- }) => ({
1945
- id: createId(),
1946
- file,
1947
- caption
1948
- })) : this.getDefaultFormFieldValue()
1949
- };
1950
- },
1951
-
1952
- getOutgoingValue(field) {
1953
- return field.value.map(imageEntry => {
1954
- var _a;
1955
-
1956
- return {
1957
- id: imageEntry.file.id,
1958
- caption: (_a = imageEntry.caption) !== null && _a !== void 0 ? _a : null
1959
- };
1960
- });
1961
- }
1962
-
1963
- };
1964
- const repeaterFieldUtils = {
1965
- type: 'REPEATER',
1966
-
1967
- getDefaultFormFieldValue() {
1968
- return [];
1969
- },
1970
-
1971
- createFormField(fieldConfig, incomingValue) {
1972
- function createNestedFieldArray(fieldConfigList, incomingFieldList) {
1973
- const nestedFieldList = [];
1974
-
1975
- for (let i = 0; i < incomingFieldList.length; i++) {
1976
- const nestedIncomingFieldList = incomingFieldList[i];
1977
- const nestedField = {
1978
- id: createId(),
1979
- value: []
1980
- };
1981
-
1982
- for (let j = 0; j < fieldConfigList.length; j++) {
1983
- const nestedFieldConfig = fieldConfigList[j];
1984
- const foundNestedIncomingField = nestedIncomingFieldList.find(field => field.name === nestedFieldConfig.name); // eslint-disable-next-line @typescript-eslint/no-use-before-define
1985
-
1986
- const field = universalFieldUtils.createFormField(nestedFieldConfig, foundNestedIncomingField === null || foundNestedIncomingField === void 0 ? void 0 : foundNestedIncomingField.value);
1987
- nestedField.value.push(field);
1988
- }
1989
-
1990
- nestedFieldList.push(nestedField);
1991
- }
1992
-
1993
- return nestedFieldList;
1994
- }
1995
-
1996
- return {
1997
- id: createId(),
1998
- config: fieldConfig,
1999
- value: incomingValue ? createNestedFieldArray(fieldConfig.fields, incomingValue) : this.getDefaultFormFieldValue()
2000
- };
2001
- },
2002
-
2003
- getOutgoingValue(field) {
2004
- return field.value.map(entity => entity.value.map(entityField => {
2005
- return {
2006
- name: entityField.config.name,
2007
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
2008
- value: universalFieldUtils.getOutgoingValue(entityField)
2009
- };
2010
- }));
2011
- },
2012
-
2013
- getOutgoingValueAsSingleArray(field) {
2014
- return field.value.map(entity => entity.value[0].value);
2015
- }
2016
-
2017
- };
2018
- const groupFieldUtils = {
2019
- type: 'GROUP',
2020
-
2021
- getDefaultFormFieldValue() {
2022
- return [];
2023
- },
2024
-
2025
- createFormField(fieldConfig, incomingValue) {
2026
- function createNestedFieldArray(fieldConfigList, incomingFieldList) {
2027
- const nestedFieldList = [];
2028
-
2029
- for (let j = 0; j < fieldConfigList.length; j++) {
2030
- const nestedFieldConfig = fieldConfigList[j];
2031
- const foundNestedIncomingField = incomingFieldList.find(field => field.name === nestedFieldConfig.name);
2032
- const field = universalFieldUtils.createFormField(nestedFieldConfig, foundNestedIncomingField === null || foundNestedIncomingField === void 0 ? void 0 : foundNestedIncomingField.value);
2033
- nestedFieldList.push(field);
2034
- }
2035
-
2036
- return nestedFieldList;
2037
- }
2038
-
2039
- return {
2040
- id: createId(),
2041
- config: fieldConfig,
2042
- value: incomingValue ? createNestedFieldArray(fieldConfig.fields, incomingValue) : this.getDefaultFormFieldValue()
2043
- };
2044
- },
2045
-
2046
- getOutgoingValue(field) {
2047
- return field.value.map(entityField => {
2048
- return {
2049
- name: entityField.config.name,
2050
- value: universalFieldUtils.getOutgoingValue(entityField)
2051
- };
2052
- });
2053
- }
2054
-
2055
- };
2056
- const unknownFieldUtils = {
2057
- type: 'UNKNOWN',
2058
-
2059
- getDefaultFormFieldValue() {
2060
- return null;
2061
- },
2062
-
2063
- createFormField(fieldConfig) {
2064
- return {
2065
- id: createId(),
2066
- config: fieldConfig,
2067
- value: null
2068
- };
2069
- },
2070
-
2071
- getOutgoingValue() {
2072
- return null;
2073
- }
2074
-
2075
- };
2076
- const FIELD_UTILS_LIST = [stringFieldUtils, urlFieldUtils, textFieldUtils, numberFieldUtils, htmlFieldUtils, imageFieldUtils, fileFieldUtils, galleryFieldUtils, dateFieldUtils, dateTimeFieldUtils, booleanFieldUtils, selectFieldUtils, ajaxSelectFieldUtils, multiSelectFieldUtils, colorFieldUtils, buttonFieldUtils, mapFieldUtils, repeaterFieldUtils, groupFieldUtils, unknownFieldUtils];
2077
-
2078
- function getFieldUtilsByType(type) {
2079
- const foundUtils = FIELD_UTILS_LIST.find(utils => utils.type === type);
2080
-
2081
- if (!foundUtils) {
2082
- console.warn('Cannot find utils for type: ', type);
2083
- }
2084
-
2085
- return foundUtils !== null && foundUtils !== void 0 ? foundUtils : unknownFieldUtils;
2086
- }
2087
-
2088
- const universalFieldUtils = {
2089
- createFormField(fieldConfig, incomingValue) {
2090
- const foundFieldUtils = getFieldUtilsByType(fieldConfig.type);
2091
- return foundFieldUtils.createFormField(fieldConfig, incomingValue);
2092
- },
2093
-
2094
- getOutgoingValue(field) {
2095
- const foundFieldUtils = getFieldUtilsByType(field.config.type);
2096
- return foundFieldUtils.getOutgoingValue(field);
2097
- },
2098
-
2099
- getOutgoingRepeaterValueAsSingleArray(field) {
2100
- return repeaterFieldUtils.getOutgoingValueAsSingleArray(field);
2101
- }
2102
-
2103
- };
2104
-
2105
- // https://tc39.github.io/ecma262/#sec-isarray
2106
-
2107
- var isArray = Array.isArray || function isArray(arg) {
2108
- return classofRaw(arg) == 'Array';
2109
- };
2110
-
2111
- var SPECIES = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation
2112
- // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
2113
-
2114
- var arraySpeciesCreate = function (originalArray, length) {
2115
- var C;
2116
-
2117
- if (isArray(originalArray)) {
2118
- C = originalArray.constructor; // cross-realm fallback
2119
-
2120
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) {
2121
- C = C[SPECIES];
2122
- if (C === null) C = undefined;
2123
- }
2124
- }
2125
-
2126
- return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
2127
- };
2128
-
2129
- var createProperty = function (object, key, value) {
2130
- var propertyKey = toPrimitive(key);
2131
- if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value;
2132
- };
2133
-
2134
- var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
2135
-
2136
- var process = global_1.process;
2137
- var versions = process && process.versions;
2138
- var v8 = versions && versions.v8;
2139
- var match, version;
2140
-
2141
- if (v8) {
2142
- match = v8.split('.');
2143
- version = match[0] + match[1];
2144
- } else if (engineUserAgent) {
2145
- match = engineUserAgent.match(/Edge\/(\d+)/);
2146
-
2147
- if (!match || match[1] >= 74) {
2148
- match = engineUserAgent.match(/Chrome\/(\d+)/);
2149
- if (match) version = match[1];
2150
- }
2151
- }
2152
-
2153
- var engineV8Version = version && +version;
2154
-
2155
- var SPECIES$1 = wellKnownSymbol('species');
2156
-
2157
- var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
2158
- // We can't use this feature detection in V8 since it causes
2159
- // deoptimization and serious performance degradation
2160
- // https://github.com/zloirock/core-js/issues/677
2161
- return engineV8Version >= 51 || !fails(function () {
2162
- var array = [];
2163
- var constructor = array.constructor = {};
2164
-
2165
- constructor[SPECIES$1] = function () {
2166
- return {
2167
- foo: 1
2168
- };
2169
- };
2170
-
2171
- return array[METHOD_NAME](Boolean).foo !== 1;
2172
- });
2173
- };
2174
-
2175
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
2176
- var USES_TO_LENGTH$1 = arrayMethodUsesToLength('splice', {
2177
- ACCESSORS: true,
2178
- 0: 0,
2179
- 1: 2
2180
- });
2181
- var max$1 = Math.max;
2182
- var min$2 = Math.min;
2183
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
2184
- var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method
2185
- // https://tc39.github.io/ecma262/#sec-array.prototype.splice
2186
- // with adding support of @@species
2187
-
2188
- _export({
2189
- target: 'Array',
2190
- proto: true,
2191
- forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1
2192
- }, {
2193
- splice: function splice(start, deleteCount
2194
- /* , ...items */
2195
- ) {
2196
- var O = toObject(this);
2197
- var len = toLength(O.length);
2198
- var actualStart = toAbsoluteIndex(start, len);
2199
- var argumentsLength = arguments.length;
2200
- var insertCount, actualDeleteCount, A, k, from, to;
2201
-
2202
- if (argumentsLength === 0) {
2203
- insertCount = actualDeleteCount = 0;
2204
- } else if (argumentsLength === 1) {
2205
- insertCount = 0;
2206
- actualDeleteCount = len - actualStart;
2207
- } else {
2208
- insertCount = argumentsLength - 2;
2209
- actualDeleteCount = min$2(max$1(toInteger(deleteCount), 0), len - actualStart);
2210
- }
2211
-
2212
- if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
2213
- throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
2214
- }
2215
-
2216
- A = arraySpeciesCreate(O, actualDeleteCount);
2217
-
2218
- for (k = 0; k < actualDeleteCount; k++) {
2219
- from = actualStart + k;
2220
- if (from in O) createProperty(A, k, O[from]);
2221
- }
2222
-
2223
- A.length = actualDeleteCount;
2224
-
2225
- if (insertCount < actualDeleteCount) {
2226
- for (k = actualStart; k < len - actualDeleteCount; k++) {
2227
- from = k + actualDeleteCount;
2228
- to = k + insertCount;
2229
- if (from in O) O[to] = O[from];else delete O[to];
2230
- }
2231
-
2232
- for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
2233
- } else if (insertCount > actualDeleteCount) {
2234
- for (k = len - actualDeleteCount; k > actualStart; k--) {
2235
- from = k + actualDeleteCount - 1;
2236
- to = k + insertCount - 1;
2237
- if (from in O) O[to] = O[from];else delete O[to];
2238
- }
2239
- }
2240
-
2241
- for (k = 0; k < insertCount; k++) {
2242
- O[k + actualStart] = arguments[k + 2];
2243
- }
2244
-
2245
- O.length = len - actualDeleteCount + insertCount;
2246
- return A;
2247
- }
2248
- });
2249
-
2250
- function removeItem(parentField, itemIndex) {
2251
- parentField.value.splice(itemIndex, 1);
2252
- }
2253
- function moveItem(parentField, itemIndex, direction) {
2254
- const itemList = parentField.value;
2255
-
2256
- if (direction === 'up' && itemIndex === 0 || direction === 'down' && itemIndex === itemList.length - 1) {
2257
- return;
2258
- }
2259
-
2260
- const item = itemList[itemIndex];
2261
- itemList.splice(itemIndex, 1);
2262
- itemList.splice(direction === 'up' ? itemIndex - 1 : itemIndex + 1, 0, item);
2263
- }
2264
-
2265
- var script$2 = defineComponent({
2266
- name: 'RepeatedItem',
2267
- props: {
2268
- /**
2269
- * Here we use hack: (https://github.com/vuejs/vue/issues/7492#issuecomment-369507267)
2270
- * because vue don't understand functional component in "components" option
2271
- */
2272
- components: {
2273
- type: Object,
2274
-
2275
- default() {
2276
- return {
2277
- DynamicField: __vue_component__$4
2278
- };
2279
- }
2280
-
2281
- },
2282
- item: {
2283
- type: Object,
2284
- required: true
2285
- },
2286
- parentField: {
2287
- type: Object,
2288
- required: true
2289
- },
2290
- index: {
2291
- type: Number,
2292
- required: true
2293
- }
2294
- },
2295
-
2296
- setup(props) {
2297
- const isOpen = ref(false);
2298
-
2299
- function toggleItem() {
2300
- isOpen.value = !isOpen.value;
2301
- }
2302
-
2303
- function handleItemRemove() {
2304
- removeItem(props.parentField, props.index);
2305
- }
2306
-
2307
- function handleItemMove(direction) {
2308
- moveItem(props.parentField, props.index, direction);
2309
- }
2310
-
2311
- return {
2312
- handleItemRemove,
2313
- handleItemMove,
2314
- isOpen,
2315
- toggleItem
2316
- };
2317
- }
2318
-
2319
- });
2320
-
2321
- function normalizeComponent$1(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
2322
- /* server only */
2323
- , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
2324
- if (typeof shadowMode !== 'boolean') {
2325
- createInjectorSSR = createInjector;
2326
- createInjector = shadowMode;
2327
- shadowMode = false;
2328
- } // Vue.extend constructor export interop.
2329
-
2330
-
2331
- const options = typeof script === 'function' ? script.options : script; // render functions
2332
-
2333
- if (template && template.render) {
2334
- options.render = template.render;
2335
- options.staticRenderFns = template.staticRenderFns;
2336
- options._compiled = true; // functional template
2337
-
2338
- if (isFunctionalTemplate) {
2339
- options.functional = true;
2340
- }
2341
- } // scopedId
2342
-
2343
-
2344
- if (scopeId) {
2345
- options._scopeId = scopeId;
2346
- }
2347
-
2348
- let hook;
2349
-
2350
- if (moduleIdentifier) {
2351
- // server build
2352
- hook = function (context) {
2353
- // 2.3 injection
2354
- context = context || // cached call
2355
- this.$vnode && this.$vnode.ssrContext || // stateful
2356
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
2357
- // 2.2 with runInNewContext: true
2358
-
2359
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
2360
- context = __VUE_SSR_CONTEXT__;
2361
- } // inject component styles
2362
-
2363
-
2364
- if (style) {
2365
- style.call(this, createInjectorSSR(context));
2366
- } // register component module identifier for async chunk inference
2367
-
2368
-
2369
- if (context && context._registeredComponents) {
2370
- context._registeredComponents.add(moduleIdentifier);
2371
- }
2372
- }; // used by ssr in case component is cached and beforeCreate
2373
- // never gets called
2374
-
2375
-
2376
- options._ssrRegister = hook;
2377
- } else if (style) {
2378
- hook = shadowMode ? function (context) {
2379
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
2380
- } : function (context) {
2381
- style.call(this, createInjector(context));
2382
- };
2383
- }
2384
-
2385
- if (hook) {
2386
- if (options.functional) {
2387
- // register for functional component in vue file
2388
- const originalRender = options.render;
2389
-
2390
- options.render = function renderWithStyleInjection(h, context) {
2391
- hook.call(context);
2392
- return originalRender(h, context);
2393
- };
2394
- } else {
2395
- // inject component registration as beforeCreate hook
2396
- const existing = options.beforeCreate;
2397
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
2398
- }
2399
- }
2400
-
2401
- return script;
2402
- }
2403
-
2404
- const isOldIE$1 = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
2405
-
2406
- function createInjector$1(context) {
2407
- return (id, style) => addStyle$1(id, style);
2408
- }
2409
-
2410
- let HEAD$1;
2411
- const styles$1 = {};
2412
-
2413
- function addStyle$1(id, css) {
2414
- const group = isOldIE$1 ? css.media || 'default' : id;
2415
- const style = styles$1[group] || (styles$1[group] = {
2416
- ids: new Set(),
2417
- styles: []
2418
- });
2419
-
2420
- if (!style.ids.has(id)) {
2421
- style.ids.add(id);
2422
- let code = css.source;
2423
-
2424
- if (css.map) {
2425
- // https://developer.chrome.com/devtools/docs/javascript-debugging
2426
- // this makes source maps inside style tags work properly in Chrome
2427
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; // http://stackoverflow.com/a/26603875
2428
-
2429
- code += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + ' */';
2430
- }
2431
-
2432
- if (!style.element) {
2433
- style.element = document.createElement('style');
2434
- style.element.type = 'text/css';
2435
- if (css.media) style.element.setAttribute('media', css.media);
2436
-
2437
- if (HEAD$1 === undefined) {
2438
- HEAD$1 = document.head || document.getElementsByTagName('head')[0];
2439
- }
2440
-
2441
- HEAD$1.appendChild(style.element);
2442
- }
2443
-
2444
- if ('styleSheet' in style.element) {
2445
- style.styles.push(code);
2446
- style.element.styleSheet.cssText = style.styles.filter(Boolean).join('\n');
2447
- } else {
2448
- const index = style.ids.size - 1;
2449
- const textNode = document.createTextNode(code);
2450
- const nodes = style.element.childNodes;
2451
- if (nodes[index]) style.element.removeChild(nodes[index]);
2452
- if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
2453
- }
2454
- }
2455
- }
2456
-
2457
- /* script */
2458
- const __vue_script__$2 = script$2;
2459
-
2460
- /* template */
2461
- var __vue_render__$2 = function() {
2462
- var _vm = this;
2463
- var _h = _vm.$createElement;
2464
- var _c = _vm._self._c || _h;
2465
- return _c("div", { staticClass: "menu-item" }, [
2466
- _c("div", { staticClass: "top" }, [
2467
- _c(
2468
- "button",
2469
- { staticClass: "title-button", on: { click: _vm.toggleItem } },
2470
- [
2471
- _c("h4", [
2472
- _vm._v(
2473
- _vm._s(_vm.parentField.config.label) +
2474
- " - #" +
2475
- _vm._s(_vm.index + 1)
2476
- )
2477
- ])
2478
- ]
2479
- ),
2480
- _vm._v(" "),
2481
- _c(
2482
- "div",
2483
- [
2484
- _c(
2485
- "base-button",
2486
- {
2487
- attrs: { variant: "icon", title: "Move up" },
2488
- on: { click: _vm.toggleItem }
2489
- },
2490
- [
2491
- _c("svg-icon", {
2492
- attrs: { name: _vm.isOpen ? "expandLess" : "expandMore" }
2493
- })
2494
- ],
2495
- 1
2496
- ),
2497
- _vm._v(" "),
2498
- _c(
2499
- "base-button",
2500
- {
2501
- attrs: {
2502
- variant: "icon",
2503
- title: "Move up",
2504
- disabled: _vm.index === 0
2505
- },
2506
- on: {
2507
- click: function($event) {
2508
- return _vm.handleItemMove("up")
2509
- }
2510
- }
2511
- },
2512
- [_c("svg-icon", { attrs: { name: "north" } })],
2513
- 1
2514
- ),
2515
- _vm._v(" "),
2516
- _c(
2517
- "base-button",
2518
- {
2519
- attrs: {
2520
- variant: "icon",
2521
- title: "Move down",
2522
- disabled: _vm.index === _vm.parentField.value.length - 1
2523
- },
2524
- on: {
2525
- click: function($event) {
2526
- return _vm.handleItemMove("down")
2527
- }
2528
- }
2529
- },
2530
- [_c("svg-icon", { attrs: { name: "south" } })],
2531
- 1
2532
- ),
2533
- _vm._v(" "),
2534
- _c(
2535
- "base-button",
2536
- {
2537
- attrs: { variant: "icon", title: "Delete" },
2538
- on: { click: _vm.handleItemRemove }
2539
- },
2540
- [_c("svg-icon", { attrs: { name: "delete" } })],
2541
- 1
2542
- )
2543
- ],
2544
- 1
2545
- )
2546
- ]),
2547
- _vm._v(" "),
2548
- _c(
2549
- "div",
2550
- {
2551
- directives: [
2552
- {
2553
- name: "show",
2554
- rawName: "v-show",
2555
- value: _vm.isOpen,
2556
- expression: "isOpen"
2557
- }
2558
- ],
2559
- staticClass: "item-form"
2560
- },
2561
- [
2562
- _c(
2563
- "fieldset",
2564
- _vm._l(_vm.item.value, function(field) {
2565
- return _c(_vm.components.DynamicField, {
2566
- key: field.id,
2567
- tag: "component",
2568
- attrs: { field: field }
2569
- })
2570
- }),
2571
- 1
2572
- )
2573
- ]
2574
- )
2575
- ])
2576
- };
2577
- var __vue_staticRenderFns__$2 = [];
2578
- __vue_render__$2._withStripped = true;
2579
-
2580
- /* style */
2581
- const __vue_inject_styles__$2 = function (inject) {
2582
- if (!inject) return
2583
- inject("data-v-72216a8c_0", { source: ".menu-item[data-v-72216a8c] {\n border: 1px solid #ccc;\n border-radius: 3px;\n}\n.menu-item[data-v-72216a8c]:not(:last-child) {\n margin-bottom: 0.7rem;\n}\n.menu-item .top[data-v-72216a8c] {\n display: flex;\n justify-content: space-between;\n padding: 1rem;\n background-color: #eee;\n}\n.menu-item .top .title-button[data-v-72216a8c] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n.menu-item .top .title-button[data-v-72216a8c]:hover {\n color: #777;\n}\n.menu-item .item-form[data-v-72216a8c] {\n border-top: 1px solid #ccc;\n}\n.menu-item .item-form fieldset[data-v-72216a8c] {\n padding: 1rem 1rem 0 1rem;\n border: 0;\n}\n.menu-item .item-form .form-bottom[data-v-72216a8c] {\n padding: 1rem;\n border-top: 1px solid #ccc;\n display: flex;\n justify-content: space-between;\n}\n\n/*# sourceMappingURL=RepeatedItem.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-dynamic-field/tager-admin-dynamic-field/src/components/DynamicField/components/RepeatedItem/RepeatedItem.vue","RepeatedItem.vue"],"names":[],"mappings":"AAgHA;EACA,sBAAA;EACA,kBAAA;AC/GA;ADiHA;EACA,qBAAA;AC/GA;ADkHA;EACA,aAAA;EACA,8BAAA;EACA,aAAA;EACA,sBAAA;AChHA;ADkHA;EACA,aAAA;EACA,sBAAA;EACA,uBAAA;AChHA;ADkHA;EACA,WAAA;AChHA;ADqHA;EACA,0BAAA;ACnHA;ADqHA;EACA,yBAAA;EACA,SAAA;ACnHA;ADsHA;EACA,aAAA;EAEA,0BAAA;EACA,aAAA;EACA,8BAAA;ACrHA;;AAEA,2CAA2C","file":"RepeatedItem.vue","sourcesContent":["<template>\n <div class=\"menu-item\">\n <div class=\"top\">\n <button class=\"title-button\" @click=\"toggleItem\">\n <h4>{{ parentField.config.label }} - #{{ index + 1 }}</h4>\n </button>\n\n <div>\n <base-button variant=\"icon\" title=\"Move up\" @click=\"toggleItem\">\n <svg-icon :name=\"isOpen ? 'expandLess' : 'expandMore'\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n title=\"Move up\"\n :disabled=\"index === 0\"\n @click=\"handleItemMove('up')\"\n >\n <svg-icon name=\"north\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n title=\"Move down\"\n :disabled=\"index === parentField.value.length - 1\"\n @click=\"handleItemMove('down')\"\n >\n <svg-icon name=\"south\" />\n </base-button>\n\n <base-button variant=\"icon\" title=\"Delete\" @click=\"handleItemRemove\">\n <svg-icon name=\"delete\" />\n </base-button>\n </div>\n </div>\n <div v-show=\"isOpen\" class=\"item-form\">\n <fieldset>\n <component\n :is=\"components.DynamicField\"\n v-for=\"field of item.value\"\n :key=\"field.id\"\n :field=\"field\"\n />\n </fieldset>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, ref } from '@vue/composition-api';\n\nimport { RepeaterField } from '../../../../typings/model';\nimport DynamicField from '../../DynamicField.vue';\n\nimport { moveItem, removeItem } from './RepeatedItem.helpers';\n\ntype Props = Readonly<{\n item: RepeaterField['value'][number];\n parentField: RepeaterField;\n index: number;\n components: { DynamicField: typeof DynamicField };\n}>;\n\nexport default defineComponent<Props>({\n name: 'RepeatedItem',\n props: {\n /**\n * Here we use hack: (https://github.com/vuejs/vue/issues/7492#issuecomment-369507267)\n * because vue don't understand functional component in \"components\" option\n */\n components: {\n type: Object,\n default() {\n return {\n DynamicField,\n };\n },\n },\n item: {\n type: Object,\n required: true,\n },\n parentField: {\n type: Object,\n required: true,\n },\n index: {\n type: Number,\n required: true,\n },\n },\n setup(props) {\n const isOpen = ref<boolean>(false);\n\n function toggleItem() {\n isOpen.value = !isOpen.value;\n }\n\n function handleItemRemove() {\n removeItem(props.parentField, props.index);\n }\n\n function handleItemMove(direction: 'up' | 'down') {\n moveItem(props.parentField, props.index, direction);\n }\n\n return { handleItemRemove, handleItemMove, isOpen, toggleItem };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.menu-item {\n border: 1px solid #ccc;\n border-radius: 3px;\n\n &:not(:last-child) {\n margin-bottom: 0.7rem;\n }\n\n .top {\n display: flex;\n justify-content: space-between;\n padding: 1rem;\n background-color: #eee;\n\n .title-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n &:hover {\n color: #777;\n }\n }\n }\n\n .item-form {\n border-top: 1px solid #ccc;\n\n fieldset {\n padding: 1rem 1rem 0 1rem;\n border: 0;\n }\n\n .form-bottom {\n padding: 1rem;\n\n border-top: 1px solid #ccc;\n display: flex;\n justify-content: space-between;\n }\n }\n}\n</style>\n",".menu-item {\n border: 1px solid #ccc;\n border-radius: 3px;\n}\n.menu-item:not(:last-child) {\n margin-bottom: 0.7rem;\n}\n.menu-item .top {\n display: flex;\n justify-content: space-between;\n padding: 1rem;\n background-color: #eee;\n}\n.menu-item .top .title-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n.menu-item .top .title-button:hover {\n color: #777;\n}\n.menu-item .item-form {\n border-top: 1px solid #ccc;\n}\n.menu-item .item-form fieldset {\n padding: 1rem 1rem 0 1rem;\n border: 0;\n}\n.menu-item .item-form .form-bottom {\n padding: 1rem;\n border-top: 1px solid #ccc;\n display: flex;\n justify-content: space-between;\n}\n\n/*# sourceMappingURL=RepeatedItem.vue.map */"]}, media: undefined });
2584
-
2585
- };
2586
- /* scoped */
2587
- const __vue_scope_id__$2 = "data-v-72216a8c";
2588
- /* module identifier */
2589
- const __vue_module_identifier__$2 = undefined;
2590
- /* functional template */
2591
- const __vue_is_functional_template__$2 = false;
2592
- /* style inject SSR */
2593
-
2594
- /* style inject shadow dom */
2595
-
2596
-
2597
-
2598
- const __vue_component__$2 = /*#__PURE__*/normalizeComponent$1(
2599
- { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
2600
- __vue_inject_styles__$2,
2601
- __vue_script__$2,
2602
- __vue_scope_id__$2,
2603
- __vue_is_functional_template__$2,
2604
- __vue_module_identifier__$2,
2605
- false,
2606
- createInjector$1,
2607
- undefined,
2608
- undefined
2609
- );
2610
-
2611
- var script$1$1 = Vue.extend({
2612
- name: 'RepeatedItemTable',
2613
- functional: true,
2614
- props: {
2615
- field: {
2616
- type: Object,
2617
- required: true
2618
- }
2619
- },
2620
-
2621
- render(h, context) {
2622
- const repeaterField = context.props.field;
2623
- const filteredFields = repeaterField.config.fields.filter(fieldConfig => !fieldConfig.meta.hidden);
2624
- const columnDefs = filteredFields.map((fieldConfig, index) => ({
2625
- id: index + 1,
2626
- name: fieldConfig.label,
2627
- field: fieldConfig.name,
2628
- useCustomDataCell: true
2629
- }));
2630
- columnDefs.push({
2631
- id: columnDefs.length + 1,
2632
- name: 'Actions',
2633
- field: 'actions',
2634
- useCustomDataCell: true
2635
- });
2636
- const rowData = repeaterField.value.map(entity => entity.value.reduce((row, field) => Object.assign(Object.assign({}, row), {
2637
- [field.config.name]: field
2638
- }), {}));
2639
- const columnWidth = `calc(100% / ${filteredFields.length})`;
2640
- const scopedSlots = filteredFields.reduce((scopedSlots, fieldConfig) => {
2641
- const slotName = `cell(${kebabCase(fieldConfig.name)})`;
2642
- return Object.assign(Object.assign({}, scopedSlots), {
2643
- [slotName]: props => h('td', {
2644
- style: {
2645
- width: columnWidth
2646
- }
2647
- }, [h(__vue_component__$4, {
2648
- props: {
2649
- field: props.row[fieldConfig.name],
2650
- isLabelHidden: true
2651
- }
2652
- })])
2653
- });
2654
- }, {});
2655
-
2656
- function handleItemRemove(index) {
2657
- removeItem(context.props.field, index);
2658
- }
2659
-
2660
- function handleItemMove(index, direction) {
2661
- moveItem(context.props.field, index, direction);
2662
- }
2663
-
2664
- return h(BaseTable, {
2665
- props: {
2666
- columnDefs,
2667
- enumerable: true,
2668
- rowData: rowData
2669
- },
2670
- class: 'repeated-field-table',
2671
- scopedSlots: Object.assign(Object.assign({}, scopedSlots), {
2672
- 'cell(actions)': ({
2673
- row,
2674
- rowIndex
2675
- }) => h('td', {
2676
- style: {
2677
- width: '140px',
2678
- whiteSpace: 'nowrap'
2679
- }
2680
- }, [h(BaseButton, {
2681
- props: {
2682
- variant: 'icon',
2683
- disabled: rowIndex === 0
2684
- },
2685
- on: {
2686
- click: () => handleItemMove(rowIndex, 'up')
2687
- }
2688
- }, [h(SvgIcon, {
2689
- props: {
2690
- name: 'north'
2691
- }
2692
- })]), h(BaseButton, {
2693
- props: {
2694
- variant: 'icon',
2695
- disabled: rowIndex === repeaterField.value.length - 1
2696
- },
2697
- on: {
2698
- click: () => handleItemMove(rowIndex, 'down')
2699
- }
2700
- }, [h(SvgIcon, {
2701
- props: {
2702
- name: 'south'
2703
- }
2704
- })]), h(BaseButton, {
2705
- props: {
2706
- variant: 'icon',
2707
- disabled: row.canBeDeleted ? !row.canBeDeleted.value : false
2708
- },
2709
- on: {
2710
- click: () => handleItemRemove(rowIndex)
2711
- }
2712
- }, [h(SvgIcon, {
2713
- props: {
2714
- name: 'delete'
2715
- }
2716
- })])])
2717
- })
2718
- });
2719
- }
2720
-
2721
- });
2722
-
2723
- /* script */
2724
- const __vue_script__$1$1 = script$1$1;
2725
-
2726
- /* template */
2727
-
2728
- /* style */
2729
- const __vue_inject_styles__$1$1 = undefined;
2730
- /* scoped */
2731
- const __vue_scope_id__$1$1 = undefined;
2732
- /* module identifier */
2733
- const __vue_module_identifier__$1$1 = undefined;
2734
- /* functional template */
2735
- const __vue_is_functional_template__$1$1 = undefined;
2736
- /* style inject */
2737
-
2738
- /* style inject SSR */
2739
-
2740
- /* style inject shadow dom */
2741
-
2742
-
2743
-
2744
- const __vue_component__$1$1 = /*#__PURE__*/normalizeComponent$1(
2745
- {},
2746
- __vue_inject_styles__$1$1,
2747
- __vue_script__$1$1,
2748
- __vue_scope_id__$1$1,
2749
- __vue_is_functional_template__$1$1,
2750
- __vue_module_identifier__$1$1,
2751
- false,
2752
- undefined,
2753
- undefined,
2754
- undefined
2755
- );
2756
-
2757
- var script$2$1 = defineComponent({
2758
- name: 'RepeatedItemTree',
2759
- components: {
2760
- RepeatedItem: __vue_component__$2,
2761
- RepeatedItemTable: __vue_component__$1$1
2762
- },
2763
- props: {
2764
- field: {
2765
- type: Object,
2766
- required: true
2767
- },
2768
- defaultIsOpen: {
2769
- type: Boolean,
2770
- default: false
2771
- },
2772
- maxItemsCount: {
2773
- type: Number,
2774
- required: false
2775
- }
2776
- },
2777
-
2778
- setup(props) {
2779
- const pseudoUniqueKey = props.field.config.fields.map(field => field.name).join('').length;
2780
- const [isOpen, setIsOpen] = useLocalStorage(`is_${props.field.config.name}_${pseudoUniqueKey}_open`, props.defaultIsOpen);
2781
-
2782
- function toggleChildren() {
2783
- setIsOpen(!isOpen.value);
2784
- }
2785
-
2786
- function addElement() {
2787
- const newNestedField = {
2788
- id: createId(),
2789
- value: props.field.config.fields.map(nestedFieldConfig => universalFieldUtils.createFormField(nestedFieldConfig, null))
2790
- };
2791
- props.field.value.push(newNestedField);
2792
- }
2793
-
2794
- return {
2795
- addElement,
2796
- toggleChildren,
2797
- isOpen,
2798
- isTable: props.field.config.meta.view === 'TABLE'
2799
- };
2800
- }
2801
-
2802
- });
2803
-
2804
- /* script */
2805
- const __vue_script__$2$1 = script$2$1;
2806
-
2807
- /* template */
2808
- var __vue_render__$1$1 = function() {
2809
- var _vm = this;
2810
- var _h = _vm.$createElement;
2811
- var _c = _vm._self._c || _h;
2812
- return _c("div", { staticClass: "repeated-field" }, [
2813
- _c(
2814
- "button",
2815
- {
2816
- class: ["title-button", _vm.isOpen ? "collapse" : "expand"],
2817
- attrs: { type: "button", title: _vm.isOpen ? "Collapse" : "Expand" },
2818
- on: { click: _vm.toggleChildren }
2819
- },
2820
- [
2821
- _c(
2822
- "span",
2823
- {
2824
- class: ["icon-chevron-right", { "icon-expand-more": _vm.isOpen }],
2825
- attrs: { role: "img" }
2826
- },
2827
- [_c("svg-icon", { attrs: { name: "chevronRight" } })],
2828
- 1
2829
- ),
2830
- _vm._v(" "),
2831
- _c("span", { staticClass: "title" }, [
2832
- _vm._v(
2833
- "\n " +
2834
- _vm._s(_vm.field.config.label) +
2835
- " (" +
2836
- _vm._s(_vm.field.value.length) +
2837
- ")\n "
2838
- )
2839
- ])
2840
- ]
2841
- ),
2842
- _vm._v(" "),
2843
- _c(
2844
- "div",
2845
- {
2846
- directives: [
2847
- {
2848
- name: "show",
2849
- rawName: "v-show",
2850
- value: _vm.isOpen,
2851
- expression: "isOpen"
2852
- }
2853
- ],
2854
- staticClass: "content"
2855
- },
2856
- [
2857
- _vm.isTable
2858
- ? _c("RepeatedItemTable", { attrs: { field: _vm.field } })
2859
- : _c(
2860
- "ul",
2861
- { staticClass: "nested-element-list" },
2862
- _vm._l(_vm.field.value, function(nestedElement, index) {
2863
- return _c(
2864
- "li",
2865
- {
2866
- key: nestedElement.id,
2867
- staticClass: "nested-element-container"
2868
- },
2869
- [
2870
- _c(
2871
- "RepeatedItem",
2872
- _vm._g(
2873
- {
2874
- attrs: {
2875
- item: nestedElement,
2876
- index: index,
2877
- "parent-field": _vm.field
2878
- }
2879
- },
2880
- _vm.$listeners
2881
- )
2882
- )
2883
- ],
2884
- 1
2885
- )
2886
- }),
2887
- 0
2888
- ),
2889
- _vm._v(" "),
2890
- _c(
2891
- "div",
2892
- { staticClass: "button-row" },
2893
- [
2894
- _c(
2895
- "base-button",
2896
- {
2897
- attrs: {
2898
- variant: "outline-primary",
2899
- title: "Add item",
2900
- disabled:
2901
- _vm.maxItemsCount &&
2902
- _vm.field.value.length >= _vm.maxItemsCount
2903
- },
2904
- on: { click: _vm.addElement }
2905
- },
2906
- [_vm._v("\n Add item\n ")]
2907
- ),
2908
- _vm._v(" "),
2909
- _vm.maxItemsCount && _vm.field.value.length >= _vm.maxItemsCount
2910
- ? _c("span", [
2911
- _vm._v("\n Maximum items count: "),
2912
- _c("b", [_vm._v(_vm._s(_vm.maxItemsCount))])
2913
- ])
2914
- : _vm._e()
2915
- ],
2916
- 1
2917
- )
2918
- ],
2919
- 1
2920
- )
2921
- ])
2922
- };
2923
- var __vue_staticRenderFns__$1$1 = [];
2924
- __vue_render__$1$1._withStripped = true;
2925
-
2926
- /* style */
2927
- const __vue_inject_styles__$2$1 = function (inject) {
2928
- if (!inject) return
2929
- inject("data-v-2a48755e_0", { source: ".repeated-field-table[data-v-2a48755e] .form-group {\n margin-bottom: 0;\n}\n.repeated-field[data-v-2a48755e] {\n margin-bottom: 1rem;\n}\n.repeated-field .title-button[data-v-2a48755e] {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.repeated-field .title-button[data-v-2a48755e]:hover {\n cursor: pointer;\n}\n.repeated-field .title-button.collapse[data-v-2a48755e] {\n color: var(--primary);\n}\n.repeated-field .title-button.collapse .icon-expand-more[data-v-2a48755e] {\n color: var(--primary);\n}\n.repeated-field .icon-chevron-right[data-v-2a48755e] {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.repeated-field .icon-chevron-right svg[data-v-2a48755e] {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n}\n.repeated-field .icon-chevron-right.icon-expand-more svg[data-v-2a48755e] {\n transform: rotate(90deg);\n}\n.repeated-field .content[data-v-2a48755e] {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n}\n.nested-element-container[data-v-2a48755e] {\n margin-bottom: 0.7rem;\n}\n.button-row[data-v-2a48755e] {\n display: flex;\n align-items: center;\n}\n.button-row span[data-v-2a48755e] {\n display: inline-block;\n margin-left: 10px;\n}\n\n/*# sourceMappingURL=RepeatedItemTree.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-dynamic-field/tager-admin-dynamic-field/src/components/DynamicField/components/RepeatedItemTree/RepeatedItemTree.vue","RepeatedItemTree.vue"],"names":[],"mappings":"AA4HA;EACA,gBAAA;AC3HA;AD+HA;EACA,mBAAA;AC5HA;AD8HA;EACA,oBAAA;EACA,mBAAA;EACA,cAAA;EACA,sBAAA;EACA,wDAAA;AC5HA;AD8HA;EACA,eAAA;AC5HA;AD+HA;EACA,qBAAA;AC7HA;AD+HA;EACA,qBAAA;AC7HA;ADkIA;EACA,sBAAA;EACA,uBAAA;EACA,wDAAA;AChIA;ADkIA;EACA,cAAA;EACA,kBAAA;EACA,sBAAA;EACA,wEAAA;AChIA;ADoIA;EACA,wBAAA;AClIA;ADuIA;EACA,qBAAA;EACA,iBAAA;ACrIA;ADyIA;EACA,qBAAA;ACtIA;ADyIA;EACA,aAAA;EACA,mBAAA;ACtIA;ADwIA;EACA,qBAAA;EACA,iBAAA;ACtIA;;AAEA,+CAA+C","file":"RepeatedItemTree.vue","sourcesContent":["<template>\n <div class='repeated-field'>\n <button\n type='button'\n :class=\"['title-button', isOpen ? 'collapse' : 'expand']\"\n :title=\"isOpen ? 'Collapse' : 'Expand'\"\n @click='toggleChildren'\n >\n <span\n role='img'\n :class=\"['icon-chevron-right', { 'icon-expand-more': isOpen }]\"\n >\n <svg-icon name='chevronRight' />\n </span>\n\n <span class='title'>\n {{ field.config.label }} ({{ field.value.length }})\n </span>\n </button>\n\n <div v-show='isOpen' class='content'>\n <RepeatedItemTable v-if='isTable' :field='field' />\n <ul v-else class='nested-element-list'>\n <li\n v-for='(nestedElement, index) of field.value'\n :key='nestedElement.id'\n class='nested-element-container'\n >\n <RepeatedItem\n :item='nestedElement'\n :index='index'\n :parent-field='field'\n v-on='$listeners'\n />\n </li>\n </ul>\n <div class='button-row'>\n <base-button\n variant='outline-primary'\n title='Add item'\n :disabled='maxItemsCount && field.value.length >= maxItemsCount'\n @click='addElement'\n >\n Add item\n </base-button>\n <span v-if='maxItemsCount && field.value.length >= maxItemsCount'>\n Maximum items count: <b>{{ maxItemsCount }}</b>\n </span>\n </div>\n </div>\n </div>\n</template>\n\n<script lang='ts'>\nimport { defineComponent } from '@vue/composition-api';\n\nimport { createId } from '@tager/admin-services';\nimport { useLocalStorage } from '@tager/admin-ui';\n\nimport { RepeaterField } from '../../../../typings/model';\nimport { universalFieldUtils } from '../../../../services/fields';\nimport RepeatedItem from '../RepeatedItem/RepeatedItem.vue';\nimport RepeatedItemTable from '../RepeatedItemTable.vue';\n\ntype Props = Readonly<{\n field: RepeaterField;\n defaultIsOpen: boolean;\n maxItemsCount?: number;\n}>;\n\nexport default defineComponent<Props>({\n name: 'RepeatedItemTree',\n components: { RepeatedItem, RepeatedItemTable },\n props: {\n field: {\n type: Object,\n required: true\n },\n defaultIsOpen: {\n type: Boolean,\n default: false\n },\n maxItemsCount: {\n type: Number,\n required: false\n }\n },\n setup(props) {\n const pseudoUniqueKey = props.field.config.fields\n .map((field) => field.name)\n .join('').length;\n\n const [isOpen, setIsOpen] = useLocalStorage<boolean>(\n `is_${props.field.config.name}_${pseudoUniqueKey}_open`,\n props.defaultIsOpen\n );\n\n function toggleChildren() {\n setIsOpen(!isOpen.value);\n }\n\n function addElement() {\n const newNestedField = {\n id: createId(),\n value: props.field.config.fields.map((nestedFieldConfig) =>\n universalFieldUtils.createFormField(nestedFieldConfig, null)\n )\n };\n\n props.field.value.push(newNestedField);\n }\n\n return {\n addElement,\n toggleChildren,\n isOpen,\n isTable: props.field.config.meta.view === 'TABLE'\n };\n }\n});\n</script>\n\n<style scoped lang='scss'>\n.repeated-field-table {\n ::v-deep .form-group {\n margin-bottom: 0;\n }\n}\n\n.repeated-field {\n margin-bottom: 1rem;\n\n .title-button {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n &:hover {\n cursor: pointer;\n }\n\n &.collapse {\n color: var(--primary);\n\n .icon-expand-more {\n color: var(--primary);\n }\n }\n }\n\n .icon-chevron-right {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n svg {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n }\n\n &.icon-expand-more {\n svg {\n transform: rotate(90deg);\n }\n }\n }\n\n .content {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n }\n}\n\n.nested-element-container {\n margin-bottom: 0.7rem;\n}\n\n.button-row {\n display: flex;\n align-items: center;\n\n span {\n display: inline-block;\n margin-left: 10px;\n }\n}\n\n</style>\n",".repeated-field-table ::v-deep .form-group {\n margin-bottom: 0;\n}\n\n.repeated-field {\n margin-bottom: 1rem;\n}\n.repeated-field .title-button {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.repeated-field .title-button:hover {\n cursor: pointer;\n}\n.repeated-field .title-button.collapse {\n color: var(--primary);\n}\n.repeated-field .title-button.collapse .icon-expand-more {\n color: var(--primary);\n}\n.repeated-field .icon-chevron-right {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.repeated-field .icon-chevron-right svg {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n}\n.repeated-field .icon-chevron-right.icon-expand-more svg {\n transform: rotate(90deg);\n}\n.repeated-field .content {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n}\n\n.nested-element-container {\n margin-bottom: 0.7rem;\n}\n\n.button-row {\n display: flex;\n align-items: center;\n}\n.button-row span {\n display: inline-block;\n margin-left: 10px;\n}\n\n/*# sourceMappingURL=RepeatedItemTree.vue.map */"]}, media: undefined });
2930
-
2931
- };
2932
- /* scoped */
2933
- const __vue_scope_id__$2$1 = "data-v-2a48755e";
2934
- /* module identifier */
2935
- const __vue_module_identifier__$2$1 = undefined;
2936
- /* functional template */
2937
- const __vue_is_functional_template__$2$1 = false;
2938
- /* style inject SSR */
2939
-
2940
- /* style inject shadow dom */
2941
-
2942
-
2943
-
2944
- const __vue_component__$2$1 = /*#__PURE__*/normalizeComponent$1(
2945
- { render: __vue_render__$1$1, staticRenderFns: __vue_staticRenderFns__$1$1 },
2946
- __vue_inject_styles__$2$1,
2947
- __vue_script__$2$1,
2948
- __vue_scope_id__$2$1,
2949
- __vue_is_functional_template__$2$1,
2950
- __vue_module_identifier__$2$1,
2951
- false,
2952
- createInjector$1,
2953
- undefined,
2954
- undefined
2955
- );
2956
-
2957
- var script$3 = defineComponent({
2958
- name: 'FieldGroup',
2959
- components: {
2960
- DynamicField: function () {
2961
- var _ref = _asyncToGenerator(function* () {
2962
- return (yield Promise.resolve().then(function () { return DynamicField; })).default;
2963
- });
2964
-
2965
- return function DynamicField() {
2966
- return _ref.apply(this, arguments);
2967
- };
2968
- }()
2969
- },
2970
- props: {
2971
- field: {
2972
- type: Object,
2973
- required: true
2974
- },
2975
- defaultIsOpen: {
2976
- type: Boolean,
2977
- default: false
2978
- }
2979
- },
2980
-
2981
- setup(props) {
2982
- const pseudoUniqueKey = props.field.config.fields.map(field => field.name).join('').length;
2983
- const [isOpen, setIsOpen] = useLocalStorage(`is_${props.field.config.name}_${pseudoUniqueKey}_open`, props.defaultIsOpen);
2984
-
2985
- function handleToggleClick() {
2986
- setIsOpen(!isOpen.value);
2987
- }
2988
-
2989
- return {
2990
- isOpen,
2991
- handleToggleClick
2992
- };
2993
- }
2994
-
2995
- });
2996
-
2997
- /* script */
2998
- const __vue_script__$3 = script$3;
2999
-
3000
- /* template */
3001
- var __vue_render__$2$1 = function() {
3002
- var _vm = this;
3003
- var _h = _vm.$createElement;
3004
- var _c = _vm._self._c || _h;
3005
- return _c("div", { staticClass: "group-field" }, [
3006
- _c(
3007
- "button",
3008
- {
3009
- class: ["title-button", _vm.isOpen ? "collapse" : "expand"],
3010
- attrs: { type: "button", title: _vm.isOpen ? "Collapse" : "Expand" },
3011
- on: { click: _vm.handleToggleClick }
3012
- },
3013
- [
3014
- _c(
3015
- "span",
3016
- {
3017
- class: ["icon-chevron-right", { "icon-expand-more": _vm.isOpen }],
3018
- attrs: { role: "img" }
3019
- },
3020
- [_c("svg-icon", { attrs: { name: "chevronRight" } })],
3021
- 1
3022
- ),
3023
- _vm._v(" "),
3024
- _c("span", { staticClass: "title" }, [
3025
- _vm._v("\n " + _vm._s(_vm.field.config.label) + "\n ")
3026
- ])
3027
- ]
3028
- ),
3029
- _vm._v(" "),
3030
- _c(
3031
- "div",
3032
- {
3033
- directives: [
3034
- {
3035
- name: "show",
3036
- rawName: "v-show",
3037
- value: _vm.isOpen,
3038
- expression: "isOpen"
3039
- }
3040
- ],
3041
- staticClass: "content"
3042
- },
3043
- _vm._l(_vm.field.value, function(field) {
3044
- return _c("DynamicField", {
3045
- key: field.config.name,
3046
- attrs: { field: field }
3047
- })
3048
- }),
3049
- 1
3050
- )
3051
- ])
3052
- };
3053
- var __vue_staticRenderFns__$2$1 = [];
3054
- __vue_render__$2$1._withStripped = true;
3055
-
3056
- /* style */
3057
- const __vue_inject_styles__$3 = function (inject) {
3058
- if (!inject) return
3059
- inject("data-v-38af784b_0", { source: ".group-field[data-v-38af784b] {\n margin-bottom: 1rem;\n}\n.group-field .title-button[data-v-38af784b] {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.group-field .title-button[data-v-38af784b]:hover {\n cursor: pointer;\n}\n.group-field .title-button.collapse[data-v-38af784b] {\n color: var(--primary);\n}\n.group-field .title-button.collapse .icon-expand-more[data-v-38af784b] {\n color: var(--primary);\n}\n.group-field .icon-chevron-right[data-v-38af784b] {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.group-field .icon-chevron-right svg[data-v-38af784b] {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n}\n.group-field .icon-chevron-right.icon-expand-more svg[data-v-38af784b] {\n transform: rotate(90deg);\n}\n.group-field .content[data-v-38af784b] {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n}\n\n/*# sourceMappingURL=FieldGroup.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-dynamic-field/tager-admin-dynamic-field/src/components/DynamicField/components/FieldGroup/FieldGroup.vue","FieldGroup.vue"],"names":[],"mappings":"AAgFA;EACA,mBAAA;AC/EA;ADiFA;EACA,oBAAA;EACA,mBAAA;EACA,cAAA;EACA,sBAAA;EACA,wDAAA;AC/EA;ADiFA;EACA,eAAA;AC/EA;ADkFA;EACA,qBAAA;AChFA;ADkFA;EACA,qBAAA;AChFA;ADqFA;EACA,sBAAA;EACA,uBAAA;EACA,wDAAA;ACnFA;ADqFA;EACA,cAAA;EACA,kBAAA;EACA,sBAAA;EACA,wEAAA;ACnFA;ADuFA;EACA,wBAAA;ACrFA;AD0FA;EACA,qBAAA;EACA,iBAAA;ACxFA;;AAEA,yCAAyC","file":"FieldGroup.vue","sourcesContent":["<template>\n <div class=\"group-field\">\n <button\n type=\"button\"\n :class=\"['title-button', isOpen ? 'collapse' : 'expand']\"\n :title=\"isOpen ? 'Collapse' : 'Expand'\"\n @click=\"handleToggleClick\"\n >\n <span\n role=\"img\"\n :class=\"['icon-chevron-right', { 'icon-expand-more': isOpen }]\"\n >\n <svg-icon name=\"chevronRight\" />\n </span>\n\n <span class=\"title\">\n {{ field.config.label }}\n </span>\n </button>\n\n <div v-show=\"isOpen\" class=\"content\">\n <DynamicField\n v-for=\"field in field.value\"\n :key=\"field.config.name\"\n :field=\"field\"\n />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from '@vue/composition-api';\n\nimport { useLocalStorage } from '@tager/admin-ui';\n\nimport { GroupField } from '../../../../typings/model';\n\ninterface Props {\n field: GroupField;\n defaultIsOpen: boolean;\n}\n\nexport default defineComponent<Props>({\n name: 'FieldGroup',\n components: {\n DynamicField: async () => (await import('../../DynamicField.vue')).default,\n },\n props: {\n field: {\n type: Object,\n required: true,\n },\n defaultIsOpen: {\n type: Boolean,\n default: false,\n },\n },\n setup(props: Props) {\n const pseudoUniqueKey = props.field.config.fields\n .map((field) => field.name)\n .join('').length;\n\n const [isOpen, setIsOpen] = useLocalStorage<boolean>(\n `is_${props.field.config.name}_${pseudoUniqueKey}_open`,\n props.defaultIsOpen\n );\n\n function handleToggleClick() {\n setIsOpen(!isOpen.value);\n }\n\n return {\n isOpen,\n handleToggleClick,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.group-field {\n margin-bottom: 1rem;\n\n .title-button {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n &:hover {\n cursor: pointer;\n }\n\n &.collapse {\n color: var(--primary);\n\n .icon-expand-more {\n color: var(--primary);\n }\n }\n }\n\n .icon-chevron-right {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n\n svg {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n }\n\n &.icon-expand-more {\n svg {\n transform: rotate(90deg);\n }\n }\n }\n\n .content {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n }\n}\n</style>\n",".group-field {\n margin-bottom: 1rem;\n}\n.group-field .title-button {\n display: inline-flex;\n align-items: center;\n color: inherit;\n margin-left: -0.375rem;\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.group-field .title-button:hover {\n cursor: pointer;\n}\n.group-field .title-button.collapse {\n color: var(--primary);\n}\n.group-field .title-button.collapse .icon-expand-more {\n color: var(--primary);\n}\n.group-field .icon-chevron-right {\n margin-right: 0.375rem;\n color: var(--secondary);\n transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.group-field .icon-chevron-right svg {\n display: block;\n fill: currentColor;\n will-change: transform;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 0.24s;\n}\n.group-field .icon-chevron-right.icon-expand-more svg {\n transform: rotate(90deg);\n}\n.group-field .content {\n margin: 1rem 0 2rem 0;\n padding: 0 1.5rem;\n}\n\n/*# sourceMappingURL=FieldGroup.vue.map */"]}, media: undefined });
3060
-
3061
- };
3062
- /* scoped */
3063
- const __vue_scope_id__$3 = "data-v-38af784b";
3064
- /* module identifier */
3065
- const __vue_module_identifier__$3 = undefined;
3066
- /* functional template */
3067
- const __vue_is_functional_template__$3 = false;
3068
- /* style inject SSR */
3069
-
3070
- /* style inject shadow dom */
3071
-
3072
-
3073
-
3074
- const __vue_component__$3 = /*#__PURE__*/normalizeComponent$1(
3075
- { render: __vue_render__$2$1, staticRenderFns: __vue_staticRenderFns__$2$1 },
3076
- __vue_inject_styles__$3,
3077
- __vue_script__$3,
3078
- __vue_scope_id__$3,
3079
- __vue_is_functional_template__$3,
3080
- __vue_module_identifier__$3,
3081
- false,
3082
- createInjector$1,
3083
- undefined,
3084
- undefined
3085
- );
3086
-
3087
- var script$4 = Vue.extend({
3088
- name: 'DynamicField',
3089
- functional: true,
3090
- props: {
3091
- field: {
3092
- type: Object,
3093
- required: true
3094
- },
3095
- isLabelHidden: {
3096
- type: Boolean,
3097
- default: false
3098
- }
3099
- },
3100
-
3101
- render(h, context) {
3102
- const isLabelHidden = context.props.isLabelHidden;
3103
-
3104
- function renderField(field) {
3105
- const commonProps = {
3106
- label: isLabelHidden ? null : field.config.label,
3107
- name: field.config.name,
3108
- value: field.value
3109
- };
3110
-
3111
- function handleChange(event) {
3112
- field.value = event;
3113
- }
3114
-
3115
- switch (field.config.type) {
3116
- case 'URL':
3117
- case 'STRING':
3118
- return h(FormField, {
3119
- props: Object.assign({}, commonProps),
3120
- on: Object.assign(Object.assign({}, context.listeners), {
3121
- input: handleChange
3122
- })
3123
- });
3124
-
3125
- case 'DATE':
3126
- return h(FormField, {
3127
- props: Object.assign(Object.assign({}, commonProps), {
3128
- type: 'date'
3129
- }),
3130
- on: Object.assign(Object.assign({}, context.listeners), {
3131
- input: handleChange
3132
- })
3133
- });
3134
-
3135
- case 'DATETIME':
3136
- return h(DateTimeInput, {
3137
- props: Object.assign({}, commonProps),
3138
- on: Object.assign(Object.assign({}, context.listeners), {
3139
- change: handleChange
3140
- })
3141
- });
3142
-
3143
- case 'NUMBER':
3144
- return h(FormFieldNumberInput, {
3145
- props: Object.assign({}, commonProps),
3146
- on: Object.assign(Object.assign({}, context.listeners), {
3147
- input: handleChange
3148
- })
3149
- });
3150
-
3151
- case 'TEXT':
3152
- return h(FormField, {
3153
- props: Object.assign(Object.assign({}, commonProps), {
3154
- type: 'textarea',
3155
- rows: 4
3156
- }),
3157
- on: Object.assign(Object.assign({}, context.listeners), {
3158
- input: handleChange
3159
- })
3160
- });
3161
-
3162
- case 'HTML':
3163
- return h(FormFieldRichTextInput, {
3164
- props: Object.assign({}, commonProps),
3165
- on: Object.assign(Object.assign({}, context.listeners), {
3166
- input: handleChange
3167
- })
3168
- });
3169
-
3170
- case 'TRUE_FALSE':
3171
- return h(FormFieldCheckbox, {
3172
- props: {
3173
- label: commonProps.label,
3174
- name: commonProps.name,
3175
- checked: field.value
3176
- },
3177
- on: Object.assign(Object.assign({}, context.listeners), {
3178
- change: handleChange
3179
- })
3180
- });
3181
-
3182
- case 'SELECT':
3183
- return h(FormFieldSelect, {
3184
- props: {
3185
- label: commonProps.label,
3186
- name: commonProps.name,
3187
- searchable: field.config.meta.searchable
3188
- },
3189
- attrs: {
3190
- value: commonProps.value,
3191
- options: field.config.meta.options
3192
- },
3193
- on: Object.assign(Object.assign({}, context.listeners), {
3194
- change: handleChange
3195
- })
3196
- });
3197
-
3198
- case 'AJAX_SELECT':
3199
- return h(AjaxSelect, {
3200
- props: {
3201
- requestUrl: field.config.meta.requestUrl,
3202
- valueField: field.config.meta.valueField,
3203
- labelField: field.config.meta.labelField
3204
- },
3205
- attrs: {
3206
- value: commonProps.value
3207
- },
3208
- on: Object.assign(Object.assign({}, context.listeners), {
3209
- change: handleChange
3210
- })
3211
- });
3212
-
3213
- case 'MULTI_SELECT':
3214
- return h(FormFieldMultiSelect, {
3215
- props: {
3216
- label: commonProps.label,
3217
- name: commonProps.name,
3218
- maxSelectedCount: field.config.meta.maximumItemsCount
3219
- },
3220
- attrs: {
3221
- selectedOptions: commonProps.value,
3222
- options: field.config.meta.options
3223
- },
3224
- on: Object.assign(Object.assign({}, context.listeners), {
3225
- change: handleChange
3226
- })
3227
- });
3228
-
3229
- case 'COLOR':
3230
- return h(FormFieldColorInput, {
3231
- props: Object.assign({}, commonProps),
3232
- on: Object.assign(Object.assign({}, context.listeners), {
3233
- change: handleChange
3234
- })
3235
- });
3236
-
3237
- case 'BUTTON':
3238
- return h(ButtonField, {
3239
- props: Object.assign({}, commonProps),
3240
- on: Object.assign(Object.assign({}, context.listeners), {
3241
- change: handleChange
3242
- })
3243
- });
3244
-
3245
- case 'MAP':
3246
- return h(MapField, {
3247
- props: Object.assign({}, commonProps),
3248
- on: Object.assign(Object.assign({}, context.listeners), {
3249
- change: handleChange
3250
- })
3251
- });
3252
-
3253
- case 'IMAGE':
3254
- return h(FormFieldFileInput, {
3255
- props: Object.assign({}, commonProps),
3256
- attrs: {
3257
- fileType: 'image',
3258
- scenario: field.config.meta.scenario
3259
- },
3260
- on: Object.assign(Object.assign({}, context.listeners), {
3261
- change: handleChange
3262
- })
3263
- });
3264
-
3265
- case 'GALLERY':
3266
- return h(FormFieldFileInput, {
3267
- props: {
3268
- label: isLabelHidden ? null : field.config.label,
3269
- name: field.config.name,
3270
- value: field.value
3271
- },
3272
- attrs: {
3273
- fileType: 'image',
3274
- multiple: true,
3275
- scenario: field.config.meta.scenario,
3276
- withCaptions: field.config.meta.withCaptions
3277
- },
3278
- on: Object.assign(Object.assign({}, context.listeners), {
3279
- change: handleChange
3280
- })
3281
- });
3282
-
3283
- case 'FILE':
3284
- return h(FormFieldFileInput, {
3285
- props: Object.assign({}, commonProps),
3286
- attrs: {
3287
- fileType: 'file',
3288
- scenario: field.config.meta.scenario
3289
- },
3290
- on: Object.assign(Object.assign({}, context.listeners), {
3291
- change: handleChange
3292
- })
3293
- });
3294
-
3295
- case 'REPEATER':
3296
- return h(__vue_component__$2$1, {
3297
- props: {
3298
- field,
3299
- defaultIsOpen: field.config.meta.defaultIsOpen,
3300
- maxItemsCount: field.config.meta.maximumItemsCount
3301
- }
3302
- });
3303
-
3304
- case 'GROUP':
3305
- return h(__vue_component__$3, {
3306
- props: {
3307
- field,
3308
- defaultIsOpen: field.config.meta.defaultIsOpen
3309
- }
3310
- });
3311
-
3312
- default:
3313
- {
3314
- const unknownFieldType = field.config.type;
3315
- console.warn('Cannot render Component for field', field.config);
3316
- return h('div', `Unknown field with type: ${unknownFieldType}`);
3317
- }
3318
- }
3319
- }
3320
-
3321
- return renderField(context.props.field);
3322
- }
3323
-
3324
- });
3325
-
3326
- /* script */
3327
- const __vue_script__$4 = script$4;
3328
-
3329
- /* template */
3330
-
3331
- /* style */
3332
- const __vue_inject_styles__$4 = function (inject) {
3333
- if (!inject) return
3334
- inject("data-v-20017307_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: {"version":3,"sources":[],"names":[],"mappings":"","file":"DynamicField.vue"}, media: undefined });
3335
-
3336
- };
3337
- /* scoped */
3338
- const __vue_scope_id__$4 = "data-v-20017307";
3339
- /* module identifier */
3340
- const __vue_module_identifier__$4 = undefined;
3341
- /* functional template */
3342
- const __vue_is_functional_template__$4 = undefined;
3343
- /* style inject SSR */
3344
-
3345
- /* style inject shadow dom */
3346
-
3347
-
3348
-
3349
- const __vue_component__$4 = /*#__PURE__*/normalizeComponent$1(
3350
- {},
3351
- __vue_inject_styles__$4,
3352
- __vue_script__$4,
3353
- __vue_scope_id__$4,
3354
- __vue_is_functional_template__$4,
3355
- __vue_module_identifier__$4,
3356
- false,
3357
- createInjector$1,
3358
- undefined,
3359
- undefined
3360
- );
3361
-
3362
- var DynamicField = /*#__PURE__*/Object.freeze({
3363
- __proto__: null,
3364
- 'default': __vue_component__$4
3365
- });
3366
-
3367
- function replaceFileExtension(fileName, newExtension) {
3368
- const dotIndex = fileName.lastIndexOf('.');
3369
- const fileNameWithoutExtension = fileName.slice(0, dotIndex);
3370
- if (newExtension) {
3371
- return `${fileNameWithoutExtension}.${newExtension}`;
3372
- }
3373
- return fileNameWithoutExtension;
3374
- }
3375
-
3376
- function convertExportFormValuesToCreationPayload(values, templateValues) {
3377
- var _a, _b, _c, _d, _e, _f;
3378
- return {
3379
- strategy: (_b = (_a = values.strategy) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '',
3380
- filename: values.filename,
3381
- format: (_d = (_c = values.format) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '',
3382
- delimiter: (_f = (_e = values.delimiter) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '',
3383
- params: templateValues.map((field) => ({
3384
- name: field.config.name,
3385
- value: universalFieldUtils.getOutgoingValue(field),
3386
- })),
3387
- };
3388
- }
3389
- function convertStrategiesToStrategyOptionList(strategies) {
3390
- return strategies.map((strategy) => ({
3391
- label: strategy.name,
3392
- value: strategy.id,
3393
- }));
3394
- }
3395
- const formatOptionList = [
3396
- { value: 'CSV', label: 'CSV' },
3397
- { value: 'XLS', label: 'XLS' },
3398
- { value: 'XML', label: 'XML' },
3399
- { value: 'YAML', label: 'YAML' },
3400
- { value: 'JSON', label: 'JSON' },
3401
- { value: 'TXT', label: 'TXT' },
3402
- ];
3403
- function isCSVFormat(format) {
3404
- return format === 'CSV';
3405
- }
3406
-
3407
- var script$5 = defineComponent({
3408
- name: 'ExportForm',
3409
- components: { DynamicField: __vue_component__$4, FormFooter },
3410
- setup(props, context) {
3411
- var _a, _b;
3412
- const { t } = useTranslation(context);
3413
- /** Strategies */
3414
- const [fetchStrategies, { data: strategies, loading: isStrategiesLoading },] = useResource({
3415
- fetchResource: getStrategies,
3416
- initialValue: [],
3417
- context,
3418
- resourceName: 'Strategies',
3419
- });
3420
- const strategyOptionList = computed(() => convertStrategiesToStrategyOptionList(strategies.value));
3421
- onMounted(() => {
3422
- fetchStrategies();
3423
- });
3424
- /** Delimiter **/
3425
- const delimiterOptionList = computed(() => [
3426
- { value: ',', label: t('export:comma') },
3427
- { value: ';', label: t('export:semicolon') },
3428
- ]);
3429
- /** Form state */
3430
- const defaultExtension = formatOptionList[0];
3431
- const defaultDelimiter = delimiterOptionList.value[0];
3432
- const errors = ref({});
3433
- const values = ref({
3434
- strategy: null,
3435
- filename: `export.${defaultExtension.value.toLowerCase()}`,
3436
- format: defaultExtension,
3437
- delimiter: defaultDelimiter,
3438
- });
3439
- const isSubmitting = ref(false);
3440
- const templateValues = ref([]);
3441
- function updateTemplateValues() {
3442
- var _a;
3443
- const selectedStrategy = strategies.value.find((strategy) => { var _a; return strategy.id === ((_a = values.value.strategy) === null || _a === void 0 ? void 0 : _a.value); });
3444
- const fieldTemplateList = (_a = selectedStrategy === null || selectedStrategy === void 0 ? void 0 : selectedStrategy.fields) !== null && _a !== void 0 ? _a : [];
3445
- templateValues.value = fieldTemplateList.map((fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null));
3446
- }
3447
- watch(() => values.value.strategy, () => {
3448
- updateTemplateValues();
3449
- });
3450
- onMounted(() => {
3451
- updateTemplateValues();
3452
- });
3453
- const shouldDisplayDelimiter = ref(isCSVFormat((_b = (_a = values.value.format) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ''));
3454
- watch(() => values.value.format, () => {
3455
- var _a, _b, _c;
3456
- const newExtension = (_a = values.value.format) === null || _a === void 0 ? void 0 : _a.value.toLowerCase();
3457
- values.value.filename = replaceFileExtension(values.value.filename, newExtension || '');
3458
- shouldDisplayDelimiter.value = isCSVFormat((_c = (_b = values.value.format) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : '');
3459
- });
3460
- function submitForm(event) {
3461
- isSubmitting.value = true;
3462
- const creationPayload = convertExportFormValuesToCreationPayload(values.value, templateValues.value);
3463
- createExport(creationPayload)
3464
- .then(() => {
3465
- errors.value = {};
3466
- if (event.type === 'create' ||
3467
- event.type === 'save' ||
3468
- event.type === 'create_exit' ||
3469
- event.type === 'save_exit') {
3470
- context.root.$router.push(getExportListUrl());
3471
- }
3472
- context.root.$toast({
3473
- variant: 'success',
3474
- title: t('export:success'),
3475
- body: t('export:createdSuccessMessage'),
3476
- });
3477
- })
3478
- .catch((error) => {
3479
- console.error(error);
3480
- errors.value = convertRequestErrorToMap(error);
3481
- context.root.$toast({
3482
- variant: 'danger',
3483
- title: t('export:error'),
3484
- body: t('export:createdErrorMessage'),
3485
- });
3486
- })
3487
- .finally(() => {
3488
- isSubmitting.value = false;
3489
- });
3490
- }
3491
- /** Is content loading **/
3492
- const isContentLoading = computed(() => isStrategiesLoading.value);
3493
- return {
3494
- values,
3495
- errors,
3496
- isSubmitting,
3497
- submitForm,
3498
- getExportListUrl,
3499
- strategyOptionList,
3500
- formatOptionList,
3501
- delimiterOptionList,
3502
- isContentLoading,
3503
- shouldDisplayDelimiter,
3504
- templateValues,
3505
- };
3506
- },
3507
- });
3508
-
3509
- /* script */
3510
- const __vue_script__$5 = script$5;
3511
-
3512
- /* template */
3513
- var __vue_render__$3 = function () {
3514
- var _vm = this;
3515
- var _h = _vm.$createElement;
3516
- var _c = _vm._self._c || _h;
3517
- return _c(
3518
- "page",
3519
- {
3520
- attrs: {
3521
- title: _vm.$t("export:newExport"),
3522
- "is-content-loading": _vm.isContentLoading,
3523
- },
3524
- scopedSlots: _vm._u([
3525
- {
3526
- key: "footer",
3527
- fn: function () {
3528
- return [
3529
- _c("FormFooter", {
3530
- attrs: {
3531
- "back-href": _vm.getExportListUrl(),
3532
- "on-submit": _vm.submitForm,
3533
- "is-submitting": _vm.isSubmitting,
3534
- "is-creation": true,
3535
- },
3536
- }),
3537
- ]
3538
- },
3539
- proxy: true,
3540
- },
3541
- ]),
3542
- },
3543
- [
3544
- _c(
3545
- "form",
3546
- {
3547
- attrs: { novalidate: "" },
3548
- on: {
3549
- submit: function ($event) {
3550
- $event.preventDefault();
3551
- },
3552
- },
3553
- },
3554
- [
3555
- _c("form-field-select", {
3556
- attrs: {
3557
- options: _vm.strategyOptionList,
3558
- error: _vm.errors.strategy,
3559
- label: _vm.$t("export:exportType"),
3560
- name: "exportType",
3561
- },
3562
- model: {
3563
- value: _vm.values.strategy,
3564
- callback: function ($$v) {
3565
- _vm.$set(_vm.values, "strategy", $$v);
3566
- },
3567
- expression: "values.strategy",
3568
- },
3569
- }),
3570
- _vm._v(" "),
3571
- _c(
3572
- "div",
3573
- { staticClass: "field" },
3574
- [
3575
- _c("form-field", {
3576
- attrs: {
3577
- error: _vm.errors.filename,
3578
- label: _vm.$t("export:filename"),
3579
- name: "filename",
3580
- },
3581
- model: {
3582
- value: _vm.values.filename,
3583
- callback: function ($$v) {
3584
- _vm.$set(_vm.values, "filename", $$v);
3585
- },
3586
- expression: "values.filename",
3587
- },
3588
- }),
3589
- _vm._v(" "),
3590
- _c("form-field-select", {
3591
- attrs: {
3592
- options: _vm.formatOptionList,
3593
- error: _vm.errors.format,
3594
- label: _vm.$t("export:format"),
3595
- name: "format",
3596
- },
3597
- model: {
3598
- value: _vm.values.format,
3599
- callback: function ($$v) {
3600
- _vm.$set(_vm.values, "format", $$v);
3601
- },
3602
- expression: "values.format",
3603
- },
3604
- }),
3605
- _vm._v(" "),
3606
- _c("div"),
3607
- _vm._v(" "),
3608
- _vm.shouldDisplayDelimiter
3609
- ? _c("form-field-select", {
3610
- attrs: {
3611
- options: _vm.delimiterOptionList,
3612
- error: _vm.errors.delimiter,
3613
- label: _vm.$t("export:delimiter"),
3614
- name: "delimiter",
3615
- },
3616
- model: {
3617
- value: _vm.values.delimiter,
3618
- callback: function ($$v) {
3619
- _vm.$set(_vm.values, "delimiter", $$v);
3620
- },
3621
- expression: "values.delimiter",
3622
- },
3623
- })
3624
- : _vm._e(),
3625
- ],
3626
- 1
3627
- ),
3628
- _vm._v(" "),
3629
- _vm._l(_vm.templateValues, function (field) {
3630
- return _c("DynamicField", {
3631
- key: field.config.name,
3632
- attrs: { field: field },
3633
- })
3634
- }),
3635
- ],
3636
- 2
3637
- ),
3638
- ]
3639
- )
3640
- };
3641
- var __vue_staticRenderFns__$3 = [];
3642
- __vue_render__$3._withStripped = true;
3643
-
3644
- /* style */
3645
- const __vue_inject_styles__$5 = function (inject) {
3646
- if (!inject) return
3647
- inject("data-v-5a365a86_0", { source: ".field[data-v-5a365a86] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 20px;\n}\n\n/*# sourceMappingURL=ExportForm.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-export/tager-admin-export/src/views/ExportForm/ExportForm.vue","ExportForm.vue"],"names":[],"mappings":"AAkPA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;ACjPA;;AAEA,yCAAyC","file":"ExportForm.vue","sourcesContent":["<template>\n <page :title=\"$t('export:newExport')\" :is-content-loading=\"isContentLoading\">\n <form novalidate @submit.prevent>\n <form-field-select\n v-model=\"values.strategy\"\n :options=\"strategyOptionList\"\n :error=\"errors.strategy\"\n :label=\"$t('export:exportType')\"\n name=\"exportType\"\n />\n\n <div class=\"field\">\n <form-field\n v-model=\"values.filename\"\n :error=\"errors.filename\"\n :label=\"$t('export:filename')\"\n name=\"filename\"\n />\n\n <form-field-select\n v-model=\"values.format\"\n :options=\"formatOptionList\"\n :error=\"errors.format\"\n :label=\"$t('export:format')\"\n name=\"format\"\n />\n\n <div />\n\n <form-field-select\n v-if=\"shouldDisplayDelimiter\"\n v-model=\"values.delimiter\"\n :options=\"delimiterOptionList\"\n :error=\"errors.delimiter\"\n :label=\"$t('export:delimiter')\"\n name=\"delimiter\"\n />\n </div>\n\n <DynamicField\n v-for=\"field of templateValues\"\n :key=\"field.config.name\"\n :field=\"field\"\n />\n </form>\n\n <template v-slot:footer>\n <FormFooter\n :back-href=\"getExportListUrl()\"\n :on-submit=\"submitForm\"\n :is-submitting=\"isSubmitting\"\n :is-creation=\"true\"\n />\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, watch } from '@vue/composition-api';\nimport { computed, onMounted, ref } from '@vue/composition-api';\n\nimport { convertRequestErrorToMap, useResource } from '@tager/admin-services';\nimport {\n OptionType,\n TagerFormSubmitEvent,\n FormFooter,\n useTranslation,\n} from '@tager/admin-ui';\nimport {\n DynamicField,\n FieldConfigUnion,\n FieldUnion,\n universalFieldUtils,\n} from '@tager/admin-dynamic-field';\n\nimport { createExport, getStrategies } from '../../services/requests';\nimport { getExportListUrl } from '../../utils/paths';\nimport { replaceFileExtension } from '../../utils/common';\n\nimport {\n convertExportFormValuesToCreationPayload,\n convertStrategiesToStrategyOptionList,\n formatOptionList,\n isCSVFormat,\n} from './ExportForm.helpers';\nimport { FormValues } from './ExportForm.types';\n\nexport default defineComponent({\n name: 'ExportForm',\n components: { DynamicField, FormFooter },\n setup(props, context) {\n const { t } = useTranslation(context);\n\n /** Strategies */\n\n const [\n fetchStrategies,\n { data: strategies, loading: isStrategiesLoading },\n ] = useResource({\n fetchResource: getStrategies,\n initialValue: [],\n context,\n resourceName: 'Strategies',\n });\n\n const strategyOptionList = computed<Array<OptionType>>(() =>\n convertStrategiesToStrategyOptionList(strategies.value)\n );\n\n onMounted(() => {\n fetchStrategies();\n });\n\n /** Delimiter **/\n\n const delimiterOptionList = computed<Array<OptionType>>(() => [\n { value: ',', label: t('export:comma') },\n { value: ';', label: t('export:semicolon') },\n ]);\n\n /** Form state */\n\n const defaultExtension = formatOptionList[0];\n const defaultDelimiter = delimiterOptionList.value[0];\n\n const errors = ref<Record<string, string>>({});\n const values = ref<FormValues>({\n strategy: null,\n filename: `export.${defaultExtension.value.toLowerCase()}`,\n format: defaultExtension,\n delimiter: defaultDelimiter,\n });\n const isSubmitting = ref<boolean>(false);\n const templateValues = ref<Array<FieldUnion>>([]);\n\n function updateTemplateValues() {\n const selectedStrategy = strategies.value.find(\n (strategy) => strategy.id === values.value.strategy?.value\n );\n\n const fieldTemplateList: Array<FieldConfigUnion> =\n selectedStrategy?.fields ?? [];\n\n templateValues.value = fieldTemplateList.map((fieldConfig) =>\n universalFieldUtils.createFormField(fieldConfig, null)\n );\n }\n\n watch(\n () => values.value.strategy,\n () => {\n updateTemplateValues();\n }\n );\n\n onMounted(() => {\n updateTemplateValues();\n });\n\n const shouldDisplayDelimiter = ref<boolean>(\n isCSVFormat(values.value.format?.value ?? '')\n );\n\n watch(\n () => values.value.format,\n () => {\n const newExtension = values.value.format?.value.toLowerCase();\n\n values.value.filename = replaceFileExtension(\n values.value.filename,\n newExtension || ''\n );\n\n shouldDisplayDelimiter.value = isCSVFormat(\n values.value.format?.value ?? ''\n );\n }\n );\n\n function submitForm(event: TagerFormSubmitEvent) {\n isSubmitting.value = true;\n\n const creationPayload = convertExportFormValuesToCreationPayload(\n values.value,\n templateValues.value\n );\n\n createExport(creationPayload)\n .then(() => {\n errors.value = {};\n\n if (\n event.type === 'create' ||\n event.type === 'save' ||\n event.type === 'create_exit' ||\n event.type === 'save_exit'\n ) {\n context.root.$router.push(getExportListUrl());\n }\n\n context.root.$toast({\n variant: 'success',\n title: t('export:success'),\n body: t('export:createdSuccessMessage'),\n });\n })\n .catch((error) => {\n console.error(error);\n errors.value = convertRequestErrorToMap(error);\n context.root.$toast({\n variant: 'danger',\n title: t('export:error'),\n body: t('export:createdErrorMessage'),\n });\n })\n .finally(() => {\n isSubmitting.value = false;\n });\n }\n\n /** Is content loading **/\n\n const isContentLoading = computed<boolean>(() => isStrategiesLoading.value);\n\n return {\n values,\n errors,\n isSubmitting,\n submitForm,\n getExportListUrl,\n strategyOptionList,\n formatOptionList,\n delimiterOptionList,\n isContentLoading,\n shouldDisplayDelimiter,\n templateValues,\n };\n },\n});\n</script>\n\n<style lang=\"scss\" scoped>\n.field {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 20px;\n}\n</style>\n",".field {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 20px;\n}\n\n/*# sourceMappingURL=ExportForm.vue.map */"]}, media: undefined });
3648
-
3649
- };
3650
- /* scoped */
3651
- const __vue_scope_id__$5 = "data-v-5a365a86";
3652
- /* module identifier */
3653
- const __vue_module_identifier__$5 = undefined;
3654
- /* functional template */
3655
- const __vue_is_functional_template__$5 = false;
3656
- /* style inject SSR */
3657
-
3658
- /* style inject shadow dom */
3659
-
3660
-
3661
-
3662
- const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
3663
- { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
3664
- __vue_inject_styles__$5,
3665
- __vue_script__$5,
3666
- __vue_scope_id__$5,
3667
- __vue_is_functional_template__$5,
3668
- __vue_module_identifier__$5,
3669
- false,
3670
- createInjector,
3671
- undefined,
3672
- undefined
3673
- );
3674
-
3675
- const EXPORT_LIST_ROUTE = {
3676
- path: EXPORT_ROUTE_PATHS.EXPORT_LIST,
3677
- component: __vue_component__$1,
3678
- name: 'Export List',
3679
- meta: {
3680
- getBreadcrumbs: (route, t) => [
3681
- { url: '/', text: t('export:home') },
3682
- { url: route.path, text: t('export:export') },
3683
- ],
3684
- },
3685
- };
3686
- const EXPORT_FORM_ROUTE = {
3687
- path: EXPORT_ROUTE_PATHS.EXPORT_FORM,
3688
- component: __vue_component__$5,
3689
- name: 'Export Form',
3690
- meta: {
3691
- getBreadcrumbs: (route, t) => [
3692
- { url: '/', text: t('export:home') },
3693
- { url: EXPORT_LIST_ROUTE.path, text: t('export:export') },
3694
- { url: route.path, text: t('export:newExport') },
3695
- ],
3696
- },
3697
- };
3698
-
3699
- i18n.addTranslations('en', 'export', EN);
3700
- i18n.addTranslations('ru', 'export', RU);
3701
-
3702
- export { EXPORT_FORM_ROUTE, EXPORT_LIST_ROUTE, createExport, getExportFormUrl, getExportList, getExportListUrl, getStrategies };