rb-document-form-constructor 0.8.65 → 0.8.67

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.
@@ -1,12 +1,10 @@
1
1
  import Vue$1 from 'vue';
2
- import { randomFillSync } from 'crypto';
3
2
 
4
3
  const UtFormConfig = {
5
4
  findField(fieldName, formConfig) {
6
5
  if (!formConfig || !formConfig.sections) {
7
6
  return null;
8
7
  }
9
-
10
8
  let found = null;
11
9
  formConfig.sections.every(r => {
12
10
  if (r.columns) {
@@ -16,25 +14,21 @@ const UtFormConfig = {
16
14
  found = f;
17
15
  }
18
16
  });
19
-
20
17
  if (found) {
21
18
  return false;
22
19
  }
23
20
  });
24
21
  }
25
-
26
22
  if (found) {
27
23
  return false;
28
24
  }
29
25
  });
30
26
  return found;
31
27
  },
32
-
33
28
  findRule(ruleId, formConfig) {
34
29
  if (!formConfig || !formConfig.sections) {
35
30
  return null;
36
31
  }
37
-
38
32
  let found = null;
39
33
  formConfig.sections.every(s => {
40
34
  if (s.columns) {
@@ -47,25 +41,21 @@ const UtFormConfig = {
47
41
  }
48
42
  });
49
43
  }
50
-
51
44
  if (found) {
52
45
  return false;
53
46
  }
54
47
  });
55
-
56
48
  if (found) {
57
49
  return false;
58
50
  }
59
51
  });
60
52
  }
61
-
62
53
  if (found) {
63
54
  return false;
64
55
  }
65
56
  });
66
57
  return found;
67
58
  },
68
-
69
59
  getFields(formConfig) {
70
60
  let fields = [];
71
61
  formConfig.sections.forEach(s => {
@@ -81,7 +71,6 @@ const UtFormConfig = {
81
71
  });
82
72
  return fields;
83
73
  },
84
-
85
74
  parseFacets(formConfig) {
86
75
  let facets = [];
87
76
  formConfig.sections.forEach(section => {
@@ -95,7 +84,6 @@ const UtFormConfig = {
95
84
  });
96
85
  return facets;
97
86
  }
98
-
99
87
  };
100
88
 
101
89
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -4797,25 +4785,19 @@ notevil.Function = _Function;
4797
4785
  let __clone = function (data) {
4798
4786
  return JSON.parse(JSON.stringify(data));
4799
4787
  };
4800
-
4801
4788
  let __assign = function () {
4802
4789
  __assign = Object.assign || function __assign(t) {
4803
4790
  for (let s, i = 1, n = arguments.length; i < n; i++) {
4804
4791
  s = arguments[i];
4805
-
4806
4792
  for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4807
4793
  }
4808
-
4809
4794
  return t;
4810
4795
  };
4811
-
4812
4796
  return __assign.apply(this, arguments);
4813
4797
  };
4814
-
4815
4798
  let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
4816
4799
  for (let dataType in formConfigInputs) {
4817
4800
  let foundInputs = inputs[dataType];
4818
-
4819
4801
  if (foundInputs) {
4820
4802
  __mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
4821
4803
  } else {
@@ -4823,17 +4805,14 @@ let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
4823
4805
  }
4824
4806
  }
4825
4807
  };
4826
-
4827
4808
  let __mergeInputsInMap = function (inputs, formConfigInputs) {
4828
4809
  for (let name in formConfigInputs) {
4829
4810
  inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
4830
4811
  }
4831
4812
  };
