40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
import * as React from 'react';
|
|
import classNames from 'classnames';
|
|
import DatePanel from '../DatePanel';
|
|
import { isSameWeek } from '../../utils/dateUtil';
|
|
|
|
function WeekPanel(props) {
|
|
var prefixCls = props.prefixCls,
|
|
generateConfig = props.generateConfig,
|
|
locale = props.locale,
|
|
value = props.value; // Render additional column
|
|
|
|
var cellPrefixCls = "".concat(prefixCls, "-cell");
|
|
|
|
var prefixColumn = function prefixColumn(date) {
|
|
return React.createElement("td", {
|
|
key: "week",
|
|
className: classNames(cellPrefixCls, "".concat(cellPrefixCls, "-week"))
|
|
}, generateConfig.locale.getWeek(locale.locale, date));
|
|
}; // Add row className
|
|
|
|
|
|
var rowPrefixCls = "".concat(prefixCls, "-week-panel-row");
|
|
|
|
var rowClassName = function rowClassName(date) {
|
|
return classNames(rowPrefixCls, _defineProperty({}, "".concat(rowPrefixCls, "-selected"), isSameWeek(generateConfig, locale.locale, value, date)));
|
|
};
|
|
|
|
return React.createElement(DatePanel, Object.assign({}, props, {
|
|
panelName: "week",
|
|
prefixColumn: prefixColumn,
|
|
rowClassName: rowClassName,
|
|
keyboardConfig: {
|
|
onLeftRight: null
|
|
}
|
|
}));
|
|
}
|
|
|
|
export default WeekPanel; |