rb-document-form-constructor 0.9.13 → 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,33 +6606,45 @@ 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
+
6630
+ isNotUndefinedAndNull(value) {
6631
+ return !(value === null || value === undefined);
6632
+ },
6633
+
6483
6634
  execApplyDefaultValues() {
6484
6635
  if (this.applyDefaultValues) {
6485
6636
  this.formConfig.sections.forEach(r => {
6486
6637
  r.columns.forEach(c => {
6487
6638
  c.fields.forEach(f => {
6488
- if (f.defaultValue) {
6639
+ if (this.isNotUndefinedAndNull(f.defaultValue)) {
6489
6640
  let defValue;
6641
+
6490
6642
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
6491
6643
  defValue = f.defaultValue();
6492
6644
  } else {
6493
6645
  defValue = f.defaultValue == null ? null : f.defaultValue;
6494
6646
  }
6647
+
6495
6648
  this.$set(this.doc, f.name, f.defaultValue = defValue);
6496
6649
  }
6497
6650
  });
@@ -6499,6 +6652,7 @@ var script$3 = {
6499
6652
  });
6500
6653
  }
6501
6654
  },
6655
+
6502
6656
  execApplyDefaultValRule() {
6503
6657
  this.formConfig.sections.forEach(el => {
6504
6658
  el.columns.forEach(c => {
@@ -6506,6 +6660,7 @@ var script$3 = {
6506
6660
  if (f.rules) {
6507
6661
  if (!f.defaultValue) {
6508
6662
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
6663
+
6509
6664
  if (rule && !this.doc[f.name]) {
6510
6665
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
6511
6666
  }
@@ -6515,27 +6670,34 @@ var script$3 = {
6515
6670
  });
6516
6671
  });
6517
6672
  }
6673
+
6518
6674
  },
6675
+
6519
6676
  mounted() {
6520
6677
  this.execApplyDefaultValues();
6521
6678
  this.execApplyDefaultValRule();
6522
6679
  this.onGlobalEventFired('form-mounted', this);
6523
6680
  },
6681
+
6524
6682
  activated() {
6525
6683
  this.execApplyDefaultValues();
6526
6684
  this.execApplyDefaultValRule();
6527
6685
  this.onGlobalEventFired('form-activated', this);
6528
6686
  }
6687
+
6529
6688
  };
6530
6689
 
6531
6690
  /* script */
6532
6691
  const __vue_script__$3 = script$3;
6533
-
6534
6692
  /* template */
6693
+
6535
6694
  var __vue_render__$3 = function () {
6536
6695
  var _vm = this;
6696
+
6537
6697
  var _h = _vm.$createElement;
6698
+
6538
6699
  var _c = _vm._self._c || _h;
6700
+
6539
6701
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
6540
6702
  staticClass: "rb-doc-form",
6541
6703
  on: {
@@ -6642,15 +6804,19 @@ var __vue_render__$3 = function () {
6642
6804
  })], 2)], 1);
6643
6805
  }), 0) : _vm._e();
6644
6806
  };
6645
- var __vue_staticRenderFns__$3 = [];
6646
6807
 
6808
+ var __vue_staticRenderFns__$3 = [];
6647
6809
  /* style */
6810
+
6648
6811
  const __vue_inject_styles__$3 = undefined;
6649
6812
  /* scoped */
6813
+
6650
6814
  const __vue_scope_id__$3 = undefined;
6651
6815
  /* module identifier */
6816
+
6652
6817
  const __vue_module_identifier__$3 = undefined;
6653
6818
  /* functional template */
6819
+
6654
6820
  const __vue_is_functional_template__$3 = false;
6655
6821
  /* style inject */
6656
6822
 
@@ -6662,21 +6828,26 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
6662
6828
  render: __vue_render__$3,
6663
6829
  staticRenderFns: __vue_staticRenderFns__$3
6664
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
+
6665
6832
  var DocForm = __vue_component__$4;
6666
6833
 
6667
6834
  const generateRandomString = length => {
6668
6835
  let result = '';
6669
6836
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
6670
6837
  const charactersLength = characters.length;
6838
+
6671
6839
  for (let i = 0; i < length; i++) {
6672
6840
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
6673
6841
  }
6842
+
6674
6843
  return result;
6675
6844
  };
6845
+
6676
6846
  const UtRandom = {
6677
6847
  getRandomString(length) {
6678
6848
  return generateRandomString(length);
6679
6849
  }
6850
+
6680
6851
  };