4832
-
4833
4813
  let __mergeInputsInArray = function (inputs, formConfigInputs) {
4834
4814
  formConfigInputs.forEach(input => {
4835
4815
  let index = inputs.findIndex(item => item.name === input.name);
4836
-
4837
4816
  if (index >= 0) {
4838
4817
  inputs[index] = input;
4839
4818
  } else {
@@ -4841,16 +4820,12 @@ let __mergeInputsInArray = function (inputs, formConfigInputs) {
4841
4820
  }
4842
4821
  });
4843
4822
  };
4844
-
4845
4823
  let __applyDefaultProps = function (input, field) {
4846
4824
  for (let propName in input.props) {
4847
4825
  if (field) {
4848
4826
  if (field.input.propsData[propName]) {
4849
- var _input$propsData, _input$props, _input$props$type;
4850
-
4851
4827
  input.propsData[propName] = field.input.propsData[propName];
4852
-
4853
- 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) {
4828
+ if (input.propsData?.type && input.props?.type?.default) {
4854
4829
  input.propsData.type = input.props.type.default;
4855
4830
  }
4856
4831
  }
@@ -4859,21 +4834,18 @@ let __applyDefaultProps = function (input, field) {
4859
4834
  }
4860
4835
  }
4861
4836
  };
4862
-
4863
4837
  let __applyRefProps = function (input, refConfig) {
4864
- if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
4838
+ if (refConfig?.propsData) {
4865
4839
  for (let propName in refConfig.propsData) {
4866
4840
  input.propsData[propName] = refConfig.propsData[propName];
4867
4841
  }
4868
4842
  }
4869
4843
  };
4870
-
4871
4844
  let __filterInputsByMultiple = function (inputs, multiple) {
4872
4845
  return inputs.filter(i => {
4873
4846
  return i.multiple && multiple || !i.multiple && !multiple;
4874
4847
  });
4875
4848
  };
4876
-
4877
4849
  let fcInputs = {
4878
4850
  string: {
4879
4851
  text: 'Текст',
@@ -5075,52 +5047,40 @@ let baseConfig = {
5075
5047
  };
5076
5048
  const UtFormConstructor = {
5077
5049
  config: {},
5078
-
5079
5050
  init(formConfig) {
5080
5051
  this.config = __clone(baseConfig);
5081
-
5082
5052
  if (formConfig) {
5083
5053
  if (formConfig.inputs) {
5084
5054
  __mergeInputsInMap(this.config.inputs, formConfig.inputs);
5085
5055
  }
5086
-
5087
5056
  if (formConfig.primitiveInputs) {
5088
5057
  __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
5089
5058
  }
5090
-
5091
5059
  if (formConfig.dictInputs) {
5092
5060
  __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
5093
5061
  }
5094
-
5095
5062
  if (formConfig.refInputs) {
5096
5063
  __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
5097
5064
  }
5098
-
5099
5065
  if (formConfig.refInputConfigs) {
5100
5066
  this.config.refInputConfigs = formConfig.refInputConfigs;
5101
5067
  }
5102
-
5103
5068
  if (formConfig.icons) {
5104
5069
  this.config.icons = __assign(this.config.icons, formConfig.icons);
5105
5070
  }
5106
-
5107
5071
  if (formConfig.rules) {
5108
5072
  this.config.rules = formConfig.rules;
5109
5073
  }
5110
-
5111
5074
  if (formConfig.ruleContext) {
5112
5075
  this.config.ruleContext = formConfig.ruleContext;
5113
5076
  }
5114
5077
  }
5115
5078
  },
5116
-
5117
5079
  getInputTypes(field) {
5118
5080
  let inputs = [];
5119
-
5120
5081
  if (!field) {
5121
5082
  return inputs;
5122
5083
  }
5123
-
5124
5084
  if (field.dict && !this.config.refInputs[field.ref]) {
5125
5085
  inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
5126
5086
  } else if (field.ref) {
@@ -5128,91 +5088,71 @@ const UtFormConstructor = {
5128
5088
  } else {
5129
5089
  inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
5130
5090
  }
5131
-
5132
5091
  return inputs;
5133
5092
  },
5134
-
5135
5093
  hasMultipleInputTypes(field) {
5136
- let inputs = this.getInputTypes({ ...field,
5094
+ let inputs = this.getInputTypes({
5095
+ ...field,
5137
5096
  multiple: true
5138
5097
  });
5139
5098
  return inputs && inputs.length > 0;
5140
5099
  },
5141
-
5142
5100
  getDefaultInput(field) {
5143
5101
  let input = null;
5144
5102
  let inputs = this.getInputTypes(field);
5145
-
5146
5103
  if (!inputs) {
5147
5104
  input = this.primitiveInputs[0];
5148
5105
  }
5149
-
5150
5106
  if (field.ref && this.config.refInputs[field.ref]) {
5151
5107
  input = __clone(inputs[0]);
5152
-
5153
5108
  __applyDefaultProps(input);
5154
-
5155
5109
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5156
5110
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5157
5111
  }
5158
5112
  } else if (field.dict) {
5159
5113
  input = __clone(inputs[0]);
5160
5114
  input.props.dict.default = field.ref;
5161
-
5162
5115
  __applyDefaultProps(input);
5163
5116
  } else {
5164
5117
  input = __clone(inputs[0]);
5165
-
5166
5118
  __applyDefaultProps(input);
5167
5119
  }
5168
-
5169
5120
  return input;
5170
5121
  },
5171
-
5172
5122
  getInputTypeByName(name, field) {
5173
5123
  let input = __clone(this.config.inputs[name]);
5174
-
5175
5124
  if (field.ref && this.config.refInputs[field.ref]) {
5176
5125
  __applyDefaultProps(input);
5177
-
5178
5126
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5179
5127
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5180
5128
  }
5181
5129
  } else if (field.dict) {
5182
5130
  input.props.dict.default = field.ref;
5183
-
5184
5131
  __applyDefaultProps(input);
5185
5132
  } else {
5186
5133
  __applyDefaultProps(input, field);
5187
5134
  }
5188
-
5189
5135
  input.propsData['ref'] = field.name;
5190
5136
  return input;
5191
5137
  },
5192
-
5193
5138
  getAvailableFieldRules(field) {
5194
5139
  return this.config.rules.filter(rule => {
5195
5140
  return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
5196
5141
  });
5197
5142
  },
5198
-
5199
5143
  getRuleContext() {
5200
5144
  return this.config.ruleContext;
5201
5145
  },
5202
-
5203
5146
  runRule(context, script) {
5204
5147
  context = context ? context : {};
5205
5148
  context['console'] = console;
5206
5149
  context['Date'] = Date;
5207
5150
  context['Math'] = Math;
5208
-
5209
5151
  let func = function (script) {
5210
5152
  return notevil(script, context);
5211
5153
  };
5212
-
5213
5154
  func.call(context, script);
5214
5155
  }
5215
-
5216
5156
  };
5217
5157
 
5218
5158
  /*!
@@ -7475,6 +7415,7 @@ const i18n = new VueI18n$1({
7475
7415
  //
7476
7416
  //
7477
7417
  //
7418
+
7478
7419
  var script$5 = {
7479
7420
  name: 'DocTemplateSectionModal',
7480
7421
  props: {
@@ -7488,19 +7429,16 @@ var script$5 = {
7488
7429
  default: () => {}
7489
7430
  }
7490
7431
  },
7491
-
7492
7432
  data() {
7493
7433
  return {
7494
7434
  id: 'rb-doc-template-section-modal',
7495
7435
  label: {}
7496
7436
  };
7497
7437
  },
7498
-
7499
7438
  computed: {
7500
7439
  title() {
7501
7440
  return this.mode === 'ins' ? 'Добавление секции' : 'Редактирование секции';
7502
7441
  }
7503
-
7504
7442
  },
7505
7443
  watch: {
7506
7444
  section() {
@@ -7508,29 +7446,23 @@ var script$5 = {
7508
7446
  this.label = this.section;
7509
7447
  }
7510
7448
  }
7511
-
7512
7449
  },
7513
7450
  methods: {
7514
7451
  onOk() {
7515
7452
  this.section = this.label;
7516
-
7517
7453
  if (this.onAfterOk) {
7518
7454
  this.onAfterOk();
7519
7455
  }
7520
-
7521
7456
  this.$nextTick(() => {
7522
7457
  this.$bvModal.hide(this.id);
7523
7458
  });
7524
7459
  }
7525
-
7526
7460
  },
7527
-
7528
7461
  created() {
7529
7462
  if (this.section) {
7530
7463
  this.label = this.section;
7531
7464
  }
7532
7465
  }
7533
-
7534
7466
  };
7535
7467
 
7536
7468
  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
@@ -7610,15 +7542,12 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
7610
7542
 
7611
7543
  /* script */
7612
7544
  const __vue_script__$5 = script$5;
7613
- /* template */
7614
7545
 
7546
+ /* template */
7615
7547
  var __vue_render__$5 = function () {
7616
7548
  var _vm = this;
7617
-
7618
7549
  var _h = _vm.$createElement;
7619
-
7620
7550
  var _c = _vm._self._c || _h;
7621
-
7622
7551
  return _c('b-modal', {
7623
7552
  attrs: {
7624
7553
  "id": "rb-doc-template-section-modal",
@@ -7659,19 +7588,15 @@ var __vue_render__$5 = function () {
7659
7588
  }
7660
7589
  })], 1)], 1)], 1)], 1)], 1);
7661
7590
  };
7662
-
7663
7591
  var __vue_staticRenderFns__$5 = [];
7664
- /* style */
7665
7592
 
7593
+ /* style */
7666
7594
  const __vue_inject_styles__$5 = undefined;
7667
7595
  /* scoped */
7668
-
7669
7596
  const __vue_scope_id__$5 = undefined;
7670
7597
  /* module identifier */
