1
0
mirror of synced 2025-01-31 14:51:41 +03:00

Updated build packages for alpha 2

This commit is contained in:
Justin Schroeder 2020-02-26 00:26:22 -05:00
parent 839f0936ed
commit bfa94fc24a
3 changed files with 51 additions and 24 deletions

25
dist/formulate.esm.js vendored
View File

@ -458,7 +458,7 @@ function cloneDeep (obj) {
var newObj = {};
for (var key in obj) {
if (obj[key] instanceof FileUpload || isValueType(obj[key])) {
newObj[key] = obj;
newObj[key] = obj[key];
} else {
newObj[key] = cloneDeep(obj[key]);
}
@ -1664,10 +1664,10 @@ FormSubmission.prototype.values = function values () {
return new Promise(function (resolve, reject) {
var pending = [];
var values = cloneDeep(this$1.form.internalModelProxy);
var values = cloneDeep(this$1.form.internalFormModelProxy);
for (var key in values) {
if (typeof this$1.form.internalModelProxy[key] === 'object' && this$1.form.internalModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalModelProxy[key].upload());
if (typeof this$1.form.internalFormModelProxy[key] === 'object' && this$1.form.internalFormModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalFormModelProxy[key].upload());
}
}
/**
@ -1759,11 +1759,20 @@ var script$1 = {
},
register: function register (field, component) {
this.registry[field] = component;
if (!component.$options.propsData.hasOwnProperty('formulateValue') && this.hasFormulateValue && this.formulateValue[field]) {
var hasVModelValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'formulateValue');
var hasValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'value');
if (
!hasVModelValue &&
this.hasFormulateValue &&
this.formulateValue[field]
) {
// In the case that the form is carrying an initial value and the
// element is not, set it directly.
component.context.model = this.formulateValue[field];
} else if (component.$options.propsData.hasOwnProperty('formulateValue') && !shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])) {
} else if (
(hasVModelValue || hasValue) &&
!shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])
) {
this.setFieldValue(field, component.internalModelProxy);
}
},
@ -1774,9 +1783,9 @@ var script$1 = {
this.showErrors();
var submission = new FormSubmission(this);
this.$emit('submit-raw', submission);
submission.hasValidationErrors()
return submission.hasValidationErrors()
.then(function (hasErrors) { return hasErrors ? false : submission.values(); })
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; });
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; })
},
showErrors: function showErrors () {
for (var fieldName in this.registry) {

25
dist/formulate.min.js vendored
View File

@ -461,7 +461,7 @@ var Formulate = (function (exports, isUrl, nanoid, isPlainObject) {
var newObj = {};
for (var key in obj) {
if (obj[key] instanceof FileUpload || isValueType(obj[key])) {
newObj[key] = obj;
newObj[key] = obj[key];
} else {
newObj[key] = cloneDeep(obj[key]);
}
@ -1667,10 +1667,10 @@ var Formulate = (function (exports, isUrl, nanoid, isPlainObject) {
return new Promise(function (resolve, reject) {
var pending = [];
var values = cloneDeep(this$1.form.internalModelProxy);
var values = cloneDeep(this$1.form.internalFormModelProxy);
for (var key in values) {
if (typeof this$1.form.internalModelProxy[key] === 'object' && this$1.form.internalModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalModelProxy[key].upload());
if (typeof this$1.form.internalFormModelProxy[key] === 'object' && this$1.form.internalFormModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalFormModelProxy[key].upload());
}
}
/**
@ -1762,11 +1762,20 @@ var Formulate = (function (exports, isUrl, nanoid, isPlainObject) {
},
register: function register (field, component) {
this.registry[field] = component;
if (!component.$options.propsData.hasOwnProperty('formulateValue') && this.hasFormulateValue && this.formulateValue[field]) {
var hasVModelValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'formulateValue');
var hasValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'value');
if (
!hasVModelValue &&
this.hasFormulateValue &&
this.formulateValue[field]
) {
// In the case that the form is carrying an initial value and the
// element is not, set it directly.
component.context.model = this.formulateValue[field];
} else if (component.$options.propsData.hasOwnProperty('formulateValue') && !shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])) {
} else if (
(hasVModelValue || hasValue) &&
!shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])
) {
this.setFieldValue(field, component.internalModelProxy);
}
},
@ -1777,9 +1786,9 @@ var Formulate = (function (exports, isUrl, nanoid, isPlainObject) {
this.showErrors();
var submission = new FormSubmission(this);
this.$emit('submit-raw', submission);
submission.hasValidationErrors()
return submission.hasValidationErrors()
.then(function (hasErrors) { return hasErrors ? false : submission.values(); })
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; });
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; })
},
showErrors: function showErrors () {
for (var fieldName in this.registry) {

25
dist/formulate.umd.js vendored
View File

@ -464,7 +464,7 @@
var newObj = {};
for (var key in obj) {
if (obj[key] instanceof FileUpload || isValueType(obj[key])) {
newObj[key] = obj;
newObj[key] = obj[key];
} else {
newObj[key] = cloneDeep(obj[key]);
}
@ -1670,10 +1670,10 @@
return new Promise(function (resolve, reject) {
var pending = [];
var values = cloneDeep(this$1.form.internalModelProxy);
var values = cloneDeep(this$1.form.internalFormModelProxy);
for (var key in values) {
if (typeof this$1.form.internalModelProxy[key] === 'object' && this$1.form.internalModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalModelProxy[key].upload());
if (typeof this$1.form.internalFormModelProxy[key] === 'object' && this$1.form.internalFormModelProxy[key] instanceof FileUpload) {
pending.push(this$1.form.internalFormModelProxy[key].upload());
}
}
/**
@ -1765,11 +1765,20 @@
},
register: function register (field, component) {
this.registry[field] = component;
if (!component.$options.propsData.hasOwnProperty('formulateValue') && this.hasFormulateValue && this.formulateValue[field]) {
var hasVModelValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'formulateValue');
var hasValue = Object.prototype.hasOwnProperty.call(component.$options.propsData, 'value');
if (
!hasVModelValue &&
this.hasFormulateValue &&
this.formulateValue[field]
) {
// In the case that the form is carrying an initial value and the
// element is not, set it directly.
component.context.model = this.formulateValue[field];
} else if (component.$options.propsData.hasOwnProperty('formulateValue') && !shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])) {
} else if (
(hasVModelValue || hasValue) &&
!shallowEqualObjects(component.internalModelProxy, this.formulateValue[field])
) {
this.setFieldValue(field, component.internalModelProxy);
}
},
@ -1780,9 +1789,9 @@
this.showErrors();
var submission = new FormSubmission(this);
this.$emit('submit-raw', submission);
submission.hasValidationErrors()
return submission.hasValidationErrors()
.then(function (hasErrors) { return hasErrors ? false : submission.values(); })
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; });
.then(function (json) { return json !== false ? this$1.$emit('submit', json) : null; })
},
showErrors: function showErrors () {
for (var fieldName in this.registry) {