6681
6852
 
6682
6853
  //
@@ -6695,6 +6866,7 @@ var script$2 = {
6695
6866
  },
6696
6867
  onAfterOk: Function
6697
6868
  },
6869
+
6698
6870
  data() {
6699
6871
  return {
6700
6872
  id: 'rb-field-rule-form-modal',
@@ -6703,21 +6875,26 @@ var script$2 = {
6703
6875
  innerRule: null
6704
6876
  };
6705
6877
  },
6878
+
6706
6879
  computed: {
6707
6880
  title() {
6708
6881
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
6709
6882
  },
6883
+
6710
6884
  fields() {
6711
6885
  return UtFormConfig.getFields(this.formConfig);
6712
6886
  },
6887
+
6713
6888
  rulePresets() {
6714
6889
  return UtFormConstructor.getAvailableFieldRules(this.field);
6715
6890
  }
6891
+
6716
6892
  },
6717
6893
  watch: {
6718
6894
  formConfig() {
6719
6895
  this.copyToInnerFormConfig();
6720
6896
  },
6897
+
6721
6898
  rule() {
6722
6899
  if (this.rule) {
6723
6900
  this.innerRule = this.rule;
@@ -6725,6 +6902,7 @@ var script$2 = {
6725
6902
  this.innerRule = this.getDefaultRule();
6726
6903
  }
6727
6904
  }
6905
+
6728
6906
  },
6729
6907
  methods: {
6730
6908
  validateFields(fieldName) {
@@ -6739,14 +6917,18 @@ var script$2 = {
6739
6917
  }
6740
6918
  });
6741
6919
  },
6920
+
6742
6921
  copyToInnerFormConfig() {
6743
6922
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
6744
6923
  },
6924
+
6745
6925
  applyRuleToInnerFormConfig() {
6746
6926
  if (this.innerFormConfig) {
6747
6927
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
6928
+
6748
6929
  if (!foundRule) {
6749
6930
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
6931
+
6750
6932
  if (foundField) {
6751
6933
  foundField.rules = foundField.rules ? foundField.rules : [];
6752
6934
  foundField.rules.push(this.rule);
@@ -6756,12 +6938,14 @@ var script$2 = {
6756
6938
  }
6757
6939
  }
6758
6940
  },
6941
+
6759
6942
  onActivateTab(index) {
6760
6943
  if (index > 0) {
6761
6944
  this.copyToInnerFormConfig();
6762
6945
  this.applyRuleToInnerFormConfig();
6763
6946
  }
6764
6947
  },
6948
+
6765
6949
  getDefaultState() {
6766
6950
  return {
6767
6951
  name: null,
@@ -6769,6 +6953,7 @@ var script$2 = {
6769
6953
  script: null
6770
6954
  };
6771
6955
  },
6956
+
6772
6957
  getDefaultRule() {
6773
6958
  return {
6774
6959
  id: UtRandom.getRandomString(10),
@@ -6777,22 +6962,27 @@ var script$2 = {
6777
6962
  script: null
6778
6963
  };
6779
6964
  },
6965
+
6780
6966
  resetModal() {
6781
6967
  this.state = this.getDefaultState();
6782
6968
  this.innerRule = null;
6783
6969
  },
6970
+
6784
6971
  addVariableToScript(varName) {
6785
6972
  let caretPosition = this.$refs.scriptInput.selectionStart;
6786
6973
  this.insertTextToScript(varName, caretPosition);
6787
6974
  },
6975
+
6788
6976
  addSetVariableToScript(field) {
6789
6977
  let caretPosition = this.$refs.scriptInput.selectionStart;
6790
6978
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
6791
6979
  },
6980
+
6792
6981
  addCallInputFunction(field) {
6793
6982
  let caretPosition = this.$refs.scriptInput.selectionStart;
6794
6983
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
6795
6984
  },
6985
+
6796
6986
  insertTextToScript(text, position) {
6797
6987
  position = position != null ? position : this.script.length;
6798
6988
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -6800,39 +6990,50 @@ var script$2 = {
6800
6990
  scriptSplit.splice(position, 0, text);
6801
6991
  this.innerRule.script = scriptSplit.join('');
6802
6992
  },
6993
+
6803
6994
  onRuleSelected(ruleName) {
6804
6995
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
6996
+
6805
6997
  if (rule) {
6806
6998
  Object.assign(this.innerRule, rule);
6807
6999
  this.innerRule.script = this.innerRule.script.trim();
6808
7000
  }
6809
7001
  },
7002
+
6810
7003
  onOk() {
6811
7004
  this.validateFields();
7005
+
6812
7006
  if (this.state.name && this.state.script) {
6813
7007
  if (this.onAfterOk) {
6814
7008
  this.onAfterOk(this.innerRule);
6815
7009
  }
7010
+
6816
7011
  this.$nextTick(() => {
6817
7012
  this.resetModal();
6818
7013
  this.$bvModal.hide(this.id);
6819
7014
  });
6820
7015
  }
6821
7016
  }
7017
+
6822
7018
  },
7019
+
6823
7020
  created() {
6824
7021
  this.copyToInnerFormConfig();
6825
7022
  }
7023
+
6826
7024
  };
6827
7025
 
6828
7026
  /* script */
6829
7027
  const __vue_script__$2 = script$2;
6830
-
6831
7028
  /* template */
7029
+
6832
7030
  var __vue_render__$2 = function () {
6833
7031
  var _vm = this;
7032
+
6834
7033
  var _h = _vm.$createElement;
7034
+
6835
7035
  var _c = _vm._self._c || _h;
7036
+
6836
7037
  return _c('b-modal', {
6837
7038
  attrs: {
6838
7039
  "id": _vm.id,
@@ -7085,15 +7286,19 @@ var __vue_render__$2 = function () {
7085
7286
  }
7086
7287
  })], 1) : _vm._e()], 1)], 1)], 1);
