rb-document-form-constructor 0.9.14 → 0.9.15

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,6 +5,7 @@ const UtFormConfig = {
5
5
  if (!formConfig || !formConfig.sections) {
6
6
  return null;
7
7
  }
8
+
8
9
  let found = null;
9
10
  formConfig.sections.every(r => {
10
11
  if (r.columns) {
@@ -14,21 +15,25 @@ const UtFormConfig = {
14
15
  found = f;
15
16
  }
16
17
  });
18
+
17
19
  if (found) {
18
20
  return false;
19
21
  }
20
22
  });
21
23
  }
24
+
22
25
  if (found) {
23
26
  return false;
24
27
  }
25
28
  });
26
29
  return found;
27
30
  },
31
+
28
32
  findRule(ruleId, formConfig) {
29
33
  if (!formConfig || !formConfig.sections) {
30
34
  return null;
31
35
  }
36
+
32
37
  let found = null;
33
38
  formConfig.sections.every(s => {
34
39
  if (s.columns) {
@@ -41,21 +46,25 @@ const UtFormConfig = {
41
46
  }
42
47
  });
43
48
  }
49
+
44
50
  if (found) {
45
51
  return false;
46
52
  }
47
53
  });
54
+
48
55
  if (found) {
49
56
  return false;
50
57
  }
51
58
  });
52
59
  }
60
+
53
61
  if (found) {
54
62
  return false;
55
63
  }
56
64
  });
57
65
  return found;
58
66
  },
67
+
59
68
  getFields(formConfig) {
60
69
  let fields = [];
61
70
  formConfig.sections.forEach(s => {
@@ -71,6 +80,7 @@ const UtFormConfig = {
71
80
  });
72
81
  return fields;
73
82
  },
83
+
74
84
  parseFacets(formConfig) {
75
85
  let facets = [];
76
86
  formConfig.sections.forEach(section => {
@@ -84,24 +94,31 @@ const UtFormConfig = {
84
94
  });
85
95
  return facets;
86
96
  }
97
+
87
98
  };
88
99
 
89
100
  let __clone = function (data) {
90
101
  return JSON.parse(JSON.stringify(data));
91
102
  };
103
+
92
104
  let __assign = function () {
93
105
  __assign = Object.assign || function __assign(t) {
94
106
  for (let s, i = 1, n = arguments.length; i < n; i++) {
95
107
  s = arguments[i];
108
+
96
109
  for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
97
110
  }
111
+
98
112
  return t;
99
113
  };
114
+
100
115
  return __assign.apply(this, arguments);
101
116
  };
117
+
102
118
  let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
103
119
  for (let dataType in formConfigInputs) {
104
120
  let foundInputs = inputs[dataType];
121
+
105
122
  if (foundInputs) {
106
123
  __mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
107
124
  } else {
@@ -109,14 +126,17 @@ let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
109
126
  }
110
127
  }
111
128
  };
129
+
112
130
  let __mergeInputsInMap = function (inputs, formConfigInputs) {
113
131
  for (let name in formConfigInputs) {
114
132
  inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
115
133
  }
116
134
  };
