rb-document-form-constructor 0.5.9 → 0.6.2

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.
@@ -5149,6 +5149,7 @@ const UtFormConstructor = {
5149
5149
  runRule(context, script) {
5150
5150
  context = context ? context : {};
5151
5151
  context['console'] = console;
5152
+ context['Date'] = new Date();
5152
5153
 
5153
5154
  let func = function (script) {
5154
5155
  return notevil(script, context);
@@ -11088,6 +11089,7 @@ var script$3 = {
11088
11089
  formConfig() {
11089
11090
  this.validationState = {};
11090
11091
  this.execApplyDefaultValues();
11092
+ this.execApplyDefaultValRule();
11091
11093
  }
11092
11094
 
11093
11095
  },
@@ -11167,18 +11169,14 @@ var script$3 = {
11167
11169
  }
11168
11170
 
11169
11171
  let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
11170
- console.info("colSize", colSize);
11171
11172
  return colSize;
11172
11173
  },
11173
11174
 
11174
11175
  execApplyDefaultValues() {
11175
- console.info("this.applyDefaultValues", this.applyDefaultValues);
11176
-
11177
11176
  if (this.applyDefaultValues) {
11178
11177
  this.formConfig.sections.forEach(r => {
11179
11178
  r.columns.forEach(c => {
11180
11179
  c.fields.forEach(f => {
11181
- console.info("f", f);
11182
11180
  let defValue;
11183
11181
 
11184
11182
  if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
@@ -11187,22 +11185,37 @@ var script$3 = {
11187
11185
  defValue = f.defaultValue == null ? null : f.defaultValue;
11188
11186
  }
11189
11187
 
11190
- console.info("defValue", defValue);
11191
11188
  this.$set(this.doc, f.name, f.defaultValue = defValue);
11192
11189
  });
11193
11190
  });
11194
11191
  });
11195
11192
  }
11193
+ },
11194
+
11195
+ execApplyDefaultValRule() {
11196
+ this.formConfig.sections.forEach(el => {
11197
+ el.columns.forEach(c => {
11198
+ c.fields.forEach(f => {
11199
+ const rule = f.rules.find(rule => rule.event === 'defaultValue');
11200
+
11201
+ if (rule) {
11202
+ this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
11203
+ }
11204
+ });
11205
+ });
11206
+ });
11196
11207
  }
11197
11208
 
11198
11209
  },
11199
11210
 
11200
11211
  mounted() {
11201
11212
  this.execApplyDefaultValues();
11213
+ this.execApplyDefaultValRule();
11202
11214
  },
11203
11215
 
11204
11216
  activated() {
11205
11217
  this.execApplyDefaultValues();
11218
+ this.execApplyDefaultValRule();
11206
11219
  }
11207
11220
 
11208
11221
  };
@@ -11269,7 +11282,8 @@ var __vue_render__$3 = function () {
11269
11282
  attrs: {
11270
11283
  "disabled": !_vm.editable || !field.editable,
11271
11284
  "id": field.name,
11272
- "state": _vm.validationState[field.name]
11285
+ "state": _vm.validationState[field.name],
11286
+ "required": field.required
11273
11287
  },
11274
11288
  on: {
11275
11289
  "input": function ($event) {
@@ -11635,7 +11649,11 @@ var __vue_render__$2 = function () {
11635
11649
  attrs: {
11636
11650
  "value": 'validate'
11637
11651
  }
11638
- }, [_vm._v("\n Валидация\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11652
+ }, [_vm._v("\n Валидация\n ")]), _vm._v(" "), _c('b-form-select-option', {
11653
+ attrs: {
11654
+ "value": 'defaultValue'
11655
+ }
11656
+ }, [_vm._v("\n Установить значение по умолчанию\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11639
11657
  attrs: {
11640
11658
  "lg": "12"
11641
11659
  }
@@ -12023,22 +12041,6 @@ var __vue_render__$1 = function () {
12023
12041
  attrs: {
12024
12042
  "lg": "12"
12025
12043
  }
12026
- }, [_c('b-checkbox', {
12027
- attrs: {
12028
- "size": "lg",
12029
- "disabled": !_vm.hasMultipleInputTypes
12030
- },
12031
- model: {
12032
- value: _vm.field.multiple,
12033
- callback: function ($$v) {
12034
- _vm.$set(_vm.field, "multiple", $$v);
12035
- },
12036
- expression: "field.multiple"
12037
- }
12038
- }, [_vm._v("\n Множественное\n ")])], 1)], 1), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12039
- attrs: {
12040
- "lg": "12"
12041
- }
12042
12044
  }, [_c('b-checkbox', {
12043
12045
  attrs: {
12044
12046
  "size": "lg"
@@ -12084,7 +12086,7 @@ var __vue_render__$1 = function () {
12084
12086
  staticClass: "rb-form-section"
12085
12087
  }, [_c('div', {
12086
12088
  staticClass: "rb-title"
12087
- }, [_vm._v("\n Настройки ввода\n ")]), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12089
+ }, [_vm._v("\n Настройки ввода\n ")]), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12088
12090
  attrs: {
12089
12091
  "lg": "12"
12090
12092
  }