UNPKG

@progress/kendo-vue-grid

Version:
90 lines (89 loc) 2.45 kB
/** * @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 i, createVNode as r, ref as t } from "vue"; import { isRtl as h } from "../utils/main.mjs"; import { setRef as s, getRef as a, kendoThemeMaps as d } from "@progress/kendo-vue-common"; const u = /* @__PURE__ */ i({ props: { staticHeaders: Boolean, headerRow: Object, columnResize: Object, cols: Array, size: String, draggable: Boolean }, emits: ["headerscroll"], data() { return { divStyle: {}, element: null, headerWrap: null, table: null }; }, computed: { wrapperClass() { return { "k-grid-header": !0, "k-grid-draggable-header": this.$props.draggable }; }, tableClass() { const { size: e } = this.$props; return { "k-table": !0, "k-grid-header-table": !0, [`k-table-${d.sizeMap[e] || e}`]: e }; } }, mounted() { this.headerWrap = a(this, "headerWrap"), this.table = a(this, "table"), this.$props.columnResize.colGroupHeader = a(this, "colGroupHeader"); const e = h(this.$el); this.$props.columnResize && this.$props.columnResize.setIsRtl(e); }, methods: { setScrollLeft(e) { this.headerWrap && (this.headerWrap.scrollLeft = e); }, setWidth(e) { this.table && (this.table.style.width = e + "px"); }, handleHeaderScroll(e) { this.$emit("headerscroll", e); } }, setup() { const e = t(null), l = t(null), o = t(null); return { headerWrapRef: e, tableRef: l, colGroupHeaderRef: o }; }, render() { return this.$props.staticHeaders ? r("div", { class: this.wrapperClass }, [r("div", { ref: s(this, "headerWrap"), class: "k-grid-header-wrap", onScroll: this.handleHeaderScroll }, [r("table", { class: this.tableClass, ref: s(this, "table"), role: "none" }, [r("colgroup", { ref: s(this, "colGroupHeader") }, [this.$props.cols]), this.$props.headerRow])])]) : this.$props.headerRow; } }); export { u as Header };