@tager/admin-import 0.1.3 → 1.0.1

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