@tager/admin-import 0.1.3 → 1.0.0

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