rb-document-form-constructor 0.8.64 → 0.8.66

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 crypto 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,66 +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 rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
13269
-
13270
- let poolPtr = rnds8Pool.length;
13271
- function rng() {
13272
- if (poolPtr > rnds8Pool.length - 16) {
13273
- crypto.randomFillSync(rnds8Pool);
13274
- poolPtr = 0;
13275
- }
13276
-
13277
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
13278
- }
13279
-
13280
- /**
13281
- * Convert array of 16 byte values to UUID string format of the form:
13282
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
13283
- */
13284
-
13285
- const byteToHex = [];
13286
-
13287
- for (let i = 0; i < 256; ++i) {
13288
- byteToHex.push((i + 0x100).toString(16).slice(1));
13289
- }
13290
-
13291
- function unsafeStringify(arr, offset = 0) {
13292
- // Note: Be careful editing this code! It's been tuned for performance
13293
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
13294
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
13295
- }
13296
-
13297
- var native = {
13298
- randomUUID: crypto.randomUUID
13299
- };
13300
-
13301
- function v4(options, buf, offset) {
13302
- if (native.randomUUID && !buf && !options) {
13303
- return native.randomUUID();
13304
- }
13305
-
13306
- options = options || {};
13307
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
13308
-
13309
- rnds[6] = rnds[6] & 0x0f | 0x40;
13310
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
13311
-
13312
- if (buf) {
13313
- offset = offset || 0;
13314
-
13315
- for (let i = 0; i < 16; ++i) {
13316
- buf[offset + i] = rnds[i];
13317
- }
13318
-
13319
- return buf;
13320
- }
13321
-
13322
- return unsafeStringify(rnds);
13323
- }
13324
-
13325
13167
  var toString = Object.prototype.toString;
13326
13168
 