135
+
117
136
  let __mergeInputsInArray = function (inputs, formConfigInputs) {
118
137
  formConfigInputs.forEach(input => {
119
138
  let index = inputs.findIndex(item => item.name === input.name);
139
+
120
140
  if (index >= 0) {
121
141
  inputs[index] = input;
122
142
  } else {
@@ -124,13 +144,16 @@ let __mergeInputsInArray = function (inputs, formConfigInputs) {
124
144
  }
125
145
  });
126
146
  };
147
+
127
148
  let __applyDefaultProps = function (input, field) {
128
149
  for (let propName in input.props) {
129
150
  if (field) {
130
151
  if (field.input.propsData[propName]) {
131
- var _input$propsData, _input$props;
152
+ var _input$propsData, _input$props, _input$props$type;
153
+
132
154
  input.propsData[propName] = field.input.propsData[propName];
133
- if ((_input$propsData = input.propsData) !== null && _input$propsData !== void 0 && _input$propsData.type && (_input$props = input.props) !== null && _input$props !== void 0 && (_input$props = _input$props.type) !== null && _input$props !== void 0 && _input$props.default) {
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) {
134
157
  input.propsData.type = input.props.type.default;
135
158
  }
136
159
  }
@@ -139,6 +162,7 @@ let __applyDefaultProps = function (input, field) {
139
162
  }
140
163
  }
141
164
  };
165
+
142
166
  let __applyRefProps = function (input, refConfig) {
143
167
  if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
144
168
  for (let propName in refConfig.propsData) {
@@ -146,11 +170,13 @@ let __applyRefProps = function (input, refConfig) {
146
170
  }
147
171
  }
148
172
  };
173
+
149
174
  let __filterInputsByMultiple = function (inputs, multiple) {
150
175
  return inputs.filter(i => {
151
176
  return i.multiple && multiple || !i.multiple && !multiple;
152
177
  });
153
178
  };
179
+
154
180
  let fcInputs = {
155
181
  string: {
156
182
  text: 'Текст',
@@ -352,40 +378,52 @@ let baseConfig = {
352
378
  };
353
379
  const UtFormConstructor = {
354
380
  config: {},
381
+
355
382
  init(formConfig) {
356
383
  this.config = __clone(baseConfig);
384
+
357
385
  if (formConfig) {
358
386
  if (formConfig.inputs) {
359
387
  __mergeInputsInMap(this.config.inputs, formConfig.inputs);
360
388
  }
389
+
361
390
  if (formConfig.primitiveInputs) {
362
391
  __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
363
392
  }
393
+
364
394
  if (formConfig.dictInputs) {
365
395
  __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
366
396
  }
397
+
367
398
  if (formConfig.refInputs) {
368
399
  __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
369
400
  }
401
+
370
402
  if (formConfig.refInputConfigs) {
371
403
  this.config.refInputConfigs = formConfig.refInputConfigs;
372
404
  }
405
+
373
406
  if (formConfig.icons) {
374
407
  this.config.icons = __assign(this.config.icons, formConfig.icons);
375
408
  }
409
+
376
410
  if (formConfig.rules) {
377
411
  this.config.rules = formConfig.rules;
378
412
  }
413
+
379
414
  if (formConfig.ruleContext) {
380
415
  this.config.ruleContext = formConfig.ruleContext;
381
416
  }
382
417
  }
383
418
  },
419
+
384
420
  getInputTypes(field) {
385
421
  let inputs = [];
422
+
386
423
  if (!field) {
387
424
  return inputs;
388
425
  }
426
+
389
427
  if (field.dict && !this.config.refInputs[field.ref]) {
390
428
  inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
391
429
  } else if (field.ref) {
@@ -393,76 +431,98 @@ const UtFormConstructor = {
393
431
  } else {
394
432
  inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
395
433
  }
434
+
396
435
  return inputs;
397
436
  },
437
+
398
438
  hasMultipleInputTypes(field) {
399
- let inputs = this.getInputTypes({
400
- ...field,
439
+ let inputs = this.getInputTypes({ ...field,
401
440
  multiple: true
402
441
  });
403
442
  return inputs && inputs.length > 0;
404
443
  },
444
+
405
445
  getDefaultInput(field) {
406
446
  let input = null;
407
447
  let inputs = this.getInputTypes(field);
448
+
408
449
  if (!inputs) {
409
450
  input = this.primitiveInputs[0];
410
451
  }
452
+
411
453
  if (field.ref && this.config.refInputs[field.ref]) {
412
454
  input = __clone(inputs[0]);
455
+
413
456
  __applyDefaultProps(input);
457
+
414
458
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
415
459
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
416
460
  }
417
461
  } else if (field.dict) {
418
462
  input = __clone(inputs[0]);
419
463
  input.props.dict.default = field.ref;
464
+
420
465
  __applyDefaultProps(input);
421
466
  } else {
422
467
  input = __clone(inputs[0]);
468
+
423
469
  __applyDefaultProps(input);
424
470
  }
471
+
425
472
  return input;
426
473
  },
474
+
427
475
  getInputTypeByName(name, field) {
428
476
  let input = __clone(this.config.inputs[name]);
477
+
429
478
  if (field.ref && this.config.refInputs[field.ref]) {
430
479
  __applyDefaultProps(input);
480
+
431
481
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
432
482
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
433
483
  }
434
484
  } else if (field.dict) {
435
485
  input.props.dict.default = field.ref;
436
- __applyDefaultProps(input);
486
+
487
+ __applyDefaultProps(input, field);
437
488
  } else {
438
489
  __applyDefaultProps(input, field);
439
490
  }
491
+
440
492
  input.propsData['ref'] = field.name;
441
493
  return input;
442
494
  },
495
+
443
496
  getAvailableFieldRules(field) {
444
497
  return this.config.rules.filter(rule => {
445
498
  return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
446
499
  });
447
500
  },
501
+
448
502
  getRuleContext() {
449
503
  return this.config.ruleContext;
450
504
  },
505
+
451
506
  runRule(context, script) {
452
507
  context = context ? context : {};
453
508
  context['console'] = console;
454
509
  context['Date'] = Date;
455
510
  context['Math'] = Math;
456
511
  let appendScript = '';
512
+
457
513
  for (let v in context) {
458
514
  appendScript = appendScript + `var ${v} = this.${v};\n`;
459
515
  }
516
+
460
517
  appendScript = appendScript ? appendScript + '\n' : '';
518
+
461
519
  let func = function (script) {
462
520
  return eval(script);
463
521
  };
522
+
464
523
  func.call(context, appendScript + script);
465
524
  }
525
+
466
526
  };
467
527
 
468
528
  //
@@ -484,7 +544,6 @@ const UtFormConstructor = {
484
544
  //
485
545
  //
486
546
  //
487
-
488
547
  var script$5 = {
489
548
  name: 'DocTemplateSectionModal',
490
549
  props: {
@@ -498,16 +557,19 @@ var script$5 = {
498
557
  default: () => {}
499
558
  }
500
559
  },
560
+
501
561
  data() {
502
562
  return {
503
563
  id: 'rb-doc-template-section-modal',
504
564
  label: {}
505
565
  };
506
566
  },
567
+
507
568
  computed: {
508
569
  title() {
509
570
  return this.mode === 'ins' ? 'Добавление секции' : 'Редактирование секции';
510
571
  }
572
+
511
573
  },
512
574
  watch: {
513
575
  section() {
@@ -515,23 +577,29 @@ var script$5 = {
515
577
  this.label = this.section;
516
578
  }
517
579
  }
580
+
518
581
  },
519
582
  methods: {
520
583
  onOk() {
521
584
  this.section = this.label;
585
+
522
586
  if (this.onAfterOk) {
523
587
  this.onAfterOk();
524
588
  }
589
+
525
590
  this.$nextTick(() => {
526
591
  this.$bvModal.hide(this.id);
527
592
  });
528
593
  }
594
+
529
595
  },
596
+
530
597
  created() {
531
598
  if (this.section) {
532
599
  this.label = this.section;
533
600
  }
534
601
  }
602
+
535
603
  };
536
604
 
537
605
  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
@@ -611,12 +679,15 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
611
679
 
612
680
  /* script */
613
681
  const __vue_script__$5 = script$5;
614
-
615
682
  /* template */
683
+
616
684
  var __vue_render__$5 = function () {
617
685
  var _vm = this;
686
+
618
687
  var _h = _vm.$createElement;
688
+
619
689
  var _c = _vm._self._c || _h;
690
+
620
691
  return _c('b-modal', {
621
692
  attrs: {
622
693
  "id": "rb-doc-template-section-modal",
@@ -657,15 +728,19 @@ var __vue_render__$5 = function () {
657
728
  }
658
729
  })], 1)], 1)], 1)], 1)], 1);
659
730
  };
660
- var __vue_staticRenderFns__$5 = [];
661
731
 
732
+ var __vue_staticRenderFns__$5 = [];
662
733
  /* style */
734
+
663
735
  const __vue_inject_styles__$5 = undefined;
664
736
  /* scoped */
737
+
665
738
  const __vue_scope_id__$5 = undefined;
666
739
  /* module identifier */
740
+
667
741
  const __vue_module_identifier__$5 = undefined;
668
742
  /* functional template */
743
+
669
744
  const __vue_is_functional_template__$5 = false;
670
745
  /* style inject */
671
746
 
@@ -677,6 +752,7 @@ const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
677
752
  render: __vue_render__$5,
678
753
  staticRenderFns: __vue_staticRenderFns__$5
679
754
  }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
755
+
680
756
  var DocTemplateSectionModal = __vue_component__$6;
681
757
 
682
758
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -6079,6 +6155,7 @@ var script$4 = {
6079
6155
  default: () => []
6080
6156
  }
6081
6157
  },
