@tager/admin-export 0.1.5 → 1.0.0

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