/**
 * DevExtreme (esm/__internal/scheduler/r1/components/base/date_table_body.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import _extends from "@babel/runtime/helpers/esm/extends";
import {
    createFragment,
    createComponentVNode
} from "inferno";
import {
    BaseInfernoComponent
} from "@devextreme/runtime/inferno";
import {
    getTemplate
} from "../../../../core/r1/utils/index";
import {
    Fragment
} from "inferno";
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 var DateTableBodyDefaultProps = _extends(_extends({}, LayoutDefaultProps), {
    cellTemplate: DateTableCellBase
});
export class DateTableBody extends BaseInfernoComponent {
    render() {
        var {
            addVerticalSizesClassToRows: addVerticalSizesClassToRows,
            viewData: viewData,
            cellTemplate: cellTemplate,
            dataCellTemplate: dataCellTemplate
        } = this.props;
        var rowClasses = renderUtils.combineClasses({
            [DATE_TABLE_ROW_CLASS]: true,
            "dx-scheduler-cell-sizes-vertical": addVerticalSizesClassToRows
        });
        var CellTemplateComponent = getTemplate(cellTemplate);
        var DataCellTemplateComponent = getTemplate(dataCellTemplate);
        return createFragment(viewData.groupedData.map(_ref => {
            var {
                allDayPanel: allDayPanel,
                dateTable: dateTable,
                isGroupedAllDayPanel: isGroupedAllDayPanel,
                key: fragmentKey
            } = _ref;
            var _a, _b;
            return createFragment([isGroupedAllDayPanel && createComponentVNode(2, AllDayPanelTableBody, {
                viewData: null !== allDayPanel && void 0 !== allDayPanel ? allDayPanel : AllDayPanelTableBodyDefaultProps.viewData,
                dataCellTemplate: DataCellTemplateComponent,
                isVerticalGroupOrientation: true,
                leftVirtualCellWidth: null !== (_a = viewData.leftVirtualCellWidth) && void 0 !== _a ? _a : AllDayPanelTableBodyDefaultProps.leftVirtualCellWidth,
                rightVirtualCellWidth: null !== (_b = viewData.rightVirtualCellWidth) && void 0 !== _b ? _b : AllDayPanelTableBodyDefaultProps.rightVirtualCellWidth,
                leftVirtualCellCount: viewData.leftVirtualCellCount,
                rightVirtualCellCount: viewData.rightVirtualCellCount
            }), dateTable.map(_ref2 => {
                var {
                    cells: cells,
                    key: rowKey
                } = _ref2;
                var _a, _b;
                return createComponentVNode(2, Row, {
                    className: rowClasses,
                    leftVirtualCellWidth: null !== (_a = viewData.leftVirtualCellWidth) && void 0 !== _a ? _a : RowDefaultProps.leftVirtualCellWidth,
                    rightVirtualCellWidth: null !== (_b = viewData.rightVirtualCellWidth) && void 0 !== _b ? _b : RowDefaultProps.rightVirtualCellWidth,
                    leftVirtualCellCount: viewData.leftVirtualCellCount,
                    rightVirtualCellCount: viewData.rightVirtualCellCount,
                    children: cells.map(_ref3 => {
                        var {
                            key: cellKey,
                            endDate: endDate,
                            firstDayOfMonth: firstDayOfMonth,
                            groupIndex: cellGroupIndex,
                            groups: groups,
                            index: cellIndex,
                            isFirstGroupCell: isFirstGroupCell,
                            isFocused: isFocused,
                            isLastGroupCell: isLastGroupCell,
                            isSelected: isSelected,
                            otherMonth: otherMonth,
                            startDate: startDate,
                            text: text,
                            today: today
                        } = _ref3;
                        return CellTemplateComponent({
                            key: cellKey,
                            isFirstGroupCell: isFirstGroupCell,
                            isLastGroupCell: isLastGroupCell,
                            startDate: startDate,
                            endDate: endDate,
                            groups: groups,
                            groupIndex: cellGroupIndex,
                            index: cellIndex,
                            dataCellTemplate: DataCellTemplateComponent,
                            text: text,
                            today: today,
                            otherMonth: otherMonth,
                            firstDayOfMonth: firstDayOfMonth,
                            isSelected: isSelected,
                            isFocused: isFocused
                        })
                    })
                }, rowKey)
            })], 0, fragmentKey)
        }), 0)
    }
}
DateTableBody.defaultProps = DateTableBodyDefaultProps;