6158
+
6082
6159
  data() {
6083
6160
  return {
6084
6161
  allFacets: [],
@@ -6086,21 +6163,26 @@ var script$4 = {
6086
6163
  facetSearchStr: null
6087
6164
  };
6088
6165
  },
6166
+
6089
6167
  computed: {
6090
6168
  iconExpandFacet() {
6091
6169
  return UtFormConstructor.config.icons.iconExpandFacet;
6092
6170
  },
6171
+
6093
6172
  iconCollapseFacet() {
6094
6173
  return UtFormConstructor.config.icons.iconCollapseFacet;
6095
6174
  }
6175
+
6096
6176
  },
6097
6177
  watch: {
6098
6178
  facetSearchStr() {
6099
6179
  this.findInFacets(this.facetSearchStr);
6100
6180
  },
6181
+
6101
6182
  facets() {
6102
6183
  this.handleFacetsProp();
6103
6184
  }
6185
+
6104
6186
  },
6105
6187
  methods: {
6106
6188
  onFieldCloned(cloneField) {
@@ -6108,55 +6190,69 @@ var script$4 = {
6108
6190
  field.input = UtFormConstructor.getDefaultInput(field);
6109
6191
  return field;
6110
6192
  },
6193
+
6111
6194
  onFieldMoveEnd(event) {
6112
6195
  this.$emit('fieldMoveEnd', event);
6113
6196
  },
6197
+
6114
6198
  findInFacets(str) {
6115
6199
  str = str.toLowerCase();
6200
+
6116
6201
  if (!str || str.length === 0) {
6117
6202
  this.innerFacets = this.allFacets;
6118
6203
  }
6204
+
6119
6205
  let facets = JSON.parse(JSON.stringify(this.allFacets));
6120
6206
  facets = facets.filter(facet => {
6121
6207
  let facetFound = false;
6122
6208
  facet.fields = facet.fields.filter(field => {
6123
6209
  let fieldFound = field.labelRu.toLowerCase().indexOf(str) >= 0 || field.name.toLowerCase().indexOf(str) >= 0;
6210
+
6124
6211
  if (fieldFound) {
6125
6212
  facetFound = true;
6126
6213
  }
6214
+
6127
6215
  return fieldFound;
6128
6216
  });
6129
6217
  return facetFound;
6130
6218
  });
6131
6219
  this.innerFacets = facets;
6132
6220
  },
6221
+
6133
6222
  handleFacetsProp() {
6134
- let innerFacets = this.facets.map(f => ({
6135
- ...f,
6223
+ let innerFacets = this.facets.map(f => ({ ...f,
6136
6224
  expanded: false
6137
6225
  }));
6226
+
6138
6227
  if (innerFacets) {
6139
6228
  innerFacets.forEach(facet => {
6140
6229
  facet.fields = facet.fields.filter(field => !field.hiddenOnFormConfig);
6141
6230
  });
6142
6231
  }
6232
+
6143
6233
  this.innerFacets = JSON.parse(JSON.stringify(innerFacets));
6144
6234
  this.allFacets = JSON.parse(JSON.stringify(innerFacets));
6145
6235
  }
6236
+
6146
6237
  },
6238
+
6147
6239
  created() {
6148
6240
  this.handleFacetsProp();
6149
6241
  }
6242
+
6150
6243
  };
6151
6244
 
6152
6245
  /* script */
6153
6246
  const __vue_script__$4 = script$4;
6154
-
6155
6247
  /* template */
6248
+
6156
6249
  var __vue_render__$4 = function () {
6157
6250
  var _vm = this;
6251
+
6158
6252
  var _h = _vm.$createElement;
6253
+
6159
6254
  var _c = _vm._self._c || _h;
6255
+
6160
6256
  return _c('div', {
6161
6257
  staticClass: "rb-facets-sidebar"
6162
6258
  }, [_c('div', {
@@ -6235,15 +6331,19 @@ var __vue_render__$4 = function () {
6235
6331
  }), 1)], 1) : _vm._e()], 1) : _vm._e();
6236
6332
  }), 0)], 1);
6237
6333
  };
6238
- var __vue_staticRenderFns__$4 = [];
6239
6334
 
6335
+ var __vue_staticRenderFns__$4 = [];
6240
6336
  /* style */
6337
+
6241
6338
  const __vue_inject_styles__$4 = undefined;
6242
6339
  /* scoped */
6340
+
6243
6341
  const __vue_scope_id__$4 = undefined;
6244
6342
  /* module identifier */
6343
+
6245
6344
  const __vue_module_identifier__$4 = undefined;
6246
6345
  /* functional template */
6346
+
6247
6347
  const __vue_is_functional_template__$4 = false;
6248
6348
  /* style inject */
6249
6349
 
@@ -6255,6 +6355,7 @@ const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
6255
6355
  render: __vue_render__$4,
6256
6356
  staticRenderFns: __vue_staticRenderFns__$4
6257
6357
  }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
6358
+
6258
6359
  var DocTemplateFacetList = __vue_component__$5;
6259
6360
 
6260
6361
  var toString = Object.prototype.toString;
@@ -6276,9 +6377,12 @@ var _typeof = function(object) {
6276
6377
  };
6277
6378
 
6278
6379
  const UtArray = {
6279
- removeDuplicate(array = [], key = 'key') {
6380
+ removeDuplicate() {
6381
+ let array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6382
+ let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key';
6280
6383
  return array.filter((v, i, a) => a.findLastIndex(v2 => (v2 === null || v2 === void 0 ? void 0 : v2[key]) === (v === null || v === void 0 ? void 0 : v[key])) === i);
6281
6384
  }
6385
+
6282
6386
  };
6283
6387
 
6284
6388
  //
@@ -6315,28 +6419,34 @@ var script$3 = {
6315
6419
  default: 'container'
6316
6420
  }
6317
6421
  },
6422
+
6318
6423
  data() {
6319
6424
  return {
6320
6425
  validationState: {}
6321
6426
  };
6322
6427
  },
6428
+
6323
6429
  watch: {
6324
6430
  formConfig() {
6325
6431
  this.validationState = {};
6326
6432
  this.execApplyDefaultValues();
6327
6433
  this.execApplyDefaultValRule();
6328
6434
  }
6435
+
6329
6436
  },
