UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

97 lines (93 loc) 3.83 kB
/** * DevExtreme (cjs/__internal/scheduler/r1/components/base/time_panel_cell.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.TimePanelCell = void 0; var _inferno = require("inferno"); var _inferno2 = require("@devextreme/runtime/inferno"); var _index = require("../../../../core/r1/utils/index"); var _cell = require("./cell"); 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) } let TimePanelCell = function(_BaseInfernoComponent) { _inheritsLoose(TimePanelCell, _BaseInfernoComponent); function TimePanelCell() { var _this; _this = _BaseInfernoComponent.apply(this, arguments) || this; _this.timeCellTemplateProps = null; return _this } var _proto = TimePanelCell.prototype; _proto.getTimeCellTemplateProps = function() { if (null !== this.timeCellTemplateProps) { return this.timeCellTemplateProps } const { groupIndex: groupIndex, groups: groups, index: index, startDate: startDate, text: text } = this.props; this.timeCellTemplateProps = { data: { date: startDate, groups: groups, groupIndex: groupIndex, text: text }, index: index }; return this.timeCellTemplateProps }; _proto.componentWillUpdate = function(nextProps) { if (this.props.groupIndex !== nextProps.groupIndex || this.props.groups !== nextProps.groups || this.props.index !== nextProps.index || this.props.startDate !== nextProps.startDate || this.props.text !== nextProps.text) { this.timeCellTemplateProps = null } }; _proto.render = function() { const { className: className, highlighted: highlighted, isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, text: text, timeCellTemplate: timeCellTemplate } = this.props; const timeCellTemplateProps = this.getTimeCellTemplateProps(); const TimeCellTemplateComponent = (0, _index.getTemplate)(timeCellTemplate); return (0, _inferno.createComponentVNode)(2, _cell.CellBase, { className: "dx-scheduler-time-panel-cell dx-scheduler-cell-sizes-vertical ".concat(highlighted ? "dx-scheduler-time-panel-current-time-cell" : "", " ").concat(className), isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, startDate: _cell.CellBaseDefaultProps.startDate, endDate: _cell.CellBaseDefaultProps.endDate, index: _cell.CellBaseDefaultProps.index, children: TimeCellTemplateComponent ? TimeCellTemplateComponent({ index: timeCellTemplateProps.index, data: timeCellTemplateProps.data }) : (0, _inferno.createVNode)(1, "div", null, text, 0) }) }; return TimePanelCell }(_inferno2.BaseInfernoComponent); exports.TimePanelCell = TimePanelCell; TimePanelCell.defaultProps = _cell.CellBaseDefaultProps;