1
0
mirror of synced 2024-11-22 05:16:05 +03:00

fix: Build

This commit is contained in:
1on 2021-09-30 13:51:12 +03:00
parent 3eeff5fe1e
commit 8e36a9f59d
3 changed files with 39 additions and 13 deletions

View File

@ -885,6 +885,11 @@ function validate(validators, context) {
}); });
} }
const UNREGISTER_BEHAVIOR = {
NONE: 'none',
UNSET: 'unset',
};
const VALIDATION_BEHAVIOR = { const VALIDATION_BEHAVIOR = {
DEMAND: 'demand', DEMAND: 'demand',
LIVE: 'live', LIVE: 'live',
@ -963,7 +968,7 @@ let FormularioField = class FormularioField extends Vue {
*/ */
beforeDestroy() { beforeDestroy() {
if (typeof this.__FormularioForm_unregister === 'function') { if (typeof this.__FormularioForm_unregister === 'function') {
this.__FormularioForm_unregister(this.fullPath); this.__FormularioForm_unregister(this.fullPath, this.unregisterBehavior);
} }
} }
syncProxy(value) { syncProxy(value) {
@ -1074,6 +1079,12 @@ __decorate([
__decorate([ __decorate([
Prop({ default: () => (value) => value }) Prop({ default: () => (value) => value })
], FormularioField.prototype, "modelSetConverter", void 0); ], FormularioField.prototype, "modelSetConverter", void 0);
__decorate([
Prop({ default: 'div' })
], FormularioField.prototype, "tag", void 0);
__decorate([
Prop({ default: UNREGISTER_BEHAVIOR.NONE })
], FormularioField.prototype, "unregisterBehavior", void 0);
__decorate([ __decorate([
Watch('value') Watch('value')
], FormularioField.prototype, "onValueChange", null); ], FormularioField.prototype, "onValueChange", null);
@ -1169,8 +1180,8 @@ var __vue_render__ = function() {
var _h = _vm.$createElement; var _h = _vm.$createElement;
var _c = _vm._self._c || _h; var _c = _vm._self._c || _h;
return _c( return _c(
"div", _vm.tag,
_vm._b({}, "div", _vm.$attrs, false), _vm._b({ tag: "component" }, "component", _vm.$attrs, false),
[_vm._t("default", null, { context: _vm.context })], [_vm._t("default", null, { context: _vm.context })],
2 2
) )
@ -1318,13 +1329,15 @@ let FormularioForm = class FormularioForm extends Vue {
field.setErrors(this.fieldsErrorsComputed[path]); field.setErrors(this.fieldsErrorsComputed[path]);
} }
} }
unregister(path) { unregister(path, behavior) {
if (this.registry.has(path)) { if (this.registry.has(path)) {
this.registry.delete(path); this.registry.delete(path);
if (behavior === UNREGISTER_BEHAVIOR.UNSET) {
this.proxy = unset(this.proxy, path); this.proxy = unset(this.proxy, path);
this.emitInput(); this.emitInput();
} }
} }
}
getState() { getState() {
return this.proxy; return this.proxy;
} }

File diff suppressed because one or more lines are too long

View File

@ -890,6 +890,11 @@
}); });
} }
const UNREGISTER_BEHAVIOR = {
NONE: 'none',
UNSET: 'unset',
};
const VALIDATION_BEHAVIOR = { const VALIDATION_BEHAVIOR = {
DEMAND: 'demand', DEMAND: 'demand',
LIVE: 'live', LIVE: 'live',
@ -968,7 +973,7 @@
*/ */
beforeDestroy() { beforeDestroy() {
if (typeof this.__FormularioForm_unregister === 'function') { if (typeof this.__FormularioForm_unregister === 'function') {
this.__FormularioForm_unregister(this.fullPath); this.__FormularioForm_unregister(this.fullPath, this.unregisterBehavior);
} }
} }
syncProxy(value) { syncProxy(value) {
@ -1079,6 +1084,12 @@
__decorate([ __decorate([
vuePropertyDecorator.Prop({ default: () => (value) => value }) vuePropertyDecorator.Prop({ default: () => (value) => value })
], FormularioField.prototype, "modelSetConverter", void 0); ], FormularioField.prototype, "modelSetConverter", void 0);
__decorate([
vuePropertyDecorator.Prop({ default: 'div' })
], FormularioField.prototype, "tag", void 0);
__decorate([
vuePropertyDecorator.Prop({ default: UNREGISTER_BEHAVIOR.NONE })
], FormularioField.prototype, "unregisterBehavior", void 0);
__decorate([ __decorate([
vuePropertyDecorator.Watch('value') vuePropertyDecorator.Watch('value')
], FormularioField.prototype, "onValueChange", null); ], FormularioField.prototype, "onValueChange", null);
@ -1174,8 +1185,8 @@
var _h = _vm.$createElement; var _h = _vm.$createElement;
var _c = _vm._self._c || _h; var _c = _vm._self._c || _h;
return _c( return _c(
"div", _vm.tag,
_vm._b({}, "div", _vm.$attrs, false), _vm._b({ tag: "component" }, "component", _vm.$attrs, false),
[_vm._t("default", null, { context: _vm.context })], [_vm._t("default", null, { context: _vm.context })],
2 2
) )
@ -1323,13 +1334,15 @@
field.setErrors(this.fieldsErrorsComputed[path]); field.setErrors(this.fieldsErrorsComputed[path]);
} }
} }
unregister(path) { unregister(path, behavior) {
if (this.registry.has(path)) { if (this.registry.has(path)) {
this.registry.delete(path); this.registry.delete(path);
if (behavior === UNREGISTER_BEHAVIOR.UNSET) {
this.proxy = unset(this.proxy, path); this.proxy = unset(this.proxy, path);
this.emitInput(); this.emitInput();
} }
} }
}
getState() { getState() {
return this.proxy; return this.proxy;
} }