7671
-
7672
7598
  const __vue_module_identifier__$5 = undefined;
7673
7599
  /* functional template */
7674
-
7675
7600
  const __vue_is_functional_template__$5 = false;
7676
7601
  /* style inject */
7677
7602
 
@@ -7683,7 +7608,6 @@ const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
7683
7608
  render: __vue_render__$5,
7684
7609
  staticRenderFns: __vue_staticRenderFns__$5
7685
7610
  }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
7686
-
7687
7611
  var DocTemplateSectionModal = __vue_component__$6;
7688
7612
 
7689
7613
  /**!
@@ -13070,7 +12994,6 @@ var script$4 = {
13070
12994
  default: () => []
13071
12995
  }
13072
12996
  },
13073
-
13074
12997
  data() {
13075
12998
  return {
13076
12999
  allFacets: [],
@@ -13078,26 +13001,21 @@ var script$4 = {
13078
13001
  facetSearchStr: null
13079
13002
  };
13080
13003
  },
13081
-
13082
13004
  computed: {
13083
13005
  iconExpandFacet() {
13084
13006
  return UtFormConstructor.config.icons.iconExpandFacet;
13085
13007
  },
13086
-
13087
13008
  iconCollapseFacet() {
13088
13009
  return UtFormConstructor.config.icons.iconCollapseFacet;
13089
13010
  }
13090
-
13091
13011
  },
13092
13012
  watch: {
13093
13013
  facetSearchStr() {
13094
13014
  this.findInFacets(this.facetSearchStr);
13095
13015
  },
13096
-
13097
13016
  facets() {
13098
13017
  this.handleFacetsProp();
13099
13018
  }
13100
-
13101
13019
  },
13102
13020
  methods: {
13103
13021
  onFieldCloned(cloneField) {
@@ -13105,69 +13023,55 @@ var script$4 = {
13105
13023
  field.input = UtFormConstructor.getDefaultInput(field);
13106
13024
  return field;
13107
13025
  },
13108
-
13109
13026
  onFieldMoveEnd(event) {
13110
13027
  this.$emit('fieldMoveEnd', event);
13111
13028
  },
13112
-
13113
13029
  findInFacets(str) {
13114
13030
  str = str.toLowerCase();
13115
-
13116
13031
  if (!str || str.length === 0) {
13117
13032
  this.innerFacets = this.allFacets;
13118
13033
  }
13119
-
13120
13034
  let facets = JSON.parse(JSON.stringify(this.allFacets));
13121
13035
  facets = facets.filter(facet => {
13122
13036
  let facetFound = false;
13123
13037
  facet.fields = facet.fields.filter(field => {
13124
13038
  let fieldFound = field.labelRu.toLowerCase().indexOf(str) >= 0;
13125
-
13126
13039
  if (fieldFound) {
13127
13040
  facetFound = true;
13128
13041
  }
13129
-
13130
13042
  return fieldFound;
13131
13043
  });
13132
13044
  return facetFound;
13133
13045
  });
13134
13046
  this.innerFacets = facets;
13135
13047
  },
13136
-
13137
13048
  handleFacetsProp() {
13138
- let innerFacets = this.facets.map(f => ({ ...f,
13049
+ let innerFacets = this.facets.map(f => ({
13050
+ ...f,
13139
13051
  expanded: false
13140
13052
  }));
13141
-
13142
13053
  if (innerFacets) {
13143
13054
  innerFacets.forEach(facet => {
13144
13055
  facet.fields = facet.fields.filter(field => !field.hiddenOnFormConfig);
13145
13056
  });
13146
13057
  }
13147
-
13148
13058
  this.innerFacets = JSON.parse(JSON.stringify(innerFacets));
13149
13059
  this.allFacets = JSON.parse(JSON.stringify(innerFacets));
13150
13060
  }
13151
-
13152
13061
  },
13153
-
13154
13062
  created() {
13155
13063
  this.handleFacetsProp();
13156
13064
  }
13157
-
13158
13065
  };
13159
13066
 
13160
13067
  /* script */
13161
13068
  const __vue_script__$4 = script$4;
13162
- /* template */
13163
13069
 
13070
+ /* template */
13164
13071
  var __vue_render__$4 = function () {
13165
13072
  var _vm = this;
13166
-
13167
13073
  var _h = _vm.$createElement;
13168
-
13169
13074
  var _c = _vm._self._c || _h;
13170
-
13171
13075
  return _c('div', {
13172
13076
  staticClass: "rb-facets-sidebar"
13173
13077
  }, [_c('h4', [_vm._v("Компоненты")]), _vm._v(" "), _c('b-form', [_c('b-form-row', [_c('b-col', {
@@ -13238,19 +13142,15 @@ var __vue_render__$4 = function () {
13238
13142
  }), 1)], 1) : _vm._e()], 1) : _vm._e();
13239
13143
  }), 0)], 1);
13240
13144
  };
13241
-
13242
13145
  var __vue_staticRenderFns__$4 = [];
13243
- /* style */
13244
13146
 
13147
+ /* style */
13245
13148
  const __vue_inject_styles__$4 = undefined;
13246
13149
  /* scoped */
13247
-
13248
13150
  const __vue_scope_id__$4 = undefined;
13249
13151
  /* module identifier */
13250
-
13251
13152
  const __vue_module_identifier__$4 = undefined;
13252
13153
  /* functional template */
13253
-
13254
13154
  const __vue_is_functional_template__$4 = false;
13255
13155
  /* style inject */
13256
13156
 
@@ -13262,34 +13162,8 @@ const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
13262
13162
  render: __vue_render__$4,
13263
13163
  staticRenderFns: __vue_staticRenderFns__$4
13264
13164
  }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
13265
-
13266
13165
  var DocTemplateFacetList = __vue_component__$5;
13267
13166
 
13268
- const urlAlphabet =
13269
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
13270
-
13271
- const POOL_SIZE_MULTIPLIER = 128;
13272
- let pool, poolOffset;
13273
- let fillPool = bytes => {
13274
- if (!pool || pool.length < bytes) {
13275
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
13276
- randomFillSync(pool);
13277
- poolOffset = 0;
13278
- } else if (poolOffset + bytes > pool.length) {
13279
- randomFillSync(pool);
13280
- poolOffset = 0;
13281
- }
13282
- poolOffset += bytes;
13283
- };
13284
- let nanoid = (size = 21) => {
13285
- fillPool((size -= 0));
13286
- let id = '';
13287
- for (let i = poolOffset - size; i < poolOffset; i++) {
13288
- id += urlAlphabet[pool[i] & 63];
13289
- }
13290
- return id
13291
- };
13292
-
13293
13167
  var toString = Object.prototype.toString;
13294
13168
 
