rb-document-form-constructor 0.8.75 → 0.8.76

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,11 +1,11 @@
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
  }
8
+
9
9
  let found = null;
10
10
  formConfig.sections.every(r => {
11
11
  if (r.columns) {
@@ -15,21 +15,25 @@ const UtFormConfig = {
15
15
  found = f;
16
16
  }
17
17
  });
18
+
18
19
  if (found) {
19
20
  return false;
20
21
  }
21
22
  });
22
23
  }
24
+
23
25
  if (found) {
24
26
  return false;
25
27
  }
26
28
  });
27
29
  return found;
28
30
  },
31
+
29
32
  findRule(ruleId, formConfig) {
30
33
  if (!formConfig || !formConfig.sections) {
31
34
  return null;
32
35
  }
36
+
33
37
  let found = null;
34
38
  formConfig.sections.every(s => {
35
39
  if (s.columns) {
@@ -42,21 +46,25 @@ const UtFormConfig = {
42
46
  }
43
47
  });
44
48
  }
49
+
45
50
  if (found) {
46
51
  return false;
47
52
  }
48
53
  });
54
+
49
55
  if (found) {
50
56
  return false;
51
57
  }
52
58
  });
53
59
  }
60
+
54
61
  if (found) {
55
62
  return false;
56
63
  }
57
64
  });
58
65
  return found;
59
66
  },
67
+
60
68
  getFields(formConfig) {
61
69
  let fields = [];
62
70
  formConfig.sections.forEach(s => {
@@ -72,6 +80,7 @@ const UtFormConfig = {
72
80
  });
73
81
  return fields;
74
82
  },
83
+
75
84
  parseFacets(formConfig) {
76
85
  let facets = [];
77
86
  formConfig.sections.forEach(section => {
@@ -85,6 +94,7 @@ const UtFormConfig = {
85
94
  });
86
95
  return facets;
87
96
  }
97
+
88
98
  };
89
99
 
90
100
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -4786,19 +4796,25 @@ notevil.Function = _Function;
4786
4796
  let __clone = function (data) {
4787
4797
  return JSON.parse(JSON.stringify(data));
4788
4798
  };
4799
+
4789
4800
  let __assign = function () {
4790
4801
  __assign = Object.assign || function __assign(t) {
4791
4802
  for (let s, i = 1, n = arguments.length; i < n; i++) {
4792
4803
  s = arguments[i];
4804
+
4793
4805
  for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4794
4806
  }
4807
+
4795
4808
  return t;
4796
4809
  };
4810
+
4797
4811
  return __assign.apply(this, arguments);
4798
4812
  };
4813
+
4799
4814
  let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
4800
4815
  for (let dataType in formConfigInputs) {
4801
4816
  let foundInputs = inputs[dataType];
4817
+
4802
4818
  if (foundInputs) {
4803
4819
  __mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
4804
4820
  } else {
@@ -4806,14 +4822,17 @@ let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
4806
4822
  }
4807
4823
  }
4808
4824
  };
4825
+
4809
4826
  let __mergeInputsInMap = function (inputs, formConfigInputs) {
4810
4827
  for (let name in formConfigInputs) {
4811
4828
  inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
4812
4829
  }
4813
4830
  };
