@progress/kendo-vue-grid
Version:
108 lines (107 loc) • 2.9 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 h, createVNode as s } from "vue";
import { setRef as d, classNames as r, uGrid as a, getter as m, getRef as o } from "@progress/kendo-vue-common";
import { GridRow as u } from "../rows/GridRow.mjs";
import { getRowContents as f } from "../getRowContents.mjs";
const g = /* @__PURE__ */ h({
name: "StickyGroupTable",
props: {
size: String,
items: Array,
cols: Array,
dataRowContext: {
type: Object,
required: !0
},
position: {
type: String,
required: !0
},
isStackedMode: Boolean,
groupLevelCount: Number,
rowHeight: Number
},
inject: {
sticky: {
default: null
}
},
mounted() {
this.tableRef = o(this, "table"), this.colGroupRef = o(this, "colGroup");
},
updated() {
this.tableRef = o(this, "table"), this.colGroupRef = o(this, "colGroup");
},
computed: {
isTop() {
return this.position === "top";
},
stickyItems() {
return this.isTop ? this.sticky.headerItems || [] : this.sticky.footerItems || [];
},
hasContent() {
return this.stickyItems.length > 0;
},
containerClassName() {
return r(a.stickyContainer({
bottom: !this.isTop
}));
},
tableClassName() {
return r(a.table({
size: this.size
}));
}
},
methods: {
setWidth(e) {
const t = o(this, "tableRef");
t && (t.style.width = e ? e + "px" : "");
},
setScrollLeft(e) {
const t = this.$el;
t && t.scrollLeft !== e && (t.scrollLeft = e);
}
},
render() {
return s("div", {
class: this.containerClassName
}, [s("table", {
ref: d(this, "table"),
class: this.tableClassName
}, [s("colgroup", {
ref: d(this, "colGroup")
}, [this.$props.cols]), s("tbody", {
class: r(a.tbody({}))
}, [this.stickyItems.map((e, t) => {
const {
item: i,
flatIndex: n
} = e, l = this.dataRowContext.dataItemKey && m(this.dataRowContext.dataItemKey)(i.dataItem) || "ai" + n, c = f(this.dataRowContext, i, l, t), p = this.isTop ? "groupHeader" : "groupFooter";
return s(u, {
key: l,
rowType: p,
item: i,
dataIndex: -1,
ariaRowIndex: t,
absoluteRowIndex: n,
isAltRow: !1,
isHidden: !1,
rowHeight: this.$props.rowHeight,
isSelected: !1,
isInEdit: !1
}, {
default: () => [c.row]
});
})])])]);
}
});
export {
g as StickyGroupTable
};