/**
 * DevExtreme (esm/__internal/scheduler/r1/components/base/time_panel_cell.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 {
    createVNode,
    createComponentVNode
} from "inferno";
import {
    BaseInfernoComponent
} from "@devextreme/runtime/inferno";
import {
    getTemplate
} from "../../../../core/r1/utils/index";
import {
    CellBase,
    CellBaseDefaultProps
} from "./cell";
export class TimePanelCell extends BaseInfernoComponent {
    constructor() {
        super(...arguments);
        this.timeCellTemplateProps = null
    }
    getTimeCellTemplateProps() {
        if (null !== this.timeCellTemplateProps) {
            return this.timeCellTemplateProps
        }
        var {
            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
    }
    componentWillUpdate(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
        }
    }
    render() {
        var {
            className: className,
            highlighted: highlighted,
            isFirstGroupCell: isFirstGroupCell,
            isLastGroupCell: isLastGroupCell,
            text: text,
            timeCellTemplate: timeCellTemplate
        } = this.props;
        var timeCellTemplateProps = this.getTimeCellTemplateProps();
        var TimeCellTemplateComponent = getTemplate(timeCellTemplate);
        return createComponentVNode(2, 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: CellBaseDefaultProps.startDate,
            endDate: CellBaseDefaultProps.endDate,
            index: CellBaseDefaultProps.index,
            children: TimeCellTemplateComponent ? TimeCellTemplateComponent({
                index: timeCellTemplateProps.index,
                data: timeCellTemplateProps.data
            }) : createVNode(1, "div", null, text, 0)
        })
    }
}
TimePanelCell.defaultProps = CellBaseDefaultProps;
