@progress/kendo-react-grid
Version:
KendoReact Grid package
53 lines • 2.28 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 { getNestedValue } from './../utils';
/**
* @hidden
*/
var GridHierarchyCell = /** @class */ (function (_super) {
__extends(GridHierarchyCell, _super);
function GridHierarchyCell() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @hidden
*/
GridHierarchyCell.prototype.render = function () {
var _this = this;
var defaultRendering = null;
if (this.props.rowType === 'groupFooter') {
defaultRendering = React.createElement("td", { className: "k-hierarchy-cell" });
}
else if (this.props.rowType !== 'groupHeader') {
var expanded_1 = getNestedValue(this.props.field, this.props.dataItem);
var className = expanded_1 ? 'k-icon k-minus' : 'k-icon k-plus';
defaultRendering = (React.createElement("td", { className: "k-hierarchy-cell" },
React.createElement("a", { onClick: function (e) {
e.preventDefault();
if (_this.props.onChange) {
_this.props.onChange({
dataItem: _this.props.dataItem,
syntheticEvent: e,
field: _this.props.field,
value: !expanded_1
});
}
}, className: className, href: "#", tabIndex: -1 })));
}
return this.props.render ?
this.props.render.call(undefined, defaultRendering, this.props) :
defaultRendering;
};
return GridHierarchyCell;
}(React.Component));
export { GridHierarchyCell };
//# sourceMappingURL=GridHierarchyCell.js.map