6330
6437
  methods: {
6331
6438
  getResolveValueName(field) {
6332
6439
  if ((field.dict || field.ref) && !field.multiple) {
6333
6440
  return field.name.substring(0, field.name.length - 2);
6334
6441
  }
6442
+
6335
6443
  return field.name;
6336
6444
  },
6445
+
6337
6446
  getResolveValue(field) {
6338
6447
  return this.doc[this.getResolveValueName(field)] ? this.doc[this.getResolveValueName(field)] : null;
6339
6448
  },
6449
+
6340
6450
  getDisplayField(value) {
6341
6451
  if (!value[this.displayField]) {
6342
6452
  return value.labelRu;
@@ -6344,9 +6454,11 @@ var script$3 = {
6344
6454
  return value[this.displayField];
6345
6455
  }
6346
6456
  },
6457
+
6347
6458
  isResolvableField(field) {
6348
6459
  return !!field.ref;
6349
6460
  },
6461
+
6350
6462
  getResolveObject(field) {
6351
6463
  if (this.isResolvableField(field)) {
6352
6464
  let resolveFieldName = this.getResolveFieldName(field);
@@ -6355,14 +6467,19 @@ var script$3 = {
6355
6467
  return null;
6356
6468
  }
6357
6469
  },
6470
+
6358
6471
  getResolveFieldName(field) {
6359
6472
  var _resolveFieldName;
6473
+
6360
6474
  let resolveFieldName = field === null || field === void 0 ? void 0 : field.name;
6475
+
6361
6476
  if ((_resolveFieldName = resolveFieldName) !== null && _resolveFieldName !== void 0 && _resolveFieldName.endsWith('Id')) {
6362
6477
  resolveFieldName = field.name.substring(0, field.name.length - 2);
6363
6478
  }
6479
+
6364
6480
  return resolveFieldName;
6365
6481
  },
6482
+
6366
6483
  onEventFired(eventName, event, field) {
6367
6484
  if (field.rules) {
6368
6485
  field.rules.forEach(rule => {
@@ -6375,6 +6492,7 @@ var script$3 = {
6375
6492
  });
6376
6493
  }
6377
6494
  },
6495
+
6378
6496
  onGlobalEventFired(eventName, event) {
6379
6497
  let fields = UtFormConfig.getFields(this.formConfig);
6380
6498
  fields.forEach(f => {
@@ -6390,6 +6508,7 @@ var script$3 = {
6390
6508
  }
6391
6509
  });
6392
6510
  },
6511
+
6393
6512
  createRuleContext(additionalContext) {
6394
6513
  return Object.assign({
6395
6514
  form: this,
@@ -6397,66 +6516,88 @@ var script$3 = {
6397
6516
  ...additionalContext
6398
6517
  }, UtFormConstructor.getRuleContext());
6399
6518
  },
6519
+
6400
6520
  runRule(rule, context) {
6401
6521
  UtFormConstructor.runRule(this.createRuleContext(context), rule.script);
6402
6522
  },
6523
+
6403
6524
  isValueEmpty(fieldName) {
6404
6525
  var _this$doc$fieldName;
6526
+
6405
6527
  if (this.doc[fieldName] == null) {
6406
6528
  return true;
6407
6529
  }
6530
+
6408
6531
  if (Array.isArray(this.doc[fieldName]) && !((_this$doc$fieldName = this.doc[fieldName]) !== null && _this$doc$fieldName !== void 0 && _this$doc$fieldName.length)) {
6409
6532
  return true;
6410
6533
  }
6534
+
6411
6535
  if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
6412
6536
  return true;
6413
6537
  }
6538
+
6414
6539
  return false;
6415
6540
  },
6541
+
6416
6542
  isValueLessThanMax(fieldname, max) {
6417
6543
  if (this.doc[fieldname] && max) {
6418
6544
  var _this$doc$fieldname;
6545
+
6419
6546
  return ((_this$doc$fieldname = this.doc[fieldname]) === null || _this$doc$fieldname === void 0 ? void 0 : _this$doc$fieldname.length) > parseInt(max);
6420
6547
  }
6548
+
6421
6549
  return false;
6422
6550
  },
6551
+
6423
6552
  isValueLessThanMin(fieldname, min) {
6424
6553
  if (this.doc[fieldname] && min) {
6425
6554
  return parseInt(this.doc[fieldname]) < parseInt(min);
6426
6555
  }
6556
+
6427
6557
  return false;
6428
6558
  },
6429
- validate(callback = () => {}) {
6559
+
6560
+ validate() {
6561
+ let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
6430
6562
  this.formConfig.sections.forEach(s => {
6431
6563
  s.columns.forEach(c => {
6432
6564
  c.fields.forEach(f => {
6433
6565
  var _f$input$propsData, _f$input$propsData3;
6566
+
6434
6567
  let feedback = '';
6568
+
6435
6569
  if (f.required && this.isValueEmpty(f.name)) {
6436
6570
  feedback += this.getDisplayField(f);
6437
6571
  }
6572
+
6438
6573
  if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
6439
6574
  feedback += f.input.propsData.min;
6440
- }
6441
- // TODO: Костыль так как на бэке нету типа memo
6575
+ } // TODO: Костыль так как на бэке нету типа memo
6576
+
6577
+
6442
6578
  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)) {
6443
6579
  var _f$input$propsData2;
6580
+
6444
6581
  feedback += `\nМаксимальное значение для этого поля ${(_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max}`;
6445
6582
  }
6583
+
6446
6584
  if (f.required && (_f$input$propsData3 = f.input.propsData) !== null && _f$input$propsData3 !== void 0 && _f$input$propsData3.isInlineTableInput) {
6447
- var _this$$refs$f$name$0$, _this$$refs, _this$$refs$getIsDirt, _UtArray$removeDuplic;
6448
- const findErrors = (_this$$refs$f$name$0$ = (_this$$refs = this.$refs) === null || _this$$refs === void 0 || (_this$$refs = _this$$refs[f.name]) === null || _this$$refs === void 0 || (_this$$refs = _this$$refs[0]) === null || _this$$refs === void 0 || (_this$$refs$getIsDirt = _this$$refs.getIsDirty) === null || _this$$refs$getIsDirt === void 0 ? void 0 : _this$$refs$getIsDirt.call(_this$$refs)) !== null && _this$$refs$f$name$0$ !== void 0 ? _this$$refs$f$name$0$ : [];
6585
+ var _this$$refs$f$name$0$, _this$$refs, _this$$refs$f$name, _this$$refs$f$name$, _this$$refs$f$name$$g, _UtArray$removeDuplic;
6586
+
6587
+ const findErrors = (_this$$refs$f$name$0$ = (_this$$refs = this.$refs) === null || _this$$refs === void 0 ? void 0 : (_this$$refs$f$name = _this$$refs[f.name]) === null || _this$$refs$f$name === void 0 ? void 0 : (_this$$refs$f$name$ = _this$$refs$f$name[0]) === null || _this$$refs$f$name$ === void 0 ? void 0 : (_this$$refs$f$name$$g = _this$$refs$f$name$.getIsDirty) === null || _this$$refs$f$name$$g === void 0 ? void 0 : _this$$refs$f$name$$g.call(_this$$refs$f$name$)) !== null && _this$$refs$f$name$0$ !== void 0 ? _this$$refs$f$name$0$ : [];
6449
6588
  const errors = (_UtArray$removeDuplic = UtArray.removeDuplicate(findErrors, 'field')) === null || _UtArray$removeDuplic === void 0 ? void 0 : _UtArray$removeDuplic.map(f => f === null || f === void 0 ? void 0 : f.label).join(', ');
6450
6589
  feedback = errors ? this.$t('validate.multiRequired', {
6451
6590
  field: errors
6452
6591
  }) : this.isValueEmpty(f.name) ? this.getDisplayField(f) : '';
6453
6592
  }
6593
+
6454
6594
  if (feedback) {
6455
6595
  Vue.set(this.validationState, f.name, false);
6456
6596
  Vue.set(this.validationState, `${f.name}__feedback`, feedback);
6457
6597
  } else {
6458
6598
  Vue.set(this.validationState, f.name, null);
6459
6599
  }
6600
+
6460
6601
  callback(feedback, this.$refs, f, this.doc);
6461
6602
  this.onEventFired('validate', {
6462
6603
  validationState: this.validationState,
@@ -6465,24 +6606,31 @@ var script$3 = {
6465
6606
  });
6466
6607
  });
6467
6608
  });
6609
+
6468
6610
  for (let fieldName in this.validationState) {
6469
6611
  if (this.validationState[fieldName] === false) {
6470
6612
  return false;
6471
6613
  }
6472
6614
  }
6615
+
6473
6616
  return true;
6474
6617
  },
6618
+
6475
6619
  getColumnSize(section) {
6476
6620
  const MAX_COLUMN_SIZE = 12;
6621
+
6477
6622
  if (!section || !section.columnCount) {
6478
6623
  return MAX_COLUMN_SIZE;
6479
6624
  }
6625
+
6480
6626
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
6481
6627
  return colSize;
6482
6628
  },
6629
+
6483
6630
  isNotUndefinedAndNull(value) {
6484
6631
  return !(value === null || value === undefined);
6485
6632
  },
6633
+
6486
6634
  execApplyDefaultValues() {
6487
6635
  if (this.applyDefaultValues) {
6488
6636
  this.formConfig.sections.forEach(r => {
@@ -6490,11 +6638,13 @@ var script$3 = {
6490
6638
  c.fields.forEach(f => {
6491
6639
  if (this.isNotUndefinedAndNull(f.defaultValue)) {
6492
6640
  let defValue;
6641
+
6493
6642
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
6494
6643
  defValue = f.defaultValue();
6495
6644
  } else {
6496
6645
  defValue = f.defaultValue == null ? null : f.defaultValue;
6497
6646
  }
6647
+
6498
6648
  this.$set(this.doc, f.name, f.defaultValue = defValue);
6499
6649
  }
6500
6650
  });
@@ -6502,6 +6652,7 @@ var script$3 = {
6502
6652
  });
6503
6653
  }
6504
6654
  },
6655
+
6505
6656
  execApplyDefaultValRule() {
6506
6657
  this.formConfig.sections.forEach(el => {
6507
6658
  el.columns.forEach(c => {
@@ -6509,6 +6660,7 @@ var script$3 = {
6509
6660
  if (f.rules) {
6510
6661
  if (!f.defaultValue) {
6511
6662
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
6663
+
6512
6664
  if (rule && !this.doc[f.name]) {
6513
6665
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
6514
6666
  }
@@ -6518,27 +6670,34 @@ var script$3 = {
6518
6670
  });
6519
6671
  });
6520
6672
  }
6673
+
6521
6674
  },
6675
+
6522
6676
  mounted() {
6523
6677
  this.execApplyDefaultValues();
6524
6678
  this.execApplyDefaultValRule();
6525
6679
  this.onGlobalEventFired('form-mounted', this);
6526
6680
  },
6681
+
6527
6682
  activated() {
6528
6683
  this.execApplyDefaultValues();
6529
6684
  this.execApplyDefaultValRule();
6530
6685
  this.onGlobalEventFired('form-activated', this);
6531
6686
  }
6687
+
6532
6688
  };
6533
6689
 
6534
6690
  /* script */
6535
6691
  const __vue_script__$3 = script$3;
6536
-
6537
6692
  /* template */
6693
+
6538
6694
  var __vue_render__$3 = function () {
6539
6695
  var _vm = this;
6696
+
6540
6697
  var _h = _vm.$createElement;
6698
+
6541
6699
  var _c = _vm._self._c || _h;
6700
+
6542
6701
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
6543
6702
  staticClass: "rb-doc-form",
6544
6703
  on: {
@@ -6645,15 +6804,19 @@ var __vue_render__$3 = function () {
6645
6804
  })], 2)], 1);
6646
6805
  }), 0) : _vm._e();
6647
6806
  };
