UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

142 lines (141 loc) 6.06 kB
/** * DevExtreme (esm/__internal/scheduler/r1/components/base/date_table_body.js) * Version: 26.1.4 * Build date: Fri Jul 24 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { createFragment, createComponentVNode } from "inferno"; import { BaseInfernoComponent } from "../../../../core/r1/runtime/inferno/index"; import { PublicTemplate } from "../../../../scheduler/r1/components/templates/index"; import { Fragment } from "inferno"; import { combineClasses } from "../../../../core/r1/utils/render_utils"; import { renderUtils } from "../../utils/index"; import { DATE_TABLE_ROW_CLASS } from "../const"; import { AllDayPanelTableBody, AllDayPanelTableBodyDefaultProps } from "./all_day_panel_table_body"; import { DateTableCellBase } from "./date_table_cell_base"; import { LayoutDefaultProps } from "./layout_props"; import { Row, RowDefaultProps } from "./row"; export const DateTableBodyDefaultProps = Object.assign({}, LayoutDefaultProps, { cellTemplate: DateTableCellBase }); export class DateTableBody extends BaseInfernoComponent { render() { const { viewData: viewData, viewContext: viewContext, addVerticalSizesClassToRows: addVerticalSizesClassToRows, cellTemplate: cellTemplate, dataCellTemplate: dataCellTemplate, rowHeights: rowHeights } = this.props; const rowClasses = combineClasses({ [DATE_TABLE_ROW_CLASS]: true, "dx-scheduler-cell-sizes-vertical": addVerticalSizesClassToRows }); return createFragment(viewData.groupedData.map((_ref2, groupIndex) => { let { allDayPanel: allDayPanel, dateTable: dateTable, isGroupedAllDayPanel: isGroupedAllDayPanel, key: fragmentKey } = _ref2; return createFragment([isGroupedAllDayPanel && createComponentVNode(2, AllDayPanelTableBody, { viewData: allDayPanel ?? AllDayPanelTableBodyDefaultProps.viewData, viewContext: viewContext, dataCellTemplate: dataCellTemplate, isVerticalGroupOrientation: true, leftVirtualCellWidth: viewData.leftVirtualCellWidth ?? AllDayPanelTableBodyDefaultProps.leftVirtualCellWidth, rightVirtualCellWidth: viewData.rightVirtualCellWidth ?? AllDayPanelTableBodyDefaultProps.rightVirtualCellWidth, leftVirtualCellCount: viewData.leftVirtualCellCount, rightVirtualCellCount: viewData.rightVirtualCellCount }), dateTable.map((_ref3, rowIndex) => { let { cells: cells, key: rowKey } = _ref3; const rowHeight = null === rowHeights || void 0 === rowHeights ? void 0 : rowHeights[(groupIndex => viewData.groupedData.slice(0, groupIndex).reduce((offset, _ref) => { let { dateTable: dateTable } = _ref; return offset + dateTable.length }, 0))(groupIndex) + rowIndex]; const rowStyles = void 0 === rowHeight ? void 0 : renderUtils.addHeightToStyle(rowHeight); return createComponentVNode(2, Row, { className: rowClasses, styles: rowStyles, leftVirtualCellWidth: viewData.leftVirtualCellWidth ?? RowDefaultProps.leftVirtualCellWidth, rightVirtualCellWidth: viewData.rightVirtualCellWidth ?? RowDefaultProps.rightVirtualCellWidth, leftVirtualCellCount: viewData.leftVirtualCellCount, rightVirtualCellCount: viewData.rightVirtualCellCount, children: cells.map(_ref4 => { let { key: cellKey, endDate: endDate, isFirstDayMonthHighlighting: isFirstDayMonthHighlighting, groupIndex: cellGroupIndex, groups: groups, index: cellIndex, isFirstGroupCell: isFirstGroupCell, isFocused: isFocused, isLastGroupCell: isLastGroupCell, isSelected: isSelected, otherMonth: otherMonth, startDate: startDate, text: text, today: today } = _ref4; return createComponentVNode(2, PublicTemplate, { template: cellTemplate, templateProps: { key: cellKey, viewContext: viewContext, isFirstGroupCell: isFirstGroupCell, isLastGroupCell: isLastGroupCell, startDate: startDate, endDate: endDate, groups: groups, groupIndex: cellGroupIndex, index: cellIndex, dataCellTemplate: dataCellTemplate, text: text, today: today, otherMonth: otherMonth, isFirstDayMonthHighlighting: isFirstDayMonthHighlighting, isSelected: isSelected, isFocused: isFocused } }) }) }, rowKey) })], 0, fragmentKey) }), 0) } } DateTableBody.defaultProps = DateTableBodyDefaultProps;