4831
+
4814
4832
  let __mergeInputsInArray = function (inputs, formConfigInputs) {
4815
4833
  formConfigInputs.forEach(input => {
4816
4834
  let index = inputs.findIndex(item => item.name === input.name);
4835
+
4817
4836
  if (index >= 0) {
4818
4837
  inputs[index] = input;
4819
4838
  } else {
@@ -4821,12 +4840,16 @@ let __mergeInputsInArray = function (inputs, formConfigInputs) {
4821
4840
  }
4822
4841
  });
4823
4842
  };
4843
+
4824
4844
  let __applyDefaultProps = function (input, field) {
4825
4845
  for (let propName in input.props) {
4826
4846
  if (field) {
4827
4847
  if (field.input.propsData[propName]) {
4848
+ var _input$propsData, _input$props, _input$props$type;
4849
+
4828
4850
  input.propsData[propName] = field.input.propsData[propName];
4829
- if (input.propsData?.type && input.props?.type?.default) {
4851
+
4852
+ 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) {
4830
4853
  input.propsData.type = input.props.type.default;
4831
4854
  }
4832
4855
  }
@@ -4835,18 +4858,21 @@ let __applyDefaultProps = function (input, field) {
4835
4858
  }
4836
4859
  }
4837
4860
  };
4861
+
4838
4862
  let __applyRefProps = function (input, refConfig) {
4839
- if (refConfig?.propsData) {
4863
+ if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
4840
4864
  for (let propName in refConfig.propsData) {
4841
4865
  input.propsData[propName] = refConfig.propsData[propName];
4842
4866
  }
4843
4867
  }
4844
4868
  };
4869
+
4845
4870
  let __filterInputsByMultiple = function (inputs, multiple) {
4846
4871
  return inputs.filter(i => {
4847
4872
  return i.multiple && multiple || !i.multiple && !multiple;
4848
4873
  });
4849
4874
  };
4875
+
4850
4876
  let fcInputs = {
4851
4877
  string: {
4852
4878
  text: 'Текст',
@@ -5048,40 +5074,52 @@ let baseConfig = {
5048
5074
  };
5049
5075
  const UtFormConstructor = {
5050
5076
  config: {},
5077
+
5051
5078
  init(formConfig) {
5052
5079
  this.config = __clone(baseConfig);
5080
+
5053
5081
  if (formConfig) {
5054
5082
  if (formConfig.inputs) {
5055
5083
  __mergeInputsInMap(this.config.inputs, formConfig.inputs);
5056
5084
  }
5085
+
5057
5086
  if (formConfig.primitiveInputs) {
5058
5087
  __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
5059
5088
  }
5089
+
5060
5090
  if (formConfig.dictInputs) {
5061
5091
  __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
5062
5092
  }
5093
+
5063
5094
  if (formConfig.refInputs) {
5064
5095
  __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
5065
5096
  }
5097
+
5066
5098
  if (formConfig.refInputConfigs) {
5067
5099
  this.config.refInputConfigs = formConfig.refInputConfigs;
5068
5100
  }
5101
+
5069
5102
  if (formConfig.icons) {
5070
5103
  this.config.icons = __assign(this.config.icons, formConfig.icons);
5071
5104
  }
5105
+
5072
5106
  if (formConfig.rules) {
5073
5107
  this.config.rules = formConfig.rules;
5074
5108
  }
5109
+
5075
5110
  if (formConfig.ruleContext) {
5076
5111
  this.config.ruleContext = formConfig.ruleContext;
5077
5112
  }
5078
5113
  }
5079
5114
  },
5115
+
5080
5116
  getInputTypes(field) {
5081
5117
  let inputs = [];
5118
+
5082
5119
  if (!field) {
5083
5120
  return inputs;
5084
5121
  }
5122
+
5085
5123
  if (field.dict && !this.config.refInputs[field.ref]) {
5086
5124
  inputs = __filterInputsByMultiple(this.config.dictInputs, field.multiple);
5087
5125
  } else if (field.ref) {
@@ -5089,71 +5127,91 @@ const UtFormConstructor = {
5089
5127
  } else {
5090
5128
  inputs = __filterInputsByMultiple(this.config.primitiveInputs[field.type], field.multiple);
5091
5129
  }
5130
+
5092
5131
  return inputs;
5093
5132
  },
5133
+
5094
5134
  hasMultipleInputTypes(field) {
5095
- let inputs = this.getInputTypes({
5096
- ...field,
5135
+ let inputs = this.getInputTypes({ ...field,
5097
5136
  multiple: true
5098
5137
  });
5099
5138
  return inputs && inputs.length > 0;
5100
5139
  },
5140
+
5101
5141
  getDefaultInput(field) {
5102
5142
  let input = null;
5103
5143
  let inputs = this.getInputTypes(field);
5144
+
5104
5145
  if (!inputs) {
5105
5146
  input = this.primitiveInputs[0];
5106
5147
  }
5148
+
5107
5149
  if (field.ref && this.config.refInputs[field.ref]) {
5108
5150
  input = __clone(inputs[0]);
5151
+
5109
5152
  __applyDefaultProps(input);
5153
+
5110
5154
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5111
5155
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5112
5156
  }
5113
5157
  } else if (field.dict) {
5114
5158
  input = __clone(inputs[0]);
5115
5159
  input.props.dict.default = field.ref;
5160
+
5116
5161
  __applyDefaultProps(input);
5117
5162
  } else {
5118
5163
  input = __clone(inputs[0]);
5164
+
5119
5165
  __applyDefaultProps(input);
5120
5166
  }
5167
+
5121
5168
  return input;
5122
5169
  },
5170
+
5123
5171
  getInputTypeByName(name, field) {
5124
5172
  let input = __clone(this.config.inputs[name]);
5173
+
5125
5174
  if (field.ref && this.config.refInputs[field.ref]) {
5126
5175
  __applyDefaultProps(input);
5176
+
5127
5177
  if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5128
5178
  __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5129
5179
  }
5130
5180
  } else if (field.dict) {
5131
5181
  input.props.dict.default = field.ref;
5182
+
5132
5183
  __applyDefaultProps(input);
5133
5184
  } else {
5134
5185
  __applyDefaultProps(input, field);
5135
5186
  }
5187
+
5136
5188
  input.propsData['ref'] = field.name;
5137
5189
  return input;
5138
5190
  },
5191
+
5139
5192
  getAvailableFieldRules(field) {
5140
5193
  return this.config.rules.filter(rule => {
5141
5194
  return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
5142
5195
  });
5143
5196
  },
5197
+
5144
5198
  getRuleContext() {
5145
5199
  return this.config.ruleContext;
5146
5200
  },
5201
+
5147
5202
  runRule(context, script) {
5148
5203
  context = context ? context : {};
5149
5204
  context['console'] = console;
5150
5205
  context['Date'] = Date;
5151
5206
  context['Math'] = Math;
5207
+
5152
5208
  let func = function (script) {
5153
5209
  return notevil(script, context);
5154
5210
  };
5211
+
5155
5212
  func.call(context, script);
5156
5213
  }
5214
+
5157
5215
  };
5158
5216
 
5159
5217
  /*!
@@ -7416,7 +7474,6 @@ const i18n = new VueI18n$1({
7416
7474
  //
7417
7475
  //
7418
7476
  //
7419
-
7420
7477
  var script$5 = {
7421
7478
  name: 'DocTemplateSectionModal',
7422
7479
  props: {
@@ -7430,16 +7487,19 @@ var script$5 = {
7430
7487
  default: () => {}
7431
7488
  }
7432
7489
  },
7490
+
7433
7491
  data() {
7434
7492
  return {
7435
7493
  id: 'rb-doc-template-section-modal',
7436
7494
  label: {}
7437
7495
  };
7438
7496
  },
7497
+
7439
7498
  computed: {
7440
7499
  title() {
7441
7500
  return this.mode === 'ins' ? 'Добавление секции' : 'Редактирование секции';
7442
7501
  }
7502
+
7443
7503
  },
7444
7504
  watch: {
7445
7505
  section() {
@@ -7447,23 +7507,29 @@ var script$5 = {
7447
7507
  this.label = this.section;
7448
7508
  }
7449
7509
  }
7510
+
7450
7511
  },
7451
7512
  methods: {
7452
7513
  onOk() {
7453
7514
  this.section = this.label;
7515
+
7454
7516
  if (this.onAfterOk) {
7455
7517
  this.onAfterOk();
7456
7518
  }
7519
+
7457
7520
  this.$nextTick(() => {
7458
7521
  this.$bvModal.hide(this.id);
7459
7522
  });
7460
7523
  }
7524
+
7461
7525
  },
7526
+
7462
7527
  created() {
7463
7528
  if (this.section) {
7464
7529
  this.label = this.section;
7465
7530
  }
7466
7531
  }
7532
+
7467
7533
  };
7468
7534
 
7469
7535
  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
@@ -7543,12 +7609,15 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
7543
7609
 
7544
7610
  /* script */
7545
7611
  const __vue_script__$5 = script$5;
7546
-
7547
7612
  /* template */
7613
+
7548
7614
  var __vue_render__$5 = function () {
7549
7615
  var _vm = this;
7616
+
7550
7617
  var _h = _vm.$createElement;
7618
+
7551
7619
  var _c = _vm._self._c || _h;
7620
+
7552
7621
  return _c('b-modal', {
7553
7622
  attrs: {
7554
7623
  "id": "rb-doc-template-section-modal",
@@ -7589,15 +7658,19 @@ var __vue_render__$5 = function () {
7589
7658
  }
7590
7659
  })], 1)], 1)], 1)], 1)], 1);
7591
7660
  };
7592
- var __vue_staticRenderFns__$5 = [];
7593
7661
 
7662
+ var __vue_staticRenderFns__$5 = [];
7594
7663
  /* style */
7664
+
7595
7665
  const __vue_inject_styles__$5 = undefined;
7596
7666
  /* scoped */
7667
+
7597
7668
  const __vue_scope_id__$5 = undefined;
7598
7669
  /* module identifier */
7670
+
7599
7671
  const __vue_module_identifier__$5 = undefined;
7600
7672
  /* functional template */
7673
+
7601
7674
  const __vue_is_functional_template__$5 = false;
7602
7675
  /* style inject */
7603
7676
 
@@ -7609,6 +7682,7 @@ const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
7609
7682
  render: __vue_render__$5,
7610
7683
  staticRenderFns: __vue_staticRenderFns__$5
7611
7684
  }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
7685
+
7612
7686
  var DocTemplateSectionModal = __vue_component__$6;
7613
7687
 