6648
- var __vue_staticRenderFns__$3 = [];
6649
6807
 
6808
+ var __vue_staticRenderFns__$3 = [];
6650
6809
  /* style */
6810
+
6651
6811
  const __vue_inject_styles__$3 = undefined;
6652
6812
  /* scoped */
6813
+
6653
6814
  const __vue_scope_id__$3 = undefined;
6654
6815
  /* module identifier */
6816
+
6655
6817
  const __vue_module_identifier__$3 = undefined;
6656
6818
  /* functional template */
6819
+
6657
6820
  const __vue_is_functional_template__$3 = false;
6658
6821
  /* style inject */
6659
6822
 
@@ -6665,21 +6828,26 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
6665
6828
  render: __vue_render__$3,
6666
6829
  staticRenderFns: __vue_staticRenderFns__$3
6667
6830
  }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
6831
+
6668
6832
  var DocForm = __vue_component__$4;
6669
6833
 
6670
6834
  const generateRandomString = length => {
6671
6835
  let result = '';
6672
6836
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
6673
6837
  const charactersLength = characters.length;
6838
+
6674
6839
  for (let i = 0; i < length; i++) {
6675
6840
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
6676
6841
  }
6842
+
6677
6843
  return result;
6678
6844
  };
6845
+
6679
6846
  const UtRandom = {
6680
6847
  getRandomString(length) {
6681
6848
  return generateRandomString(length);
6682
6849
  }
6850
+
6683
6851
  };
6684
6852
 
6685
6853
  //
@@ -6698,6 +6866,7 @@ var script$2 = {
6698
6866
  },
6699
6867
  onAfterOk: Function
6700
6868
  },
