UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

94 lines (90 loc) 4.5 kB
/** * DevExtreme (cjs/__internal/scheduler/r1/components/base/table.js) * Version: 23.2.6 * Build date: Wed May 01 2024 * * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TableDefaultProps = exports.Table = void 0; var _inferno = require("inferno"); var _inferno2 = require("@devextreme/runtime/inferno"); var _index = require("../../utils/index"); var _virtual_row = require("./virtual_row"); function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass) } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) { o.__proto__ = p; return o }; return _setPrototypeOf(o, p) } const TableDefaultProps = { topVirtualRowHeight: 0, bottomVirtualRowHeight: 0, leftVirtualCellWidth: 0, rightVirtualCellWidth: 0, virtualCellsCount: 0 }; exports.TableDefaultProps = TableDefaultProps; let Table = function(_BaseInfernoComponent) { _inheritsLoose(Table, _BaseInfernoComponent); function Table() { return _BaseInfernoComponent.apply(this, arguments) || this } var _proto = Table.prototype; _proto.getResultStyles = function() { const { height: height, width: width, styles: styles } = this.props; const heightAdded = _index.renderUtils.addHeightToStyle(height, styles); return _index.renderUtils.addWidthToStyle(width, heightAdded) }; _proto.render = function() { const { className: className, topVirtualRowHeight: topVirtualRowHeight, bottomVirtualRowHeight: bottomVirtualRowHeight, children: children, leftVirtualCellCount: leftVirtualCellCount, leftVirtualCellWidth: leftVirtualCellWidth, rightVirtualCellCount: rightVirtualCellCount, rightVirtualCellWidth: rightVirtualCellWidth, tableRef: tableRef, virtualCellsCount: virtualCellsCount } = this.props; const hasTopVirtualRow = !!topVirtualRowHeight; const hasBottomVirtualRow = !!bottomVirtualRowHeight; const resultStyles = this.getResultStyles(); return (0, _inferno.createVNode)(1, "table", className, (0, _inferno.createVNode)(1, "tbody", null, [hasTopVirtualRow && (0, _inferno.createComponentVNode)(2, _virtual_row.VirtualRow, { height: topVirtualRowHeight, cellsCount: null !== virtualCellsCount && void 0 !== virtualCellsCount ? virtualCellsCount : _virtual_row.VirtualRowDefaultProps.cellsCount, leftVirtualCellWidth: null !== leftVirtualCellWidth && void 0 !== leftVirtualCellWidth ? leftVirtualCellWidth : _virtual_row.VirtualRowDefaultProps.leftVirtualCellWidth, rightVirtualCellWidth: null !== rightVirtualCellWidth && void 0 !== rightVirtualCellWidth ? rightVirtualCellWidth : _virtual_row.VirtualRowDefaultProps.rightVirtualCellWidth, leftVirtualCellCount: leftVirtualCellCount, rightVirtualCellCount: rightVirtualCellCount }), children, hasBottomVirtualRow && (0, _inferno.createComponentVNode)(2, _virtual_row.VirtualRow, { height: bottomVirtualRowHeight, cellsCount: null !== virtualCellsCount && void 0 !== virtualCellsCount ? virtualCellsCount : _virtual_row.VirtualRowDefaultProps.cellsCount, leftVirtualCellWidth: null !== leftVirtualCellWidth && void 0 !== leftVirtualCellWidth ? leftVirtualCellWidth : _virtual_row.VirtualRowDefaultProps.leftVirtualCellWidth, rightVirtualCellWidth: null !== rightVirtualCellWidth && void 0 !== rightVirtualCellWidth ? rightVirtualCellWidth : _virtual_row.VirtualRowDefaultProps.rightVirtualCellWidth, leftVirtualCellCount: leftVirtualCellCount, rightVirtualCellCount: rightVirtualCellCount })], 0), 2, { style: (0, _inferno2.normalizeStyles)(resultStyles) }, null, tableRef) }; return Table }(_inferno2.BaseInfernoComponent); exports.Table = Table; Table.defaultProps = TableDefaultProps;