7614
7688
  /**!
@@ -12995,6 +13069,7 @@ var script$4 = {
12995
13069
  default: () => []
12996
13070
  }
12997
13071
  },
13072
+
12998
13073
  data() {
12999
13074
  return {
13000
13075
  allFacets: [],
@@ -13002,21 +13077,26 @@ var script$4 = {
13002
13077
  facetSearchStr: null
13003
13078
  };
13004
13079
  },
13080
+
13005
13081
  computed: {
13006
13082
  iconExpandFacet() {
13007
13083
  return UtFormConstructor.config.icons.iconExpandFacet;
13008
13084
  },
13085
+
13009
13086
  iconCollapseFacet() {
13010
13087
  return UtFormConstructor.config.icons.iconCollapseFacet;
13011
13088
  }
13089
+
13012
13090
  },
13013
13091
  watch: {
13014
13092
  facetSearchStr() {
13015
13093
  this.findInFacets(this.facetSearchStr);
13016
13094
  },
13095
+
13017
13096
  facets() {
13018
13097
  this.handleFacetsProp();
13019
13098
  }
13099
+
13020
13100
  },
13021
13101
  methods: {
13022
13102
  onFieldCloned(cloneField) {
@@ -13024,55 +13104,69 @@ var script$4 = {
13024
13104
  field.input = UtFormConstructor.getDefaultInput(field);
13025
13105
  return field;
13026
13106
  },
13107
+
13027
13108
  onFieldMoveEnd(event) {
13028
13109
  this.$emit('fieldMoveEnd', event);
13029
13110
  },
13111
+
13030
13112
  findInFacets(str) {
13031
13113
  str = str.toLowerCase();
13114
+
13032
13115
  if (!str || str.length === 0) {
13033
13116
  this.innerFacets = this.allFacets;
13034
13117
  }
13118
+
13035
13119
  let facets = JSON.parse(JSON.stringify(this.allFacets));
13036
13120
  facets = facets.filter(facet => {
13037
13121
  let facetFound = false;
13038
13122
  facet.fields = facet.fields.filter(field => {
13039
13123
  let fieldFound = field.labelRu.toLowerCase().indexOf(str) >= 0;
13124
+
13040
13125
  if (fieldFound) {
13041
13126
  facetFound = true;
13042
13127
  }
13128
+
13043
13129
  return fieldFound;
13044
13130
  });
13045
13131
  return facetFound;
13046
13132
  });
13047
13133
  this.innerFacets = facets;
13048
13134
  },
13135
+
13049
13136
  handleFacetsProp() {
13050
- let innerFacets = this.facets.map(f => ({
13051
- ...f,
13137
+ let innerFacets = this.facets.map(f => ({ ...f,
13052
13138
  expanded: false
13053
13139
  }));
13140
+
13054
13141
  if (innerFacets) {
13055
13142
  innerFacets.forEach(facet => {
13056
13143
  facet.fields = facet.fields.filter(field => !field.hiddenOnFormConfig);
13057
13144
  });
13058
13145
  }
13146
+
13059
13147
  this.innerFacets = JSON.parse(JSON.stringify(innerFacets));
13060
13148
  this.allFacets = JSON.parse(JSON.stringify(innerFacets));
13061
13149
  }
13150
+
13062
13151
  },
13152
+
13063
13153
  created() {
13064
13154
  this.handleFacetsProp();
13065
13155
  }
13156
+
13066
13157
  };
13067
13158
 
13068
13159
  /* script */
13069
13160
  const __vue_script__$4 = script$4;
13070
-
13071
13161
  /* template */
13162
+
13072
13163
  var __vue_render__$4 = function () {
13073
13164
  var _vm = this;
13165
+
13074
13166
  var _h = _vm.$createElement;
13167
+
13075
13168
  var _c = _vm._self._c || _h;
13169
+
13076
13170
  return _c('div', {
13077
13171
  staticClass: "rb-facets-sidebar"
13078
13172
  }, [_c('h4', [_vm._v("Компоненты")]), _vm._v(" "), _c('b-form', [_c('b-form-row', [_c('b-col', {
@@ -13143,15 +13237,19 @@ var __vue_render__$4 = function () {
13143
13237
  }), 1)], 1) : _vm._e()], 1) : _vm._e();
13144
13238
  }), 0)], 1);
13145
13239
  };
13146
- var __vue_staticRenderFns__$4 = [];
13147
13240
 
13241
+ var __vue_staticRenderFns__$4 = [];
13148
13242
  /* style */
13243
+
13149
13244
  const __vue_inject_styles__$4 = undefined;
13150
13245
  /* scoped */
13246
+
13151
13247
  const __vue_scope_id__$4 = undefined;
13152
13248
  /* module identifier */
13249
+
13153
13250
  const __vue_module_identifier__$4 = undefined;
13154
13251
  /* functional template */
13252
+
13155
13253
  const __vue_is_functional_template__$4 = false;
13156
13254
  /* style inject */
13157
13255
 
@@ -13163,183 +13261,8 @@ const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
13163
13261
  render: __vue_render__$4,
13164
13262
  staticRenderFns: __vue_staticRenderFns__$4
13165
13263
  }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
13166
- var DocTemplateFacetList = __vue_component__$5;
13167
-
13168
- // Unique ID creation requires a high quality random # generator. In node.js
13169
- // this is pretty straight-forward - we use the crypto API.
13170
-
13171
-
13172
-
13173
- var rng = function nodeRNG() {
13174
- return crypto.randomBytes(16);
13175
- };
13176
-
13177
- /**
13178
- * Convert array of 16 byte values to UUID string format of the form:
13179
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
13180
- */
13181
- var byteToHex = [];
13182
- for (var i = 0; i < 256; ++i) {
13183
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
13184
- }
13185
-
13186
- function bytesToUuid(buf, offset) {
13187
- var i = offset || 0;
13188
- var bth = byteToHex;
13189
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
13190
- return ([
13191
- bth[buf[i++]], bth[buf[i++]],
13192
- bth[buf[i++]], bth[buf[i++]], '-',
13193
- bth[buf[i++]], bth[buf[i++]], '-',
13194
- bth[buf[i++]], bth[buf[i++]], '-',
13195
- bth[buf[i++]], bth[buf[i++]], '-',
13196
- bth[buf[i++]], bth[buf[i++]],
13197
- bth[buf[i++]], bth[buf[i++]],
13198
- bth[buf[i++]], bth[buf[i++]]
13199
- ]).join('');
13200
- }
13201
-
13202
- var bytesToUuid_1 = bytesToUuid;
13203
-
13204
- // **`v1()` - Generate time-based UUID**
13205
- //
13206
- // Inspired by https://github.com/LiosK/UUID.js
13207
- // and http://docs.python.org/library/uuid.html
13208
-
13209
- var _nodeId;
13210
- var _clockseq;
13211
-
13212
- // Previous uuid creation time
13213
- var _lastMSecs = 0;
13214
- var _lastNSecs = 0;
13215
-
13216
- // See https://github.com/uuidjs/uuid for API details
13217
- function v1(options, buf, offset) {
13218
- var i = buf && offset || 0;
13219
- var b = buf || [];
13220
-
13221
- options = options || {};
13222
- var node = options.node || _nodeId;
13223
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
13224
-
13225
- // node and clockseq need to be initialized to random values if they're not
13226
- // specified. We do this lazily to minimize issues related to insufficient
13227
- // system entropy. See #189
13228
- if (node == null || clockseq == null) {
13229
- var seedBytes = rng();
13230
- if (node == null) {
13231
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
13232
- node = _nodeId = [
13233
- seedBytes[0] | 0x01,
13234
- seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
13235
- ];
13236
- }
13237
- if (clockseq == null) {
13238
- // Per 4.2.2, randomize (14 bit) clockseq
13239
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
13240
- }
13241
- }
13242
-
13243
- // UUID timestamps are 100 nano-second units since the Gregorian epoch,
13244
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
13245
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
13246
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
13247
- var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
13248
-
13249
- // Per 4.2.1.2, use count of uuid's generated during the current clock
13250
- // cycle to simulate higher resolution clock
13251
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
13252
-
13253
- // Time since last uuid creation (in msecs)
13254
- var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
13255
-
13256
- // Per 4.2.1.2, Bump clockseq on clock regression
13257
- if (dt < 0 && options.clockseq === undefined) {
13258
- clockseq = clockseq + 1 & 0x3fff;
13259
- }
13260
-
13261
- // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
13262
- // time interval
13263
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
13264
- nsecs = 0;
13265
- }
13266
13264
 
