rb-document-form-constructor 0.8.77 → 0.8.78

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.
@@ -5,7 +5,6 @@ const UtFormConfig = {
5
5
  if (!formConfig || !formConfig.sections) {
6
6
  return null;
7
7
  }
8
-
9
8
  let found = null;
10
9
  formConfig.sections.every(r => {
11
10
  if (r.columns) {
@@ -15,25 +14,21 @@ const UtFormConfig = {
15
14
  found = f;
16
15
  }
17
16
  });
18
-
19
17
  if (found) {
20
18
  return false;
21
19
  }
22
20
  });
23
21
  }
24
-
25
22
  if (found) {
26
23
  return false;
27
24
  }
28
25
  });
29
26
  return found;
30
27
  },
31
-
32
28
  findRule(ruleId, formConfig) {
33
29
  if (!formConfig || !formConfig.sections) {
34
30
  return null;
35
31
  }
36
-
37
32
  let found = null;
38
33
  formConfig.sections.every(s => {
39
34
  if (s.columns) {
@@ -46,25 +41,21 @@ const UtFormConfig = {
46
41
  }
47
42
  });
48
43
  }
49
-
50
44
  if (found) {
51
45
  return false;
52
46
  }
53
47
  });
54
-
55
48
  if (found) {
56
49
  return false;
57
50
  }
58
51
  });
59
52
  }
60
-
61
53
  if (found) {
62
54
  return false;
63
55
  }
64
56
  });
65
57
  return found;
66
58
  },
67
-
68
59
  getFields(formConfig) {
69
60
  let fields = [];
70
61
  formConfig.sections.forEach(s => {
@@ -80,7 +71,6 @@ const UtFormConfig = {
80
71
  });
81
72
  return fields;
82
73
  },
83
-
84
74
  parseFacets(formConfig) {
85
75
  let facets = [];
86
76
  formConfig.sections.forEach(section => {
@@ -94,31 +84,24 @@ const UtFormConfig = {
94
84
  });
95
85
  return facets;
96
86
  }
97
-
98
87
  };
99
88
 
100
89
  let __clone = function (data) {
101
90
  return JSON.parse(JSON.stringify(data));
102
91
  };
103
-
104
92
  let __assign = function () {
105
93
  __assign = Object.assign || function __assign(t) {
106
94
  for (let s, i = 1, n = arguments.length; i < n; i++) {
107
95
  s = arguments[i];
108
-
109
96
  for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
110
97
  }
111
-
112
98
  return t;
113
99
  };
114
-
115
100
  return __assign.apply(this, arguments);
116
101
  };
117
-
118
102
  let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
119
103
  for (let dataType in formConfigInputs) {
120
104
  let foundInputs = inputs[dataType];
121
-
122
105
  if (foundInputs) {
123
106
  __mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
124
107
  } else {
@@ -126,17 +109,14 @@ let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
126
109
  }
127
110
  }
128
111
  };
129
-
130
112
  let __mergeInputsInMap = function (inputs, formConfigInputs) {
131
113
  for (let name in formConfigInputs) {
132
114
  inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
133
115
  }
134
116
  };
