@progress/kendo-vue-grid
Version:
153 lines (152 loc) • 5.62 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { defineComponent as w, createVNode as i, mergeProps as x, ref as R } from "vue";
import { Grid as O } from "./Grid.mjs";
import { GridStateProvider as W } from "./GridState.mjs";
import { gridProps as G } from "./common.mjs";
import { getDefaultSlots as b, getListeners as l, mapTree as L, templateRendering as P } from "@progress/kendo-vue-common";
const M = /* @__PURE__ */ w({
name: "KendoVueGrid",
props: G,
setup(e, {
expose: t
}) {
const o = R(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 ? P.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 = l.call(this);
return L(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 = l.call(this);
return this.transformCellTemplates(this.$props.cells, e);
},
rowsWithTemplates() {
const e = l.call(this);
return this.transformRowTemplates(this.$props.rows, e);
}
},
render() {
const e = b(this) || [], t = l.call(this), o = e.filter((r) => {
var n, m, p;
return (r == null ? void 0 : r.tag) && r.tag.toLowerCase().indexOf("toolbar") !== -1 || (r == null ? void 0 : r.componentOptions) && ((n = r.componentOptions.tag) == null ? void 0 : n.toLowerCase().indexOf("toolbar")) !== -1 || ((p = (m = r == null ? void 0 : r.type) == null ? void 0 : m.name) == null ? void 0 : p.toLowerCase().indexOf("toolbar")) !== -1;
}), a = e.filter((r) => {
var n, m, p;
return (r == null ? void 0 : r.tag) && r.tag.toLowerCase().indexOf("records") !== -1 || (r == null ? void 0 : r.componentOptions) && ((n = r.componentOptions.tag) == null ? void 0 : n.toLowerCase().indexOf("records")) !== -1 || ((p = (m = r == null ? void 0 : r.type) == null ? void 0 : m.name) == null ? void 0 : p.toLowerCase().indexOf("records")) !== -1;
}), {
cellRender: s,
detail: u,
columns: v,
rowRender: T,
pager: d,
loader: h,
rows: y,
...f
} = this.$props, g = this.columnsWithTemplates, C = this.cellsWithTemplates, c = this.rowsWithTemplates;
return i(W, f, {
default: () => [i(O, x(f, t, {
class: this.$attrs.class,
style: this.$attrs.style,
columns: g,
cells: C,
rows: c,
cellRender: this.transformTemplate(s, t),
rowRender: this.transformTemplate(T, t),
pager: this.transformTemplate(d, t),
loader: this.transformTemplate(h, t),
detail: this.transformTemplate(u, t),
toolbar: o,
noRecords: a
}), null)]
});
}
});
export {
M as RootGrid
};