13295
13169
  var _typeof = function(object) {
@@ -13309,6 +13183,7 @@ var _typeof = function(object) {
13309
13183
  };
13310
13184
 
13311
13185
  //
13186
+ // import safeEval from "notevil";
13312
13187
 
13313
13188
  var script$3 = {
13314
13189
  name: 'DocForm',
@@ -13339,42 +13214,34 @@ var script$3 = {
13339
13214
  default: true
13340
13215
  }
13341
13216
  },
13342
-
13343
13217
  data() {
13344
13218
  return {
13345
13219
  validationState: {}
13346
13220
  };
13347
13221
  },
13348
-
13349
13222
  watch: {
13350
13223
  formConfig() {
13351
13224
  this.validationState = {};
13352
13225
  this.execApplyDefaultValues();
13353
13226
  this.execApplyDefaultValRule();
13354
13227
  }
13355
-
13356
13228
  },
13357
13229
  methods: {
13358
13230
  getResolveValueName(field) {
13359
13231
  if ((field.dict || field.ref) && !field.multiple) {
13360
13232
  return field.name.substring(0, field.name.length - 2);
13361
13233
  }
13362
-
13363
13234
  return field.name;
13364
13235
  },
13365
-
13366
13236
  getResolveValue(field) {
13367
13237
  return this.doc[this.getResolveValueName(field)] ? this.doc[this.getResolveValueName(field)] : null;
13368
13238
  },
13369
-
13370
- setResolveValue(_ref) {
13371
- let {
13372
- field,
13373
- multiple = false
13374
- } = _ref;
13239
+ setResolveValue({
13240
+ field,
13241
+ multiple = false
13242
+ }) {
13375
13243
  this.getResolveValue(field);
13376
13244
  },
13377
-
13378
13245
  getDisplayField(value) {
13379
13246
  if (!value[this.displayField]) {
13380
13247
  return value.labelRu;
@@ -13382,20 +13249,16 @@ var script$3 = {
13382
13249
  return value[this.displayField];
13383
13250
  }
13384
13251
  },
13385
-
13386
13252
  onEventFired(eventName, event, field) {
13387
13253
  if (eventName === 'input' && field.ref && !field.multiple) {
13388
13254
  let dataField = null;
13389
-
13390
13255
  if (field.name.lastIndexOf(this.refSuffix) >= 0) {
13391
13256
  dataField = field.name.substring(0, field.name.lastIndexOf(this.refSuffix));
13392
13257
  }
13393
-
13394
13258
  if (dataField && dataField.length > 0) {
13395
13259
  this.doc[dataField] = null;
13396
13260
  }
13397
13261
  }
13398
-
13399
13262
  if (field.rules) {
13400
13263
  field.rules.forEach(rule => {
13401
13264
  if (rule.event === eventName && rule.script) {
@@ -13407,7 +13270,6 @@ var script$3 = {
13407
13270
  });
13408
13271
  }
13409
13272
  },
13410
-
13411
13273
  onGlobalEventFired(eventName, event) {
13412
13274
  let fields = UtFormConfig.getFields(this.formConfig);
13413
13275
  fields.forEach(f => {
@@ -13423,7 +13285,6 @@ var script$3 = {
13423
13285
  }
13424
13286
  });
13425
13287
  },
13426
-
13427
13288
  createRuleContext(additionalContext) {
13428
13289
  return Object.assign({
13429
13290
  form: this,
@@ -13431,81 +13292,58 @@ var script$3 = {
13431
13292
  ...additionalContext
13432
13293
  }, UtFormConstructor.getRuleContext());
13433
13294
  },
13434
-
13435
13295
  runRule(rule, context) {
13436
13296
  UtFormConstructor.runRule(this.createRuleContext(context), rule.script);
13437
13297
  },
13438
-
13439
13298
  isValueEmpty(fieldName) {
13440
- var _this$doc$fieldName;
13441
-
13442
13299
  if (this.doc[fieldName] == null) {
13443
13300
  return true;
13444
13301
  }
13445
-
13446
- if (Array.isArray(this.doc[fieldName]) && !((_this$doc$fieldName = this.doc[fieldName]) !== null && _this$doc$fieldName !== void 0 && _this$doc$fieldName.length)) {
13302
+ if (Array.isArray(this.doc[fieldName]) && !this.doc[fieldName]?.length) {
13447
13303
  return true;
13448
13304
  }
13449
-
13450
13305
  if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
13451
13306
  return true;
13452
13307
  }
13453
-
13454
13308
  return false;
13455
13309
  },
13456
-
13457
13310
  isValueLessThanMax(fieldname, max) {
13458
13311
  if (this.doc[fieldname] && max) {
13459
- var _this$doc$fieldname;
13460
-
13461
- return ((_this$doc$fieldname = this.doc[fieldname]) === null || _this$doc$fieldname === void 0 ? void 0 : _this$doc$fieldname.length) > parseInt(max);
13312
+ return this.doc[fieldname]?.length > parseInt(max);
13462
13313
  }
13463
-
13464
13314
  return false;
13465
13315
  },
13466
-
13467
13316
  isValueLessThanMin(fieldname, min) {
13468
13317
  if (this.doc[fieldname] && min) {
13469
13318
  return parseInt(this.doc[fieldname]) < parseInt(min);
13470
13319
  }
13471
-
13472
13320
  return false;
13473
13321
  },
13474
-
13475
13322
  validate() {
13476
13323
  this.formConfig.sections.forEach(s => {
13477
13324
  s.columns.forEach(c => {
13478
13325
  c.fields.forEach(f => {
13479
- var _f$input$propsData;
13480
-
13481
13326
  let feedback = '';
13482
-
13483
13327
  if (f.required && this.isValueEmpty(f.name)) {
13484
13328
  feedback += i18n.t('validate.required', {
13485
13329
  field: this.getDisplayField(f)
13486
13330
  });
13487
13331
  }
13488
-
13489
13332
  if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
13490
13333
  feedback += `\n${i18n.t('validate.min', {
13491
13334
  min: f.input.propsData.min
13492
13335
  })}`;
13493
- } // TODO: Костыль так как на бэке нету типа memo
13494
-
13495
-
13496
- 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)) {
13497
- var _f$input$propsData2;
13498
-
13499
- feedback += `\nМаксимальное значение для этого поля ${(_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max}`;
13500
13336
  }
13501
-
13337
+ // TODO: Костыль так как на бэке нету типа memo
13338
+ if (f.input.type === 'b-form-textarea' && this.isValueLessThanMax(f.name, f.input.propsData?.max)) {
13339
+ feedback += `\nМаксимальное значение для этого поля ${f.input.propsData?.max}`;
13340
+ }
13502
13341
  if (feedback) {
13503
13342
  Vue$1.set(this.validationState, f.name, false);
13504
13343
  Vue$1.set(this.validationState, `${f.name}__feedback`, feedback);
13505
13344
  } else {
13506
13345
  Vue$1.set(this.validationState, f.name, null);
13507
13346
  }
13508
-
13509
13347
  this.onEventFired('validate', {
13510
13348
  validationState: this.validationState,
13511
13349
  doc: this.doc
@@ -13513,27 +13351,21 @@ var script$3 = {
13513
13351
  });
13514
13352
  });
13515
13353
  });
13516
-
13517
13354
  for (let fieldName in this.validationState) {
13518
13355
  if (this.validationState[fieldName] === false) {
13519
13356
  return false;
13520
13357
  }
13521
13358
  }
13522
-
13523
13359
  return true;
13524
13360
  },
13525
-
13526
13361
  getColumnSize(section) {
13527
13362
  const MAX_COLUMN_SIZE = 12;
13528
-
13529
13363
  if (!section || !section.columnCount) {
13530
13364
  return MAX_COLUMN_SIZE;
13531
13365
  }
13532
-
13533
13366
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
13534
13367
  return colSize;
13535
13368
  },
13536
-
13537
13369
  execApplyDefaultValues() {
13538
13370
  if (this.applyDefaultValues) {
13539
13371
  this.formConfig.sections.forEach(r => {
@@ -13541,13 +13373,11 @@ var script$3 = {
13541
13373
  c.fields.forEach(f => {
13542
13374
  if (f.defaultValue) {
13543
13375
  let defValue;
13544
-
13545
13376
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
13546
13377
  defValue = f.defaultValue();
13547
13378
  } else {
13548
13379
  defValue = f.defaultValue == null ? null : f.defaultValue;
13549
13380
  }
13550
-
13551
13381
  this.$set(this.doc, f.name, f.defaultValue = defValue);
13552
13382
  }
13553
13383
  });
@@ -13555,7 +13385,6 @@ var script$3 = {
13555
13385
  });
13556
13386
  }
13557
13387
  },
13558
-
13559
13388
  execApplyDefaultValRule() {
13560
13389
  this.formConfig.sections.forEach(el => {
13561
13390
  el.columns.forEach(c => {
@@ -13563,7 +13392,6 @@ var script$3 = {
13563
13392
  if (f.rules) {
13564
13393
  if (!f.defaultValue) {
13565
13394
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
13566
-
13567
13395
  if (rule && !this.doc[f.name]) {
13568
13396
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
13569
13397
  }
@@ -13573,34 +13401,27 @@ var script$3 = {
13573
13401
  });
13574
13402
  });
13575
13403
  }
13576
-
13577
13404
  },
13578
-
13579
13405
  mounted() {
13580
13406
  this.execApplyDefaultValues();
13581
13407
  this.execApplyDefaultValRule();
13582
13408
  this.onGlobalEventFired('form-mounted', this);
13583
13409
  },
13584
-
13585
13410
  activated() {
13586
13411
  this.execApplyDefaultValues();
13587
13412
  this.execApplyDefaultValRule();
13588
13413
  this.onGlobalEventFired('form-activated', this);
13589
13414
  }
13590
-
13591
13415
  };
13592
13416
 
13593
13417
  /* script */
13594
13418
  const __vue_script__$3 = script$3;
13595
- /* template */
13596
13419
 
13420
+ /* template */
13597
13421
  var __vue_render__$3 = function () {
13598
13422
  var _vm = this;
13599
-
13600
13423
  var _h = _vm.$createElement;
13601
-
13602
13424
  var _c = _vm._self._c || _h;
13603
-
13604
13425
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
13605
13426
  staticClass: "rb-doc-form",
13606
13427
  on: {
@@ -13698,19 +13519,15 @@ var __vue_render__$3 = function () {
13698
13519
  })], 2)], 1);
13699
13520
  }), 1) : _vm._e();
13700
13521
  };
13701
-
13702
13522
  var __vue_staticRenderFns__$3 = [];
13703
- /* style */
13704
13523
 
13524
+ /* style */
13705
13525
  const __vue_inject_styles__$3 = undefined;
13706
13526
  /* scoped */
13707
-
13708
13527
  const __vue_scope_id__$3 = undefined;
13709
13528
  /* module identifier */
13710
-
13711
13529
  const __vue_module_identifier__$3 = undefined;
13712
13530
  /* functional template */
13713
-
13714
13531
  const __vue_is_functional_template__$3 = false;
13715
13532
  /* style inject */
13716
13533
 
@@ -13722,9 +13539,23 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
13722
13539
  render: __vue_render__$3,
13723
13540
  staticRenderFns: __vue_staticRenderFns__$3
13724
13541
  }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
13725
-
13726
13542
  var DocForm = __vue_component__$4;
13727
13543
 
13544
+ const generateRandomString = length => {
13545
+ let result = '';
13546
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
13547
+ const charactersLength = characters.length;
13548
+ for (let i = 0; i < length; i++) {
13549
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
13550
+ }
13551
+ return result;
13552
+ };
13553
+ const UtRandom = {
13554
+ getRandomString(length) {
13555
+ return generateRandomString(length);
13556
+ }
13557
+ };
13558
+
13728
13559
  //
13729
13560
  var script$2 = {
13730
13561
  name: 'FieldRuleFormModal',
@@ -13741,7 +13572,6 @@ var script$2 = {
13741
13572
  },
13742
13573
  onAfterOk: Function
13743
13574
  },
13744
-
13745
13575
  data() {
13746
13576
  return {
13747
13577
  id: 'rb-field-rule-form-modal',
@@ -13750,26 +13580,21 @@ var script$2 = {
13750
13580
  innerRule: null
13751
13581
  };
13752
13582
  },
13753
-
13754
13583
  computed: {
13755
13584
  title() {
13756
13585
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
13757
13586
  },
13758
-
13759
13587
  fields() {
13760
13588
  return UtFormConfig.getFields(this.formConfig);
13761
13589
  },
13762
-
13763
13590
  rulePresets() {
13764
13591
  return UtFormConstructor.getAvailableFieldRules(this.field);
13765
13592
  }
13766
-
13767
13593
  },
13768
13594
  watch: {
13769
13595
  formConfig() {
13770
13596
  this.copyToInnerFormConfig();
13771
13597
  },
13772
-
13773
13598
  rule() {
13774
13599
  if (this.rule) {
13775
13600
  this.innerRule = this.rule;
@@ -13777,7 +13602,6 @@ var script$2 = {
13777
13602
  this.innerRule = this.getDefaultRule();
13778
13603
  }
13779
13604
  }
13780
-
13781
13605
  },
13782
13606
  methods: {
13783
13607
  validateFields(fieldName) {
@@ -13792,18 +13616,14 @@ var script$2 = {
13792
13616
  }
13793
13617
  });
13794
13618
  },
13795
-
13796
13619
  copyToInnerFormConfig() {
13797
13620
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
13798
13621
  },
13799
-
13800
13622
  applyRuleToInnerFormConfig() {
13801
13623
  if (this.innerFormConfig) {
13802
13624
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
13803
-
13804
13625
  if (!foundRule) {
13805
13626
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
13806
-
13807
13627
  if (foundField) {
13808
13628
  foundField.rules = foundField.rules ? foundField.rules : [];
13809
13629
  foundField.rules.push(this.rule);
@@ -13813,14 +13633,12 @@ var script$2 = {
13813
13633
  }
13814
13634
  }
13815
13635
  },
13816
-
13817
13636
  onActivateTab(index) {
13818
13637
  if (index > 0) {
13819
13638
  this.copyToInnerFormConfig();
13820
13639
  this.applyRuleToInnerFormConfig();
13821
13640
  }
13822
13641
  },
13823
-
13824
13642
  getDefaultState() {
13825
13643
  return {
13826
13644
  name: null,
@@ -13828,36 +13646,30 @@ var script$2 = {
13828
13646
  script: null
13829
13647
  };
13830
13648
  },
13831
-
13832
13649
  getDefaultRule() {
13833
13650
  return {
13834
- id: nanoid(),
13651
+ id: UtRandom.getRandomString(10),
13835
13652
  name: null,
13836
13653
  event: null,
13837
13654
  script: null
13838
13655
  };
13839
13656
  },
13840
-
13841
13657
  resetModal() {
13842
13658
  this.state = this.getDefaultState();
13843
13659
  this.innerRule = null;
13844
13660
  },
13845
-
13846
13661
  addVariableToScript(varName) {
13847
13662
  let caretPosition = this.$refs.scriptInput.selectionStart;
13848
13663
  this.insertTextToScript(varName, caretPosition);
13849
13664
  },
13850
-
13851
13665
  addSetVariableToScript(field) {
13852
13666
  let caretPosition = this.$refs.scriptInput.selectionStart;
13853
13667
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
13854
13668
  },
13855
-
13856
13669
  addCallInputFunction(field) {
13857
13670
  let caretPosition = this.$refs.scriptInput.selectionStart;
13858
13671
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
13859
13672
  },
13860
-
13861
13673
  insertTextToScript(text, position) {
13862
13674
  position = position != null ? position : this.script.length;
13863
13675
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -13865,50 +13677,39 @@ var script$2 = {
13865
13677
  scriptSplit.splice(position, 0, text);
13866
13678
  this.innerRule.script = scriptSplit.join('');
13867
13679
  },
13868
-
13869
13680
  onRuleSelected(ruleName) {
13870
13681
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
13871
-
13872
13682
  if (rule) {
13873
13683
  Object.assign(this.innerRule, rule);
13874
13684
  this.innerRule.script = this.innerRule.script.trim();
13875
13685
  }
13876
13686
  },
13877
-
13878
13687
  onOk() {
13879
13688
  this.validateFields();
13880
-
13881
13689
  if (this.state.name && this.state.script) {
13882
13690
  if (this.onAfterOk) {
13883
13691
  this.onAfterOk(this.innerRule);
13884
13692
  }
13885
-
13886
13693
  this.$nextTick(() => {
13887
13694
  this.resetModal();
13888
13695
  this.$bvModal.hide(this.id);
13889
13696
  });
13890
13697
  }
13891
13698
  }
13892
-
13893
13699
  },
13894
-
13895
13700
  created() {
13896
13701
  this.copyToInnerFormConfig();
13897
13702
  }
13898
-
13899
13703
  };
13900
13704
 
13901
13705
  /* script */
13902
13706
  const __vue_script__$2 = script$2;
13903
- /* template */
13904
13707
 
13708
+ /* template */
13905
13709
  var __vue_render__$2 = function () {
13906
13710
  var _vm = this;
13907
-
13908
13711
  var _h = _vm.$createElement;
13909
-
13910
13712
  var _c = _vm._self._c || _h;
13911
-
13912
13713
  return _c('b-modal', {
13913
13714
  attrs: {
13914
13715
  "id": _vm.id,
@@ -14161,19 +13962,15 @@ var __vue_render__$2 = function () {
14161
13962
  }
14162
13963
  })], 1) : _vm._e()], 1)], 1)], 1);