135
-
136
117
  let __mergeInputsInArray = function (inputs, formConfigInputs) {
137
118
  formConfigInputs.forEach(input => {
138
119
  let index = inputs.findIndex(item => item.name === input.name);
139
-
140
120
  if (index >= 0) {
141
121
  inputs[index] = input;
142
122
  } else {
@@ -144,16 +124,12 @@ let __mergeInputsInArray = function (inputs, formConfigInputs) {
144
124
  }
145
125
  });
146
126
  };
147
-
148
127
  let __applyDefaultProps = function (input, field) {
149
128
  for (let propName in input.props) {
150
129
  if (field) {
151
130
  if (field.input.propsData[propName]) {
152
- var _input$propsData, _input$props, _input$props$type;
153
-
154
131
  input.propsData[propName] = field.input.propsData[propName];
155
-
156
- if ((_input$propsData = input.propsData) !== null && _input$propsData !== void 0 && _input$propsData.type && (_input$props = input.props) !== null && _input$props !== void 0 && (_input$props$type = _input$props.type) !== null && _input$props$type !== void 0 && _input$props$type.default) {
132
+ if (input.propsData?.type && input.props?.type?.default) {
157
133
  input.propsData.type = input.props.type.default;
158
134
  }
159
135
  }
@@ -162,21 +138,18 @@ let __applyDefaultProps = function (input, field) {
162
138
  }
163
139
  }
164
140
  };
165
-
166
141
  let __applyRefProps = function (input, refConfig) {
167
- if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
142
+ if (refConfig?.propsData) {
168
143
  for (let propName in refConfig.propsData) {
169
144
  input.propsData[propName] = refConfig.propsData[propName];
170
145
  }
171
146
  }
172
147
  };
173
-
174
148
  let __filterInputsByMultiple = function (inputs, multiple) {
175
149
  return inputs.filter(i => {
176
150
  return i.multiple && multiple || !i.multiple && !multiple;
177
151
  });
178
152
  };
179
-
180
153
  let fcInputs = {
181
154
  string: {
182
155
  text: 'Текст',
@@ -378,52 +351,40 @@ let baseConfig = {
378
351
  };
379
352
  const UtFormConstructor = {
380
353
  config: {},
381
-
382
354
  init(formConfig) {
383
355
  this.config = __clone(baseConfig);
384
-
385
356
  if (formConfig) {
386
357
  if (formConfig.inputs) {
387
358
  __mergeInputsInMap(this.config.inputs, formConfig.inputs);
388
359
  }
389
-
390
360
  if (formConfig.primitiveInputs) {
391
361
  __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
392
362
  }
393
-
394
363
  if (formConfig.dictInputs) {
395
364
  __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
396
365
  }
397
-
398
366
  if (formConfig.refInputs) {
399
367
  __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
400
368
  }
401
-
402
369
  if (formConfig.refInputConfigs) {
403
370
  this.config.refInputConfigs = formConfig.refInputConfigs;
404
371
  }
405
-
406
372
  if (formConfig.icons) {
407
373
  this.config.icons = __assign(this.config.icons, formConfig.icons);
408
374
  }
409
-
410
375
  if (formConfig.rules) {
411
376
  this.config.rules = formConfig.rules;
412
377
  }
413
-
414
378
  if (formConfig.ruleContext) {
415
379
  this.config.ruleContext = formConfig.ruleContext;
416
380
  }
417
381
  }
418
382
  },
419
-
420
383
  getInputTypes(field) {
421
384
  let inputs = [];
422
-
423
385
  if (!field) {
424
386
  return inputs;
425
387
  }
426
-
427
388
  if (field.dict && !this.config.refInputs[field.ref]) {
428
389
  inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
429
390
  } else if (field.ref) {
@@ -431,98 +392,76 @@ const UtFormConstructor = {
431
392
  } else {
432
393
  inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
433
394
  }
434
-
435
395
  return inputs;
436
396
  },
437
-
438
397
  hasMultipleInputTypes(field) {
439
- let inputs = this.getInputTypes({ ...field,
398
+ let inputs = this.getInputTypes({
399
+ ...field,
440
400
  multiple: true
441
401
  });
442
402
  return inputs && inputs.length > 0;
443
403
  },
444
-
445
404
  getDefaultInput(field) {
446
405
  let input = null;
447
406
  let inputs = this.getInputTypes(field);
448
-
449
407
  if (!inputs) {
450
408
  input = this.primitiveInputs[0];
451
409
  }
452
-
453
410
  if (field.ref && this.config.refInputs[field.ref]) {
454
411
  input = __clone(inputs[0]);
455
-
456
412
  __applyDefaultProps(input);
457
-
458
413
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
459
414
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
460
415
  }
461
416
  } else if (field.dict) {
462
417
  input = __clone(inputs[0]);
463
418
  input.props.dict.default = field.ref;
464
-
465
419
  __applyDefaultProps(input);
466
420
  } else {
467
421
  input = __clone(inputs[0]);
468
-
469
422
  __applyDefaultProps(input);
470
423
  }
471
-
472
424
  return input;
473
425
  },
474
-
475
426
  getInputTypeByName(name, field) {
476
427
  let input = __clone(this.config.inputs[name]);
477
-
478
428
  if (field.ref && this.config.refInputs[field.ref]) {
479
429
  __applyDefaultProps(input);
480
-
481
430
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
482
431
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
483
432
  }
484
433
  } else if (field.dict) {
485
434
  input.props.dict.default = field.ref;
486
-
487
435
  __applyDefaultProps(input);
488
436
  } else {
489
437
  __applyDefaultProps(input, field);
490
438
  }
491
-
492
439
  input.propsData['ref'] = field.name;
493
440
  return input;
494
441
  },
495
-
496
442
  getAvailableFieldRules(field) {
497
443
  return this.config.rules.filter(rule => {
498
444
  return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
499
445
  });
500
446
  },
501
-
502
447
  getRuleContext() {
503
448
  return this.config.ruleContext;
504
449
  },
505
-
506
450
  runRule(context, script) {
507
451
  context = context ? context : {};
508
452
  context['console'] = console;
509
453
  context['Date'] = Date;
510
454
  context['Math'] = Math;
511
455
  let appendScript = '';
512
-
513
456
  for (let v in context) {
514
457
  appendScript = appendScript + `var ${v} = this.${v};\n`;
515
458
  }
516
-
517
459
  appendScript = appendScript ? appendScript + '\n' : '';
518
-
519
460
  let func = function (script) {
520
461
  return eval(script);
521
462
  };
522
-
523
463
  func.call(context, appendScript + script);
524
464
  }
525
-
526
465
  };
527
466
 
528
467
  /*!
@@ -2785,6 +2724,7 @@ const i18n = new VueI18n$1({
2785
2724
  //
2786
2725
  //
2787
2726
  //
2727
+
2788
2728
  var script$5 = {
2789
2729
  name: 'DocTemplateSectionModal',
2790
2730
  props: {
@@ -2798,19 +2738,16 @@ var script$5 = {
2798
2738
  default: () => {}
2799
2739
  }
2800
2740
  },
2801
-
2802
2741
  data() {
2803
2742
  return {
2804
2743
  id: 'rb-doc-template-section-modal',
2805
2744
  label: {}
2806
2745
  };
2807
2746
  },
2808
-
2809
2747
  computed: {
2810
2748
  title() {
2811
2749
  return this.mode === 'ins' ? 'Добавление секции' : 'Редактирование секции';
2812
2750
  }
2813
-
2814
2751
  },
2815
2752
  watch: {
2816
2753
  section() {
@@ -2818,29 +2755,23 @@ var script$5 = {
2818
2755
  this.label = this.section;
2819
2756
  }
2820
2757
  }
2821
-
2822
2758
  },
2823
2759
  methods: {
2824
2760
  onOk() {
2825
2761
  this.section = this.label;
2826
-
2827
2762
  if (this.onAfterOk) {
2828
2763
  this.onAfterOk();
2829
2764
  }
2830
-
2831
2765
  this.$nextTick(() => {
2832
2766
  this.$bvModal.hide(this.id);
2833
2767
  });
2834
2768
  }
2835
-
2836
2769
  },
2837
-
2838
2770
  created() {
2839
2771
  if (this.section) {
2840
2772
  this.label = this.section;
2841
2773
  }
2842
2774
  }
2843
-
2844
2775
  };
2845
2776
 
2846
2777
  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
@@ -2920,15 +2851,12 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
2920
2851
 
2921
2852
  /* script */
2922
2853
  const __vue_script__$5 = script$5;
2923
- /* template */
2924
2854
 
2855
+ /* template */
2925
2856
  var __vue_render__$5 = function () {
2926
2857
  var _vm = this;
2927
-
2928
2858
  var _h = _vm.$createElement;
2929
-
2930
2859
  var _c = _vm._self._c || _h;
2931
-
2932
2860
  return _c('b-modal', {
2933
2861
  attrs: {
2934
2862
  "id": "rb-doc-template-section-modal",
@@ -2969,19 +2897,15 @@ var __vue_render__$5 = function () {
2969
2897
  }
2970
2898
  })], 1)], 1)], 1)], 1)], 1);
2971
2899
  };
2972
-
2973
2900
  var __vue_staticRenderFns__$5 = [];
2974
- /* style */
2975
2901
 
2902
+ /* style */
2976
2903
  const __vue_inject_styles__$5 = undefined;
2977
2904
  /* scoped */
2978
-
2979
2905
  const __vue_scope_id__$5 = undefined;
2980
2906
  /* module identifier */
2981
-
2982
2907
  const __vue_module_identifier__$5 = undefined;
2983
2908
  /* functional template */
2984
-
2985
2909
  const __vue_is_functional_template__$5 = false;
2986
2910
  /* style inject */
2987
2911
 