13327
13169
  var _typeof = function(object) {
@@ -13341,6 +13183,7 @@ var _typeof = function(object) {
13341
13183
  };
13342
13184
 
13343
13185
  //
13186
+ // import safeEval from "notevil";
13344
13187
 
13345
13188
  var script$3 = {
13346
13189
  name: 'DocForm',
@@ -13371,42 +13214,34 @@ var script$3 = {
13371
13214
  default: true
13372
13215
  }
13373
13216
  },
13374
-
13375
13217
  data() {
13376
13218
  return {
13377
13219
  validationState: {}
13378
13220
  };
13379
13221
  },
13380
-
13381
13222
  watch: {
13382
13223
  formConfig() {
13383
13224
  this.validationState = {};
13384
13225
  this.execApplyDefaultValues();
13385
13226
  this.execApplyDefaultValRule();
13386
13227
  }
13387
-
13388
13228
  },
13389
13229
  methods: {
13390
13230
  getResolveValueName(field) {
13391
13231
  if ((field.dict || field.ref) && !field.multiple) {
13392
13232
  return field.name.substring(0, field.name.length - 2);
13393
13233
  }
13394
-
13395
13234
  return field.name;
13396
13235
  },
13397
-
13398
13236
  getResolveValue(field) {
13399
13237
  return this.doc[this.getResolveValueName(field)] ? this.doc[this.getResolveValueName(field)] : null;
13400
13238
  },
13401
-
13402
- setResolveValue(_ref) {
13403
- let {
13404
- field,
13405
- multiple = false
13406
- } = _ref;
13239
+ setResolveValue({
13240
+ field,
13241
+ multiple = false
13242
+ }) {
13407
13243
  this.getResolveValue(field);
13408
13244
  },
13409
-
13410
13245
  getDisplayField(value) {
13411
13246
  if (!value[this.displayField]) {
13412
13247
  return value.labelRu;
@@ -13414,20 +13249,16 @@ var script$3 = {
13414
13249
  return value[this.displayField];
13415
13250
  }
13416
13251
  },
13417
-
13418
13252
  onEventFired(eventName, event, field) {
13419
13253
  if (eventName === 'input' && field.ref && !field.multiple) {
13420
13254
  let dataField = null;
13421
-
13422
13255
  if (field.name.lastIndexOf(this.refSuffix) >= 0) {
13423
13256
  dataField = field.name.substring(0, field.name.lastIndexOf(this.refSuffix));
13424
13257
  }
13425
-
13426
13258
  if (dataField && dataField.length > 0) {
13427
13259
  this.doc[dataField] = null;
13428
13260
  }
13429
13261
  }
13430
-
13431
13262
  if (field.rules) {
13432
13263
  field.rules.forEach(rule => {
13433
13264
  if (rule.event === eventName && rule.script) {
@@ -13439,7 +13270,6 @@ var script$3 = {
13439
13270
  });
13440
13271
  }
13441
13272
  },
13442
-
13443
13273
  onGlobalEventFired(eventName, event) {
13444
13274
  let fields = UtFormConfig.getFields(this.formConfig);
13445
13275
  fields.forEach(f => {
@@ -13455,7 +13285,6 @@ var script$3 = {
13455
13285
  }
13456
13286
  });
13457
13287
  },
13458
-
13459
13288
  createRuleContext(additionalContext) {
13460
13289
  return Object.assign({
13461
13290
  form: this,
@@ -13463,81 +13292,58 @@ var script$3 = {
13463
13292
  ...additionalContext
13464
13293
  }, UtFormConstructor.getRuleContext());
13465
13294
  },
13466
-
13467
13295
  runRule(rule, context) {
13468
13296
  UtFormConstructor.runRule(this.createRuleContext(context), rule.script);
13469
13297
  },
13470
-
13471
13298
  isValueEmpty(fieldName) {
13472
- var _this$doc$fieldName;
13473
-
13474
13299
  if (this.doc[fieldName] == null) {
13475
13300
  return true;
13476
13301
  }
13477
-
13478
- 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) {
13479
13303
  return true;
13480
13304
  }
13481
-
13482
13305
  if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
13483
13306
  return true;
13484
13307
  }
13485
-
13486
13308
  return false;
13487
13309
  },
13488
-
13489
13310
  isValueLessThanMax(fieldname, max) {
13490
13311
  if (this.doc[fieldname] && max) {
13491
- var _this$doc$fieldname;
13492
-
13493
- 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);
13494
13313
  }
13495
-
13496
13314
  return false;
13497
13315
  },
13498
-
13499
13316
  isValueLessThanMin(fieldname, min) {
13500
13317
  if (this.doc[fieldname] && min) {
13501
13318
  return parseInt(this.doc[fieldname]) < parseInt(min);
13502
13319
  }
13503
-
13504
13320
  return false;
13505
13321
  },
13506
-
13507
13322
  validate() {
13508
13323
  this.formConfig.sections.forEach(s => {
13509
13324
  s.columns.forEach(c => {
13510
13325
  c.fields.forEach(f => {
13511
- var _f$input$propsData;
13512
-
13513
13326
  let feedback = '';
13514
-
13515
13327
  if (f.required && this.isValueEmpty(f.name)) {
13516
13328
  feedback += i18n.t('validate.required', {
13517
13329
  field: this.getDisplayField(f)
13518
13330
  });
13519
13331
  }
13520
-
13521
13332
  if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
13522
13333
  feedback += `\n${i18n.t('validate.min', {
13523
13334
  min: f.input.propsData.min
13524
13335
  })}`;
13525
- } // TODO: Костыль так как на бэке нету типа memo
13526
-
13527
-
13528
- 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)) {
13529
- var _f$input$propsData2;
13530
-
13531
- feedback += `\nМаксимальное значение для этого поля ${(_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max}`;
13532
13336
  }
13533
-
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
+ }
13534
13341
  if (feedback) {
13535
13342
  Vue$1.set(this.validationState, f.name, false);
13536
13343
  Vue$1.set(this.validationState, `${f.name}__feedback`, feedback);
13537
13344
  } else {
13538
13345
  Vue$1.set(this.validationState, f.name, null);
13539
13346
  }
13540
-
13541
13347
  this.onEventFired('validate', {
13542
13348
  validationState: this.validationState,
13543
13349
  doc: this.doc
@@ -13545,27 +13351,21 @@ var script$3 = {
13545
13351
  });
13546
13352
  });
13547
13353
  });
13548
-
13549
13354
  for (let fieldName in this.validationState) {
13550
13355
  if (this.validationState[fieldName] === false) {
13551
13356
  return false;
13552
13357
  }
13553
13358
  }
13554
-
13555
13359
  return true;
13556
13360
  },
13557
-
13558
13361
  getColumnSize(section) {
13559
13362
  const MAX_COLUMN_SIZE = 12;
13560
-
13561
13363
  if (!section || !section.columnCount) {
13562
13364
  return MAX_COLUMN_SIZE;
13563
13365
  }
13564
-
13565
13366
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
13566
13367
  return colSize;
13567
13368
  },
13568
-
13569
13369
  execApplyDefaultValues() {
13570
13370
  if (this.applyDefaultValues) {
13571
13371
  this.formConfig.sections.forEach(r => {
@@ -13573,13 +13373,11 @@ var script$3 = {
13573
13373
  c.fields.forEach(f => {
13574
13374
  if (f.defaultValue) {
13575
13375
  let defValue;
13576
-
13577
13376
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
13578
13377
  defValue = f.defaultValue();
13579
13378
  } else {
13580
13379
  defValue = f.defaultValue == null ? null : f.defaultValue;
13581
13380
  }
13582
-
13583
13381
  this.$set(this.doc, f.name, f.defaultValue = defValue);
13584
13382
  }
13585
13383
  });
@@ -13587,7 +13385,6 @@ var script$3 = {
13587
13385
  });
13588
13386
  }
13589
13387
  },
13590
-
13591
13388
  execApplyDefaultValRule() {
13592
13389
  this.formConfig.sections.forEach(el => {
13593
13390
  el.columns.forEach(c => {
@@ -13595,7 +13392,6 @@ var script$3 = {
13595
13392
  if (f.rules) {
13596
13393
  if (!f.defaultValue) {
13597
13394
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
13598
-
13599
13395
  if (rule && !this.doc[f.name]) {
13600
13396
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
13601
13397
  }
@@ -13605,34 +13401,27 @@ var script$3 = {
13605
13401
  });
13606
13402
  });
13607
13403
  }
13608
-
13609
13404
  },
13610
-
13611
13405
  mounted() {
13612
13406
  this.execApplyDefaultValues();
13613
13407
  this.execApplyDefaultValRule();
13614
13408
  this.onGlobalEventFired('form-mounted', this);
13615
13409
  },
13616
-
13617
13410
  activated() {
13618
13411
  this.execApplyDefaultValues();
13619
13412
  this.execApplyDefaultValRule();
13620
13413
  this.onGlobalEventFired('form-activated', this);
13621
13414
  }
13622
-
13623
13415
  };
13624
13416
 
13625
13417
  /* script */
13626
13418
  const __vue_script__$3 = script$3;
13627
- /* template */
13628
13419
 
13420
+ /* template */
13629
13421
  var __vue_render__$3 = function () {
13630
13422
  var _vm = this;
13631
-
13632
13423
  var _h = _vm.$createElement;
13633
-
13634
13424
  var _c = _vm._self._c || _h;
13635
-
13636
13425
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
13637
13426
  staticClass: "rb-doc-form",
13638
13427
  on: {
@@ -13730,19 +13519,15 @@ var __vue_render__$3 = function () {
13730
13519
  })], 2)], 1);
13731
13520
  }), 1) : _vm._e();
