devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
110 lines (106 loc) • 4.51 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/r1/components/base/date_header.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/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DateHeaderDefaultProps = exports.DateHeader = void 0;
var _inferno = require("inferno");
var _inferno2 = require("@devextreme/runtime/inferno");
var _index = require("../../../../core/r1/utils/index");
var _index2 = require("../../utils/index");
var _date_header_cell = require("./date_header_cell");
var _row = require("./row");
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass)
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) {
o.__proto__ = p;
return o
};
return _setPrototypeOf(o, p)
}
const {
isMaterialBased: isMaterialBased
} = _index2.themeUtils.getThemeType();
const DateHeaderDefaultProps = {
groupOrientation: "horizontal",
groupByDate: false,
groups: []
};
exports.DateHeaderDefaultProps = DateHeaderDefaultProps;
let DateHeader = function(_BaseInfernoComponent) {
_inheritsLoose(DateHeader, _BaseInfernoComponent);
function DateHeader() {
return _BaseInfernoComponent.apply(this, arguments) || this
}
var _proto = DateHeader.prototype;
_proto.render = function() {
const {
dateCellTemplate: dateCellTemplate,
dateHeaderData: {
dataMap: dataMap,
leftVirtualCellCount: leftVirtualCellCount,
leftVirtualCellWidth: leftVirtualCellWidth,
rightVirtualCellCount: rightVirtualCellCount,
rightVirtualCellWidth: rightVirtualCellWidth
},
groupByDate: groupByDate,
groupOrientation: groupOrientation,
groups: groups
} = this.props;
const isHorizontalGrouping = (0, _index2.isHorizontalGroupingApplied)(groups, groupOrientation) && !groupByDate;
const DateCellTemplateComponent = (0, _index.getTemplate)(dateCellTemplate);
return (0, _inferno.createFragment)(dataMap.map((dateHeaderRow, rowIndex) => (0, _inferno.createComponentVNode)(2, _row.Row, {
className: "dx-scheduler-header-row",
leftVirtualCellWidth: leftVirtualCellWidth,
leftVirtualCellCount: leftVirtualCellCount,
rightVirtualCellWidth: rightVirtualCellWidth,
rightVirtualCellCount: rightVirtualCellCount,
isHeaderRow: true,
children: dateHeaderRow.map(_ref => {
let {
colSpan: colSpan,
endDate: endDate,
groupIndex: groupIndex,
groups: cellGroups,
index: index,
isFirstGroupCell: isFirstGroupCell,
isLastGroupCell: isLastGroupCell,
key: key,
startDate: startDate,
text: text,
today: today
} = _ref;
return (0, _inferno.createComponentVNode)(2, _date_header_cell.DateHeaderCell, {
startDate: startDate,
endDate: endDate,
groups: isHorizontalGrouping ? cellGroups : void 0,
groupIndex: isHorizontalGrouping ? groupIndex : void 0,
today: null !== today && void 0 !== today ? today : false,
isWeekDayCell: false,
isTimeCellTemplate: false,
index: index,
text: text,
isFirstGroupCell: isFirstGroupCell,
isLastGroupCell: isLastGroupCell,
dateCellTemplate: DateCellTemplateComponent,
colSpan: colSpan,
splitText: isMaterialBased
}, key)
})
}, rowIndex.toString())), 0)
};
return DateHeader
}(_inferno2.BaseInfernoComponent);
exports.DateHeader = DateHeader;
DateHeader.defaultProps = DateHeaderDefaultProps;