7087
7288
  };
7088
- var __vue_staticRenderFns__$2 = [];
7089
7289
 
7290
+ var __vue_staticRenderFns__$2 = [];
7090
7291
  /* style */
7292
+
7091
7293
  const __vue_inject_styles__$2 = undefined;
7092
7294
  /* scoped */
7295
+
7093
7296
  const __vue_scope_id__$2 = undefined;
7094
7297
  /* module identifier */
7298
+
7095
7299
  const __vue_module_identifier__$2 = undefined;
7096
7300
  /* functional template */
7301
+
7097
7302
  const __vue_is_functional_template__$2 = false;
7098
7303
  /* style inject */
7099
7304
 
@@ -7105,6 +7310,7 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
7105
7310
  render: __vue_render__$2,
7106
7311
  staticRenderFns: __vue_staticRenderFns__$2
7107
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
+
7108
7314
  var FieldRuleFormModal = __vue_component__$3;
7109
7315
 
7110
7316
  //
@@ -7124,6 +7330,7 @@ var script$1 = {
7124
7330
  },
7125
7331
  formConfig: Object
7126
7332
  },
7333
+
7127
7334
  data() {
7128
7335
  return {
7129
7336
  innerVisible: null,
@@ -7137,61 +7344,78 @@ var script$1 = {
7137
7344
  rulesHash: UtRandom.getRandomString(10)
7138
7345
  };
7139
7346
  },
7347
+
7140
7348
  computed: {
7141
7349
  inputOptions() {
7142
7350
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
7143
7351
  },
7352
+
7144
7353
  iconCloseSidebar() {
7145
7354
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
7146
7355
  },
7356
+
7147
7357
  iconOpenSidebar() {
7148
7358
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
7149
7359
  },
7360
+
7150
7361
  iconAdd() {
7151
7362
  return UtFormConstructor.config.icons.iconAdd;
7152
7363
  },
7364
+
7153
7365
  rules() {
7154
7366
  return UtFormConstructor.getAvailableFieldRules(this.field);
7155
7367
  },
7368
+
7156
7369
  hasMultipleInputTypes() {
7157
7370
  return UtFormConstructor.hasMultipleInputTypes(this.field);
7158
7371
  },
7372
+
7159
7373
  multiple() {
7160
7374
  return this.field && this.field.multiple;
7161
7375
  }
7376
+
7162
7377
  },
7163
7378
  watch: {
7164
7379
  visible() {
7165
7380
  this.innerVisible = this.visible;
7166
7381
  },
7382
+
7167
7383
  value() {
7168
7384
  this.field = this.value;
7385
+
7169
7386
  if (this.field && this.field.input) {
7170
7387
  this.currentInputName = this.field.input.name;
7171
7388
  }
7172
7389
  },
7390
+
7173
7391
  field: {
7174
7392
  handler() {
7175
7393
  this.$emit('input', this.field);
7176
7394
  this.$emit('change', this.field);
7177
7395
  },
7396
+
7178
7397
  deep: true
7179
7398
  },
7399
+
7180
7400
  currentInputName(val) {
7181
7401
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
7182
7402
  },
7403
+
7183
7404
  multiple() {
7184
7405
  let input = UtFormConstructor.getDefaultInput(this.field);
7406
+
7185
7407
  if (this.field.multiple) {
7186
7408
  this.currentInputName = input.name;
7187
7409
  }
7188
7410
  }
7411
+
7189
7412
  },
7190
7413
  methods: {
7191
7414
  hide() {
7192
7415
  this.innerVisible = false;
7193
7416
  this.$emit('hide');
7194
7417
  },
7418
+
7195
7419
  getPropInputType(prop, propName) {
7196
7420
  if (['string', 'number'].includes(prop.type)) {
7197
7421
  return 'b-form-input';
@@ -7201,6 +7425,7 @@ var script$1 = {
7201
7425
  return 'rb-boolean-single-option-input';
7202
7426
  }
7203
7427
  },
7428
+
7204
7429
  getPropInputPropData(prop, propName) {
7205
7430
  if (prop.type === 'string') {
7206
7431
  return {
@@ -7214,6 +7439,7 @@ var script$1 = {
7214
7439
  return {};
7215
7440
  }
7216
7441
  },
7442
+
7217
7443
  addRule() {
7218
7444
  this.ruleModalCfg = {
7219
7445
  mode: 'ins',
@@ -7223,22 +7449,22 @@ var script$1 = {
7223
7449
  },
7224
7450
  onAfterOk: rule => {
7225
7451
  this.field.rules = this.field.rules ? this.field.rules : [];
7226
- this.field.rules.push({
7227
- ...rule
7452
+ this.field.rules.push({ ...rule
7228
7453
  });
7229
7454
  this.rulesHash = UtRandom.getRandomString(10);
7230
7455
  }
7231
7456
  };
7232
7457
  this.$bvModal.show(this.modalId);
7233
7458
  },
7459
+
7234
7460
  editRule(rule, event) {
7235
7461
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
7236
7462
  return;
7237
7463
  }
7464
+
7238
7465
  this.ruleModalCfg = {
7239
7466
  mode: 'upd',
7240
- rule: {
7241
- ...rule
7467
+ rule: { ...rule
7242
7468
  },
7243
7469
  onAfterOk: modalRule => {
7244
7470
  Object.assign(rule, modalRule);
@@ -7246,33 +7472,43 @@ var script$1 = {
7246
7472
  };
7247
7473
  this.$bvModal.show(this.modalId);
7248
7474
  },
7475
+
7249
7476
  removeRule(rule) {
7250
7477
  let index = this.field.rules.findIndex(r => r.id === rule.id);
7478
+
7251
7479
  if (index >= 0) {
7252
7480
  this.field.rules.splice(index, 1);
7253
7481
  }
7482
+
7254
7483
  this.rulesHash = UtRandom.getRandomString(10);
7255
7484
  }
7485
+
7256
7486
  },
7487
+
7257
7488
  created() {
7258
7489
  if (this.value) {
7259
7490
  this.innerVisible = this.visible;
7260
7491
  this.field = this.value;
7492
+
7261
7493
  if (this.field && this.field.input) {
7262
7494
  this.currentInputName = this.field.input.name;
7263
7495
  }
7264
7496
  }
7265
7497
  }
7498
+
7266
7499
  };
7267
7500
 
7268
7501
  /* script */
7269
7502
  const __vue_script__$1 = script$1;
7270
-
7271
7503
  /* template */
7504
+
7272
7505
  var __vue_render__$1 = function () {
7273
7506
  var _vm = this;
7507
+
7274
7508
  var _h = _vm.$createElement;
7509
+
7275
7510
  var _c = _vm._self._c || _h;
7511
+
7276
7512
  return _c('b-sidebar', {
7277
7513
  staticClass: "rb-doc-template-field-sidebar",
7278
7514
  attrs: {
@@ -7510,15 +7746,19 @@ var __vue_render__$1 = function () {
7510
7746
  }
7511
7747
  })], 1);
7512
7748
  };
7513
- var __vue_staticRenderFns__$1 = [];
7514
7749
 
7750
+ var __vue_staticRenderFns__$1 = [];
7515
7751
  /* style */
7752
+
7516
7753
  const __vue_inject_styles__$1 = undefined;
7517
7754
  /* scoped */
7755
+
7518
7756
  const __vue_scope_id__$1 = undefined;
7519
7757
  /* module identifier */
7758
+
7520
7759
  const __vue_module_identifier__$1 = undefined;
7521
7760
  /* functional template */
7761
+
7522
7762
  const __vue_is_functional_template__$1 = false;
7523
7763
  /* style inject */
7524
7764
 
@@ -7530,6 +7770,7 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
7530
7770
  render: __vue_render__$1,
7531
7771
  staticRenderFns: __vue_staticRenderFns__$1
7532
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
+
7533
7774
  var DocTemplateFieldSidebar = __vue_component__$2;
7534
7775
 
7535
7776
  //
@@ -7555,6 +7796,7 @@ var script = {
7555
7796
  default: () => []
7556
7797
  }
7557
7798
  },
7799
+
7558
7800
  data() {
7559
7801
  return {
7560
7802
  sidebarVisible: false,
@@ -7565,32 +7807,41 @@ var script = {
7565
7807
  id: 'rb-doc-template-section-modal',
7566
7808
  mode: 'ins',
7567
7809
  section: null,
7810
+
7568
7811
  onAfterOk() {}
7812
+
7569
7813
  }
7570
7814
  };
7571
7815
  },
7816
+
7572
7817
  computed: {
7573
7818
  iconAdd() {
7574
7819
  return UtFormConstructor.config.icons.iconAdd;
7575
7820
  },
7821
+
7576
7822
  iconEdit() {
7577
7823
  return UtFormConstructor.config.icons.iconEdit;
7578
7824
  },
7825
+
7579
7826
  iconDelete() {
7580
7827
  return UtFormConstructor.config.icons.iconDelete;
7581
7828
  },
7829
+
7582
7830
  iconDrag() {
7583
7831
  return UtFormConstructor.config.icons.iconDrag;
7584
7832
  }
7833
+
7585
7834
  },
7586
7835
  methods: {
7587
7836
  showProperties(field, event) {
7588
7837
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
7589
7838
  return;
7590
7839
  }
7840
+
7591
7841
  this.sidebarVisible = true;
7592
7842
  this.sidebarField = field;
7593
7843
  },
7844
+
7594
7845
  addSection(columnCount) {
7595
7846
  let section = {
7596
7847
  labelRu: null,
@@ -7598,31 +7849,39 @@ var script = {
7598
7849
  };
7599
7850
  this.sectionModalCfg.mode = 'ins';
7600
7851
  this.sectionModalCfg.section = section;
7852
+
7601
7853
  this.sectionModalCfg.onAfterOk = () => {
7602
7854
  section.columns = [];
7855
+
7603
7856
  for (let i = 0; i < columnCount; i++) {
7604
7857
  section.columns.push({
7605
7858
  index: i,
7606
7859
  fields: []
7607
7860
  });
7608
7861
  }
7862
+
7609
7863
  this.formConfig.sections.push(section);
7610
7864
  };
7865
+
7611
7866
  this.$bvModal.show(this.sectionModalCfg.id);
7612
7867
  },
7868
+
7613
7869
  editSection(section) {
7614
7870
  this.sectionModalCfg.mode = 'update';
7615
7871
  this.sectionModalCfg.section = section;
7872
+
7616
7873
  this.sectionModalCfg.onAfterOk = () => {};
7874
+
7617
7875
  this.$bvModal.show(this.sectionModalCfg.id);
7618
7876
  },
7877
+
7619
7878
  removeSection(section, index) {
7620
7879
  this.formConfig.sections.splice(index, 1);
7621
- /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7622
- onOk: (event, modal) => {
7623
- this.formConfig.sections.splice(index, 1);
7624
- UtModal.closeModal(modal);
7625
- }
7880
+ /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7881
+ onOk: (event, modal) => {
7882
+ this.formConfig.sections.splice(index, 1);
7883
+ UtModal.closeModal(modal);
7884
+ }
7626
7885
  });*/
7627
7886
  },
7628
7887
 
@@ -7639,31 +7898,40 @@ var script = {
7639
7898
  });
7640
7899
  return count > 1;
7641
7900
  },
7901
+
7642
7902
  removeFieldFromColumn(field, column, newIndex) {
7643
7903
  let index = newIndex != null ? newIndex : -1;
7904
+
7644
7905
  if (index < 0) {
7645
7906
  index = column.fields.findIndex(f => field.name === f.name);
7646
7907
  }
7908
+
7647
7909
  if (index >= 0) {
7648
7910
  column.fields.splice(index, 1);
7649
7911
  }
7650
7912
  },
7913
+
7651
7914
  onRemoveField(event, field, column) {
7652
7915
  event.preventDefault();
7653
7916
  this.removeFieldFromColumn(field, column);
7654
7917
  },
7918
+
7655
7919
  onFieldAddedToColumn(event, column, section) {
7656
7920
  this.columnTo = column;
7657
7921
  },
7922
+
7658
7923
  onFieldMoveEnd(event) {
7659
7924
  const {
7660
7925
  newIndex
7661
7926
  } = event;
7662
7927
  let field = event.item._underlying_vm_;
7928
+
7663
7929
  if (!field.hasOwnProperty('defaultValue')) {
7664
7930
  this.$set(field, 'defaultValue', undefined);
7665
7931
  }
7932
+
7666
7933
  let found = this.multipleFieldAreOnFormConfig(field);
7934
+
7667
7935
  if (found) {
7668
7936
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
7669
7937
  this.resetDragVariables();
@@ -7677,30 +7945,36 @@ var script = {
7677
7945
  noCloseOnEsc: true
7678
7946
  });
7679
7947
  }
7948
+
7680
7949
  this.resetDragVariables();
7681
7950
  this.hash = (Math.random() + 1).toString(36).substring(7);
7682
7951
  },
7952
+
7683
7953
  getFieldExtendedPropsData(field) {
7684
- return {
7685
- ...field.input.propsData,
7954
+ return { ...field.input.propsData,
7686
7955
  placeholder: field.tag,
7687
7956
  disabled: true
7688
7957
  };
7689
7958
  },
7959
+
7690
7960
  resetDragVariables() {
7691
7961
  this.columnTo = null;
7692
7962
  }
7963
+
7693
7964
  }
7694
7965
  };
