rb-document-form-constructor 0.6.1 → 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
  },
@@ -11188,16 +11190,32 @@ 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
+ 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
+ });
11191
11207
  }
11192
11208
 
11193
11209
  },
11194
11210
 
11195
11211
  mounted() {
11196
11212
  this.execApplyDefaultValues();
11213
+ this.execApplyDefaultValRule();
11197
11214
  },
11198
11215
 
11199
11216
  activated() {
11200
11217
  this.execApplyDefaultValues();
11218
+ this.execApplyDefaultValRule();
11201
11219
  }
11202
11220
 
11203
11221
  };
@@ -11264,7 +11282,8 @@ var __vue_render__$3 = function () {
11264
11282
  attrs: {
11265
11283
  "disabled": !_vm.editable || !field.editable,
11266
11284
  "id": field.name,
11267
- "state": _vm.validationState[field.name]
11285
+ "state": _vm.validationState[field.name],
11286
+ "required": field.required
11268
11287
  },
11269
11288
  on: {
11270
11289
  "input": function ($event) {
@@ -11630,7 +11649,11 @@ var __vue_render__$2 = function () {
11630
11649
  attrs: {
11631
11650
  "value": 'validate'
11632
11651
  }
11633
- }, [_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', {
11634
11657
  attrs: {
11635
11658
  "lg": "12"
11636
11659
  }