13732
13521
  };
13733
-
13734
13522
  var __vue_staticRenderFns__$3 = [];
13735
- /* style */
13736
13523
 
13524
+ /* style */
13737
13525
  const __vue_inject_styles__$3 = undefined;
13738
13526
  /* scoped */
13739
-
13740
13527
  const __vue_scope_id__$3 = undefined;
13741
13528
  /* module identifier */
13742
-
13743
13529
  const __vue_module_identifier__$3 = undefined;
13744
13530
  /* functional template */
13745
-
13746
13531
  const __vue_is_functional_template__$3 = false;
13747
13532
  /* style inject */
13748
13533
 
@@ -13754,9 +13539,23 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
13754
13539
  render: __vue_render__$3,
13755
13540
  staticRenderFns: __vue_staticRenderFns__$3
13756
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);
13757
-
13758
13542
  var DocForm = __vue_component__$4;
13759
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
+
13760
13559
  //
13761
13560
  var script$2 = {
13762
13561
  name: 'FieldRuleFormModal',
@@ -13773,7 +13572,6 @@ var script$2 = {
13773
13572
  },
13774
13573
  onAfterOk: Function
13775
13574
  },
13776
-
13777
13575
  data() {
13778
13576
  return {
13779
13577
  id: 'rb-field-rule-form-modal',
@@ -13782,26 +13580,21 @@ var script$2 = {
13782
13580
  innerRule: null
13783
13581
  };
13784
13582
  },
13785
-
13786
13583
  computed: {
13787
13584
  title() {
13788
13585
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
13789
13586
  },
13790
-
13791
13587
  fields() {
13792
13588
  return UtFormConfig.getFields(this.formConfig);
13793
13589
  },
13794
-
13795
13590
  rulePresets() {
13796
13591
  return UtFormConstructor.getAvailableFieldRules(this.field);
13797
13592
  }
13798
-
13799
13593
  },
13800
13594
  watch: {
13801
13595
  formConfig() {
13802
13596
  this.copyToInnerFormConfig();
13803
13597
  },
13804
-
13805
13598
  rule() {
13806
13599
  if (this.rule) {
13807
13600
  this.innerRule = this.rule;
@@ -13809,7 +13602,6 @@ var script$2 = {
13809
13602
  this.innerRule = this.getDefaultRule();
13810
13603
  }
13811
13604
  }
13812
-
13813
13605
  },
13814
13606
  methods: {
13815
13607
  validateFields(fieldName) {
@@ -13824,18 +13616,14 @@ var script$2 = {
13824
13616
  }
13825
13617
  });
13826
13618
  },
13827
-
13828
13619
  copyToInnerFormConfig() {
13829
13620
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
13830
13621
  },
13831
-
13832
13622
  applyRuleToInnerFormConfig() {
13833
13623
  if (this.innerFormConfig) {
13834
13624
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
13835
-
13836
13625
  if (!foundRule) {
13837
13626
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
13838
-
13839
13627
  if (foundField) {
13840
13628
  foundField.rules = foundField.rules ? foundField.rules : [];
13841
13629
  foundField.rules.push(this.rule);
@@ -13845,14 +13633,12 @@ var script$2 = {
13845
13633
  }
13846
13634
  }
13847
13635
  },
13848
-
13849
13636
  onActivateTab(index) {
13850
13637
  if (index > 0) {
13851
13638
  this.copyToInnerFormConfig();
13852
13639
  this.applyRuleToInnerFormConfig();
13853
13640
  }
13854
13641
  },
13855
-
13856
13642
  getDefaultState() {
13857
13643
  return {
13858
13644
  name: null,
@@ -13860,36 +13646,30 @@ var script$2 = {
13860
13646
  script: null
13861
13647
  };
13862
13648
  },
13863
-
13864
13649
  getDefaultRule() {
13865
13650
  return {
13866
- id: v4(),
13651
+ id: UtRandom.getRandomString(10),
13867
13652
  name: null,
13868
13653
  event: null,
13869
13654
  script: null
13870
13655
  };
13871
13656
  },
13872
-
13873
13657
  resetModal() {
13874
13658
  this.state = this.getDefaultState();
13875
13659
  this.innerRule = null;
13876
13660
  },
13877
-
13878
13661
  addVariableToScript(varName) {
13879
13662
  let caretPosition = this.$refs.scriptInput.selectionStart;
13880
13663
  this.insertTextToScript(varName, caretPosition);
13881
13664
  },
13882
-
13883
13665
  addSetVariableToScript(field) {
13884
13666
  let caretPosition = this.$refs.scriptInput.selectionStart;
13885
13667
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
13886
13668
  },
13887
-
13888
13669
  addCallInputFunction(field) {
13889
13670
  let caretPosition = this.$refs.scriptInput.selectionStart;
13890
13671
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
13891
13672
  },
13892
-
13893
13673
  insertTextToScript(text, position) {
13894
13674
  position = position != null ? position : this.script.length;
13895
13675
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -13897,50 +13677,39 @@ var script$2 = {
13897
13677
  scriptSplit.splice(position, 0, text);
13898
13678
  this.innerRule.script = scriptSplit.join('');
13899
13679
  },
13900
-
13901
13680
  onRuleSelected(ruleName) {
13902
13681
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
13903
-
13904
13682
  if (rule) {
13905
13683
  Object.assign(this.innerRule, rule);
13906
13684
  this.innerRule.script = this.innerRule.script.trim();
13907
13685
  }
13908
13686
  },
13909
-
13910
13687
  onOk() {
13911
13688
  this.validateFields();
13912
-
13913
13689
  if (this.state.name && this.state.script) {
13914
13690
  if (this.onAfterOk) {
13915
13691
  this.onAfterOk(this.innerRule);
13916
13692
  }
13917
-
13918
13693
  this.$nextTick(() => {
13919
13694
  this.resetModal();
13920
13695
  this.$bvModal.hide(this.id);
13921
13696
  });
13922
13697
  }
13923
13698
  }
13924
-
13925
13699
  },
13926
-
13927
13700
  created() {
13928
13701
  this.copyToInnerFormConfig();
13929
13702
  }
13930
-
13931
13703
  };
13932
13704
 
13933
13705
  /* script */
13934
13706
  const __vue_script__$2 = script$2;
13935
- /* template */
13936
13707
 
13708
+ /* template */
13937
13709
  var __vue_render__$2 = function () {
13938
13710
  var _vm = this;
13939
-
13940
13711
  var _h = _vm.$createElement;
13941
-
13942
13712
  var _c = _vm._self._c || _h;
13943
-
13944
13713
  return _c('b-modal', {
13945
13714
  attrs: {
13946
13715
  "id": _vm.id,
@@ -14193,19 +13962,15 @@ var __vue_render__$2 = function () {
14193
13962
  }
14194
13963
  })], 1) : _vm._e()], 1)], 1)], 1);