@@ -2993,7 +2917,6 @@ const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
2993
2917
  render: __vue_render__$5,
2994
2918
  staticRenderFns: __vue_staticRenderFns__$5
2995
2919
  }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
2996
-
2997
2920
  var DocTemplateSectionModal = __vue_component__$6;
2998
2921
 
2999
2922
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -8396,7 +8319,6 @@ var script$4 = {
8396
8319
  default: () => []
8397
8320
  }
8398
8321
  },
8399
-
8400
8322
  data() {
8401
8323
  return {
8402
8324
  allFacets: [],
@@ -8404,26 +8326,21 @@ var script$4 = {
8404
8326
  facetSearchStr: null
8405
8327
  };
8406
8328
  },
8407
-
8408
8329
  computed: {
8409
8330
  iconExpandFacet() {
8410
8331
  return UtFormConstructor.config.icons.iconExpandFacet;
8411
8332
  },
8412
-
8413
8333
  iconCollapseFacet() {
8414
8334
  return UtFormConstructor.config.icons.iconCollapseFacet;
8415
8335
  }
8416
-
8417
8336
  },
8418
8337
  watch: {
8419
8338
  facetSearchStr() {
8420
8339
  this.findInFacets(this.facetSearchStr);
8421
8340
  },
8422
-
8423
8341
  facets() {
8424
8342
  this.handleFacetsProp();
8425
8343
  }
8426
-
8427
8344
  },
8428
8345
  methods: {
8429
8346
  onFieldCloned(cloneField) {
@@ -8431,69 +8348,55 @@ var script$4 = {
8431
8348
  field.input = UtFormConstructor.getDefaultInput(field);
8432
8349
  return field;
8433
8350
  },
8434
-
8435
8351
  onFieldMoveEnd(event) {
8436
8352
  this.$emit('fieldMoveEnd', event);
8437
8353
  },
8438
-
8439
8354
  findInFacets(str) {
8440
8355
  str = str.toLowerCase();
8441
-
8442
8356
  if (!str || str.length === 0) {
8443
8357
  this.innerFacets = this.allFacets;
8444
8358
  }
8445
-
8446
8359
  let facets = JSON.parse(JSON.stringify(this.allFacets));
8447
8360
  facets = facets.filter(facet => {
8448
8361
  let facetFound = false;
8449
8362
  facet.fields = facet.fields.filter(field => {
8450
8363
  let fieldFound = field.labelRu.toLowerCase().indexOf(str) >= 0;
8451
-
8452
8364
  if (fieldFound) {
8453
8365
  facetFound = true;
8454
8366
  }
8455
-
8456
8367
  return fieldFound;
8457
8368
  });
8458
8369
  return facetFound;
8459
8370
  });
8460
8371
  this.innerFacets = facets;
8461
8372
  },
8462
-
8463
8373
  handleFacetsProp() {
8464
- let innerFacets = this.facets.map(f => ({ ...f,
8374
+ let innerFacets = this.facets.map(f => ({
8375
+ ...f,
8465
8376
  expanded: false
8466
8377
  }));
8467
-
8468
8378
  if (innerFacets) {
8469
8379
  innerFacets.forEach(facet => {
8470
8380
  facet.fields = facet.fields.filter(field => !field.hiddenOnFormConfig);
8471
8381
  });
8472
8382
  }
8473
-
8474
8383
  this.innerFacets = JSON.parse(JSON.stringify(innerFacets));
8475
8384
  this.allFacets = JSON.parse(JSON.stringify(innerFacets));
8476
8385
  }
8477
-
8478
8386
  },
8479
-
8480
8387
  created() {
8481
8388
  this.handleFacetsProp();
8482
8389
  }
8483
-
8484
8390
  };
8485
8391
 
8486
8392
  /* script */
8487
8393
  const __vue_script__$4 = script$4;
8488
- /* template */
8489
8394
 
8395
+ /* template */
8490
8396
  var __vue_render__$4 = function () {
8491
8397
  var _vm = this;
8492
-
8493
8398
  var _h = _vm.$createElement;
8494
-
8495
8399
  var _c = _vm._self._c || _h;
8496
-
8497
8400
  return _c('div', {
8498
8401
  staticClass: "rb-facets-sidebar"
8499
8402
  }, [_c('h4', [_vm._v("Компоненты")]), _vm._v(" "), _c('b-form', [_c('b-form-row', [_c('b-col', {
@@ -8564,19 +8467,15 @@ var __vue_render__$4 = function () {
8564
8467
  }), 1)], 1) : _vm._e()], 1) : _vm._e();
8565
8468
  }), 0)], 1);
8566
8469
  };
8567
-
8568
8470
  var __vue_staticRenderFns__$4 = [];
8569
- /* style */
8570
8471
 
8472
+ /* style */
8571
8473
  const __vue_inject_styles__$4 = undefined;
8572
8474
  /* scoped */
8573
-
8574
8475
  const __vue_scope_id__$4 = undefined;
8575
8476
  /* module identifier */
8576
-
8577
8477
  const __vue_module_identifier__$4 = undefined;
8578
8478
  /* functional template */
8579
-
8580
8479
  const __vue_is_functional_template__$4 = false;
8581
8480
  /* style inject */
8582
8481
 
@@ -8588,7 +8487,6 @@ const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
8588
8487
  render: __vue_render__$4,
8589
8488
  staticRenderFns: __vue_staticRenderFns__$4
8590
8489
  }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
8591
-
8592
8490
  var DocTemplateFacetList = __vue_component__$5;
8593
8491
 
8594
8492
  var toString = Object.prototype.toString;
@@ -8639,42 +8537,34 @@ var script$3 = {
8639
8537
  default: true
8640
8538
  }
8641
8539
  },
8642
-
8643
8540
  data() {
8644
8541
  return {
8645
8542
  validationState: {}
8646
8543
  };
8647
8544
  },
8648
-
8649
8545
  watch: {
8650
8546
  formConfig() {
8651
8547
  this.validationState = {};
8652
8548
  this.execApplyDefaultValues();
8653
8549
  this.execApplyDefaultValRule();
8654
8550
  }
8655
-
8656
8551
  },
