rb-document-form-constructor 0.5.3 → 0.5.6
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.
|
@@ -11087,6 +11087,7 @@ var script$3 = {
|
|
|
11087
11087
|
watch: {
|
|
11088
11088
|
formConfig() {
|
|
11089
11089
|
this.validationState = {};
|
|
11090
|
+
this.execApplyDefaultValues();
|
|
11090
11091
|
}
|
|
11091
11092
|
|
|
11092
11093
|
},
|
|
@@ -11119,19 +11120,14 @@ var script$3 = {
|
|
|
11119
11120
|
},
|
|
11120
11121
|
|
|
11121
11122
|
isValueEmpty(fieldName) {
|
|
11122
|
-
console.info('isValueEmpty', fieldName, this.doc[fieldName]);
|
|
11123
|
-
|
|
11124
11123
|
if (this.doc[fieldName] == null) {
|
|
11125
|
-
console.info(`${fieldName} is empty`);
|
|
11126
11124
|
return true;
|
|
11127
11125
|
}
|
|
11128
11126
|
|
|
11129
11127
|
if (_typeof(this.doc[fieldName] === 'string') && this.doc[fieldName] === '') {
|
|
11130
|
-
console.info(`${fieldName} is empty`);
|
|
11131
11128
|
return true;
|
|
11132
11129
|
}
|
|
11133
11130
|
|
|
11134
|
-
console.info(`${fieldName} is not empty`);
|
|
11135
11131
|
return false;
|
|
11136
11132
|
},
|
|
11137
11133
|
|
|
@@ -11161,28 +11157,44 @@ var script$3 = {
|
|
|
11161
11157
|
}
|
|
11162
11158
|
|
|
11163
11159
|
return true;
|
|
11164
|
-
}
|
|
11160
|
+
},
|
|
11165
11161
|
|
|
11166
|
-
|
|
11162
|
+
getColumnSize(section) {
|
|
11163
|
+
const MAX_COLUMN_SIZE = 12;
|
|
11167
11164
|
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
r.columns.forEach(c => {
|
|
11172
|
-
c.fields.forEach(f => {
|
|
11173
|
-
let defValue = null;
|
|
11165
|
+
if (!section || !section.columnCount) {
|
|
11166
|
+
return MAX_COLUMN_SIZE;
|
|
11167
|
+
}
|
|
11174
11168
|
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11169
|
+
let colSize = Math.floor(MAX_COLUMN_SIZE / section.columnCount);
|
|
11170
|
+
console.info("colSize", colSize);
|
|
11171
|
+
return colSize;
|
|
11172
|
+
},
|
|
11173
|
+
|
|
11174
|
+
execApplyDefaultValues() {
|
|
11175
|
+
if (this.applyDefaultValues) {
|
|
11176
|
+
this.formConfig.sections.forEach(r => {
|
|
11177
|
+
r.columns.forEach(c => {
|
|
11178
|
+
c.fields.forEach(f => {
|
|
11179
|
+
let defValue;
|
|
11180
|
+
|
|
11181
|
+
if (this.defaultValue && _typeof(f.defaultValue) === 'function') {
|
|
11182
|
+
defValue = f.defaultValue();
|
|
11183
|
+
} else {
|
|
11184
|
+
defValue = f.defaultValue == null ? null : f.defaultValue;
|
|
11185
|
+
}
|
|
11180
11186
|
|
|
11181
|
-
|
|
11187
|
+
this.$set(this.doc, f.name, f.defaultValue = defValue);
|
|
11188
|
+
});
|
|
11182
11189
|
});
|
|
11183
11190
|
});
|
|
11184
|
-
}
|
|
11191
|
+
}
|
|
11185
11192
|
}
|
|
11193
|
+
|
|
11194
|
+
},
|
|
11195
|
+
|
|
11196
|
+
created() {
|
|
11197
|
+
this.execApplyDefaultValues();
|
|
11186
11198
|
}
|
|
11187
11199
|
|
|
11188
11200
|
};
|
|
@@ -11201,15 +11213,20 @@ var __vue_render__$3 = function () {
|
|
|
11201
11213
|
return _vm.formConfig ? _c('b-form', {
|
|
11202
11214
|
staticClass: "rb-doc-form"
|
|
11203
11215
|
}, _vm._l(_vm.formConfig.sections, function (section) {
|
|
11204
|
-
return _vm.formConfig && _vm.formConfig.sections ? _c('
|
|
11216
|
+
return _vm.formConfig && _vm.formConfig.sections ? _c('b-container', {
|
|
11205
11217
|
key: section.labelRu,
|
|
11206
11218
|
staticClass: "rb-form-section"
|
|
11207
|
-
}, [_c('
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11219
|
+
}, [_c('b-row', [_c('b-col', {
|
|
11220
|
+
attrs: {
|
|
11221
|
+
"lg": "12"
|
|
11222
|
+
}
|
|
11223
|
+
}, [_c('h4', [_vm._v(_vm._s(section.labelRu))])]), _vm._v(" "), _vm._l(section.columns, function (column) {
|
|
11224
|
+
return [_c('b-col', {
|
|
11211
11225
|
key: column.index,
|
|
11212
|
-
|
|
11226
|
+
attrs: {
|
|
11227
|
+
"lg": _vm.getColumnSize(section),
|
|
11228
|
+
"sm": 12
|
|
11229
|
+
}
|
|
11213
11230
|
}, [_vm._l(column.fields, function (field) {
|
|
11214
11231
|
return [field.visible ? _c('b-form-row', {
|
|
11215
11232
|
key: field.name
|
|
@@ -11227,7 +11244,7 @@ var __vue_render__$3 = function () {
|
|
|
11227
11244
|
scopedSlots: _vm._u([{
|
|
11228
11245
|
key: "label",
|
|
11229
11246
|
fn: function () {
|
|
11230
|
-
return [_vm._v("\n
|
|
11247
|
+
return [_vm._v("\n " + _vm._s(field.labelRu) + " "), _vm.showRequiredInLabel && field.required ? _c('span', {
|
|
11231
11248
|
staticClass: "text-danger"
|
|
11232
11249
|
}, [_vm._v("*")]) : _vm._e()];
|
|
11233
11250
|
},
|
|
@@ -11261,9 +11278,9 @@ var __vue_render__$3 = function () {
|
|
|
11261
11278
|
expression: "doc[field.name]"
|
|
11262
11279
|
}
|
|
11263
11280
|
}, 'component', field.input.propsData, false))], 1)], 1)], 1) : _vm._e()];
|
|
11264
|
-
})], 2);
|
|
11265
|
-
}),
|
|
11266
|
-
}),
|
|
11281
|
+
})], 2)];
|
|
11282
|
+
})], 2)], 1) : _vm._e();
|
|
11283
|
+
}), 1) : _vm._e();
|
|
11267
11284
|
};
|
|
11268
11285
|
|
|
11269
11286
|
var __vue_staticRenderFns__$3 = [];
|