rb-document-form-constructor 0.6.1 → 0.6.4

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
  },
@@ -11188,16 +11190,36 @@ var script$3 = {
11188
11190
  });
11189
11191
  });
11190
11192
  }
11193
+ },
11194
+
11195
+ execApplyDefaultValRule() {
11196
+ this.formConfig.sections.forEach(el => {
11197
+ el.columns.forEach(c => {
11198
+ c.fields.forEach(f => {
11199
+ if (f.rules) {
11200
+ if (!f.defaultValue) {
11201
+ const rule = f.rules.find(rule => rule.event === 'defaultValue');
11202
+
11203
+ if (rule && !this.doc[f.name]) {
11204
+ this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
11205
+ }
11206
+ }
11207
+ }
11208
+ });
11209
+ });
11210
+ });
11191
11211
  }
11192
11212
 
11193
11213
  },
11194
11214
 
11195
11215
  mounted() {
11196
11216
  this.execApplyDefaultValues();
11217
+ this.execApplyDefaultValRule();
11197
11218
  },
11198
11219
 
11199
11220
  activated() {
11200
11221
  this.execApplyDefaultValues();
11222
+ this.execApplyDefaultValRule();
11201
11223
  }
11202
11224
 
11203
11225
  };
@@ -11264,7 +11286,8 @@ var __vue_render__$3 = function () {
11264
11286
  attrs: {
11265
11287
  "disabled": !_vm.editable || !field.editable,
11266
11288
  "id": field.name,
11267
- "state": _vm.validationState[field.name]
11289
+ "state": _vm.validationState[field.name],
11290
+ "required": field.required
11268
11291
  },
11269
11292
  on: {
11270
11293
  "input": function ($event) {
@@ -11630,7 +11653,11 @@ var __vue_render__$2 = function () {
11630
11653
  attrs: {
11631
11654
  "value": 'validate'
11632
11655
  }
11633
- }, [_vm._v("\n Валидация\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11656
+ }, [_vm._v("\n Валидация\n ")]), _vm._v(" "), _c('b-form-select-option', {
11657
+ attrs: {
11658
+ "value": 'defaultValue'
11659
+ }
11660
+ }, [_vm._v("\n Установить значение по умолчанию\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11634
11661
  attrs: {
11635
11662
  "lg": "12"
11636
11663
  }