8657
8552
  methods: {
8658
8553
  getResolveValueName(field) {
8659
8554
  if ((field.dict || field.ref) && !field.multiple) {
8660
8555
  return field.name.substring(0, field.name.length - 2);
8661
8556
  }
8662
-
8663
8557
  return field.name;
8664
8558
  },
8665
-
8666
8559
  getResolveValue(field) {
8667
8560
  return this.doc[this.getResolveValueName(field)] ? this.doc[this.getResolveValueName(field)] : null;
8668
8561
  },
8669
-
8670
- setResolveValue(_ref) {
8671
- let {
8672
- field,
8673
- multiple = false
8674
- } = _ref;
8562
+ setResolveValue({
8563
+ field,
8564
+ multiple = false
8565
+ }) {
8675
8566
  this.getResolveValue(field);
8676
8567
  },
8677
-
8678
8568
  getDisplayField(value) {
8679
8569
  if (!value[this.displayField]) {
8680
8570
  return value.labelRu;
@@ -8682,20 +8572,16 @@ var script$3 = {
8682
8572
  return value[this.displayField];
8683
8573
  }
8684
8574
  },
8685
-
8686
8575
  onEventFired(eventName, event, field) {
8687
8576
  if (eventName === 'input' && field.ref && !field.multiple) {
8688
8577
  let dataField = null;
8689
-
8690
8578
  if (field.name.lastIndexOf(this.refSuffix) >= 0) {
8691
8579
  dataField = field.name.substring(0, field.name.lastIndexOf(this.refSuffix));
8692
8580
  }
8693
-
8694
8581
  if (dataField && dataField.length > 0) {
8695
8582
  this.doc[dataField] = null;
8696
8583
  }
8697
8584
  }
8698
-
8699
8585
  if (field.rules) {
8700
8586
  field.rules.forEach(rule => {
8701
8587
  if (rule.event === eventName && rule.script) {
@@ -8707,7 +8593,6 @@ var script$3 = {
8707
8593
  });
8708
8594
  }
8709
8595
  },
8710
-
8711
8596
  onGlobalEventFired(eventName, event) {
8712
8597
  let fields = UtFormConfig.getFields(this.formConfig);
8713
8598
  fields.forEach(f => {
@@ -8723,7 +8608,6 @@ var script$3 = {
8723
8608
  }
8724
8609
  });
8725
8610
  },
8726
-
8727
8611
  createRuleContext(additionalContext) {
8728
8612
  return Object.assign({
8729
8613
  form: this,
@@ -8731,81 +8615,58 @@ var script$3 = {
8731
8615
  ...additionalContext
8732
8616
  }, UtFormConstructor.getRuleContext());
8733
8617
  },
8734
-
8735
8618
  runRule(rule, context) {
8736
8619
  UtFormConstructor.runRule(this.createRuleContext(context), rule.script);
8737
8620
  },
8738
-
8739
8621
  isValueEmpty(fieldName) {
8740
- var _this$doc$fieldName;
8741
-
8742
8622
  if (this.doc[fieldName] == null) {
8743
8623
  return true;
8744
8624
  }
8745
-
8746
- if (Array.isArray(this.doc[fieldName]) && !((_this$doc$fieldName = this.doc[fieldName]) !== null && _this$doc$fieldName !== void 0 && _this$doc$fieldName.length)) {
8625
+ if (Array.isArray(this.doc[fieldName]) && !this.doc[fieldName]?.length) {
8747
8626
  return true;
8748
8627
  }
8749
-
8750
8628
  if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
8751
8629
  return true;
8752
8630
  }
8753
-
8754
8631
  return false;
8755
8632
  },
8756
-
8757
8633
  isValueLessThanMax(fieldname, max) {
8758
8634
  if (this.doc[fieldname] && max) {
8759
- var _this$doc$fieldname;
8760
-
8761
- return ((_this$doc$fieldname = this.doc[fieldname]) === null || _this$doc$fieldname === void 0 ? void 0 : _this$doc$fieldname.length) > parseInt(max);
8635
+ return this.doc[fieldname]?.length > parseInt(max);
8762
8636
  }
8763
-
8764
8637
  return false;
8765
8638
  },
8766
-
8767
8639
  isValueLessThanMin(fieldname, min) {
8768
8640
  if (this.doc[fieldname] && min) {
8769
8641
  return parseInt(this.doc[fieldname]) < parseInt(min);
8770
8642
  }
8771
-
8772
8643
  return false;
8773
8644
  },
8774
-
8775
8645
  validate() {
8776
8646
  this.formConfig.sections.forEach(s => {
8777
8647
  s.columns.forEach(c => {
8778
8648
  c.fields.forEach(f => {
8779
- var _f$input$propsData;
8780
-
8781
8649
  let feedback = '';
8782
-
8783
8650
  if (f.required && this.isValueEmpty(f.name)) {
8784
8651
  feedback += i18n.t('validate.required', {
8785
8652
  field: this.getDisplayField(f)
8786
8653
  });
8787
8654
  }
8788
-
8789
8655
  if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
8790
8656
  feedback += `\n${i18n.t('validate.min', {
8791
8657
  min: f.input.propsData.min
8792
8658
  })}`;
8793
- } // TODO: Костыль так как на бэке нету типа memo
8794
-
8795
-
8796
- if (f.input.type === 'b-form-textarea' && this.isValueLessThanMax(f.name, (_f$input$propsData = f.input.propsData) === null || _f$input$propsData === void 0 ? void 0 : _f$input$propsData.max)) {
8797
- var _f$input$propsData2;
8798
-
8799
- feedback += `\nМаксимальное значение для этого поля ${(_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max}`;
8800
8659
  }
8801
-
8660
+ // TODO: Костыль так как на бэке нету типа memo
8661
+ if (f.input.type === 'b-form-textarea' && this.isValueLessThanMax(f.name, f.input.propsData?.max)) {
8662
+ feedback += `\nМаксимальное значение для этого поля ${f.input.propsData?.max}`;
8663
+ }
8802
8664
  if (feedback) {
8803
8665
  Vue$1.set(this.validationState, f.name, false);
8804
8666
  Vue$1.set(this.validationState, `${f.name}__feedback`, feedback);
8805
8667
  } else {
8806
8668
  Vue$1.set(this.validationState, f.name, null);
8807
8669
  }
8808
-
8809
8670
  this.onEventFired('validate', {
8810
8671
  validationState: this.validationState,
8811
8672
  doc: this.doc
@@ -8813,27 +8674,21 @@ var script$3 = {
8813
8674
  });
8814
8675
  });
8815
8676
  });
8816
-
8817
8677
  for (let fieldName in this.validationState) {
8818
8678
  if (this.validationState[fieldName] === false) {
8819
8679
  return false;
8820
8680
  }
8821
8681
  }
8822
-
8823
8682
  return true;
8824
8683
  },
8825
-
8826
8684
  getColumnSize(section) {
8827
8685
  const MAX_COLUMN_SIZE = 12;
8828
-
8829
8686
  if (!section || !section.columnCount) {
8830
8687
  return MAX_COLUMN_SIZE;
8831
8688
  }
8832
-
8833
8689
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
8834
8690
  return colSize;
8835
8691
  },
8836
-
8837
8692
  execApplyDefaultValues() {
8838
8693
  if (this.applyDefaultValues) {
8839
8694
  this.formConfig.sections.forEach(r => {
@@ -8841,13 +8696,11 @@ var script$3 = {
8841
8696
  c.fields.forEach(f => {
8842
8697
  if (f.defaultValue) {
8843
8698
  let defValue;
8844
-
8845
8699
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
8846
8700
  defValue = f.defaultValue();
8847
8701
  } else {
8848
8702
  defValue = f.defaultValue == null ? null : f.defaultValue;
8849
8703
  }
8850
-
8851
8704
  this.$set(this.doc, f.name, f.defaultValue = defValue);
8852
8705
  }
8853
8706
  });
@@ -8855,7 +8708,6 @@ var script$3 = {
8855
8708
  });
8856
8709
  }
8857
8710
  },
8858
-
8859
8711
  execApplyDefaultValRule() {
8860
8712
  this.formConfig.sections.forEach(el => {
8861
8713
  el.columns.forEach(c => {
@@ -8863,7 +8715,6 @@ var script$3 = {
8863
8715
  if (f.rules) {
8864
8716
  if (!f.defaultValue) {
8865
8717
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
8866
-
8867
8718
  if (rule && !this.doc[f.name]) {
8868
8719
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
8869
8720
  }
@@ -8873,34 +8724,27 @@ var script$3 = {
8873
8724
  });
8874
8725
  });
8875
8726
  }
8876
-
8877
8727
  },
8878
-
8879
8728
  mounted() {
8880
8729
  this.execApplyDefaultValues();
8881
8730
  this.execApplyDefaultValRule();
8882
8731
  this.onGlobalEventFired('form-mounted', this);
8883
8732
  },
8884
-
8885
8733
  activated() {
8886
8734
  this.execApplyDefaultValues();
8887
8735
  this.execApplyDefaultValRule();
8888
8736
  this.onGlobalEventFired('form-activated', this);
8889
8737
  }
8890
-
8891
8738
  };
8892
8739
 
8893
8740
  /* script */
8894
8741
  const __vue_script__$3 = script$3;
8895
- /* template */
8896
8742
 
8743
+ /* template */
8897
8744
  var __vue_render__$3 = function () {
8898
8745
  var _vm = this;
8899
-
8900
8746
  var _h = _vm.$createElement;
8901
-
8902
8747
  var _c = _vm._self._c || _h;
8903
-
8904
8748
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
8905
8749
  staticClass: "rb-doc-form",
8906
8750
  on: {
@@ -8998,19 +8842,15 @@ var __vue_render__$3 = function () {
8998
8842
  })], 2)], 1);
8999
8843
  }), 1) : _vm._e();
9000
8844
  };
9001
-
9002
8845
  var __vue_staticRenderFns__$3 = [];
9003
- /* style */
9004
8846
 
8847
+ /* style */
9005
8848
  const __vue_inject_styles__$3 = undefined;
9006
8849
  /* scoped */
9007
-
9008
8850
  const __vue_scope_id__$3 = undefined;
9009
8851
  /* module identifier */
9010
-
9011
8852
  const __vue_module_identifier__$3 = undefined;
9012
8853
  /* functional template */
9013
-
9014
8854
  const __vue_is_functional_template__$3 = false;
9015
8855
  /* style inject */
9016
8856
 
@@ -9022,26 +8862,21 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
9022
8862
  render: __vue_render__$3,
9023
8863
  staticRenderFns: __vue_staticRenderFns__$3
9024
8864
  }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
9025
-
9026
8865
  var DocForm = __vue_component__$4;
9027
8866
 
9028
8867
  const generateRandomString = length => {
9029
8868
  let result = '';
9030
8869
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
9031
8870
  const charactersLength = characters.length;
9032
-
9033
8871
  for (let i = 0; i < length; i++) {
9034
8872
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
9035
8873
  }
9036
-
9037
8874
  return result;
9038
8875
  };
9039
-
9040
8876
  const UtRandom = {
9041
8877
  getRandomString(length) {
9042
8878
  return generateRandomString(length);
9043
8879
  }
9044
-
9045
8880
  };
9046
8881
 
9047
8882
  //
@@ -9060,7 +8895,6 @@ var script$2 = {
9060
8895
  },
9061
8896
  onAfterOk: Function
9062
8897
  },
9063
-
9064
8898
  data() {
9065
8899
  return {
9066
8900
  id: 'rb-field-rule-form-modal',
@@ -9069,26 +8903,21 @@ var script$2 = {
9069
8903
  innerRule: null
9070
8904
  };
9071
8905
  },
9072
-
9073
8906
  computed: {
9074
8907
  title() {
9075
8908
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
9076
8909
  },
9077
-
9078
8910
  fields() {
9079
8911
  return UtFormConfig.getFields(this.formConfig);
9080
8912
  },
9081
-
9082
8913
  rulePresets() {
9083
8914
  return UtFormConstructor.getAvailableFieldRules(this.field);
9084
8915
  }
9085
-
9086
8916
  },
9087
8917
  watch: {
9088
8918
  formConfig() {
9089
8919
  this.copyToInnerFormConfig();
9090
8920
  },
9091
-
9092
8921
  rule() {
9093
8922
  if (this.rule) {
9094
8923
  this.innerRule = this.rule;
@@ -9096,7 +8925,6 @@ var script$2 = {
9096
8925
  this.innerRule = this.getDefaultRule();
9097
8926
  }
9098
8927
  }
9099
-
9100
8928
  },
9101
8929
  methods: {
9102
8930
  validateFields(fieldName) {
@@ -9111,18 +8939,14 @@ var script$2 = {
9111
8939
  }
9112
8940
  });
9113
8941
  },
9114
-
9115
8942
  copyToInnerFormConfig() {
9116
8943
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
9117
8944
  },
9118
-
9119
8945
  applyRuleToInnerFormConfig() {
9120
8946
  if (this.innerFormConfig) {
9121
8947
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
9122
-
9123
8948
  if (!foundRule) {
9124
8949
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
9125
-
9126
8950
  if (foundField) {
9127
8951
  foundField.rules = foundField.rules ? foundField.rules : [];
9128
8952
  foundField.rules.push(this.rule);
@@ -9132,14 +8956,12 @@ var script$2 = {
9132
8956
  }
9133
8957
  }
9134
8958
  },
9135
-
9136
8959
  onActivateTab(index) {
9137
8960
  if (index > 0) {
9138
8961
  this.copyToInnerFormConfig();
9139
8962
  this.applyRuleToInnerFormConfig();
9140
8963
  }
9141
8964
  },
9142
-
9143
8965
  getDefaultState() {
9144
8966
  return {
9145
8967
  name: null,
@@ -9147,7 +8969,6 @@ var script$2 = {
9147
8969
  script: null
9148
8970
  };
9149
8971
  },
9150
-
9151
8972
  getDefaultRule() {
9152
8973
  return {
9153
8974
  id: UtRandom.getRandomString(10),
@@ -9156,27 +8977,22 @@ var script$2 = {
9156
8977
  script: null
9157
8978
  };
9158
8979
  },
9159
-
9160
8980
  resetModal() {
9161
8981
  this.state = this.getDefaultState();
9162
8982
  this.innerRule = null;
9163
8983
  },
9164
-
9165
8984
  addVariableToScript(varName) {
9166
8985
  let caretPosition = this.$refs.scriptInput.selectionStart;
9167
8986
  this.insertTextToScript(varName, caretPosition);
9168
8987
  },
9169
-
9170
8988
  addSetVariableToScript(field) {
9171
8989
  let caretPosition = this.$refs.scriptInput.selectionStart;
9172
8990
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
9173
8991
  },
9174
-
9175
8992
  addCallInputFunction(field) {
9176
8993
  let caretPosition = this.$refs.scriptInput.selectionStart;
9177
8994
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
9178
8995
  },
9179
-
9180
8996
  insertTextToScript(text, position) {
9181
8997
  position = position != null ? position : this.script.length;
9182
8998
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -9184,50 +9000,39 @@ var script$2 = {
9184
9000
  scriptSplit.splice(position, 0, text);
9185
9001
  this.innerRule.script = scriptSplit.join('');
9186
9002
  },
9187
-
9188
9003
  onRuleSelected(ruleName) {
9189
9004
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
9190
-
9191
9005
  if (rule) {
9192
9006
  Object.assign(this.innerRule, rule);
9193
9007
  this.innerRule.script = this.innerRule.script.trim();
9194
9008
  }
9195
9009
  },
9196
-
9197
9010
  onOk() {
9198
9011
  this.validateFields();
9199
-
9200
9012
  if (this.state.name && this.state.script) {
9201
9013
  if (this.onAfterOk) {
9202
9014
  this.onAfterOk(this.innerRule);
9203
9015
  }
9204
-
9205
9016
  this.$nextTick(() => {
9206
9017
  this.resetModal();
9207
9018
  this.$bvModal.hide(this.id);
9208
9019
  });
9209
9020
  }
9210
9021
  }
9211
-
9212
9022
  },
9213
-
9214
9023
  created() {
9215
9024
  this.copyToInnerFormConfig();
9216
9025
  }
9217
-
9218
9026
  };
9219
9027
 
9220
9028
  /* script */
9221
9029
  const __vue_script__$2 = script$2;
9222
- /* template */
9223
9030
 
9031
+ /* template */
9224
9032
  var __vue_render__$2 = function () {
9225
9033
  var _vm = this;
9226
-
9227
9034
  var _h = _vm.$createElement;
9228
-
9229
9035
  var _c = _vm._self._c || _h;
9230
-
9231
9036
  return _c('b-modal', {
9232
9037
  attrs: {
9233
9038
  "id": _vm.id,
@@ -9480,19 +9285,15 @@ var __vue_render__$2 = function () {
9480
9285
  }
9481
9286
  })], 1) : _vm._e()], 1)], 1)], 1);
