rb-document-form-constructor 0.9.16 → 0.9.17

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.
@@ -7,20 +7,24 @@ const UtFormConfig = {
7
7
  }
8
8
 
9
9
  let found = null;
10
- formConfig.sections.forEach(r => {
11
- console.info(r);
12
-
10
+ formConfig.sections.every(r => {
13
11
  if (r.columns) {
14
- r.columns.forEach(c => {
12
+ r.columns.every(c => {
15
13
  c.fields.forEach(f => {
16
- console.info(f.name);
17
-
18
14
  if (f.name === fieldName) {
19
15
  found = f;
20
16
  }
21
17
  });
18
+
19
+ if (found) {
20
+ return false;
21
+ }
22
22
  });
23
23
  }
24
+
25
+ if (found) {
26
+ return false;
27
+ }
24
28
  });
25
29
  return found;
26
30
  },
@@ -6585,6 +6589,16 @@ var script$3 = {
6585
6589
  feedback = errors ? this.$t('validate.multiRequired', {
6586
6590
  field: errors
6587
6591
  }) : this.isValueEmpty(f.name) ? this.getDisplayField(f) : '';
6592
+ } // 🔥 Кастомная валидация для конкретного поля
6593
+
6594
+
6595
+ if (typeof f.validate === 'function') {
6596
+ console.log(f, this.doc);
6597
+ const customError = f.validate(this.doc[f.name]);
6598
+
6599
+ if (customError) {
6600
+ feedback += `\n${customError}`;
6601
+ }
6588
6602
  }
6589
6603
 
6590
6604
  if (feedback) {
@@ -7873,11 +7887,11 @@ var script = {
7873
7887
 
7874
7888
  removeSection(section, index) {
7875
7889
  this.formConfig.sections.splice(index, 1);
7876
- /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7877
- onOk: (event, modal) => {
7878
- this.formConfig.sections.splice(index, 1);
7879
- UtModal.closeModal(modal);
7880
- }
7890
+ /*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
7891
+ onOk: (event, modal) => {
7892
+ this.formConfig.sections.splice(index, 1);
7893
+ UtModal.closeModal(modal);
7894
+ }
7881
7895
  });*/
7882
7896
  },
7883
7897