/*! * FormCreate 低代码表单渲染器 * @form-create/component-elm-tree v2.6.3 * (c) 2018-2024 xaboy * Github https://github.com/xaboy/form-create * Site https://form-create.com/ * Released under the MIT License. */ (function(i,o){typeof exports=="object"&&typeof module!="undefined"?module.exports=o():typeof define=="function"&&define.amd?define(o):(i=typeof globalThis!="undefined"?globalThis:i||self,i.FcTree=o())})(this,function(){"use strict";function i(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function o(){return o=Object.assign?Object.assign.bind():function(r){for(var t,n=1;n-1?[]:[r]}function m(r,t){return Object.keys(r).reduce((n,e)=>(n.push(r[e]),n),[])}return{name:"fcTree",formCreateParser:{mergeProp(r){const t=r.prop.props;t.nodeKey||(t.nodeKey="id"),t.props||(t.props={label:"title"})}},props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},watch:{value(){this.setValue()}},methods:{onChange(){this.updateValue()},updateValue(){if(!this.$refs.tree)return;const r=this.type.toLocaleLowerCase();let t;r==="selected"?t=this.$refs.tree.getCurrentKey():t=this.$refs.tree.getCheckedKeys(),this.$emit("input",t)},setValue(){this.type.toLocaleLowerCase()==="selected"?this.$refs.tree.setCurrentKey(this.value):this.$refs.tree.setCheckedKeys(y(this.value))}},render(){const r=arguments[0];return r("ElTree",h([{},this.formCreateInject.prop,{ref:"tree",on:{check:()=>this.updateValue(),"node-click":()=>this.updateValue()}}]),[m(this.$slots)])},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}}});