9482
9287
  };
9483
-
9484
9288
  var __vue_staticRenderFns__$2 = [];
9485
- /* style */
9486
9289
 
9290
+ /* style */
9487
9291
  const __vue_inject_styles__$2 = undefined;
9488
9292
  /* scoped */
9489
-
9490
9293
  const __vue_scope_id__$2 = undefined;
9491
9294
  /* module identifier */
9492
-
9493
9295
  const __vue_module_identifier__$2 = undefined;
9494
9296
  /* functional template */
9495
-
9496
9297
  const __vue_is_functional_template__$2 = false;
9497
9298
  /* style inject */
9498
9299
 
@@ -9504,7 +9305,6 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
9504
9305
  render: __vue_render__$2,
9505
9306
  staticRenderFns: __vue_staticRenderFns__$2
9506
9307
  }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
9507
-
9508
9308
  var FieldRuleFormModal = __vue_component__$3;
9509
9309
 
9510
9310
  //
@@ -9524,7 +9324,6 @@ var script$1 = {
9524
9324
  },
9525
9325
  formConfig: Object
9526
9326
  },
9527
-
9528
9327
  data() {
9529
9328
  return {
9530
9329
  innerVisible: null,
@@ -9538,78 +9337,61 @@ var script$1 = {
9538
9337
  rulesHash: UtRandom.getRandomString(10)
9539
9338
  };
9540
9339
  },
9541
-
9542
9340
  computed: {
9543
9341
  inputOptions() {
9544
9342
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
9545
9343
  },
9546
-
9547
9344
  iconCloseSidebar() {
9548
9345
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
9549
9346
  },
9550
-
9551
9347
  iconOpenSidebar() {
9552
9348
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
9553
9349
  },
9554
-
9555
9350
  iconAdd() {
9556
9351
  return UtFormConstructor.config.icons.iconAdd;
9557
9352
  },
9558
-
9559
9353
  rules() {
9560
9354
  return UtFormConstructor.getAvailableFieldRules(this.field);
9561
9355
  },
9562
-
9563
9356
  hasMultipleInputTypes() {
9564
9357
  return UtFormConstructor.hasMultipleInputTypes(this.field);
9565
9358
  },
9566
-
9567
9359
  multiple() {
9568
9360
  return this.field && this.field.multiple;
9569
9361
  }
9570
-
9571
9362
  },
9572
9363
  watch: {
9573
9364
  visible() {
9574
9365
  this.innerVisible = this.visible;
9575
9366
  },
9576
-
9577
9367
  value() {
9578
9368
  this.field = this.value;
9579
-
9580
9369
  if (this.field && this.field.input) {
9581
9370
  this.currentInputName = this.field.input.name;
9582
9371
  }
9583
9372
  },
9584
-
9585
9373
  field: {
9586
9374
  handler() {
9587
9375
  this.$emit('input', this.field);
9588
9376
  this.$emit('change', this.field);
9589
9377
  },
9590
-
9591
9378
  deep: true
9592
9379
  },
9593
-
9594
9380
  currentInputName(val) {
9595
9381
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
9596
9382
  },
9597
-
9598
9383
  multiple() {
9599
9384
  let input = UtFormConstructor.getDefaultInput(this.field);
9600
-
9601
9385
  if (this.field.multiple) {
9602
9386
  this.currentInputName = input.name;
9603
9387
  }
9604
9388
  }
9605
-
9606
9389
  },
9607
9390
  methods: {
9608
9391
  hide() {
9609
9392
  this.innerVisible = false;
9610
9393
  this.$emit('hide');
9611
9394
  },
9612
-
9613
9395
  getPropInputType(prop, propName) {
9614
9396
  if (['string', 'number'].includes(prop.type)) {
9615
9397
  return 'b-form-input';
@@ -9619,7 +9401,6 @@ var script$1 = {
9619
9401
  return 'rb-boolean-single-option-input';
9620
9402
  }
9621
9403
  },
9622
-
9623
9404
  getPropInputPropData(prop, propName) {
9624
9405
  if (prop.type === 'string') {
9625
9406
  return {
@@ -9633,7 +9414,6 @@ var script$1 = {
9633
9414
  return {};
9634
9415
  }
9635
9416
  },
9636
-
9637
9417
  addRule() {
9638
9418
  this.ruleModalCfg = {
9639
9419
  mode: 'ins',
@@ -9643,22 +9423,22 @@ var script$1 = {
9643
9423
  },
9644
9424
  onAfterOk: rule => {
9645
9425
  this.field.rules = this.field.rules ? this.field.rules : [];
9646
- this.field.rules.push({ ...rule
9426
+ this.field.rules.push({
9427
+ ...rule
9647
9428
  });
9648
9429
  this.rulesHash = UtRandom.getRandomString(10);
9649
9430
  }
9650
9431
  };
9651
9432
  this.$bvModal.show(this.modalId);
9652
9433
  },
9653
-
9654
9434
  editRule(rule, event) {
9655
9435
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
9656
9436
  return;
9657
9437
  }
9658
-
9659
9438
  this.ruleModalCfg = {
9660
9439
  mode: 'upd',
9661
- rule: { ...rule
9440
+ rule: {
9441
+ ...rule
9662
9442
  },
9663
9443
  onAfterOk: modalRule => {
9664
9444
  Object.assign(rule, modalRule);
@@ -9666,43 +9446,33 @@ var script$1 = {
9666
9446
  };
9667
9447
  this.$bvModal.show(this.modalId);
9668
9448
  },
9669
-
9670
9449
  removeRule(rule) {
9671
9450
  let index = this.field.rules.findIndex(r => r.id === rule.id);
9672
-
9673
9451
  if (index >= 0) {
9674
9452
  this.field.rules.splice(index, 1);
9675
9453
  }
9676
-
9677
9454
  this.rulesHash = UtRandom.getRandomString(10);
9678
9455
  }
9679
-
9680
9456
  },
9681
-
9682
9457
  created() {
9683
9458
  if (this.value) {
9684
9459
  this.innerVisible = this.visible;
9685
9460
  this.field = this.value;
9686
-
9687
9461
  if (this.field && this.field.input) {
9688
9462
  this.currentInputName = this.field.input.name;
9689
9463
  }
9690
9464
  }
9691
9465
  }
9692
-
9693
9466
  };
9694
9467
 
9695
9468
  /* script */
9696
9469
  const __vue_script__$1 = script$1;
9697
- /* template */
9698
9470
 
9471
+ /* template */
9699
9472
  var __vue_render__$1 = function () {
9700
9473
  var _vm = this;
9701
-
9702
9474
  var _h = _vm.$createElement;
9703
-
9704
9475
  var _c = _vm._self._c || _h;
9705
-
9706
9476
  return _c('b-sidebar', {
9707
9477
  staticClass: "rb-doc-template-field-sidebar",
9708
9478
  attrs: {
@@ -9940,19 +9710,15 @@ var __vue_render__$1 = function () {
9940
9710
  }
9941
9711
  })], 1);
9942
9712
  };
9943
-
9944
9713
  var __vue_staticRenderFns__$1 = [];
9945
- /* style */
9946
9714
 
9715
+ /* style */
9947
9716
  const __vue_inject_styles__$1 = undefined;
9948
9717
  /* scoped */
9949
-
9950
9718
  const __vue_scope_id__$1 = undefined;
9951
9719
  /* module identifier */
9952
-
9953
9720
  const __vue_module_identifier__$1 = undefined;
9954
9721
  /* functional template */
9955
-
9956
9722
  const __vue_is_functional_template__$1 = false;
9957
9723
  /* style inject */
9958
9724
 
@@ -9964,7 +9730,6 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
9964
9730
  render: __vue_render__$1,
9965
9731
  staticRenderFns: __vue_staticRenderFns__$1
9966
9732
  }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
9967
-
9968
9733
  var DocTemplateFieldSidebar = __vue_component__$2;
9969
9734
 
9970
9735
  //
@@ -9990,7 +9755,6 @@ var script = {
9990
9755
  default: () => []
9991
9756
  }
9992
9757
  },
9993
-
9994
9758
  data() {
9995
9759
  return {
9996
9760
  sidebarVisible: false,
@@ -10001,41 +9765,32 @@ var script = {
10001
9765
  id: 'rb-doc-template-section-modal',
10002
9766
  mode: 'ins',
10003
9767
  section: null,
10004
-
10005
9768
  onAfterOk() {}
10006
-
10007
9769
  }
10008
9770
  };
10009
9771
  },
10010
-
10011
9772
  computed: {
10012
9773
  iconAdd() {
10013
9774
  return UtFormConstructor.config.icons.iconAdd;
10014
9775
  },
10015
-
10016
9776
  iconEdit() {
10017
9777
  return UtFormConstructor.config.icons.iconEdit;
10018
9778
  },
10019
-
10020
9779
  iconDelete() {
10021
9780
  return UtFormConstructor.config.icons.iconDelete;
10022
9781
  },
10023
-
10024
9782
  iconDrag() {
10025
9783
  return UtFormConstructor.config.icons.iconDrag;
10026
9784
  }
10027
-
10028
9785
  },
10029
9786
  methods: {
10030
9787
  showProperties(field, event) {
10031
9788
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
10032
9789
  return;
10033
9790
  }
10034
-
10035
9791
  this.sidebarVisible = true;
10036
9792
  this.sidebarField = field;
10037
9793
  },
10038
-
10039
9794
  addSection(columnCount) {
10040
9795
  let section = {
10041
9796
  labelRu: null,
@@ -10043,32 +9798,24 @@ var script = {
10043
9798
  };
10044
9799
  this.sectionModalCfg.mode = 'ins';
10045
9800
  this.sectionModalCfg.section = section;
10046
-
10047
9801
  this.sectionModalCfg.onAfterOk = () => {
10048
9802
  section.columns = [];
10049
-
10050
9803
  for (let i = 0; i < columnCount; i++) {
10051
9804
  section.columns.push({
10052
9805
  index: i,
10053
9806
  fields: []
10054
9807
  });
10055
9808
  }
10056
-
10057
9809
  this.formConfig.sections.push(section);
10058
9810
  };
10059
-
10060
9811
  this.$bvModal.show(this.sectionModalCfg.id);
10061
9812
  },
10062
-
10063
9813
  editSection(section) {
10064
9814
  this.sectionModalCfg.mode = 'update';
10065
9815
  this.sectionModalCfg.section = section;
10066
-
10067
9816
  this.sectionModalCfg.onAfterOk = () => {};
10068
-
10069
9817
  this.$bvModal.show(this.sectionModalCfg.id);
10070
9818
  },
10071
-
10072
9819
  removeSection(section, index) {
10073
9820
  this.formConfig.sections.splice(index, 1);
10074
9821
  /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
@@ -10092,40 +9839,31 @@ var script = {
10092
9839
  });
10093
9840
  return count > 1;
10094
9841
  },
10095
-
10096
9842
  removeFieldFromColumn(field, column, newIndex) {
10097
9843
  let index = newIndex != null ? newIndex : -1;
10098
-
10099
9844
  if (index < 0) {
10100
9845
  index = column.fields.findIndex(f => field.name === f.name);
10101
9846
  }
10102
-
10103
9847
  if (index >= 0) {
10104
9848
  column.fields.splice(index, 1);
10105
9849
  }
10106
9850
  },
10107
-
10108
9851
  onRemoveField(event, field, column) {
10109
9852
  event.preventDefault();
10110
9853
  this.removeFieldFromColumn(field, column);
10111
9854
  },
10112
-
10113
9855
  onFieldAddedToColumn(event, column, section) {
10114
9856
  this.columnTo = column;
10115
9857
  },
10116
-
10117
9858
  onFieldMoveEnd(event) {
10118
9859
  const {
10119
9860
  newIndex
10120
9861
  } = event;
10121
9862
  let field = event.item._underlying_vm_;
10122
-
10123
9863
  if (!field.hasOwnProperty('defaultValue')) {
10124
9864
  this.$set(field, 'defaultValue', undefined);
10125
9865
  }
10126
-
10127
9866
  let found = this.multipleFieldAreOnFormConfig(field);
10128
-
10129
9867
  if (found) {
10130
9868
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
10131
9869
  this.resetDragVariables();
@@ -10139,36 +9877,30 @@ var script = {
10139
9877
  noCloseOnEsc: true
10140
9878
  });
10141
9879
  }
10142
-
10143
9880
  this.resetDragVariables();
10144
9881
  this.hash = (Math.random() + 1).toString(36).substring(7);
10145
9882
  },
10146
-
10147
9883
  getFieldExtendedPropsData(field) {
10148
- return { ...field.input.propsData,
9884
+ return {
9885
+ ...field.input.propsData,
10149
9886
  placeholder: field.tag,
10150
9887
  disabled: true
10151
9888
  };
10152
9889
  },
10153
-
10154
9890
  resetDragVariables() {
10155
9891
  this.columnTo = null;
10156
9892
  }
10157
-
10158
9893
  }
10159
9894
  };
10160
9895
 
10161
9896
  /* script */
10162
9897
  const __vue_script__ = script;
10163
- /* template */
10164
9898
 
9899
+ /* template */
10165
9900
  var __vue_render__ = function () {
10166
9901
  var _vm = this;
10167
-
10168
9902
  var _h = _vm.$createElement;
10169
-
10170
9903
  var _c = _vm._self._c || _h;
10171
-
10172
9904
  return _c('div', {
10173
9905
  staticClass: "rb-doc-template-constructor d-flex"
10174
9906
  }, [_c('doc-template-facet-list', {
@@ -10393,19 +10125,15 @@ var __vue_render__ = function () {
10393
10125
  }
10394
10126
  })], 1)], 1);
10395
10127
  };