14195
13964
  };
14196
-
14197
13965
  var __vue_staticRenderFns__$2 = [];
14198
- /* style */
14199
13966
 
13967
+ /* style */
14200
13968
  const __vue_inject_styles__$2 = undefined;
14201
13969
  /* scoped */
14202
-
14203
13970
  const __vue_scope_id__$2 = undefined;
14204
13971
  /* module identifier */
14205
-
14206
13972
  const __vue_module_identifier__$2 = undefined;
14207
13973
  /* functional template */
14208
-
14209
13974
  const __vue_is_functional_template__$2 = false;
14210
13975
  /* style inject */
14211
13976
 
@@ -14217,7 +13982,6 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
14217
13982
  render: __vue_render__$2,
14218
13983
  staticRenderFns: __vue_staticRenderFns__$2
14219
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);
14220
-
14221
13985
  var FieldRuleFormModal = __vue_component__$3;
14222
13986
 
14223
13987
  //
@@ -14237,7 +14001,6 @@ var script$1 = {
14237
14001
  },
14238
14002
  formConfig: Object
14239
14003
  },
14240
-
14241
14004
  data() {
14242
14005
  return {
14243
14006
  innerVisible: null,
@@ -14248,81 +14011,64 @@ var script$1 = {
14248
14011
  rule: {},
14249
14012
  mode: 'ins'
14250
14013
  },
14251
- rulesHash: v4()
14014
+ rulesHash: UtRandom.getRandomString(10)
14252
14015
  };
14253
14016
  },
