UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

97 lines (96 loc) 3.31 kB
/** * DevExtreme (esm/__internal/scheduler/r1/components/month/date_table_month_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/ */ import { createVNode, createComponentVNode } from "inferno"; import { BaseInfernoComponent } from "@devextreme/runtime/inferno"; import { getTemplate } from "../../../../core/r1/utils/index"; import { renderUtils } from "../../utils/index"; import { DateTableCallBaseDefaultProps, DateTableCellBase } from "../base/date_table_cell_base"; export class DateTableMonthCell extends BaseInfernoComponent { constructor() { super(...arguments); this.contentTemplateProps = null } getContentTemplateProps() { if (null !== this.contentTemplateProps) { return this.contentTemplateProps } var { index: index, text: text } = this.props; this.contentTemplateProps = { data: { text: text }, index: index }; return this.contentTemplateProps } componentWillUpdate(nextProps) { if (this.props.index !== nextProps.index || this.props.text !== nextProps.text) { this.contentTemplateProps = null } } render() { var { dataCellTemplate: dataCellTemplate, endDate: endDate, groupIndex: groupIndex, groups: groups, index: index, isFirstGroupCell: isFirstGroupCell, isFocused: isFocused, isLastGroupCell: isLastGroupCell, isSelected: isSelected, startDate: startDate, text: text, className: className, firstDayOfMonth: firstDayOfMonth, otherMonth: otherMonth, today: today } = this.props; var classes = renderUtils.combineClasses({ "dx-scheduler-date-table-other-month": !!otherMonth, "dx-scheduler-date-table-current-date": !!today, "dx-scheduler-date-table-first-of-month": !!firstDayOfMonth, [null !== className && void 0 !== className ? className : ""]: !!className }); var contentTemplateProps = this.getContentTemplateProps(); var DataCellTemplateComponent = getTemplate(dataCellTemplate); return createComponentVNode(2, DateTableCellBase, { className: classes, dataCellTemplate: DataCellTemplateComponent, startDate: startDate, endDate: endDate, text: text, groups: groups, groupIndex: groupIndex, index: index, isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, isSelected: isSelected, isFocused: isFocused, contentTemplateProps: contentTemplateProps, children: createVNode(1, "div", "dx-scheduler-date-table-cell-text", text, 0) }) } } DateTableMonthCell.defaultProps = DateTableCallBaseDefaultProps;