13267
- // Per 4.2.1.2 Throw error if too many uuids are requested
13268
- if (nsecs >= 10000) {
13269
- throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
13270
- }
13271
-
13272
- _lastMSecs = msecs;
13273
- _lastNSecs = nsecs;
13274
- _clockseq = clockseq;
13275
-
13276
- // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
13277
- msecs += 12219292800000;
13278
-
13279
- // `time_low`
13280
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
13281
- b[i++] = tl >>> 24 & 0xff;
13282
- b[i++] = tl >>> 16 & 0xff;
13283
- b[i++] = tl >>> 8 & 0xff;
13284
- b[i++] = tl & 0xff;
13285
-
13286
- // `time_mid`
13287
- var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
13288
- b[i++] = tmh >>> 8 & 0xff;
13289
- b[i++] = tmh & 0xff;
13290
-
13291
- // `time_high_and_version`
13292
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
13293
- b[i++] = tmh >>> 16 & 0xff;
13294
-
13295
- // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
13296
- b[i++] = clockseq >>> 8 | 0x80;
13297
-
13298
- // `clock_seq_low`
13299
- b[i++] = clockseq & 0xff;
13300
-
13301
- // `node`
13302
- for (var n = 0; n < 6; ++n) {
13303
- b[i + n] = node[n];
13304
- }
13305
-
13306
- return buf ? buf : bytesToUuid_1(b);
13307
- }
13308
-
13309
- var v1_1 = v1;
13310
-
13311
- function v4(options, buf, offset) {
13312
- var i = buf && offset || 0;
13313
-
13314
- if (typeof(options) == 'string') {
13315
- buf = options === 'binary' ? new Array(16) : null;
13316
- options = null;
13317
- }
13318
- options = options || {};
13319
-
13320
- var rnds = options.random || (options.rng || rng)();
13321
-
13322
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
13323
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
13324
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
13325
-
13326
- // Copy bytes to buffer, if provided
13327
- if (buf) {
13328
- for (var ii = 0; ii < 16; ++ii) {
13329
- buf[i + ii] = rnds[ii];
13330
- }
13331
- }
13332
-
13333
- return buf || bytesToUuid_1(rnds);
13334
- }
13335
-
13336
- var v4_1 = v4;
13337
-
13338
- var uuid = v4_1;
13339
- uuid.v1 = v1_1;
13340
- uuid.v4 = v4_1;
13341
-
13342
- var uuid_1 = uuid;
13265
+ var DocTemplateFacetList = __vue_component__$5;
13343
13266
 
13344
13267
  var toString = Object.prototype.toString;
13345
13268
 
@@ -13360,7 +13283,6 @@ var _typeof = function(object) {
13360
13283
  };
13361
13284
 
13362
13285
  //
13363
- // import safeEval from "notevil";
13364
13286
 
13365
13287
  var script$3 = {
13366
13288
  name: 'DocForm',
@@ -13391,34 +13313,42 @@ var script$3 = {
13391
13313
  default: true
13392
13314
  }
13393
13315
  },
13316
+
13394
13317
  data() {
13395
13318
  return {
13396
13319
  validationState: {}
13397
13320
  };
13398
13321
  },
13322
+
13399
13323
  watch: {
13400
13324
  formConfig() {
13401
13325
  this.validationState = {};
13402
13326
  this.execApplyDefaultValues();
13403
13327
  this.execApplyDefaultValRule();
13404
13328
  }
13329
+
13405
13330
  },