14163
13964
  };
14164
-
14165
13965
  var __vue_staticRenderFns__$2 = [];
14166
- /* style */
14167
13966
 
13967
+ /* style */
14168
13968
  const __vue_inject_styles__$2 = undefined;
14169
13969
  /* scoped */
14170
-
14171
13970
  const __vue_scope_id__$2 = undefined;
14172
13971
  /* module identifier */
14173
-
14174
13972
  const __vue_module_identifier__$2 = undefined;
14175
13973
  /* functional template */
14176
-
14177
13974
  const __vue_is_functional_template__$2 = false;
14178
13975
  /* style inject */
14179
13976
 
@@ -14185,7 +13982,6 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
14185
13982
  render: __vue_render__$2,
14186
13983
  staticRenderFns: __vue_staticRenderFns__$2
14187
13984
  }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
14188
-
14189
13985
  var FieldRuleFormModal = __vue_component__$3;
14190
13986
 
14191
13987
  //
@@ -14205,7 +14001,6 @@ var script$1 = {
14205
14001
  },
14206
14002
  formConfig: Object
14207
14003
  },
14208
-
14209
14004
  data() {
14210
14005
  return {
14211
14006
  innerVisible: null,
@@ -14216,81 +14011,64 @@ var script$1 = {
14216
14011
  rule: {},
14217
14012
  mode: 'ins'
14218
14013
  },
14219
- rulesHash: nanoid()
14014
+ rulesHash: UtRandom.getRandomString(10)
14220
14015
  };
14221
14016
  },
