rb-document-form-constructor 0.6.0 → 0.6.3

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,34 @@ 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
+ const rule = f.rules.find(rule => rule.event === 'defaultValue');
11201
+
11202
+ if (rule) {
11203
+ this.$set(this.doc, f.name, f.defaultValue = eval(rule.script));
11204
+ }
11205
+ }
11206
+ });
11207
+ });
11208
+ });
11191
11209
  }
11192
11210
 
11193
11211
  },
11194
11212
 
11195
11213
  mounted() {
11196
11214
  this.execApplyDefaultValues();
11215
+ this.execApplyDefaultValRule();
11197
11216
  },
11198
11217
 
11199
11218
  activated() {
11200
11219
  this.execApplyDefaultValues();
11220
+ this.execApplyDefaultValRule();
11201
11221
  }
11202
11222
 
11203
11223
  };
@@ -11264,7 +11284,8 @@ var __vue_render__$3 = function () {
11264
11284
  attrs: {
11265
11285
  "disabled": !_vm.editable || !field.editable,
11266
11286
  "id": field.name,
11267
- "state": _vm.validationState[field.name]
11287
+ "state": _vm.validationState[field.name],
11288
+ "required": field.required
11268
11289
  },
11269
11290
  on: {
11270
11291
  "input": function ($event) {
@@ -11630,7 +11651,11 @@ var __vue_render__$2 = function () {
11630
11651
  attrs: {
11631
11652
  "value": 'validate'
11632
11653
  }
11633
- }, [_vm._v("\n Валидация\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11654
+ }, [_vm._v("\n Валидация\n ")]), _vm._v(" "), _c('b-form-select-option', {
11655
+ attrs: {
11656
+ "value": 'defaultValue'
11657
+ }
11658
+ }, [_vm._v("\n Установить значение по умолчанию\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
11634
11659
  attrs: {
11635
11660
  "lg": "12"
11636
11661
  }
@@ -12018,22 +12043,6 @@ var __vue_render__$1 = function () {
12018
12043
  attrs: {
12019
12044
  "lg": "12"
12020
12045
  }
12021
- }, [_c('b-checkbox', {
12022
- attrs: {
12023
- "size": "lg",
12024
- "disabled": !_vm.hasMultipleInputTypes
12025
- },
12026
- model: {
12027
- value: _vm.field.multiple,
12028
- callback: function ($$v) {
12029
- _vm.$set(_vm.field, "multiple", $$v);
12030
- },
12031
- expression: "field.multiple"
12032
- }
12033
- }, [_vm._v("\n Множественное\n ")])], 1)], 1), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12034
- attrs: {
12035
- "lg": "12"
12036
- }
12037
12046
  }, [_c('b-checkbox', {
12038
12047
  attrs: {
12039
12048
  "size": "lg"
@@ -12079,7 +12088,7 @@ var __vue_render__$1 = function () {
12079
12088
  staticClass: "rb-form-section"
12080
12089
  }, [_c('div', {
12081
12090
  staticClass: "rb-title"
12082
- }, [_vm._v("\n Настройки ввода\n ")]), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12091
+ }, [_vm._v("\n Настройки ввода\n ")]), _vm._v(" "), _c('b-form-row', [_c('b-col', {
12083
12092
  attrs: {
12084
12093
  "lg": "12"
12085
12094
  }