6869
+
6701
6870
  data() {
6702
6871
  return {
6703
6872
  id: 'rb-field-rule-form-modal',
@@ -6706,21 +6875,26 @@ var script$2 = {
6706
6875
  innerRule: null
6707
6876
  };
6708
6877
  },
6878
+
6709
6879
  computed: {
6710
6880
  title() {
6711
6881
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
6712
6882
  },
6883
+
6713
6884
  fields() {
6714
6885
  return UtFormConfig.getFields(this.formConfig);
6715
6886
  },
6887
+
6716
6888
  rulePresets() {
6717
6889
  return UtFormConstructor.getAvailableFieldRules(this.field);
6718
6890
  }
6891
+
6719
6892
  },
6720
6893
  watch: {
6721
6894
  formConfig() {
6722
6895
  this.copyToInnerFormConfig();
6723
6896
  },
6897
+
6724
6898
  rule() {
6725
6899
  if (this.rule) {
6726
6900
  this.innerRule = this.rule;
@@ -6728,6 +6902,7 @@ var script$2 = {
6728
6902
  this.innerRule = this.getDefaultRule();
6729
6903
  }
6730
6904
  }
6905
+
6731
6906
  },
6732
6907
  methods: {
6733
6908
  validateFields(fieldName) {
@@ -6742,14 +6917,18 @@ var script$2 = {
6742
6917
  }
6743
6918
  });
6744
6919
  },
6920
+
6745
6921
  copyToInnerFormConfig() {
6746
6922
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
6747
6923
  },
6924
+
6748
6925
  applyRuleToInnerFormConfig() {
6749
6926
  if (this.innerFormConfig) {
6750
6927
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
6928
+
6751
6929
  if (!foundRule) {
6752
6930
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
6931
+
6753
6932
  if (foundField) {
6754
6933
  foundField.rules = foundField.rules ? foundField.rules : [];
6755
6934
  foundField.rules.push(this.rule);
@@ -6759,12 +6938,14 @@ var script$2 = {
6759
6938
  }
6760
6939
  }
6761
6940
  },
6941
+
6762
6942
  onActivateTab(index) {
6763
6943
  if (index > 0) {
6764
6944
  this.copyToInnerFormConfig();
6765
6945
  this.applyRuleToInnerFormConfig();
6766
6946
  }
6767
6947
  },
6948
+
6768
6949
  getDefaultState() {
6769
6950
  return {
6770
6951
  name: null,
@@ -6772,6 +6953,7 @@ var script$2 = {
6772
6953
  script: null
6773
6954
  };
6774
6955
  },
6956
+
6775
6957
  getDefaultRule() {
6776
6958
  return {
6777
6959
  id: UtRandom.getRandomString(10),
@@ -6780,22 +6962,27 @@ var script$2 = {
6780
6962
  script: null
6781
6963
  };
6782
6964
  },
6965
+
6783
6966
  resetModal() {
6784
6967
  this.state = this.getDefaultState();
6785
6968
  this.innerRule = null;
6786
6969
  },
6970
+
6787
6971
  addVariableToScript(varName) {
6788
6972
  let caretPosition = this.$refs.scriptInput.selectionStart;
6789
6973
  this.insertTextToScript(varName, caretPosition);
6790
6974
  },
6975
+
6791
6976
  addSetVariableToScript(field) {
6792
6977
  let caretPosition = this.$refs.scriptInput.selectionStart;
6793
6978
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
6794
6979
  },
6980
+
6795
6981
  addCallInputFunction(field) {
6796
6982
  let caretPosition = this.$refs.scriptInput.selectionStart;
6797
6983
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
6798
6984
  },
6985
+
6799
6986
  insertTextToScript(text, position) {
6800
6987
  position = position != null ? position : this.script.length;
6801
6988
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -6803,39 +6990,50 @@ var script$2 = {
6803
6990
  scriptSplit.splice(position, 0, text);
6804
6991
  this.innerRule.script = scriptSplit.join('');
6805
6992
  },
6993
+
6806
6994
  onRuleSelected(ruleName) {
6807
6995
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
6996
+
6808
6997
  if (rule) {
6809
6998
  Object.assign(this.innerRule, rule);
6810
6999
  this.innerRule.script = this.innerRule.script.trim();
6811
7000
  }
6812
7001
  },
7002
+
6813
7003
  onOk() {
6814
7004
  this.validateFields();
7005
+
6815
7006
  if (this.state.name && this.state.script) {
6816
7007
  if (this.onAfterOk) {
6817
7008
  this.onAfterOk(this.innerRule);
6818
7009
  }
7010
+
6819
7011
  this.$nextTick(() => {
6820
7012
  this.resetModal();
6821
7013
  this.$bvModal.hide(this.id);
6822
7014
  });
6823
7015
  }
6824
7016
  }
7017
+
6825
7018
  },
7019
+
6826
7020
  created() {
6827
7021
  this.copyToInnerFormConfig();
6828
7022
  }
7023
+
6829
7024
  };
6830
7025
 
6831
7026
  /* script */
6832
7027
  const __vue_script__$2 = script$2;
6833
-
6834
7028
  /* template */
7029
+
6835
7030
  var __vue_render__$2 = function () {
6836
7031
  var _vm = this;
7032
+
6837
7033
  var _h = _vm.$createElement;
7034
+
6838
7035
  var _c = _vm._self._c || _h;
7036
+
6839
7037
  return _c('b-modal', {
6840
7038
  attrs: {
6841
7039
  "id": _vm.id,
@@ -7088,15 +7286,19 @@ var __vue_render__$2 = function () {
7088
7286
  }
7089
7287
  })], 1) : _vm._e()], 1)], 1)], 1);
7090
7288
  };
7091
- var __vue_staticRenderFns__$2 = [];
7092
7289
 
7290
+ var __vue_staticRenderFns__$2 = [];
7093
7291
  /* style */
7292
+
7094
7293
  const __vue_inject_styles__$2 = undefined;
7095
7294
  /* scoped */
7295
+
7096
7296
  const __vue_scope_id__$2 = undefined;
7097
7297
  /* module identifier */
7298
+
7098
7299
  const __vue_module_identifier__$2 = undefined;
7099
7300
  /* functional template */
7301
+
7100
7302
  const __vue_is_functional_template__$2 = false;
7101
7303
  /* style inject */
7102
7304
 
@@ -7108,6 +7310,7 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
7108
7310
  render: __vue_render__$2,
7109
7311
  staticRenderFns: __vue_staticRenderFns__$2
7110
7312
  }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
7313
+
7111
7314
  var FieldRuleFormModal = __vue_component__$3;
7112
7315
 
7113
7316
  //
@@ -7127,6 +7330,7 @@ var script$1 = {
7127
7330
  },
7128
7331
  formConfig: Object
7129
7332
  },
