UNPKG

@progress/kendo-vue-grid

Version:
9 lines (8 loc) 4.21 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 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 i=require("vue"),w=require("./Grid.js"),R=require("./GridState.js"),G=require("./common.js"),n=require("@progress/kendo-vue-common"),O=i.defineComponent({name:"KendoVueGrid",props:G.gridProps,setup(e,{expose:t}){const o=i.ref(null);t({get element(){var a;return((a=o.value)==null?void 0:a.element)||null},get props(){return e},get columns(){var a;return((a=o.value)==null?void 0:a.columns)||[]},scrollIntoView:a=>{var s;(s=o.value)==null||s.scrollIntoView(a)},fitColumns:a=>{var s;(s=o.value)==null||s.fitColumns(a)},exportAsPdf:()=>{var a;(a=o.value)==null||a.exportAsPdf()}})},methods:{transformTemplate(e,t){return e?n.templateRendering.call(this,e,t):void 0},transformGroupTemplates(e,t){if(e)return{groupHeader:this.transformTemplate(e.groupHeader,t),data:this.transformTemplate(e.data,t),groupFooter:this.transformTemplate(e.groupFooter,t)}},transformCellTemplates(e,t){if(e)return{headerCell:this.transformTemplate(e.headerCell,t),filterCell:this.transformTemplate(e.filterCell,t),footerCell:this.transformTemplate(e.footerCell,t),groupHeader:this.transformTemplate(e.groupHeader,t),data:this.transformTemplate(e.data,t),groupFooter:this.transformTemplate(e.groupFooter,t),select:this.transformGroupTemplates(e.select,t),hierarchy:this.transformGroupTemplates(e.hierarchy,t),group:this.transformGroupTemplates(e.group,t),edit:e.edit?{text:this.transformTemplate(e.edit.text,t),numeric:this.transformTemplate(e.edit.numeric,t),boolean:this.transformTemplate(e.edit.boolean,t),date:this.transformTemplate(e.edit.date,t)}:void 0}},transformRowTemplates(e,t){if(e)return{groupHeader:this.transformTemplate(e.groupHeader,t),data:this.transformTemplate(e.data,t),groupFooter:this.transformTemplate(e.groupFooter,t),pinnedData:this.transformTemplate(e.pinnedData,t)}}},computed:{columnsWithTemplates(){const e=n.getListeners.call(this);return n.mapTree(this.$props.columns||[],"children",t=>{const o={...t};return{...o,cell:this.transformTemplate(o.cell,e),headerCell:this.transformTemplate(o.headerCell,e),filterCell:this.transformTemplate(o.filterCell,e),footerCell:this.transformTemplate(o.footerCell,e),columnMenu:o.columnMenu===!1?!1:this.transformTemplate(o.columnMenu,e),cells:this.transformCellTemplates(o.cells,e)}})},cellsWithTemplates(){const e=n.getListeners.call(this);return this.transformCellTemplates(this.$props.cells,e)},rowsWithTemplates(){const e=n.getListeners.call(this);return this.transformRowTemplates(this.$props.rows,e)}},render(){const e=n.getDefaultSlots(this)||[],t=n.getListeners.call(this),o=e.filter(r=>{var m,l,p;return(r==null?void 0:r.tag)&&r.tag.toLowerCase().indexOf("toolbar")!==-1||(r==null?void 0:r.componentOptions)&&((m=r.componentOptions.tag)==null?void 0:m.toLowerCase().indexOf("toolbar"))!==-1||((p=(l=r==null?void 0:r.type)==null?void 0:l.name)==null?void 0:p.toLowerCase().indexOf("toolbar"))!==-1}),a=e.filter(r=>{var m,l,p;return(r==null?void 0:r.tag)&&r.tag.toLowerCase().indexOf("records")!==-1||(r==null?void 0:r.componentOptions)&&((m=r.componentOptions.tag)==null?void 0:m.toLowerCase().indexOf("records"))!==-1||((p=(l=r==null?void 0:r.type)==null?void 0:l.name)==null?void 0:p.toLowerCase().indexOf("records"))!==-1}),{cellRender:s,detail:f,columns:x,rowRender:d,pager:T,loader:h,rows:L,...u}=this.$props,g=this.columnsWithTemplates,c=this.cellsWithTemplates,C=this.rowsWithTemplates;return i.createVNode(R.GridStateProvider,u,{default:()=>[i.createVNode(w.Grid,i.mergeProps(u,t,{class:this.$attrs.class,style:this.$attrs.style,columns:g,cells:c,rows:C,cellRender:this.transformTemplate(s,t),rowRender:this.transformTemplate(d,t),pager:this.transformTemplate(T,t),loader:this.transformTemplate(h,t),detail:this.transformTemplate(f,t),toolbar:o,noRecords:a}),null)]})}});exports.RootGrid=O;