devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
108 lines (107 loc) • 3.79 kB
JavaScript
/**
* DevExtreme (esm/__internal/scheduler/r1/components/base/date_header_cell.js)
* Version: 25.1.3
* Build date: Wed Jun 25 2025
*
* Copyright (c) 2012 - 2025 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 {
createVNode,
createFragment,
createComponentVNode
} from "inferno";
import {
BaseInfernoComponent
} from "../../../../core/r1/runtime/inferno/index";
import {
PublicTemplate
} from "../../../../scheduler/r1/components/templates/index";
import {
combineClasses
} from "../../../../core/r1/utils/render_utils";
import {
renderUtils
} from "../../utils/index";
import {
CellBaseDefaultProps
} from "./cell";
import {
DateHeaderText
} from "./date_header_text";
export const DateHeaderCellDefaultProps = _extends({}, CellBaseDefaultProps, {
today: false,
colSpan: 1,
isWeekDayCell: false,
splitText: false,
isTimeCellTemplate: false
});
export class DateHeaderCell extends BaseInfernoComponent {
render() {
const {
viewContext: {
view: {
type: viewType
},
crossScrollingEnabled: crossScrollingEnabled
},
colSpan: colSpan,
dateCellTemplate: dateCellTemplate,
groupIndex: groupIndex,
groups: groups,
index: index,
isTimeCellTemplate: isTimeCellTemplate,
splitText: splitText,
startDate: startDate,
text: text,
timeCellTemplate: timeCellTemplate,
className: className,
isFirstGroupCell: isFirstGroupCell,
isLastGroupCell: isLastGroupCell,
isWeekDayCell: isWeekDayCell,
today: today
} = this.props;
const cellSizeHorizontalClass = renderUtils.getCellSizeHorizontalClass(viewType, crossScrollingEnabled);
const cellClasses = combineClasses({
"dx-scheduler-header-panel-cell": true,
[cellSizeHorizontalClass]: true,
"dx-scheduler-header-panel-current-time-cell": today,
"dx-scheduler-header-panel-week-cell": isWeekDayCell,
[className ?? ""]: !!className
});
const classes = renderUtils.getGroupCellClasses(isFirstGroupCell, isLastGroupCell, cellClasses);
const useTemplate = !isTimeCellTemplate && !!dateCellTemplate || isTimeCellTemplate && !!timeCellTemplate;
const children = useTemplate ? createFragment([isTimeCellTemplate && createComponentVNode(2, PublicTemplate, {
template: timeCellTemplate,
templateProps: {
data: {
date: startDate,
text: text,
groups: groups,
groupIndex: groupIndex
},
index: index
}
}), !isTimeCellTemplate && createComponentVNode(2, PublicTemplate, {
template: dateCellTemplate,
templateProps: {
data: {
date: startDate,
text: text,
groups: groups,
groupIndex: groupIndex
},
index: index
}
})], 0) : createComponentVNode(2, DateHeaderText, {
splitText: splitText,
text: text
});
return createVNode(1, "th", classes, children, 0, {
colspan: colSpan,
title: text
})
}
}
DateHeaderCell.defaultProps = DateHeaderCellDefaultProps;