7333
+
7130
7334
  data() {
7131
7335
  return {
7132
7336
  innerVisible: null,
@@ -7140,61 +7344,78 @@ var script$1 = {
7140
7344
  rulesHash: UtRandom.getRandomString(10)
7141
7345
  };
7142
7346
  },
7347
+
7143
7348
  computed: {
7144
7349
  inputOptions() {
7145
7350
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
7146
7351
  },
7352
+
7147
7353
  iconCloseSidebar() {
7148
7354
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
7149
7355
  },
7356
+
7150
7357
  iconOpenSidebar() {
7151
7358
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
7152
7359
  },
7360
+
7153
7361
  iconAdd() {
7154
7362
  return UtFormConstructor.config.icons.iconAdd;
7155
7363
  },
7364
+
7156
7365
  rules() {
7157
7366
  return UtFormConstructor.getAvailableFieldRules(this.field);
7158
7367
  },
7368
+
7159
7369
  hasMultipleInputTypes() {
7160
7370
  return UtFormConstructor.hasMultipleInputTypes(this.field);
7161
7371
  },
7372
+
7162
7373
  multiple() {
7163
7374
  return this.field && this.field.multiple;
7164
7375
  }
7376
+
7165
7377
  },
7166
7378
  watch: {
7167
7379
  visible() {
7168
7380
  this.innerVisible = this.visible;
7169
7381
  },
7382
+
7170
7383
  value() {
7171
7384
  this.field = this.value;
7385
+
7172
7386
  if (this.field && this.field.input) {
7173
7387
  this.currentInputName = this.field.input.name;
7174
7388
  }
7175
7389
  },
7390
+
7176
7391
  field: {
7177
7392
  handler() {
7178
7393
  this.$emit('input', this.field);
7179
7394
  this.$emit('change', this.field);
7180
7395
  },
7396
+
7181
7397
  deep: true
7182
7398
  },
7399
+
7183
7400
  currentInputName(val) {
7184
7401
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
7185
7402
  },
7403
+
7186
7404
  multiple() {
7187
7405
  let input = UtFormConstructor.getDefaultInput(this.field);
7406
+
7188
7407
  if (this.field.multiple) {
7189
7408
  this.currentInputName = input.name;
7190
7409
  }
7191
7410
  }
7411
+
7192
7412
  },
7193
7413
  methods: {
7194
7414
  hide() {
7195
7415
  this.innerVisible = false;
7196
7416
  this.$emit('hide');
7197
7417
  },
7418
+
7198
7419
  getPropInputType(prop, propName) {
7199
7420
  if (['string', 'number'].includes(prop.type)) {
7200
7421
  return 'b-form-input';
@@ -7204,6 +7425,7 @@ var script$1 = {
7204
7425
  return 'rb-boolean-single-option-input';
7205
7426
  }
7206
7427
  },
7428
+
7207
7429
  getPropInputPropData(prop, propName) {
7208
7430
  if (prop.type === 'string') {
7209
7431
  return {
@@ -7217,6 +7439,7 @@ var script$1 = {
7217
7439
  return {};
7218
7440
  }
7219
7441
  },
7442
+
7220
7443
  addRule() {
7221
7444
  this.ruleModalCfg = {
7222
7445
  mode: 'ins',
@@ -7226,22 +7449,22 @@ var script$1 = {
7226
7449
  },
7227
7450
  onAfterOk: rule => {
7228
7451
  this.field.rules = this.field.rules ? this.field.rules : [];
7229
- this.field.rules.push({
7230
- ...rule
7452
+ this.field.rules.push({ ...rule
7231
7453
  });
7232
7454
  this.rulesHash = UtRandom.getRandomString(10);
7233
7455
  }
7234
7456
  };
7235
7457
  this.$bvModal.show(this.modalId);
7236
7458
  },
7459
+
7237
7460
  editRule(rule, event) {
7238
7461
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
7239
7462
  return;
7240
7463
  }
7464
+
7241
7465
  this.ruleModalCfg = {
7242
7466
  mode: 'upd',
7243
- rule: {
7244
- ...rule
7467
+ rule: { ...rule
7245
7468
  },
7246
7469
  onAfterOk: modalRule => {
7247
7470
  Object.assign(rule, modalRule);
@@ -7249,33 +7472,43 @@ var script$1 = {
7249
7472
  };
7250
7473
  this.$bvModal.show(this.modalId);
7251
7474
  },
7475
+
7252
7476
  removeRule(rule) {
7253
7477
  let index = this.field.rules.findIndex(r => r.id === rule.id);
7478
+
7254
7479
  if (index >= 0) {
7255
7480
  this.field.rules.splice(index, 1);
7256
7481
  }
7482
+
7257
7483
  this.rulesHash = UtRandom.getRandomString(10);
7258
7484
  }
7485
+
7259
7486
  },
7487
+
7260
7488
  created() {
7261
7489
  if (this.value) {
7262
7490
  this.innerVisible = this.visible;
7263
7491
  this.field = this.value;
7492
+
7264
7493
  if (this.field && this.field.input) {
7265
7494
  this.currentInputName = this.field.input.name;
7266
7495
  }
7267
7496
  }
7268
7497
  }
7498
+
7269
7499
  };
7270
7500
 
7271
7501
  /* script */
7272
7502
  const __vue_script__$1 = script$1;
7273
-
7274
7503
  /* template */
7504
+
7275
7505
  var __vue_render__$1 = function () {
7276
7506
  var _vm = this;
7507
+
7277
7508
  var _h = _vm.$createElement;
7509
+
7278
7510
  var _c = _vm._self._c || _h;
7511
+
7279
7512
  return _c('b-sidebar', {
7280
7513
  staticClass: "rb-doc-template-field-sidebar",
7281
7514
  attrs: {
@@ -7513,15 +7746,19 @@ var __vue_render__$1 = function () {
7513
7746
  }
7514
7747
  })], 1);
7515
7748
  };
7516
- var __vue_staticRenderFns__$1 = [];
7517
7749
 
7750
+ var __vue_staticRenderFns__$1 = [];
7518
7751
  /* style */
7752
+
7519
7753
  const __vue_inject_styles__$1 = undefined;
7520
7754
  /* scoped */
7755
+
7521
7756
  const __vue_scope_id__$1 = undefined;
7522
7757
  /* module identifier */
7758
+
7523
7759
  const __vue_module_identifier__$1 = undefined;
7524
7760
  /* functional template */
7761
+
7525
7762
  const __vue_is_functional_template__$1 = false;
7526
7763
  /* style inject */
7527
7764
 
@@ -7533,6 +7770,7 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
7533
7770
  render: __vue_render__$1,
7534
7771
  staticRenderFns: __vue_staticRenderFns__$1
7535
7772
  }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
7773
+
7536
7774
  var DocTemplateFieldSidebar = __vue_component__$2;
7537
7775
 
7538
7776
  //
@@ -7558,6 +7796,7 @@ var script = {
7558
7796
  default: () => []
7559
7797
  }
7560
7798
  },
7799
+
7561
7800
  data() {
7562
7801
  return {
7563
7802
  sidebarVisible: false,
@@ -7568,32 +7807,41 @@ var script = {
7568
7807
  id: 'rb-doc-template-section-modal',
7569
7808
  mode: 'ins',
7570
7809
  section: null,
7810
+
7571
7811
  onAfterOk() {}
7812
+
7572
7813
  }
7573
7814
  };
7574
7815
  },
7816
+
7575
7817
  computed: {
7576
7818
  iconAdd() {
7577
7819
  return UtFormConstructor.config.icons.iconAdd;
7578
7820
  },
7821
+
7579
7822
  iconEdit() {
7580
7823
  return UtFormConstructor.config.icons.iconEdit;
7581
7824
  },
7825
+
7582
7826
  iconDelete() {
7583
7827
  return UtFormConstructor.config.icons.iconDelete;
7584
7828
  },
7829
+
7585
7830
  iconDrag() {
7586
7831
  return UtFormConstructor.config.icons.iconDrag;
7587
7832
  }
7833
+
7588
7834
  },
7589
7835
  methods: {
7590
7836
  showProperties(field, event) {
7591
7837
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
7592
7838
  return;
7593
7839
  }
7840
+
7594
7841
  this.sidebarVisible = true;
7595
7842
  this.sidebarField = field;
7596
7843
  },
7844
+
7597
7845
  addSection(columnCount) {
7598
7846
  let section = {
7599
7847
  labelRu: null,
@@ -7601,31 +7849,39 @@ var script = {
7601
7849
  };
7602
7850
  this.sectionModalCfg.mode = 'ins';
7603
7851
  this.sectionModalCfg.section = section;
7852
+
7604
7853
  this.sectionModalCfg.onAfterOk = () => {
7605
7854
  section.columns = [];
7855
+
7606
7856
  for (let i = 0; i < columnCount; i++) {
7607
7857
  section.columns.push({
7608
7858
  index: i,
7609
7859
  fields: []
7610
7860
  });
7611
7861
  }
7862
+
7612
7863
  this.formConfig.sections.push(section);
7613
7864
  };
7865
+
7614
7866
  this.$bvModal.show(this.sectionModalCfg.id);
7615
7867
  },
7868
+
7616
7869
  editSection(section) {
7617
7870
  this.sectionModalCfg.mode = 'update';
7618
7871
  this.sectionModalCfg.section = section;
7872
+
7619
7873
  this.sectionModalCfg.onAfterOk = () => {};
7874
+
7620
7875
  this.$bvModal.show(this.sectionModalCfg.id);
7621
7876
  },
7877
+
7622
7878
  removeSection(section, index) {
7623
7879
  this.formConfig.sections.splice(index, 1);
7624
- /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7625
- onOk: (event, modal) => {
7626
- this.formConfig.sections.splice(index, 1);
7627
- UtModal.closeModal(modal);
7628
- }
7880
+ /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7881
+ onOk: (event, modal) => {
7882
+ this.formConfig.sections.splice(index, 1);
7883
+ UtModal.closeModal(modal);
7884
+ }
7629
7885
  });*/
7630
7886
  },
7631
7887
 
@@ -7642,31 +7898,40 @@ var script = {
7642
7898
  });
7643
7899
  return count > 1;
7644
7900
  },
7901
+
7645
7902
  removeFieldFromColumn(field, column, newIndex) {
7646
7903
  let index = newIndex != null ? newIndex : -1;
7904
+
7647
7905
  if (index < 0) {
7648
7906
  index = column.fields.findIndex(f => field.name === f.name);
7649
7907
  }
7908
+
7650
7909
  if (index >= 0) {
7651
7910
  column.fields.splice(index, 1);
7652
7911
  }
7653
7912
  },
7913
+
7654
7914
  onRemoveField(event, field, column) {
7655
7915
  event.preventDefault();
7656
7916
  this.removeFieldFromColumn(field, column);
7657
7917
  },
7918
+
7658
7919
  onFieldAddedToColumn(event, column, section) {
7659
7920
  this.columnTo = column;
7660
7921
  },
7922
+
7661
7923
  onFieldMoveEnd(event) {
7662
7924
  const {
7663
7925
  newIndex
7664
7926
  } = event;
7665
7927
  let field = event.item._underlying_vm_;
7928
+
7666
7929
  if (!field.hasOwnProperty('defaultValue')) {
7667
7930
  this.$set(field, 'defaultValue', undefined);
7668
7931
  }
7932
+
7669
7933
  let found = this.multipleFieldAreOnFormConfig(field);
7934
+
7670
7935
  if (found) {
7671
7936
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
7672
7937
  this.resetDragVariables();
@@ -7680,30 +7945,36 @@ var script = {
7680
7945
  noCloseOnEsc: true
7681
7946
  });
7682
7947
  }
7948
+
7683
7949
  this.resetDragVariables();
7684
7950
  this.hash = (Math.random() + 1).toString(36).substring(7);
7685
7951
  },