13406
13331
  methods: {
13407
13332
  getResolveValueName(field) {
13408
13333
  if ((field.dict || field.ref) && !field.multiple) {
13409
13334
  return field.name.substring(0, field.name.length - 2);
13410
13335
  }
13336
+
13411
13337
  return field.name;
13412
13338
  },
13339
+
13413
13340
  getResolveValue(field) {
13414
13341
  return this.doc[this.getResolveValueName(field)] ? this.doc[this.getResolveValueName(field)] : null;
13415
13342
  },
13416
- setResolveValue({
13417
- field,
13418
- multiple = false
13419
- }) {
13343
+
13344
+ setResolveValue(_ref) {
13345
+ let {
13346
+ field,
13347
+ multiple = false
13348
+ } = _ref;
13420
13349
  this.getResolveValue(field);
13421
13350
  },
13351
+
13422
13352
  getDisplayField(value) {
13423
13353
  if (!value[this.displayField]) {
13424
13354
  return value.labelRu;
@@ -13426,16 +13356,20 @@ var script$3 = {
13426
13356
  return value[this.displayField];
13427
13357
  }
13428
13358
  },
13359
+
13429
13360
  onEventFired(eventName, event, field) {
13430
13361
  if (eventName === 'input' && field.ref && !field.multiple) {
13431
13362
  let dataField = null;
13363
+
13432
13364
  if (field.name.lastIndexOf(this.refSuffix) >= 0) {
13433
13365
  dataField = field.name.substring(0, field.name.lastIndexOf(this.refSuffix));
13434
13366
  }
13367
+
13435
13368
  if (dataField && dataField.length > 0) {
13436
13369
  this.doc[dataField] = null;
13437
13370
  }
13438
13371
  }
13372
+
13439
13373
  if (field.rules) {
13440
13374
  field.rules.forEach(rule => {
13441
13375
  if (rule.event === eventName && rule.script) {
@@ -13447,6 +13381,7 @@ var script$3 = {
13447
13381
  });
13448
13382
  }
13449
13383
  },
13384
+
13450
13385
  onGlobalEventFired(eventName, event) {
13451
13386
  let fields = UtFormConfig.getFields(this.formConfig);
13452
13387
  fields.forEach(f => {
@@ -13462,6 +13397,7 @@ var script$3 = {
13462
13397
  }
13463
13398
  });
13464
13399
  },
13400
+
13465
13401
  createRuleContext(additionalContext) {
13466
13402
  return Object.assign({
13467
13403
  form: this,
@@ -13469,58 +13405,81 @@ var script$3 = {
13469
13405
  ...additionalContext
13470
13406
  }, UtFormConstructor.getRuleContext());
13471
13407
  },
13408
+
13472
13409
  runRule(rule, context) {
13473
13410
  UtFormConstructor.runRule(this.createRuleContext(context), rule.script);
13474
13411
  },
13412
+
13475
13413
  isValueEmpty(fieldName) {
13414
+ var _this$doc$fieldName;
13415
+
13476
13416
  if (this.doc[fieldName] == null) {
13477
13417
  return true;
13478
13418
  }
13479
- if (Array.isArray(this.doc[fieldName]) && !this.doc[fieldName]?.length) {
13419
+
13420
+ if (Array.isArray(this.doc[fieldName]) && !((_this$doc$fieldName = this.doc[fieldName]) !== null && _this$doc$fieldName !== void 0 && _this$doc$fieldName.length)) {
13480
13421
  return true;
13481
13422
  }
13423
+
13482
13424
  if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
13483
13425
  return true;
13484
13426
  }
13427
+
13485
13428
  return false;
13486
13429
  },
13430
+
13487
13431
  isValueLessThanMax(fieldname, max) {
13488
13432
  if (this.doc[fieldname] && max) {
13489
- return this.doc[fieldname]?.length > parseInt(max);
13433
+ var _this$doc$fieldname;
13434
+
13435
+ return ((_this$doc$fieldname = this.doc[fieldname]) === null || _this$doc$fieldname === void 0 ? void 0 : _this$doc$fieldname.length) > parseInt(max);
13490
13436
  }
13437
+
13491
13438
  return false;
13492
13439
  },
13440
+
13493
13441
  isValueLessThanMin(fieldname, min) {
13494
13442
  if (this.doc[fieldname] && min) {
13495
13443
  return parseInt(this.doc[fieldname]) < parseInt(min);
13496
13444
  }
13445
+
13497
13446
  return false;
13498
13447
  },
13448
+
13499
13449
  validate() {
13500
13450
  this.formConfig.sections.forEach(s => {
13501
13451
  s.columns.forEach(c => {
13502
13452
  c.fields.forEach(f => {
13453
+ var _f$input$propsData;
13454
+
13503
13455
  let feedback = '';
13456
+
13504
13457
  if (f.required && this.isValueEmpty(f.name)) {
13505
13458
  feedback += i18n.t('validate.required', {
13506
13459
  field: this.getDisplayField(f)
13507
13460
  });
13508
13461
  }
13462
+
13509
13463
  if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
13510
13464
  feedback += `\n${i18n.t('validate.min', {
13511
13465
  min: f.input.propsData.min
13512
13466
  })}`;
13467
+ } // TODO: Костыль так как на бэке нету типа memo
13468
+
13469
+
13470
+ 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)) {
13471
+ var _f$input$propsData2;
13472
+
13473
+ feedback += `\nМаксимальное значение для этого поля ${(_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max}`;
13513
13474
  }
13514
- // TODO: Костыль так как на бэке нету типа memo
13515
- if (f.input.type === 'b-form-textarea' && this.isValueLessThanMax(f.name, f.input.propsData?.max)) {
13516
- feedback += `\nМаксимальное значение для этого поля ${f.input.propsData?.max}`;
13517
- }
13475
+
13518
13476
  if (feedback) {
13519
13477
  Vue$1.set(this.validationState, f.name, false);
13520
13478
  Vue$1.set(this.validationState, `${f.name}__feedback`, feedback);
13521
13479
  } else {
13522
13480
  Vue$1.set(this.validationState, f.name, null);
13523
13481
  }
13482
+
13524
13483
  this.onEventFired('validate', {
13525
13484
  validationState: this.validationState,
13526
13485
  doc: this.doc
@@ -13528,21 +13487,27 @@ var script$3 = {
13528
13487
  });
13529
13488
  });
13530
13489
  });
13490
+
13531
13491
  for (let fieldName in this.validationState) {
13532
13492
  if (this.validationState[fieldName] === false) {
13533
13493
  return false;
13534
13494
  }
13535
13495
  }
13496
+
13536
13497
  return true;
13537
13498
  },
13499
+
13538
13500
  getColumnSize(section) {
13539
13501
  const MAX_COLUMN_SIZE = 12;
13502
+
13540
13503
  if (!section || !section.columnCount) {
13541
13504
  return MAX_COLUMN_SIZE;
13542
13505
  }
13506
+
13543
13507
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
13544
13508
  return colSize;
13545
13509
  },
13510
+
13546
13511
  execApplyDefaultValues() {
13547
13512
  if (this.applyDefaultValues) {
13548
13513
  this.formConfig.sections.forEach(r => {
@@ -13550,11 +13515,13 @@ var script$3 = {
13550
13515
  c.fields.forEach(f => {
13551
13516
  if (f.defaultValue) {
13552
13517
  let defValue;
13518
+
13553
13519
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
13554
13520
  defValue = f.defaultValue();
13555
13521
  } else {
13556
13522
  defValue = f.defaultValue == null ? null : f.defaultValue;
13557
13523
  }
13524
+
13558
13525
  this.$set(this.doc, f.name, f.defaultValue = defValue);
13559
13526
  }
13560
13527
  });
@@ -13562,6 +13529,7 @@ var script$3 = {
13562
13529
  });
13563
13530
  }
13564
13531
  },
13532
+
13565
13533
  execApplyDefaultValRule() {
13566
13534
  this.formConfig.sections.forEach(el => {
13567
13535
  el.columns.forEach(c => {
@@ -13569,6 +13537,7 @@ var script$3 = {
13569
13537
  if (f.rules) {
13570
13538
  if (!f.defaultValue) {
13571
13539
  const rule = f.rules.find(rule => rule.event === 'defaultValue');
13540
+
13572
13541
  if (rule && !this.doc[f.name]) {
13573
13542
  this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
13574
13543
  }
@@ -13578,27 +13547,34 @@ var script$3 = {
13578
13547
  });
13579
13548
  });
13580
13549
  }
13550
+
13581
13551
  },
13552
+
13582
13553
  mounted() {
13583
13554
  this.execApplyDefaultValues();
13584
13555
  this.execApplyDefaultValRule();
13585
13556
  this.onGlobalEventFired('form-mounted', this);
13586
13557
  },
13558
+
13587
13559
  activated() {
13588
13560
  this.execApplyDefaultValues();
13589
13561
  this.execApplyDefaultValRule();
13590
13562
  this.onGlobalEventFired('form-activated', this);
13591
13563
  }
13564
+
13592
13565
  };
13593
13566
 
13594
13567
  /* script */
13595
13568
  const __vue_script__$3 = script$3;
13596
-
13597
13569
  /* template */
13570
+
13598
13571
  var __vue_render__$3 = function () {
13599
13572
  var _vm = this;
13573
+
13600
13574
  var _h = _vm.$createElement;
13575
+
13601
13576
  var _c = _vm._self._c || _h;
13577
+
13602
13578
  return _vm.formConfig && _vm.formConfig.sections ? _c('b-form', {
13603
13579
  staticClass: "rb-doc-form",
13604
13580
  on: {
@@ -13696,15 +13672,19 @@ var __vue_render__$3 = function () {
13696
13672
  })], 2)], 1);
13697
13673
  }), 1) : _vm._e();
13698
13674
  };
13699
- var __vue_staticRenderFns__$3 = [];
13700
13675
 
13676
+ var __vue_staticRenderFns__$3 = [];
13701
13677
  /* style */
13678
+
13702
13679
  const __vue_inject_styles__$3 = undefined;
13703
13680
  /* scoped */
13681
+
13704
13682
  const __vue_scope_id__$3 = undefined;
13705
13683
  /* module identifier */
13684
+
13706
13685
  const __vue_module_identifier__$3 = undefined;
13707
13686
  /* functional template */
13687
+
13708
13688
  const __vue_is_functional_template__$3 = false;
13709
13689
  /* style inject */
13710
13690
 
@@ -13716,8 +13696,28 @@ const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
13716
13696
  render: __vue_render__$3,
13717
13697
  staticRenderFns: __vue_staticRenderFns__$3
13718
13698
  }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
13699
+
13719
13700
  var DocForm = __vue_component__$4;
13720
13701
 
13702
+ const generateRandomString = length => {
13703
+ let result = '';
13704
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
13705
+ const charactersLength = characters.length;
13706
+
13707
+ for (let i = 0; i < length; i++) {
13708
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
13709
+ }
13710
+
13711
+ return result;
13712
+ };
13713
+
13714
+ const UtRandom = {
13715
+ getRandomString(length) {
13716
+ return generateRandomString(length);
13717
+ }
13718
+
13719
+ };
13720
+
13721
13721
  //
13722
13722
  var script$2 = {
13723
13723
  name: 'FieldRuleFormModal',
@@ -13734,6 +13734,7 @@ var script$2 = {
13734
13734
  },
13735
13735
  onAfterOk: Function
13736
13736
  },
13737
+
13737
13738
  data() {
13738
13739
  return {
13739
13740
  id: 'rb-field-rule-form-modal',
@@ -13742,21 +13743,26 @@ var script$2 = {
13742
13743
  innerRule: null
13743
13744
  };
13744
13745
  },
13746
+
13745
13747
  computed: {
13746
13748
  title() {
13747
13749
  return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
13748
13750
  },
13751
+
13749
13752
  fields() {
13750
13753
  return UtFormConfig.getFields(this.formConfig);
13751
13754
  },
13755
+
13752
13756
  rulePresets() {
13753
13757
  return UtFormConstructor.getAvailableFieldRules(this.field);
13754
13758
  }
13759
+
13755
13760
  },
13756
13761
  watch: {
13757
13762
  formConfig() {
13758
13763
  this.copyToInnerFormConfig();
13759
13764
  },
13765
+
13760
13766
  rule() {
13761
13767
  if (this.rule) {
13762
13768
  this.innerRule = this.rule;
@@ -13764,6 +13770,7 @@ var script$2 = {
13764
13770
  this.innerRule = this.getDefaultRule();
13765
13771
  }
13766
13772
  }
13773
+
13767
13774
  },
13768
13775
  methods: {
13769
13776
  validateFields(fieldName) {
@@ -13778,14 +13785,18 @@ var script$2 = {
13778
13785
  }
13779
13786
  });
13780
13787
  },
13788
+
13781
13789
  copyToInnerFormConfig() {
13782
13790
  this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
13783
13791
  },
13792
+
13784
13793
  applyRuleToInnerFormConfig() {
13785
13794
  if (this.innerFormConfig) {
13786
13795
  let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
13796
+
13787
13797
  if (!foundRule) {
13788
13798
  let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
13799
+
13789
13800
  if (foundField) {
13790
13801
  foundField.rules = foundField.rules ? foundField.rules : [];
13791
13802
  foundField.rules.push(this.rule);
@@ -13795,12 +13806,14 @@ var script$2 = {
13795
13806
  }
13796
13807
  }
13797
13808
  },
13809
+
13798
13810
  onActivateTab(index) {
13799
13811
  if (index > 0) {
13800
13812
  this.copyToInnerFormConfig();
13801
13813
  this.applyRuleToInnerFormConfig();
13802
13814
  }
13803
13815
  },
13816
+
13804
13817
  getDefaultState() {
13805
13818
  return {
13806
13819
  name: null,
@@ -13808,30 +13821,36 @@ var script$2 = {
13808
13821
  script: null
13809
13822
  };
13810
13823
  },
13824
+
13811
13825
  getDefaultRule() {
13812
13826
  return {
13813
- id: uuid_1.v4(),
13827
+ id: UtRandom.getRandomString(10),
13814
13828
  name: null,
13815
13829
  event: null,
13816
13830
  script: null
13817
13831
  };
13818
13832
  },
13833
+
13819
13834
  resetModal() {
13820
13835
  this.state = this.getDefaultState();
13821
13836
  this.innerRule = null;
13822
13837
  },
13838
+
13823
13839
  addVariableToScript(varName) {
13824
13840
  let caretPosition = this.$refs.scriptInput.selectionStart;
13825
13841
  this.insertTextToScript(varName, caretPosition);
13826
13842
  },
13843
+
13827
13844
  addSetVariableToScript(field) {
13828
13845
  let caretPosition = this.$refs.scriptInput.selectionStart;
13829
13846
  this.insertTextToScript(`doc['${field.name}'] = Значение;`, caretPosition);
13830
13847
  },
13848
+
13831
13849
  addCallInputFunction(field) {
13832
13850
  let caretPosition = this.$refs.scriptInput.selectionStart;
13833
13851
  this.insertTextToScript(`form.$refs['${field.name}'][0].Название функции();`, caretPosition);
13834
13852
  },
13853
+
13835
13854
  insertTextToScript(text, position) {
13836
13855
  position = position != null ? position : this.script.length;
13837
13856
  this.innerRule.script = this.innerRule.script != null ? this.innerRule.script : '';
@@ -13839,39 +13858,50 @@ var script$2 = {
13839
13858
  scriptSplit.splice(position, 0, text);
13840
13859
  this.innerRule.script = scriptSplit.join('');
13841
13860
  },
13861
+
13842
13862
  onRuleSelected(ruleName) {
13843
13863
  let rule = this.rulePresets.find(rule => rule.name === ruleName);
13864
+
13844
13865
  if (rule) {
13845
13866
  Object.assign(this.innerRule, rule);
13846
13867
  this.innerRule.script = this.innerRule.script.trim();
13847
13868
  }
13848
13869
  },
13870
+
13849
13871
  onOk() {
13850
13872
  this.validateFields();
13873
+
13851
13874
  if (this.state.name && this.state.script) {
13852
13875
  if (this.onAfterOk) {
13853
13876
  this.onAfterOk(this.innerRule);
13854
13877
  }
13878
+
13855
13879
  this.$nextTick(() => {
13856
13880
  this.resetModal();
13857
13881
  this.$bvModal.hide(this.id);
13858
13882
  });
13859
13883
  }
13860
13884
  }
13885
+
13861
13886
  },
13887
+
13862
13888
  created() {
13863
13889
  this.copyToInnerFormConfig();
13864
13890
  }
13891
+
13865
13892
  };
13866
13893
 
13867
13894
  /* script */
13868
13895
  const __vue_script__$2 = script$2;
13869
-
13870
13896
  /* template */
13897
+
13871
13898
  var __vue_render__$2 = function () {
13872
13899
  var _vm = this;
13900
+
13873
13901
  var _h = _vm.$createElement;
13902
+
13874
13903
  var _c = _vm._self._c || _h;
13904
+
13875
13905
  return _c('b-modal', {
13876
13906
  attrs: {
13877
13907
  "id": _vm.id,
@@ -14124,15 +14154,19 @@ var __vue_render__$2 = function () {
14124
14154
  }
14125
14155
  })], 1) : _vm._e()], 1)], 1)], 1);