14254
-
14255
14017
  computed: {
14256
14018
  inputOptions() {
14257
14019
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
14258
14020
  },
14259
-
14260
14021
  iconCloseSidebar() {
14261
14022
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
14262
14023
  },
14263
-
14264
14024
  iconOpenSidebar() {
14265
14025
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
14266
14026
  },
14267
-
14268
14027
  iconAdd() {
14269
14028
  return UtFormConstructor.config.icons.iconAdd;
14270
14029
  },
14271
-
14272
14030
  rules() {
14273
14031
  return UtFormConstructor.getAvailableFieldRules(this.field);
14274
14032
  },
14275
-
14276
14033
  hasMultipleInputTypes() {
14277
14034
  return UtFormConstructor.hasMultipleInputTypes(this.field);
14278
14035
  },
14279
-
14280
14036
  multiple() {
14281
14037
  return this.field && this.field.multiple;
14282
14038
  }
14283
-
14284
14039
  },
14285
14040
  watch: {
14286
14041
  visible() {
14287
14042
  this.innerVisible = this.visible;
14288
14043
  },
14289
-
14290
14044
  value() {
14291
14045
  this.field = this.value;
14292
-
14293
14046
  if (this.field && this.field.input) {
14294
14047
  this.currentInputName = this.field.input.name;
14295
14048
  }
14296
14049
  },
14297
-
14298
14050
  field: {
14299
14051
  handler() {
14300
14052
  this.$emit('input', this.field);
14301
14053
  this.$emit('change', this.field);
14302
14054
  },
14303
-
14304
14055
  deep: true
14305
14056
  },
14306
-
14307
14057
  currentInputName(val) {
14308
14058
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
14309
14059
  },
14310
-
14311
14060
  multiple() {
14312
14061
  let input = UtFormConstructor.getDefaultInput(this.field);
14313
-
14314
14062
  if (this.field.multiple) {
14315
14063
  this.currentInputName = input.name;
14316
14064
  }
14317
14065
  }
14318
-
14319
14066
  },