14222
-
14223
14017
  computed: {
14224
14018
  inputOptions() {
14225
14019
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
14226
14020
  },
14227
-
14228
14021
  iconCloseSidebar() {
14229
14022
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
14230
14023
  },
14231
-
14232
14024
  iconOpenSidebar() {
14233
14025
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
14234
14026
  },
14235
-
14236
14027
  iconAdd() {
14237
14028
  return UtFormConstructor.config.icons.iconAdd;
14238
14029
  },
14239
-
14240
14030
  rules() {
14241
14031
  return UtFormConstructor.getAvailableFieldRules(this.field);
14242
14032
  },
14243
-
14244
14033
  hasMultipleInputTypes() {
14245
14034
  return UtFormConstructor.hasMultipleInputTypes(this.field);
14246
14035
  },
14247
-
14248
14036
  multiple() {
14249
14037
  return this.field && this.field.multiple;
14250
14038
  }
14251
-
14252
14039
  },
14253
14040
  watch: {
14254
14041
  visible() {
14255
14042
  this.innerVisible = this.visible;
14256
14043
  },
14257
-
14258
14044
  value() {
14259
14045
  this.field = this.value;
14260
-
14261
14046
  if (this.field && this.field.input) {
14262
14047
  this.currentInputName = this.field.input.name;
14263
14048
  }
14264
14049
  },
14265
-
14266
14050
  field: {
14267
14051
  handler() {
14268
14052
  this.$emit('input', this.field);
14269
14053
  this.$emit('change', this.field);
14270
14054
  },
14271
-
14272
14055
  deep: true
14273
14056
  },
14274
-
14275
14057
  currentInputName(val) {
14276
14058
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
14277
14059
  },
14278
-
14279
14060
  multiple() {
14280
14061
  let input = UtFormConstructor.getDefaultInput(this.field);
14281
-
14282
14062
  if (this.field.multiple) {
14283
14063
  this.currentInputName = input.name;
14284
14064
  }
14285
14065
  }
14286
-
14287
14066
  },