10396
-
10397
10128
  var __vue_staticRenderFns__ = [];
10398
- /* style */
10399
10129
 
10130
+ /* style */
10400
10131
  const __vue_inject_styles__ = undefined;
10401
10132
  /* scoped */
10402
-
10403
10133
  const __vue_scope_id__ = undefined;
10404
10134
  /* module identifier */
10405
-
10406
10135
  const __vue_module_identifier__ = undefined;
10407
10136
  /* functional template */
10408
-
10409
10137
  const __vue_is_functional_template__ = false;
10410
10138
  /* style inject */
10411
10139
 
@@ -10417,7 +10145,6 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
10417
10145
  render: __vue_render__,
10418
10146
  staticRenderFns: __vue_staticRenderFns__
10419
10147
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
10420
-
10421
10148
  var __vue_component__$1 = __vue_component__;
10422
10149
 
10423
10150
  /* eslint-disable import/prefer-default-export */
@@ -10437,11 +10164,11 @@ var components = /*#__PURE__*/Object.freeze({
10437
10164
 
10438
10165
  // Import vue components
10439
10166
 
10167
+ // install function executed by Vue.use()
10440
10168
  const install = function installRbDocumentFormConstructor(Vue) {
10441
- Object.entries(components).forEach(_ref => {
10442
- let [componentName, component] = _ref;
10169
+ Object.entries(components).forEach(([componentName, component]) => {
10443
10170
  Vue.component(componentName, component);
10444
10171
  });
10445
- }; // Create module definition for Vue.use()
10172
+ };
10446
10173
 
10447
10174
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default, i18n };