import{al as r,as as n}from"./JQJBiNWj.js";var a={name:"BaseEditableHolder",extends:r,emits:["update:modelValue","value-change"],props:{modelValue:{type:null,default:void 0},defaultValue:{type:null,default:void 0},name:{type:String,default:void 0},invalid:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},formControl:{type:Object,default:void 0}},inject:{$parentInstance:{default:void 0},$pcForm:{default:void 0},$pcFormField:{default:void 0}},data:function(){return{d_value:this.defaultValue||this.modelValue}},watch:{modelValue:function(i){this.d_value=i},defaultValue:function(i){this.d_value=i},$formName:{immediate:!0,handler:function(i){var e,l;this.formField=((e=this.$pcForm)===null||e===void 0||(l=e.register)===null||l===void 0?void 0:l.call(e,i,this.$formControl))||{}}},$formControl:{immediate:!0,handler:function(i){var e,l;this.formField=((e=this.$pcForm)===null||e===void 0||(l=e.register)===null||l===void 0?void 0:l.call(e,this.$formName,i))||{}}},$formDefaultValue:{immediate:!0,handler:function(i){this.d_value!==i&&(this.d_value=i)}},$formValue:{immediate:!1,handler:function(i){var e;(e=this.$pcForm)!==null&&e!==void 0&&e.getFieldState(this.$formName)&&i!==this.d_value&&(this.d_value=i)}}},formField:{},methods:{writeValue:function(i,e){var l,o;this.controlled&&(this.d_value=i,this.$emit("update:modelValue",i)),this.$emit("value-change",i),(l=(o=this.formField).onChange)===null||l===void 0||l.call(o,{originalEvent:e,value:i})},findNonEmpty:function(){for(var i=arguments.length,e=new Array(i),l=0;l<i;l++)e[l]=arguments[l];return e.find(n)}},computed:{$filled:function(){return n(this.d_value)},$invalid:function(){var i,e;return!this.$formNovalidate&&this.findNonEmpty(this.invalid,(i=this.$pcFormField)===null||i===void 0||(i=i.$field)===null||i===void 0?void 0:i.invalid,(e=this.$pcForm)===null||e===void 0||(e=e.getFieldState(this.$formName))===null||e===void 0?void 0:e.invalid)},$formName:function(){var i;return this.$formNovalidate?void 0:this.name||((i=this.$formControl)===null||i===void 0?void 0:i.name)},$formControl:function(){var i;return this.formControl||((i=this.$pcFormField)===null||i===void 0?void 0:i.formControl)},$formNovalidate:function(){var i;return(i=this.$formControl)===null||i===void 0?void 0:i.novalidate},$formDefaultValue:function(){var i,e;return this.findNonEmpty(this.d_value,(i=this.$pcFormField)===null||i===void 0?void 0:i.initialValue,(e=this.$pcForm)===null||e===void 0||(e=e.initialValues)===null||e===void 0?void 0:e[this.$formName])},$formValue:function(){var i,e;return this.findNonEmpty((i=this.$pcFormField)===null||i===void 0||(i=i.$field)===null||i===void 0?void 0:i.value,(e=this.$pcForm)===null||e===void 0||(e=e.getFieldState(this.$formName))===null||e===void 0?void 0:e.value)},controlled:function(){return this.$inProps.hasOwnProperty("modelValue")||!this.$inProps.hasOwnProperty("modelValue")&&!this.$inProps.hasOwnProperty("defaultValue")},filled:function(){return this.$filled}}};export{a as s};