14126
14156
  };
14127
- var __vue_staticRenderFns__$2 = [];
14128
14157
 
14158
+ var __vue_staticRenderFns__$2 = [];
14129
14159
  /* style */
14160
+
14130
14161
  const __vue_inject_styles__$2 = undefined;
14131
14162
  /* scoped */
14163
+
14132
14164
  const __vue_scope_id__$2 = undefined;
14133
14165
  /* module identifier */
14166
+
14134
14167
  const __vue_module_identifier__$2 = undefined;
14135
14168
  /* functional template */
14169
+
14136
14170
  const __vue_is_functional_template__$2 = false;
14137
14171
  /* style inject */
14138
14172
 
@@ -14144,6 +14178,7 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
14144
14178
  render: __vue_render__$2,
14145
14179
  staticRenderFns: __vue_staticRenderFns__$2
14146
14180
  }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
14181
+
14147
14182
  var FieldRuleFormModal = __vue_component__$3;
14148
14183
 
14149
14184
  //
@@ -14163,6 +14198,7 @@ var script$1 = {
14163
14198
  },
14164
14199
  formConfig: Object
14165
14200
  },
14201
+
14166
14202
  data() {
14167
14203
  return {
14168
14204
  innerVisible: null,
@@ -14173,64 +14209,81 @@ var script$1 = {
14173
14209
  rule: {},
14174
14210
  mode: 'ins'
14175
14211
  },
14176
- rulesHash: uuid_1.v4()
14212
+ rulesHash: UtRandom.getRandomString(10)
14177
14213
  };
14178
14214
  },
