@progress/kendo-react-grid
Version:
KendoReact Grid package
71 lines • 2.9 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as React from 'react';
import { BrowserSupportService } from '../utils/browser-support.service';
/**
* @hidden
*/
var Header = /** @class */ (function (_super) {
__extends(Header, _super);
function Header() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.divStyle = {};
_this.element = null;
_this.headerWrap = null;
_this.table = null;
return _this;
}
Header.prototype.componentDidMount = function () {
this.setState({});
var scrollbarWidth = (new BrowserSupportService()).scrollbarWidth;
var rtl = this.element && (getComputedStyle(this.element).direction === 'rtl') || false;
var padding = Math.max(0, scrollbarWidth - 1) + 'px';
var right = rtl ? 0 : padding;
var left = rtl ? padding : 0;
this.divStyle = { padding: "0 " + right + " 0 " + left };
};
/**
*
* @param scrollLeft scroll left in pixels
*/
Header.prototype.setScrollLeft = function (scrollLeft) {
if (this.headerWrap) {
this.headerWrap.scrollLeft = scrollLeft;
}
};
/**
*
* @param width scroll width in pixels
*/
Header.prototype.setWidth = function (width) {
if (this.table) {
this.table.style.width = width + 'px';
}
};
Header.prototype.render = function () {
var _this = this;
if (!this.props.staticHeaders) {
return (React.createElement("thead", { className: "k-grid-header" },
this.props.headerRow,
this.props.filterRow));
}
return (React.createElement("div", { ref: function (div) { _this.element = div; }, className: "k-grid-header", style: this.divStyle },
React.createElement("div", { ref: function (div) { _this.headerWrap = div; }, className: "k-grid-header-wrap" },
React.createElement("table", { ref: function (table) { _this.table = table; } },
React.createElement("colgroup", { ref: function (e) { _this.props.columnResize.colGroupHeader = e; } }, this.props.cols),
React.createElement("thead", null,
this.props.headerRow,
this.props.filterRow)))));
};
return Header;
}(React.Component));
export { Header };
//# sourceMappingURL=Header.js.map