14288
14067
  methods: {
14289
14068
  hide() {
14290
14069
  this.innerVisible = false;
14291
14070
  this.$emit('hide');
14292
14071
  },
14293
-
14294
14072
  getPropInputType(prop, propName) {
14295
14073
  if (['string', 'number'].includes(prop.type)) {
14296
14074
  return 'b-form-input';
@@ -14300,7 +14078,6 @@ var script$1 = {
14300
14078
  return 'rb-boolean-single-option-input';
14301
14079
  }
14302
14080
  },
14303
-
14304
14081
  getPropInputPropData(prop, propName) {
14305
14082
  if (prop.type === 'string') {
14306
14083
  return {
@@ -14314,7 +14091,6 @@ var script$1 = {
14314
14091
  return {};
14315
14092
  }
14316
14093
  },
14317
-
14318
14094
  addRule() {
14319
14095
  this.ruleModalCfg = {
14320
14096
  mode: 'ins',
@@ -14324,22 +14100,22 @@ var script$1 = {
14324
14100
  },
14325
14101
  onAfterOk: rule => {
14326
14102
  this.field.rules = this.field.rules ? this.field.rules : [];
14327
- this.field.rules.push({ ...rule
14103
+ this.field.rules.push({
14104
+ ...rule
14328
14105
  });
14329
- this.rulesHash = nanoid();
14106
+ this.rulesHash = UtRandom.getRandomString(10);
14330
14107
  }
14331
14108
  };
14332
14109
  this.$bvModal.show(this.modalId);
14333
14110
  },
14334
-
14335
14111
  editRule(rule, event) {
14336
14112
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
14337
14113
  return;
14338
14114
  }
14339
-
14340
14115
  this.ruleModalCfg = {
14341
14116
  mode: 'upd',
14342
- rule: { ...rule
14117
+ rule: {
14118
+ ...rule
14343
14119
  },
14344
14120
  onAfterOk: modalRule => {
14345
14121
  Object.assign(rule, modalRule);
@@ -14347,43 +14123,33 @@ var script$1 = {
14347
14123
  };
14348
14124
  this.$bvModal.show(this.modalId);
14349
14125
  },
14350
-
14351
14126
  removeRule(rule) {
14352
14127
  let index = this.field.rules.findIndex(r => r.id === rule.id);
14353
-
14354
14128
  if (index >= 0) {
14355
14129
  this.field.rules.splice(index, 1);
14356
14130
  }
14357
-
14358
- this.rulesHash = nanoid();
14131
+ this.rulesHash = UtRandom.getRandomString(10);
14359
14132
  }
14360
-
14361
14133
  },
14362
-
14363
14134
  created() {
14364
14135
  if (this.value) {
14365
14136
  this.innerVisible = this.visible;
14366
14137
  this.field = this.value;
14367
-
14368
14138
  if (this.field && this.field.input) {
14369
14139
  this.currentInputName = this.field.input.name;
14370
14140
  }
14371
14141
  }
14372
14142
  }
14373
-
14374
14143
  };
14375
14144
 
14376
14145
  /* script */
14377
14146
  const __vue_script__$1 = script$1;
14378
- /* template */
14379
14147
 
14148
+ /* template */
14380
14149
  var __vue_render__$1 = function () {
14381
14150
  var _vm = this;
14382
-
14383
14151
  var _h = _vm.$createElement;
14384
-
14385
14152
  var _c = _vm._self._c || _h;
14386
-
14387
14153
  return _c('b-sidebar', {
14388
14154
  staticClass: "rb-doc-template-field-sidebar",
14389
14155
  attrs: {
@@ -14621,19 +14387,15 @@ var __vue_render__$1 = function () {
14621
14387
  }
14622
14388
  })], 1);
14623
14389
  };
14624
-
14625
14390
  var __vue_staticRenderFns__$1 = [];
14626
- /* style */
14627
14391
 
14392
+ /* style */
14628
14393
  const __vue_inject_styles__$1 = undefined;
14629
14394
  /* scoped */
14630
-
14631
14395
  const __vue_scope_id__$1 = undefined;
14632
14396
  /* module identifier */
14633
-
14634
14397
  const __vue_module_identifier__$1 = undefined;
14635
14398
  /* functional template */
14636
-
14637
14399
  const __vue_is_functional_template__$1 = false;
14638
14400
  /* style inject */
14639
14401
 
@@ -14645,7 +14407,6 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
14645
14407
  render: __vue_render__$1,
14646
14408
  staticRenderFns: __vue_staticRenderFns__$1
14647
14409
  }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
14648
-
14649
14410
  var DocTemplateFieldSidebar = __vue_component__$2;
14650
14411
 
14651
14412
  //
@@ -14671,7 +14432,6 @@ var script = {
14671
14432
  default: () => []
14672
14433
  }
14673
14434
  },
14674
-
14675
14435
  data() {
14676
14436
  return {
14677
14437
  sidebarVisible: false,
@@ -14682,41 +14442,32 @@ var script = {
14682
14442
  id: 'rb-doc-template-section-modal',
14683
14443
  mode: 'ins',
14684
14444
  section: null,
14685
-
14686
14445
  onAfterOk() {}
14687
-
14688
14446
  }
14689
14447
  };
14690
14448
  },
14691
-
14692
14449
  computed: {
14693
14450
  iconAdd() {
14694
14451
  return UtFormConstructor.config.icons.iconAdd;
14695
14452
  },
14696
-
14697
14453
  iconEdit() {
14698
14454
  return UtFormConstructor.config.icons.iconEdit;
14699
14455
  },
14700
-
14701
14456
  iconDelete() {
14702
14457
  return UtFormConstructor.config.icons.iconDelete;
14703
14458
  },
14704
-
14705
14459
  iconDrag() {
14706
14460
  return UtFormConstructor.config.icons.iconDrag;
14707
14461
  }
14708
-
14709
14462
  },
14710
14463
  methods: {
14711
14464
  showProperties(field, event) {
14712
14465
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
14713
14466
  return;
14714
14467
  }
14715
-
14716
14468
  this.sidebarVisible = true;
14717
14469
  this.sidebarField = field;
14718
14470
  },
14719
-
14720
14471
  addSection(columnCount) {
14721
14472
  let section = {
14722
14473
  labelRu: null,
@@ -14724,32 +14475,24 @@ var script = {
14724
14475
  };
14725
14476
  this.sectionModalCfg.mode = 'ins';
14726
14477
  this.sectionModalCfg.section = section;
14727
-
14728
14478
  this.sectionModalCfg.onAfterOk = () => {
14729
14479
  section.columns = [];
14730
-
14731
14480
  for (let i = 0; i < columnCount; i++) {
14732
14481
  section.columns.push({
14733
14482
  index: i,
14734
14483
  fields: []
14735
14484
  });
14736
14485
  }
14737
-
14738
14486
  this.formConfig.sections.push(section);
14739
14487
  };
14740
-
14741
14488
  this.$bvModal.show(this.sectionModalCfg.id);
14742
14489
  },
14743
-
14744
14490
  editSection(section) {
14745
14491
  this.sectionModalCfg.mode = 'update';
14746
14492
  this.sectionModalCfg.section = section;
14747
-
14748
14493
  this.sectionModalCfg.onAfterOk = () => {};
14749
-
14750
14494
  this.$bvModal.show(this.sectionModalCfg.id);
14751
14495
  },
14752
-
14753
14496
  removeSection(section, index) {
14754
14497
  this.formConfig.sections.splice(index, 1);
14755
14498
  /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
@@ -14773,40 +14516,31 @@ var script = {
14773
14516
  });
14774
14517
  return count > 1;
14775
14518
  },
14776
-
14777
14519
  removeFieldFromColumn(field, column, newIndex) {
14778
14520
  let index = newIndex != null ? newIndex : -1;
14779
-
14780
14521
  if (index < 0) {
14781
14522
  index = column.fields.findIndex(f => field.name === f.name);
14782
14523
  }
14783
-
14784
14524
  if (index >= 0) {
14785
14525
  column.fields.splice(index, 1);
14786
14526
  }
14787
14527
  },
14788
-
14789
14528
  onRemoveField(event, field, column) {
14790
14529
  event.preventDefault();
14791
14530
  this.removeFieldFromColumn(field, column);
14792
14531
  },
14793
-
14794
14532
  onFieldAddedToColumn(event, column, section) {
14795
14533
  this.columnTo = column;
14796
14534
  },
14797
-
14798
14535
  onFieldMoveEnd(event) {
14799
14536
  const {
14800
14537
  newIndex
14801
14538
  } = event;
14802
14539
  let field = event.item._underlying_vm_;
14803
-
14804
14540
  if (!field.hasOwnProperty('defaultValue')) {
14805
14541
  this.$set(field, 'defaultValue', undefined);
14806
14542
  }
14807
-
14808
14543
  let found = this.multipleFieldAreOnFormConfig(field);
14809
-
14810
14544
  if (found) {
14811
14545
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
14812
14546
  this.resetDragVariables();
@@ -14820,36 +14554,30 @@ var script = {
14820
14554
  noCloseOnEsc: true
14821
14555
  });
14822
14556
  }
14823
-
14824
14557
  this.resetDragVariables();
14825
14558
  this.hash = (Math.random() + 1).toString(36).substring(7);
14826
14559
  },
14827
-
14828
14560
  getFieldExtendedPropsData(field) {
14829
- return { ...field.input.propsData,
14561
+ return {
14562
+ ...field.input.propsData,
14830
14563
  placeholder: field.tag,
14831
14564
  disabled: true
14832
14565
  };
14833
14566
  },
14834
-
14835
14567
  resetDragVariables() {
14836
14568
  this.columnTo = null;
14837
14569
  }
14838
-
14839
14570
  }
14840
14571
  };
14841
14572
 
14842
14573
  /* script */
14843
14574
  const __vue_script__ = script;
14844
- /* template */
14845
14575
 
14576
+ /* template */
14846
14577
  var __vue_render__ = function () {
14847
14578
  var _vm = this;
14848
-
14849
14579
  var _h = _vm.$createElement;
14850
-
14851
14580
  var _c = _vm._self._c || _h;
14852
-
14853
14581
  return _c('div', {
14854
14582
  staticClass: "rb-doc-template-constructor d-flex"
14855
14583
  }, [_c('doc-template-facet-list', {
@@ -15074,19 +14802,15 @@ var __vue_render__ = function () {
15074
14802
  }
15075
14803
  })], 1)], 1);