14215
+
14179
14216
  computed: {
14180
14217
  inputOptions() {
14181
14218
  return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
14182
14219
  },
14220
+
14183
14221
  iconCloseSidebar() {
14184
14222
  return UtFormConstructor.config.icons.iconCloseFieldSidebar;
14185
14223
  },
14224
+
14186
14225
  iconOpenSidebar() {
14187
14226
  return UtFormConstructor.config.icons.iconOpenFieldSidebar;
14188
14227
  },
14228
+
14189
14229
  iconAdd() {
14190
14230
  return UtFormConstructor.config.icons.iconAdd;
14191
14231
  },
14232
+
14192
14233
  rules() {
14193
14234
  return UtFormConstructor.getAvailableFieldRules(this.field);
14194
14235
  },
14236
+
14195
14237
  hasMultipleInputTypes() {
14196
14238
  return UtFormConstructor.hasMultipleInputTypes(this.field);
14197
14239
  },
14240
+
14198
14241
  multiple() {
14199
14242
  return this.field && this.field.multiple;
14200
14243
  }
14244
+
14201
14245
  },
14202
14246
  watch: {
14203
14247
  visible() {
14204
14248
  this.innerVisible = this.visible;
14205
14249
  },
14250
+
14206
14251
  value() {
14207
14252
  this.field = this.value;
14253
+
14208
14254
  if (this.field && this.field.input) {
14209
14255
  this.currentInputName = this.field.input.name;
14210
14256
  }
14211
14257
  },
14258
+
14212
14259
  field: {
14213
14260
  handler() {
14214
14261
  this.$emit('input', this.field);
14215
14262
  this.$emit('change', this.field);
14216
14263
  },
14264
+
14217
14265
  deep: true
14218
14266
  },
14267
+
14219
14268
  currentInputName(val) {
14220
14269
  this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
14221
14270
  },
14271
+
14222
14272
  multiple() {
14223
14273
  let input = UtFormConstructor.getDefaultInput(this.field);
14274
+
14224
14275
  if (this.field.multiple) {
14225
14276
  this.currentInputName = input.name;
14226
14277
  }
14227
14278
  }
14279
+
14228
14280
  },