14320
14067
  methods: {
14321
14068
  hide() {
14322
14069
  this.innerVisible = false;
14323
14070
  this.$emit('hide');
14324
14071
  },
14325
-
14326
14072
  getPropInputType(prop, propName) {
14327
14073
  if (['string', 'number'].includes(prop.type)) {
14328
14074
  return 'b-form-input';
@@ -14332,7 +14078,6 @@ var script$1 = {
14332
14078
  return 'rb-boolean-single-option-input';
14333
14079
  }
14334
14080
  },
14335
-
14336
14081
  getPropInputPropData(prop, propName) {
14337
14082
  if (prop.type === 'string') {
14338
14083
  return {
@@ -14346,7 +14091,6 @@ var script$1 = {
14346
14091
  return {};
14347
14092
  }
14348
14093
  },
14349
-
14350
14094
  addRule() {
14351
14095
  this.ruleModalCfg = {
14352
14096
  mode: 'ins',
@@ -14356,22 +14100,22 @@ var script$1 = {
14356
14100
  },
14357
14101
  onAfterOk: rule => {
14358
14102
  this.field.rules = this.field.rules ? this.field.rules : [];
14359
- this.field.rules.push({ ...rule
14103
+ this.field.rules.push({
14104
+ ...rule
14360
14105
  });
14361
- this.rulesHash = v4();
14106
+ this.rulesHash = UtRandom.getRandomString(10);
14362
14107
  }
14363
14108
  };
14364
14109
  this.$bvModal.show(this.modalId);
14365
14110
  },
14366
-
14367
14111
  editRule(rule, event) {
14368
14112
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
14369
14113
  return;
14370
14114
  }
14371
-
14372
14115
  this.ruleModalCfg = {
14373
14116
  mode: 'upd',
14374
- rule: { ...rule
14117
+ rule: {
14118
+ ...rule
14375
14119
  },
14376
14120
  onAfterOk: modalRule => {
14377
14121
  Object.assign(rule, modalRule);
@@ -14379,43 +14123,33 @@ var script$1 = {
14379
14123
  };
14380
14124
  this.$bvModal.show(this.modalId);
14381
14125
  },
14382
-
14383
14126
  removeRule(rule) {
14384
14127
  let index = this.field.rules.findIndex(r => r.id === rule.id);
14385
-
14386
14128
  if (index >= 0) {
14387
14129
  this.field.rules.splice(index, 1);
14388
14130
  }
14389
-
14390
- this.rulesHash = v4();
14131
+ this.rulesHash = UtRandom.getRandomString(10);
14391
14132
  }
14392
-
14393
14133
  },
14394
-
14395
14134
  created() {
14396
14135
  if (this.value) {
14397
14136
  this.innerVisible = this.visible;
14398
14137
  this.field = this.value;
14399
-
14400
14138
  if (this.field && this.field.input) {
14401
14139
  this.currentInputName = this.field.input.name;
14402
14140
  }
14403
14141
  }
14404
14142
  }
14405
-
14406
14143
  };
14407
14144
 
14408
14145
  /* script */
14409
14146
  const __vue_script__$1 = script$1;
14410
- /* template */
14411
14147
 
14148
+ /* template */
14412
14149
  var __vue_render__$1 = function () {
14413
14150
  var _vm = this;
14414
-
14415
14151
  var _h = _vm.$createElement;
14416
-
14417
14152
  var _c = _vm._self._c || _h;
14418
-
14419
14153
  return _c('b-sidebar', {
14420
14154
  staticClass: "rb-doc-template-field-sidebar",
14421
14155
  attrs: {
@@ -14653,19 +14387,15 @@ var __vue_render__$1 = function () {
14653
14387
  }
14654
14388
  })], 1);
14655
14389
  };
14656
-
14657
14390
  var __vue_staticRenderFns__$1 = [];
14658
- /* style */
14659
14391
 
14392
+ /* style */
14660
14393
  const __vue_inject_styles__$1 = undefined;
14661
14394
  /* scoped */
14662
-
14663
14395
  const __vue_scope_id__$1 = undefined;
14664
14396
  /* module identifier */
14665
-
14666
14397
  const __vue_module_identifier__$1 = undefined;
14667
14398
  /* functional template */
14668
-
14669
14399
  const __vue_is_functional_template__$1 = false;
14670
14400
  /* style inject */
14671
14401
 
@@ -14677,7 +14407,6 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
14677
14407
  render: __vue_render__$1,
14678
14408
  staticRenderFns: __vue_staticRenderFns__$1
14679
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);
14680
-
14681
14410
  var DocTemplateFieldSidebar = __vue_component__$2;
14682
14411
 
14683
14412
  //
@@ -14703,7 +14432,6 @@ var script = {
14703
14432
  default: () => []
14704
14433
  }
14705
14434
  },
14706
-
14707
14435
  data() {
14708
14436
  return {
14709
14437
  sidebarVisible: false,
@@ -14714,41 +14442,32 @@ var script = {
14714
14442
  id: 'rb-doc-template-section-modal',
14715
14443
  mode: 'ins',
14716
14444
  section: null,
14717
-
14718
14445
  onAfterOk() {}
14719
-
14720
14446
  }
14721
14447
  };
14722
14448
  },
14723
-
14724
14449
  computed: {
14725
14450
  iconAdd() {
14726
14451
  return UtFormConstructor.config.icons.iconAdd;
14727
14452
  },
14728
-
14729
14453
  iconEdit() {
14730
14454
  return UtFormConstructor.config.icons.iconEdit;
14731
14455
  },
14732
-
14733
14456
  iconDelete() {
14734
14457
  return UtFormConstructor.config.icons.iconDelete;
14735
14458
  },
14736
-
14737
14459
  iconDrag() {
14738
14460
  return UtFormConstructor.config.icons.iconDrag;
14739
14461
  }
14740
-
14741
14462
  },
14742
14463
  methods: {
14743
14464
  showProperties(field, event) {
14744
14465
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
14745
14466
  return;
14746
14467
  }
14747
-
14748
14468
  this.sidebarVisible = true;
14749
14469
  this.sidebarField = field;
14750
14470
  },
14751
-
14752
14471
  addSection(columnCount) {
14753
14472
  let section = {
14754
14473
  labelRu: null,
@@ -14756,32 +14475,24 @@ var script = {
14756
14475
  };
14757
14476
  this.sectionModalCfg.mode = 'ins';
14758
14477
  this.sectionModalCfg.section = section;
14759
-
14760
14478
  this.sectionModalCfg.onAfterOk = () => {
14761
14479
  section.columns = [];
14762
-
14763
14480
  for (let i = 0; i < columnCount; i++) {
14764
14481
  section.columns.push({
14765
14482
  index: i,
14766
14483
  fields: []
14767
14484
  });
14768
14485
  }
14769
-
14770
14486
  this.formConfig.sections.push(section);
14771
14487
  };
14772
-
14773
14488
  this.$bvModal.show(this.sectionModalCfg.id);
14774
14489
  },
14775
-
14776
14490
  editSection(section) {
14777
14491
  this.sectionModalCfg.mode = 'update';
14778
14492
  this.sectionModalCfg.section = section;
14779
-
14780
14493
  this.sectionModalCfg.onAfterOk = () => {};
14781
-
14782
14494
  this.$bvModal.show(this.sectionModalCfg.id);
14783
14495
  },
14784
-
14785
14496
  removeSection(section, index) {
14786
14497
  this.formConfig.sections.splice(index, 1);
14787
14498
  /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
@@ -14805,40 +14516,31 @@ var script = {
14805
14516
  });
14806
14517
  return count > 1;
14807
14518
  },
14808
-
14809
14519
  removeFieldFromColumn(field, column, newIndex) {
14810
14520
  let index = newIndex != null ? newIndex : -1;
14811
-
14812
14521
  if (index < 0) {
14813
14522
  index = column.fields.findIndex(f => field.name === f.name);
14814
14523
  }
14815
-
14816
14524
  if (index >= 0) {
14817
14525
  column.fields.splice(index, 1);
14818
14526
  }
14819
14527
  },
14820
-
14821
14528
  onRemoveField(event, field, column) {
14822
14529
  event.preventDefault();
14823
14530
  this.removeFieldFromColumn(field, column);
14824
14531
  },
14825
-
14826
14532
  onFieldAddedToColumn(event, column, section) {
14827
14533
  this.columnTo = column;
14828
14534
  },
14829
-
14830
14535
  onFieldMoveEnd(event) {
14831
14536
  const {
14832
14537
  newIndex
14833
14538
  } = event;
14834
14539
  let field = event.item._underlying_vm_;
14835
-
14836
14540
  if (!field.hasOwnProperty('defaultValue')) {
14837
14541
  this.$set(field, 'defaultValue', undefined);
14838
14542
  }
14839
-
14840
14543
  let found = this.multipleFieldAreOnFormConfig(field);
14841
-
14842
14544
  if (found) {
14843
14545
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
14844
14546
  this.resetDragVariables();
@@ -14852,36 +14554,30 @@ var script = {
14852
14554
  noCloseOnEsc: true
14853
14555
  });
14854
14556
  }
14855
-
14856
14557
  this.resetDragVariables();
14857
14558
  this.hash = (Math.random() + 1).toString(36).substring(7);
14858
14559
  },
14859
-
14860
14560
  getFieldExtendedPropsData(field) {
14861
- return { ...field.input.propsData,
14561
+ return {
14562
+ ...field.input.propsData,
14862
14563
  placeholder: field.tag,
14863
14564
  disabled: true
14864
14565
  };
14865
14566
  },
14866
-
14867
14567
  resetDragVariables() {
14868
14568
  this.columnTo = null;
14869
14569
  }
14870
-
14871
14570
  }
14872
14571
  };
14873
14572
 
14874
14573
  /* script */
14875
14574
  const __vue_script__ = script;
14876
- /* template */
14877
14575
 
14576
+ /* template */
14878
14577
  var __vue_render__ = function () {
14879
14578
  var _vm = this;
14880
-
14881
14579
  var _h = _vm.$createElement;
14882
-
14883
14580
  var _c = _vm._self._c || _h;
14884
-
14885
14581
  return _c('div', {
14886
14582
  staticClass: "rb-doc-template-constructor d-flex"
14887
14583
  }, [_c('doc-template-facet-list', {
@@ -15106,19 +14802,15 @@ var __vue_render__ = function () {
15106
14802
  }
15107
14803
  })], 1)], 1);
