@progress/kendo-vue-charts
Version:
9 lines (8 loc) • 2.33 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),d=require("@progress/kendo-vue-common"),s=h.defineComponent({name:"KendoConfiguration",props:{chartKey:String,config:{type:Object,default:function(){return{}}}},data(){return{childState:{},index:null}},provide(){return{addChild:this.addChildOption,removeChild:this.removeChildOption,childOption:!0}},inject:{childOption:{default:null},addChild:{default:d.noop},removeChild:{default:d.noop},child:{default:{}},parentKey:{default:null},chartCollection:{default:null},dispatchOptions:{default:null},childrenObserver:{default:null}},created(){this.currentIndex=void 0,this.uid=d.guid(),this.addChild&&this.addChild({chartKey:this.$props.chartKey,payload:Object.assign({},this.$props.config),uid:this.uid})},mounted(){this.dispatch()},watch:{config(t,i){JSON.stringify(t)!==JSON.stringify(i)&&this.dispatch()}},unmounted(){this.onDestroyed()},render(){const t=d.getDefaultSlots(this);return h.createVNode("div",null,[t])},methods:{onDestroyed(){if(this.removeChild){this.removeChild({uid:this.uid});const{chartKey:t,parentStore:i,config:e}=this.$props;(i||this.dispatchOptions)({chartKey:t,parentKey:this.parentKey,chartCollectionIdxKey:this.chartCollection+"_",uid:this.uid})}},addChildOption(t){this.childState={...this.childState,[t.chartKey]:t.payload},this.dispatch()},removeChildOption(){this.childState={}},dispatch(){const{chartKey:t,parentStore:i,config:e}=this.$props,n=i||this.dispatchOptions;if(this.childOption){this.addChild({chartKey:t,payload:Object.assign({},e,this.childState)});return}this.chartCollection?(this.currentIndex=this.child.collection.findIndex(o=>o.uid===this.uid),n({chartKey:t,parentKey:this.parentKey,chartCollectionIdxKey:this.chartCollection+"_"+this.currentIndex,payload:Object.assign({},e,{uid:this.uid},this.childState)})):n({chartKey:t,payload:Object.assign({},e,this.childState)})}}});exports.Configuration=s;