14229
14281
  methods: {
14230
14282
  hide() {
14231
14283
  this.innerVisible = false;
14232
14284
  this.$emit('hide');
14233
14285
  },
14286
+
14234
14287
  getPropInputType(prop, propName) {
14235
14288
  if (['string', 'number'].includes(prop.type)) {
14236
14289
  return 'b-form-input';
@@ -14240,6 +14293,7 @@ var script$1 = {
14240
14293
  return 'rb-boolean-single-option-input';
14241
14294
  }
14242
14295
  },
14296
+
14243
14297
  getPropInputPropData(prop, propName) {
14244
14298
  if (prop.type === 'string') {
14245
14299
  return {
@@ -14253,6 +14307,7 @@ var script$1 = {
14253
14307
  return {};
14254
14308
  }
14255
14309
  },
14310
+
14256
14311
  addRule() {
14257
14312
  this.ruleModalCfg = {
14258
14313
  mode: 'ins',
@@ -14262,22 +14317,22 @@ var script$1 = {
14262
14317
  },
14263
14318
  onAfterOk: rule => {
14264
14319
  this.field.rules = this.field.rules ? this.field.rules : [];
14265
- this.field.rules.push({
14266
- ...rule
14320
+ this.field.rules.push({ ...rule
14267
14321
  });
14268
- this.rulesHash = uuid_1.v4();
14322
+ this.rulesHash = UtRandom.getRandomString(10);
14269
14323
  }
14270
14324
  };
14271
14325
  this.$bvModal.show(this.modalId);
14272
14326
  },
14327
+
14273
14328
  editRule(rule, event) {
14274
14329
  if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
14275
14330
  return;
14276
14331
  }
14332
+
14277
14333
  this.ruleModalCfg = {
14278
14334
  mode: 'upd',
14279
- rule: {
14280
- ...rule
14335
+ rule: { ...rule
14281
14336
  },
14282
14337
  onAfterOk: modalRule => {
14283
14338
  Object.assign(rule, modalRule);
@@ -14285,33 +14340,43 @@ var script$1 = {
14285
14340
  };
14286
14341
  this.$bvModal.show(this.modalId);
14287
14342
  },
14343
+
14288
14344
  removeRule(rule) {
14289
14345
  let index = this.field.rules.findIndex(r => r.id === rule.id);
14346
+
14290
14347
  if (index >= 0) {
14291
14348
  this.field.rules.splice(index, 1);
14292
14349
  }
14293
- this.rulesHash = uuid_1.v4();
14350
+
14351
+ this.rulesHash = UtRandom.getRandomString(10);
14294
14352
  }
14353
+
14295
14354
  },
14355
+
14296
14356
  created() {
14297
14357
  if (this.value) {
14298
14358
  this.innerVisible = this.visible;
14299
14359
  this.field = this.value;
14360
+
14300
14361
  if (this.field && this.field.input) {
14301
14362
  this.currentInputName = this.field.input.name;
14302
14363
  }
14303
14364
  }
14304
14365
  }
14366
+
14305
14367
  };
14306
14368
 
14307
14369
  /* script */
14308
14370
  const __vue_script__$1 = script$1;
14309
-
14310
14371
  /* template */
14372
+
14311
14373
  var __vue_render__$1 = function () {
14312
14374
  var _vm = this;
14375
+
14313
14376
  var _h = _vm.$createElement;
14377
+
14314
14378
  var _c = _vm._self._c || _h;
14379
+
14315
14380
  return _c('b-sidebar', {
14316
14381
  staticClass: "rb-doc-template-field-sidebar",
14317
14382
  attrs: {
@@ -14549,15 +14614,19 @@ var __vue_render__$1 = function () {
14549
14614
  }
14550
14615
  })], 1);
14551
14616
  };
14552
- var __vue_staticRenderFns__$1 = [];
14553
14617
 
14618
+ var __vue_staticRenderFns__$1 = [];
14554
14619
  /* style */
14620
+
14555
14621
  const __vue_inject_styles__$1 = undefined;
14556
14622
  /* scoped */
14623
+
14557
14624
  const __vue_scope_id__$1 = undefined;
14558
14625
  /* module identifier */
14626
+
14559
14627
  const __vue_module_identifier__$1 = undefined;
14560
14628
  /* functional template */
14629
+
14561
14630
  const __vue_is_functional_template__$1 = false;
14562
14631
  /* style inject */
14563
14632
 
@@ -14569,6 +14638,7 @@ const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
14569
14638
  render: __vue_render__$1,
14570
14639
  staticRenderFns: __vue_staticRenderFns__$1
14571
14640
  }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
14641
+
14572
14642
  var DocTemplateFieldSidebar = __vue_component__$2;
14573
14643
 
14574
14644
  //
@@ -14594,6 +14664,7 @@ var script = {
14594
14664
  default: () => []
14595
14665
  }
14596
14666
  },
14667
+
14597
14668
  data() {
14598
14669
  return {
14599
14670
  sidebarVisible: false,
@@ -14604,32 +14675,41 @@ var script = {
14604
14675
  id: 'rb-doc-template-section-modal',
14605
14676
  mode: 'ins',
14606
14677
  section: null,
14678
+
14607
14679
  onAfterOk() {}
14680
+
14608
14681
  }
14609
14682
  };
14610
14683
  },
14684
+
14611
14685
  computed: {
14612
14686
  iconAdd() {
14613
14687
  return UtFormConstructor.config.icons.iconAdd;
14614
14688
  },
14689
+
14615
14690
  iconEdit() {
14616
14691
  return UtFormConstructor.config.icons.iconEdit;
14617
14692
  },
14693
+
14618
14694
  iconDelete() {
14619
14695
  return UtFormConstructor.config.icons.iconDelete;
14620
14696
  },
14697
+
14621
14698
  iconDrag() {
14622
14699
  return UtFormConstructor.config.icons.iconDrag;
14623
14700
  }
14701
+
14624
14702
  },
14625
14703
  methods: {
14626
14704
  showProperties(field, event) {
14627
14705
  if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
14628
14706
  return;
14629
14707
  }
14708
+
14630
14709
  this.sidebarVisible = true;
14631
14710
  this.sidebarField = field;
14632
14711
  },
14712
+
14633
14713
  addSection(columnCount) {
14634
14714
  let section = {
14635
14715
  labelRu: null,
@@ -14637,24 +14717,32 @@ var script = {
14637
14717
  };
14638
14718
  this.sectionModalCfg.mode = 'ins';
14639
14719
  this.sectionModalCfg.section = section;
14720
+
14640
14721
  this.sectionModalCfg.onAfterOk = () => {
14641
14722
  section.columns = [];
14723
+
14642
14724
  for (let i = 0; i < columnCount; i++) {
14643
14725
  section.columns.push({
14644
14726
  index: i,
14645
14727
  fields: []
14646
14728
  });
14647
14729
  }
14730
+
14648
14731
  this.formConfig.sections.push(section);
14649
14732
  };
14733
+
14650
14734
  this.$bvModal.show(this.sectionModalCfg.id);
14651
14735
  },
14736
+
14652
14737
  editSection(section) {
14653
14738
  this.sectionModalCfg.mode = 'update';
14654
14739
  this.sectionModalCfg.section = section;
14740
+
14655
14741
  this.sectionModalCfg.onAfterOk = () => {};
14742
+
14656
14743
  this.$bvModal.show(this.sectionModalCfg.id);
14657
14744
  },
14745
+
14658
14746
  removeSection(section, index) {
14659
14747
  this.formConfig.sections.splice(index, 1);
14660
14748
  /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
@@ -14678,31 +14766,40 @@ var script = {
14678
14766
  });
14679
14767
  return count > 1;
14680
14768
  },
14769
+
14681
14770
  removeFieldFromColumn(field, column, newIndex) {
14682
14771
  let index = newIndex != null ? newIndex : -1;
14772
+
14683
14773
  if (index < 0) {
14684
14774
  index = column.fields.findIndex(f => field.name === f.name);
14685
14775
  }
14776
+
14686
14777
  if (index >= 0) {
14687
14778
  column.fields.splice(index, 1);
14688
14779
  }
14689
14780
  },
14781
+
14690
14782
  onRemoveField(event, field, column) {
14691
14783
  event.preventDefault();
14692
14784
  this.removeFieldFromColumn(field, column);
14693
14785
  },
14786
+
14694
14787
  onFieldAddedToColumn(event, column, section) {
14695
14788
  this.columnTo = column;
14696
14789
  },
14790
+
14697
14791
  onFieldMoveEnd(event) {
14698
14792
  const {
14699
14793
  newIndex
14700
14794
  } = event;
14701
14795
  let field = event.item._underlying_vm_;
14796
+
14702
14797
  if (!field.hasOwnProperty('defaultValue')) {
14703
14798
  this.$set(field, 'defaultValue', undefined);
14704
14799
  }
14800
+
14705
14801
  let found = this.multipleFieldAreOnFormConfig(field);
14802
+
14706
14803
  if (found) {
14707
14804
  this.removeFieldFromColumn(field, this.columnTo, newIndex);
14708
14805
  this.resetDragVariables();
@@ -14716,30 +14813,36 @@ var script = {
14716
14813
  noCloseOnEsc: true
14717
14814
  });
14718
14815
  }
14816
+
14719
14817
  this.resetDragVariables();
14720
14818
  this.hash = (Math.random() + 1).toString(36).substring(7);
14721
14819
  },
14820
+
14722
14821
  getFieldExtendedPropsData(field) {
14723
- return {
14724
- ...field.input.propsData,
14822
+ return { ...field.input.propsData,
14725
14823
  placeholder: field.tag,
14726
14824
  disabled: true
14727
14825
  };
14728
14826
  },
14827
+
14729
14828
  resetDragVariables() {
14730
14829
  this.columnTo = null;
14731
14830
  }
14831
+
14732
14832
  }
14733
14833
  };
14734
14834
 
14735
14835
  /* script */
14736
14836
  const __vue_script__ = script;
14737
-
14738
14837
  /* template */
14838
+
14739
14839
  var __vue_render__ = function () {
14740
14840
  var _vm = this;
14841
+
14741
14842
  var _h = _vm.$createElement;
14843
+
14742
14844
  var _c = _vm._self._c || _h;
14845
+
14743
14846
  return _c('div', {
14744
14847
  staticClass: "rb-doc-template-constructor d-flex"
14745
14848
  }, [_c('doc-template-facet-list', {
@@ -14964,15 +15067,19 @@ var __vue_render__ = function () {
14964
15067
  }
14965
15068
  })], 1)], 1);
14966
15069
  };
14967
- var __vue_staticRenderFns__ = [];
14968
15070
 
15071
+ var __vue_staticRenderFns__ = [];
14969
15072
  /* style */
15073
+
14970
15074
  const __vue_inject_styles__ = undefined;
14971
15075
  /* scoped */
15076
+
14972
15077
  const __vue_scope_id__ = undefined;
14973
15078
  /* module identifier */
15079
+
14974
15080
  const __vue_module_identifier__ = undefined;
14975
15081
  /* functional template */
15082
+
14976
15083
  const __vue_is_functional_template__ = false;
14977
15084
  /* style inject */
14978
15085
 
@@ -14984,6 +15091,7 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
14984
15091
  render: __vue_render__,
14985
15092
  staticRenderFns: __vue_staticRenderFns__
14986
15093
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
15094
+
14987
15095
  var __vue_component__$1 = __vue_component__;
14988
15096
 
14989
15097
  /* eslint-disable import/prefer-default-export */
@@ -15003,11 +15111,11 @@ var components = /*#__PURE__*/Object.freeze({
15003
15111
 
15004
15112
  // Import vue components
15005
15113
 
15006
- // install function executed by Vue.use()
15007
15114
  const install = function installRbDocumentFormConstructor(Vue) {
15008
- Object.entries(components).forEach(([componentName, component]) => {
15115
+ Object.entries(components).forEach(_ref => {
15116
+ let [componentName, component] = _ref;
15009
15117
  Vue.component(componentName, component);
15010
15118
  });
15011
- };
15119
+ }; // Create module definition for Vue.use()
15012
15120
 
15013
15121
  export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default, i18n };