15076
14804
  };
15077
-
15078
14805
  var __vue_staticRenderFns__ = [];
15079
- /* style */
15080
14806
 
14807
+ /* style */
15081
14808
  const __vue_inject_styles__ = undefined;
15082
14809
  /* scoped */
15083
-
15084
14810
  const __vue_scope_id__ = undefined;
15085
14811
  /* module identifier */
15086
-
15087
14812
  const __vue_module_identifier__ = undefined;
15088
14813
  /* functional template */
15089
-
15090
14814
  const __vue_is_functional_template__ = false;
15091
14815
  /* style inject */
15092
14816
 
@@ -15098,7 +14822,6 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
15098
14822
  render: __vue_render__,
15099
14823
  staticRenderFns: __vue_staticRenderFns__
15100
14824
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
15101
-
15102
14825
  var __vue_component__$1 = __vue_component__;
15103
14826
 
15104
14827
  /* eslint-disable import/prefer-default-export */
@@ -15118,11 +14841,11 @@ var components = /*#__PURE__*/Object.freeze({
15118
14841
 
15119
14842
  // Import vue components
15120
14843
 
14844
+ // install function executed by Vue.use()
15121
14845
  const install = function installRbDocumentFormConstructor(Vue) {
15122
- Object.entries(components).forEach(_ref => {
15123
- let [componentName, component] = _ref;
14846
+ Object.entries(components).forEach(([componentName, component]) => {
15124
14847
  Vue.component(componentName, component);
15125
14848
  });
15126
- }; // Create module definition for Vue.use()
14849
+ };
15127
14850
 
15128
14851
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default, i18n };