7695
7966
 
7696
7967
  /* script */
7697
7968
  const __vue_script__ = script;
7698
-
7699
7969
  /* template */
7970
+
7700
7971
  var __vue_render__ = function () {
7701
7972
  var _vm = this;
7973
+
7702
7974
  var _h = _vm.$createElement;
7975
+
7703
7976
  var _c = _vm._self._c || _h;
7977
+
7704
7978
  return _c('div', {
7705
7979
  staticClass: "rb-doc-template-constructor d-flex"
7706
7980
  }, [_c('doc-template-facet-list', {
@@ -7940,15 +8214,19 @@ var __vue_render__ = function () {
7940
8214
  }
7941
8215
  })], 1)], 1);
7942
8216
  };
7943
- var __vue_staticRenderFns__ = [];
7944
8217
 
8218
+ var __vue_staticRenderFns__ = [];
7945
8219
  /* style */
8220
+
7946
8221
  const __vue_inject_styles__ = undefined;
7947
8222
  /* scoped */
8223
+
7948
8224
  const __vue_scope_id__ = undefined;
7949
8225
  /* module identifier */
8226
+
7950
8227
  const __vue_module_identifier__ = undefined;
7951
8228
  /* functional template */
8229
+
7952
8230
  const __vue_is_functional_template__ = false;
7953
8231
  /* style inject */
7954
8232
 
@@ -7960,6 +8238,7 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
7960
8238
  render: __vue_render__,
7961
8239
  staticRenderFns: __vue_staticRenderFns__
7962
8240
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
8241
+
7963
8242
  var __vue_component__$1 = __vue_component__;
7964
8243
 
7965
8244
  /* eslint-disable import/prefer-default-export */
@@ -7978,11 +8257,11 @@ var components = /*#__PURE__*/Object.freeze({
7978
8257
 
7979
8258
  // Import vue components
7980
8259
 
7981
- // install function executed by Vue.use()
7982
8260
  const install = function installRbDocumentFormConstructor(Vue) {
7983
- Object.entries(components).forEach(([componentName, component]) => {
8261
+ Object.entries(components).forEach(_ref => {
8262
+ let [componentName, component] = _ref;
7984
8263
  Vue.component(componentName, component);
7985
8264
  });
7986
- };
8265
+ }; // Create module definition for Vue.use()
7987
8266
 
7988
8267
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default };