7952
+
7686
7953
  getFieldExtendedPropsData(field) {
7687
- return {
7688
- ...field.input.propsData,
7954
+ return { ...field.input.propsData,
7689
7955
  placeholder: field.tag,
7690
7956
  disabled: true
7691
7957
  };
7692
7958
  },
7959
+
7693
7960
  resetDragVariables() {
7694
7961
  this.columnTo = null;
7695
7962
  }
7963
+
7696
7964
  }
7697
7965
  };
7698
7966
 
7699
7967
  /* script */
7700
7968
  const __vue_script__ = script;
7701
-
7702
7969
  /* template */
7970
+
7703
7971
  var __vue_render__ = function () {
7704
7972
  var _vm = this;
7973
+
7705
7974
  var _h = _vm.$createElement;
7975
+
7706
7976
  var _c = _vm._self._c || _h;
7977
+
7707
7978
  return _c('div', {
7708
7979
  staticClass: "rb-doc-template-constructor d-flex"
7709
7980
  }, [_c('doc-template-facet-list', {
@@ -7943,15 +8214,19 @@ var __vue_render__ = function () {
7943
8214
  }
7944
8215
  })], 1)], 1);
7945
8216
  };
7946
- var __vue_staticRenderFns__ = [];
7947
8217
 
8218
+ var __vue_staticRenderFns__ = [];
7948
8219
  /* style */
8220
+
7949
8221
  const __vue_inject_styles__ = undefined;
7950
8222
  /* scoped */
8223
+
7951
8224
  const __vue_scope_id__ = undefined;
7952
8225
  /* module identifier */
8226
+
7953
8227
  const __vue_module_identifier__ = undefined;
7954
8228
  /* functional template */
8229
+
7955
8230
  const __vue_is_functional_template__ = false;
7956
8231
  /* style inject */
7957
8232
 
@@ -7963,6 +8238,7 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
7963
8238
  render: __vue_render__,
7964
8239
  staticRenderFns: __vue_staticRenderFns__
7965
8240
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
8241
+
7966
8242
  var __vue_component__$1 = __vue_component__;
7967
8243
 
7968
8244
  /* eslint-disable import/prefer-default-export */
@@ -7981,11 +8257,11 @@ var components = /*#__PURE__*/Object.freeze({
7981
8257
 
7982
8258
  // Import vue components
7983
8259
 
7984
- // install function executed by Vue.use()
7985
8260
  const install = function installRbDocumentFormConstructor(Vue) {
7986
- Object.entries(components).forEach(([componentName, component]) => {
8261
+ Object.entries(components).forEach(_ref => {
8262
+ let [componentName, component] = _ref;
7987
8263
  Vue.component(componentName, component);
7988
8264
  });
7989
- };
8265
+ }; // Create module definition for Vue.use()
7990
8266
 
7991
8267
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default };