react-application-core
Version:
A react-based application core for the business applications.
98 lines • 4.5 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GridColumn = void 0;
var React = require("react");
var util_1 = require("../../../util");
var base_column_1 = require("../base-column");
var GridColumn = /** @class */ (function (_super) {
__extends(GridColumn, _super);
/**
* @stable [12.12.2020]
* @param originalProps
*/
function GridColumn(originalProps) {
var _this = _super.call(this, originalProps) || this;
_this.onColumnClick = _this.onColumnClick.bind(_this);
_this.onColumnContentClick = _this.onColumnContentClick.bind(_this);
return _this;
}
/**
* @stable [12.12.2020]
*/
GridColumn.prototype.render = function () {
var _this = this;
var originalProps = this.originalProps;
var originalChildren = this.originalChildren;
var colSpan = originalProps.colSpan, columnClassName = originalProps.columnClassName, columnColSpan = originalProps.columnColSpan, columnRendered = originalProps.columnRendered, columnTitle = originalProps.columnTitle, onColumnClick = originalProps.onColumnClick;
return util_1.ConditionUtils.orNull(columnRendered, function () { return (React.createElement("td", __assign({ style: _this.styles, colSpan: util_1.NvlUtils.nvl(columnColSpan, colSpan), className: _this.getClassName(util_1.CalcUtils.calc(columnClassName, originalProps)), title: columnTitle ||
util_1.ConditionUtils.orUndef(util_1.TypeUtils.isPrimitive(originalChildren), function () { return String(originalChildren); }) }, util_1.PropsUtils.buildClickHandlerProps(_this.onColumnClick, util_1.TypeUtils.isFn(onColumnClick), false)), _this.columnContentElement)); });
};
/**
* @stable [09.12.2020]
* @protected
*/
GridColumn.prototype.getColumnContentProps = function () {
var onColumnContentClick = this.originalProps.onColumnContentClick;
return __assign(__assign({}, _super.prototype.getColumnContentProps.call(this)), util_1.PropsUtils.buildClickHandlerProps(this.onColumnContentClick, util_1.TypeUtils.isFn(onColumnContentClick), false));
};
/**
* @stable [09.12.2020]
* @private
*/
GridColumn.prototype.onColumnClick = function () {
var originalProps = this.originalProps;
var onColumnClick = originalProps.onColumnClick;
onColumnClick(originalProps);
};
/**
* @stable [09.12.2020]
* @private
*/
GridColumn.prototype.onColumnContentClick = function () {
var originalProps = this.originalProps;
var onColumnContentClick = originalProps.onColumnContentClick;
onColumnContentClick(originalProps);
};
Object.defineProperty(GridColumn.prototype, "styles", {
/**
* @stable [09.12.2020]
*/
get: function () {
var originalProps = this.originalProps;
var columnStyle = originalProps.columnStyle, columnWidth = originalProps.columnWidth;
return this.getStyle(__assign({ width: columnWidth }, util_1.CalcUtils.calc(columnStyle, originalProps)));
},
enumerable: false,
configurable: true
});
GridColumn.defaultProps = {
columnRendered: true,
};
return GridColumn;
}(base_column_1.BaseGridColumn));
exports.GridColumn = GridColumn;
//# sourceMappingURL=grid-column.component.js.map