UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

122 lines (121 loc) 5.58 kB
/** * DevExtreme (esm/__internal/scheduler/r1/components/timeline/date_header_timeline.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 { createFragment, createComponentVNode } from "inferno"; import { BaseInfernoComponent } from "@devextreme/runtime/inferno"; import { getTemplate } from "../../../../core/r1/utils/index"; import { getThemeType } from "../../../../scheduler/r1/utils/themes"; import { isHorizontalGroupingApplied } from "../../utils/index"; import { DateHeaderDefaultProps } from "../base/date_header"; import { DateHeaderCell, DateHeaderCellDefaultProps } from "../base/date_header_cell"; import { Row, RowDefaultProps } from "../base/row"; var { isMaterialBased: isMaterialBased } = getThemeType(); export class TimelineDateHeaderLayout extends BaseInfernoComponent { render() { var { groupByDate: groupByDate, groupOrientation: groupOrientation, groups: groups, dateHeaderData: dateHeaderData, dateCellTemplate: dateCellTemplate, timeCellTemplate: timeCellTemplate } = this.props; var { dataMap: dataMap, isMonthDateHeader: isMonthDateHeader, leftVirtualCellCount: leftVirtualCellCount, leftVirtualCellWidth: leftVirtualCellWidth, rightVirtualCellCount: rightVirtualCellCount, rightVirtualCellWidth: rightVirtualCellWidth, weekDayLeftVirtualCellCount: weekDayLeftVirtualCellCount, weekDayLeftVirtualCellWidth: weekDayLeftVirtualCellWidth, weekDayRightVirtualCellCount: weekDayRightVirtualCellCount, weekDayRightVirtualCellWidth: weekDayRightVirtualCellWidth } = dateHeaderData; var isHorizontalGrouping = isHorizontalGroupingApplied(groups, groupOrientation) && !groupByDate; var DateCellTemplateComponent = getTemplate(dateCellTemplate); var TimeCellTemplateComponent = getTemplate(timeCellTemplate); return createFragment(dataMap.map((dateHeaderRow, rowIndex) => { var rowsCount = dataMap.length; var isTimeCellTemplate = rowsCount - 1 === rowIndex; var isWeekDayRow = rowsCount > 1 && 0 === rowIndex; var splitText = isMaterialBased && (isMonthDateHeader || isWeekDayRow); var validLeftVirtualCellCount = leftVirtualCellCount; var validRightVirtualCellCount = rightVirtualCellCount; var validRightVirtualCellWidth = rightVirtualCellWidth; var validLeftVirtualCellWidth = leftVirtualCellWidth; if (isWeekDayRow) { validLeftVirtualCellCount = weekDayLeftVirtualCellCount; validRightVirtualCellCount = weekDayRightVirtualCellCount; validRightVirtualCellWidth = weekDayRightVirtualCellWidth; validLeftVirtualCellWidth = weekDayLeftVirtualCellWidth } return createComponentVNode(2, Row, { className: "dx-scheduler-header-row", leftVirtualCellWidth: null !== validLeftVirtualCellWidth && void 0 !== validLeftVirtualCellWidth ? validLeftVirtualCellWidth : RowDefaultProps.leftVirtualCellWidth, leftVirtualCellCount: validLeftVirtualCellCount, rightVirtualCellWidth: null !== validRightVirtualCellWidth && void 0 !== validRightVirtualCellWidth ? validRightVirtualCellWidth : RowDefaultProps.rightVirtualCellWidth, rightVirtualCellCount: validRightVirtualCellCount, children: dateHeaderRow.map(_ref => { var { colSpan: colSpan, endDate: endDate, groupIndex: groupIndex, groups: cellGroups, index: index, isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, key: key, startDate: startDate, text: text, today: today } = _ref; return createComponentVNode(2, DateHeaderCell, { startDate: startDate, endDate: endDate, groups: isHorizontalGrouping ? cellGroups : void 0, groupIndex: isHorizontalGrouping ? groupIndex : void 0, today: null !== today && void 0 !== today ? today : DateHeaderCellDefaultProps.today, index: index, text: text, isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, isWeekDayCell: isWeekDayRow, colSpan: colSpan, splitText: splitText, dateCellTemplate: DateCellTemplateComponent, timeCellTemplate: TimeCellTemplateComponent, isTimeCellTemplate: isTimeCellTemplate }, key) }) }, rowIndex.toString()) }), 0) } } TimelineDateHeaderLayout.defaultProps = DateHeaderDefaultProps;