123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- function keys(obj) {
- if (typeof Object.keys === 'function') {
- return Object.keys(obj);
- }
- }
- function getClassName(value, index) {
- var isSelected = value.isSelected,
- isSelectedBegin = value.isSelectedBegin,
- isSelectedEnd = value.isSelectedEnd,
- isRowBegin = value.isRowBegin,
- isRowEnd = value.isRowEnd,
- inThisMonth = value.inThisMonth,
- isToday = value.isToday,
- disabled = value.disabled;
- var classNames = {
- disabled: disabled,
- today: inThisMonth && isToday,
- selected: inThisMonth && isSelected,
- 'selected-begin': inThisMonth && isSelectedBegin,
- 'selected-end': inThisMonth && isSelectedEnd,
- 'selected-row-begin': inThisMonth && isRowBegin && isSelected,
- 'selected-row-end': inThisMonth && isRowEnd && isSelected,
- hidden: !inThisMonth,
- 'row-end': index % 7 === 6
- };
- var result = 'ant-calendar-cell';
- keys(classNames).forEach(function (key) {
- if (classNames[key]) {
- result += " ant-calendar-cell-".concat(key);
- }
- });
- return result;
- }
- function getSpaceClassName(index, items) {
- var isNotEnd = index % 7 !== 6;
- var nextItem = items[index + 1];
- var nextSelected = nextItem && nextItem.isSelected && nextItem.inThisMonth;
- var isSelected = items[index].isSelected;
- var classNames = {
- active: isNotEnd && isSelected && nextSelected
- };
- var result = 'ant-calendar-cell-space';
- keys(classNames).forEach(function (key) {
- if (classNames[key]) {
- result += " ant-calendar-cell-space-".concat(key);
- }
- });
- return result;
- }
- function getMarkCellClassName(index, items) {
- if (items[index].length - 1 === index) {
- return "ant-calendar-mark-cell ant-calendar-mark-cell-last";
- }
- return 'ant-calendar-mark-cell';
- }
- export default {
- getSpaceClassName: getSpaceClassName,
- getClassName: getClassName,
- getMarkCellClassName: getMarkCellClassName
- };
|