15108
14804
  };
15109
-
15110
14805
  var __vue_staticRenderFns__ = [];
15111
- /* style */
15112
14806
 
14807
+ /* style */
15113
14808
  const __vue_inject_styles__ = undefined;
15114
14809
  /* scoped */
15115
-
15116
14810
  const __vue_scope_id__ = undefined;
15117
14811
  /* module identifier */
15118
-
15119
14812
  const __vue_module_identifier__ = undefined;
15120
14813
  /* functional template */
15121
-
15122
14814
  const __vue_is_functional_template__ = false;
15123
14815
  /* style inject */
15124
14816
 
@@ -15130,7 +14822,6 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
15130
14822
  render: __vue_render__,
15131
14823
  staticRenderFns: __vue_staticRenderFns__
15132
14824
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
15133
-
15134
14825
  var __vue_component__$1 = __vue_component__;
15135
14826
 
15136
14827
  /* eslint-disable import/prefer-default-export */
@@ -15150,11 +14841,11 @@ var components = /*#__PURE__*/Object.freeze({
15150
14841
 
15151
14842
  // Import vue components
15152
14843
 
14844
+ // install function executed by Vue.use()
15153
14845
  const install = function installRbDocumentFormConstructor(Vue) {
15154
- Object.entries(components).forEach(_ref => {
15155
- let [componentName, component] = _ref;
14846
+ Object.entries(components).forEach(([componentName, component]) => {
15156
14847
  Vue.component(componentName, component);
15157
14848
  });
15158
- }; // Create module definition for Vue.use()
14849
+ };
15159
14850
 
15160
14851
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default, i18n };