tdesign-vue
Version:
892 lines (886 loc) • 31.9 kB
JavaScript
/**
* tdesign v1.12.1
* (c) 2025 tdesign
* @license MIT
*/
import { h as helper } from '../_chunks/dep-323b993c.js';
import _typeof from '@babel/runtime/helpers/typeof';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import dayjs from 'dayjs';
import { c as createCommonjsModule, a as commonjsGlobal } from '../_chunks/dep-d639fbd7.js';
import props from './props.js';
import mixins from '../utils/mixins.js';
import getConfigReceiverMixins from '../config-provider/config-receiver.js';
import { createMonthCellsData, createYearCellsData, getDayCn } from './utils.js';
import { emitEvent } from '../utils/event.js';
import { getIEVersion } from '../_common/js/utils/helper.js';
import { MIN_YEAR, FIRST_MONTH_OF_YEAR, LAST_MONTH_OF_YEAR, DEFAULT_YEAR_CELL_NUMINROW } from './const.js';
import { Select, Option } from '../select/index.js';
import { RadioGroup, RadioButton } from '../radio/index.js';
import { Button } from '../button/index.js';
import { CheckTag } from '../tag/index.js';
import CalendarCellItem from './calendar-cell.js';
import RenderComponent from '../utils/render-component.js';
import { renderTNodeJSX, renderTNodeJSXDefault } from '../utils/render-tnode.js';
import 'vue';
import 'lodash-es';
import '../config-provider/context.js';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../_chunks/dep-c44a474d.js';
import '../_chunks/dep-3c66615e.js';
import '../config-provider/type.js';
import '../_common/js/global-config/t.js';
import '../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/toConsumableArray';
import '@vue/composition-api';
import '../select/select.js';
import '../hooks/useDefaultValue.js';
import '../hooks/useVModel.js';
import '../hooks/tnode.js';
import '../hooks/render-tnode.js';
import '../config-provider/useConfig.js';
import '../select/props.js';
import '../loading/index.js';
import '../loading/directive.js';
import '../loading/plugin.js';
import '../loading/loading.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/setStyle.js';
import '../utils/dom.js';
import 'raf';
import '../utils/easing.js';
import '../utils/transfer-dom.js';
import '../loading/props.js';
import '../config.js';
import '@babel/runtime/helpers/readOnlyError';
import '../utils/withInstall.js';
import './style/css.js';
import '../loading/type.js';
import '../popup/index.js';
import '../popup/popup.js';
import '@popperjs/core';
import '../popup/props.js';
import '../popup/container.js';
import '../popup/utils.js';
import '../utils/map-props.js';
import '../popup/type.js';
import '../popup/plugin.js';
import '../_common/js/log/index.js';
import '../_common/js/log/log.js';
import '../input/index.js';
import '../input/input.js';
import 'tdesign-icons-vue';
import '../input/props.js';
import '../input/input-group.js';
import '../input/type.js';
import '../select-input/index.js';
import '../select-input/select-input.js';
import '../select-input/props.js';
import '../select-input/useSingle.js';
import '../hooks/useConfig.js';
import '../select-input/useMultiple.js';
import '../tag-input/index.js';
import '../tag-input/tag-input.js';
import '../tag-input/props.js';
import '../tag-input/hooks/useTagScroll.js';
import '../tag-input/useTagList.js';
import '../tag-input/hooks/useHover.js';
import '../tag-input/hooks/useDragSorter.js';
import '../hooks/useGlobalIcon.js';
import '../tag/tag.js';
import 'tinycolor2';
import '../tag/props.js';
import '../tag/check-tag.js';
import '../tag/check-tag-props.js';
import '../_common/js/common.js';
import '../hooks/index.js';
import '../hooks/slots.js';
import '../hooks/useCommonClassName.js';
import '../hooks/useDestroyOnClose.js';
import '../hooks/useElementLazyRender.js';
import '../_common/js/utils/observe.js';
import '../hooks/useFormDisabled.js';
import '../hooks/useLazyLoad.js';
import '../hooks/useResizeObserver.js';
import '../hooks/useVirtualScrollNew.js';
import '../hooks/useImagePreviewUrl.js';
import '../_common/js/upload/utils.js';
import '../tag/check-tag-group.js';
import '../tag/check-tag-group-props.js';
import '../tag/type.js';
import '../tag-input/type.js';
import '../tag-input/interface.js';
import '../select-input/useOverlayInnerStyle.js';
import '../select-input/type.js';
import '../common-components/fake-arrow.js';
import '../select/option.js';
import '../utils/ripple.js';
import '../select/option-props.js';
import '../checkbox/index.js';
import '../checkbox/group.js';
import '../checkbox/checkbox.js';
import '../checkbox/props.js';
import '../checkbox/constants.js';
import '../checkbox/store.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '../checkbox/hooks/useKeyboardEvent.js';
import '../checkbox/checkbox-group-props.js';
import '../checkbox/type.js';
import '../select/util.js';
import '../select/select-panel.js';
import '../select/optionGroup.js';
import '../select/option-group-props.js';
import '../hooks/useVirtualScroll.js';
import '../select/hooks/useSelectOptions.js';
import '../select/type.js';
import '../radio/radio.js';
import '../radio/props.js';
import '../radio/group.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/regenerator';
import '../radio/radio-group-props.js';
import '../radio/radio-button.js';
import '../radio/type.js';
import '../button/button.js';
import '../button/props.js';
import '../button/type.js';
var calendar = createCommonjsModule(function (module, exports) {
!function (e, t) {
"object" == 'object' && "undefined" != 'object' ? module.exports = t() : "function" == typeof undefined && undefined.amd ? undefined(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_calendar = t();
}(commonjsGlobal, function () {
"use strict";
return function (e, t, a) {
var n = "h:mm A",
d = {
lastDay: "[Yesterday at] " + n,
sameDay: "[Today at] " + n,
nextDay: "[Tomorrow at] " + n,
nextWeek: "dddd [at] " + n,
lastWeek: "[Last] dddd [at] " + n,
sameElse: "MM/DD/YYYY"
};
t.prototype.calendar = function (e, t) {
var n = t || this.$locale().calendar || d,
o = a(e || void 0).startOf("d"),
s = this.diff(o, "d", !0),
i = "sameElse",
f = s < -6 ? i : s < -1 ? "lastWeek" : s < 0 ? "lastDay" : s < 1 ? "sameDay" : s < 2 ? "nextDay" : s < 7 ? "nextWeek" : i,
l = n[f] || d[f];
return "function" == typeof l ? l.call(this, a()) : this.format(l);
};
};
});
});
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
dayjs.extend(calendar);
var createDefaultCurDate = function createDefaultCurDate() {
return dayjs(dayjs().format("YYYY-MM-DD"));
};
var getDefaultControllerConfigData = function getDefaultControllerConfigData() {
var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
return {
visible: visible,
disabled: false,
mode: {
visible: true,
radioGroupProps: {}
},
year: {
visible: true,
selectProps: {}
},
month: {
visible: true,
selectProps: {}
},
weekend: {
visible: true,
showWeekendButtonProps: {},
hideWeekendButtonProps: {}
},
current: {
visible: true,
currentDayButtonProps: {},
currentMonthButtonProps: {}
}
};
};
var _Calendar = mixins(getConfigReceiverMixins("calendar")).extend({
name: "TCalendar",
components: {
TCheckTag: CheckTag,
TSelect: Select,
TOption: Option,
TRadioGroup: RadioGroup,
TRadioButton: RadioButton,
TButton: Button,
CalendarCellItem: CalendarCellItem,
RenderComponent: RenderComponent
},
props: _objectSpread({}, props),
data: function data() {
return {
realFirstDayOfWeek: 1,
curDate: null,
curDateList: [],
curSelectedYear: null,
curSelectedMonth: null,
curSelectedMode: null,
isShowWeekend: true,
controlSize: "medium"
};
},
computed: {
state: function state() {
return this.$data;
},
props: function props() {
return this.$props;
},
TEXT_MAP: function TEXT_MAP() {
var t = this.t,
global = this.global;
var r = {
showWeekend: t(global.showWeekend),
hideWeekend: t(global.hideWeekend),
today: t(global.today),
thisMonth: t(global.thisMonth)
};
return r;
},
weekDipalyText: function weekDipalyText() {
return this.week || this.t(this.global.week).split(",");
},
calendarCls: function calendarCls() {
return ["".concat(this.componentName), "".concat(this.componentName, "--").concat(this.theme)];
},
calendarPanelCls: function calendarPanelCls() {
return ["".concat(this.componentName, "__panel"), "".concat(this.componentName, "__panel--").concat(this.curSelectedMode)];
},
isWeekRender: function isWeekRender() {
return typeof this.week === "function";
},
rangeFromTo: function rangeFromTo() {
if (!this.range || this.range.length < 2) {
return null;
}
var _this$range = _slicedToArray(this.range, 2),
v1 = _this$range[0],
v2 = _this$range[1];
if (dayjs(v1).isBefore(dayjs(v2))) {
return {
from: v1,
to: v2
};
}
return {
from: v2,
to: v1
};
},
controllerOptions: function controllerOptions() {
var dayJsFilterDate = dayjs("".concat(this.curSelectedYear, "-").concat(this.curSelectedMonth));
var re = {
isShowWeekend: this.isShowWeekend,
filterDate: dayJsFilterDate.toDate(),
formattedFilterDate: dayJsFilterDate.format(this.format),
mode: this.curSelectedMode
};
return re;
},
cellColHeaders: function cellColHeaders() {
var re = [];
var min = 1;
var max = 7;
for (var i = this.realFirstDayOfWeek; i <= max; i++) {
re.push({
num: i,
display: this.getWeekDisplay(i)
});
}
if (this.realFirstDayOfWeek > min) {
for (var _i = min; _i < this.realFirstDayOfWeek; _i++) {
re.push({
num: _i,
display: this.getWeekDisplay(_i)
});
}
}
return re;
},
yearSelectOptionList: function yearSelectOptionList() {
var re = [];
var begin = this.curSelectedYear - 10;
var end = this.curSelectedYear + 10;
if (this.rangeFromTo && this.rangeFromTo.from && this.rangeFromTo.to) {
begin = dayjs(this.rangeFromTo.from).year();
end = dayjs(this.rangeFromTo.to).year();
}
if (begin < MIN_YEAR) {
begin = MIN_YEAR;
}
if (end < MIN_YEAR) {
end = MIN_YEAR;
}
for (var i = begin; i <= end; i++) {
var disabled = this.checkMonthAndYearSelectorDisabled(i, this.curSelectedMonth);
re.push({
value: i,
label: this.t(this.global.yearSelection, {
year: i
}),
disabled: disabled
});
}
return re;
},
monthSelectOptionList: function monthSelectOptionList() {
var re = [];
for (var i = FIRST_MONTH_OF_YEAR; i <= LAST_MONTH_OF_YEAR; i++) {
var disabled = this.checkMonthAndYearSelectorDisabled(this.curSelectedYear, i);
re.push({
value: i,
label: this.t(this.global.monthSelection, {
month: i
}),
disabled: disabled
});
}
return re;
},
modeSelectOptionList: function modeSelectOptionList() {
return [{
value: "month",
label: this.t(this.global.monthRadio)
}, {
value: "year",
label: this.t(this.global.yearRadio)
}];
},
monthCellsData: function monthCellsData() {
var daysArr = createMonthCellsData(this.props, this.state);
return daysArr;
},
yearCellsData: function yearCellsData() {
var re = [];
var monthsArr = createYearCellsData(this.props, this.state);
var rowCount = Math.ceil(monthsArr.length / DEFAULT_YEAR_CELL_NUMINROW);
var index = 0;
for (var i = 1; i <= rowCount; i++) {
var row = [];
for (var j = 1; j <= DEFAULT_YEAR_CELL_NUMINROW; j++) {
row.push(monthsArr[index]);
index += 1;
}
re.push(row);
}
return re;
},
controllerConfigData: function controllerConfigData() {
var _ref, _this$controllerConfi;
var controllerConfig = (_ref = (_this$controllerConfi = this.controllerConfig) !== null && _this$controllerConfi !== void 0 ? _this$controllerConfi : this.global.controllerConfig) !== null && _ref !== void 0 ? _ref : true;
if (typeof controllerConfig === "boolean") {
return getDefaultControllerConfigData(controllerConfig);
}
return _objectSpread(_objectSpread({}, getDefaultControllerConfigData()), controllerConfig);
},
isControllerVisible: function isControllerVisible() {
return this.controllerConfigData && this.controllerConfigData.visible;
},
weekendBtnText: function weekendBtnText() {
return this.isShowWeekend ? this.TEXT_MAP.hideWeekend : this.TEXT_MAP.showWeekend;
},
weekendBtnVBind: function weekendBtnVBind() {
var c = this.controllerConfigData.weekend;
return this.isShowWeekend ? c.hideWeekendButtonProps : c.showWeekendButtonProps;
},
currentBtnText: function currentBtnText() {
return this.curSelectedMode === "month" ? this.TEXT_MAP.today : this.TEXT_MAP.thisMonth;
},
currentBtnVBind: function currentBtnVBind() {
var c = this.controllerConfigData.current;
return this.curSelectedMode === "month" ? c.currentDayButtonProps : c.currentMonthButtonProps;
},
isModeVisible: function isModeVisible() {
return this.checkControllerVisible("mode");
},
isYearVisible: function isYearVisible() {
return this.checkControllerVisible("year");
},
isMonthVisible: function isMonthVisible() {
return this.checkControllerVisible("month");
},
isWeekendToggleVisible: function isWeekendToggleVisible() {
return this.checkControllerVisible("weekend");
},
isCurrentBtnVisible: function isCurrentBtnVisible() {
return this.checkControllerVisible("current");
},
isModeDisabled: function isModeDisabled() {
return this.checkControllerDisabled("mode", "radioGroupProps");
},
isYearDisabled: function isYearDisabled() {
return this.checkControllerDisabled("year", "selectProps");
},
isMonthDisabled: function isMonthDisabled() {
return this.checkControllerDisabled("month", "selectProps");
},
isWeekendToggleDisabled: function isWeekendToggleDisabled() {
var p = this.isShowWeekend ? "hideWeekendButtonProps" : "showWeekendButtonProps";
return this.checkControllerDisabled("weekend", p);
},
isCurrentBtnDisabled: function isCurrentBtnDisabled() {
var p = this.curSelectedMode === "month" ? "currentDayButtonProps" : "currentMonthButtonProps";
return this.checkControllerDisabled("current", p);
},
filterYearStr: function filterYearStr() {
return "".concat(this.controllerOptions.filterDate.getFullYear());
},
filterMonthStr: function filterMonthStr() {
return "".concat(this.controllerOptions.filterDate.getMonth() + 1);
},
filterYearMonth: function filterYearMonth() {
return {
year: this.filterYearStr,
month: this.filterMonthStr
};
}
},
watch: {
firstDayOfWeek: {
handler: function handler() {
var _ref2, _this$firstDayOfWeek;
this.realFirstDayOfWeek = (_ref2 = (_this$firstDayOfWeek = this.firstDayOfWeek) !== null && _this$firstDayOfWeek !== void 0 ? _this$firstDayOfWeek : this.global.firstDayOfWeek) !== null && _ref2 !== void 0 ? _ref2 : 1;
},
immediate: true
},
value: {
handler: function handler(v) {
if (this.multiple) {
this.setCurrentDateList(v);
} else {
this.setCurrentDate(v);
}
},
immediate: true
},
year: {
handler: function handler(v) {
this.setCurSelectedYear(v);
},
immediate: true
},
month: {
handler: function handler(v) {
this.setCurSelectedMonth(v);
},
immediate: true
},
mode: {
handler: function handler(v) {
this.curSelectedMode = v;
},
immediate: true
},
isShowWeekendDefault: {
handler: function handler(v) {
this.isShowWeekend = v;
},
immediate: true
},
filterYearMonth: {
handler: function handler(v) {
emitEvent(this, "month-change", v);
this.controllerChange();
}
},
curSelectedMode: function curSelectedMode() {
this.handleIE();
},
isShowWeekend: function isShowWeekend() {
this.handleIE();
},
isControllerVisible: function isControllerVisible() {
this.handleIE();
},
theme: {
handler: function handler(v) {
if (v === "card") this.controlSize = "small";
if (v === "full") this.controlSize = "medium";
},
immediate: true
}
},
mounted: function mounted() {
this.handleIE();
},
methods: {
handleIE: function handleIE() {
var _this = this;
if (getIEVersion() <= 9) {
this.$nextTick(function () {
var element = _this.$el.children[_this.isControllerVisible ? 1 : 0];
if (_this.curSelectedMode === "month") {
element.setAttribute("is-show-weekend", "".concat(_this.isShowWeekend));
} else {
element.removeAttribute("is-show-weekend");
}
});
}
},
getCalendarWeekSlotData: function getCalendarWeekSlotData(item) {
return {
day: item.num
};
},
getWeekDisplay: function getWeekDisplay(weekNum) {
var weekText = this.weekDipalyText;
return _typeof(weekText) === "object" && weekText[weekNum - 1] ? weekText[weekNum - 1] : getDayCn(weekNum);
},
checkMonthCellItemShowed: function checkMonthCellItemShowed(cellData) {
return this.isShowWeekend || cellData.day < 6;
},
createCalendarCell: function createCalendarCell(cellData) {
return _objectSpread(_objectSpread({}, cellData), this.controllerOptions);
},
clickCell: function clickCell(e, cellData) {
var d = dayjs(cellData.date);
if (this.multiple) {
if (this.curDateList.find(function (item) {
return item.isSame(d);
})) {
this.curDateList = this.curDateList.filter(function (item) {
return item.isSame(d);
});
} else {
this.curDateList.push(d);
}
} else {
this.curDate = d;
}
var options = this.getCellClickEventOptions(e, cellData);
emitEvent(this, "cell-click", options);
},
doubleClickCell: function doubleClickCell(e, cellData) {
var options = this.getCellClickEventOptions(e, cellData);
emitEvent(this, "cell-double-click", options);
},
rightClickCell: function rightClickCell(e, cellData) {
if (this.preventCellContextmenu) {
e.preventDefault();
}
var options = this.getCellClickEventOptions(e, cellData);
emitEvent(this, "cell-right-click", options);
},
getCellClickEventOptions: function getCellClickEventOptions(e, cellData) {
return {
cell: this.createCalendarCell(cellData),
e: e
};
},
controllerChange: function controllerChange() {
var options = this.controllerOptions;
emitEvent(this, "controller-change", options);
},
onWeekendToggleClick: function onWeekendToggleClick() {
this.isShowWeekend = !this.isShowWeekend;
this.controllerChange();
},
checkMonthCellColHeaderVisibled: function checkMonthCellColHeaderVisibled(item) {
var re = true;
if (!this.isShowWeekend) {
re = item.num !== 6 && item.num !== 7;
}
return re;
},
checkControllerDisabled: function checkControllerDisabled(name, propsName) {
var re = false;
var conf = this.controllerConfigData;
if (conf && (conf.disabled || conf[name] && conf[name][propsName] && conf[name][propsName].disabled)) {
re = true;
}
return re;
},
checkControllerVisible: function checkControllerVisible(name) {
var re = true;
var conf = this.controllerConfigData;
if (!conf || !conf.visible || conf[name] === false || conf[name] && !conf[name].visible) {
re = false;
}
return re;
},
toToday: function toToday() {
var currentSelectDate = createDefaultCurDate();
this.curSelectedYear = currentSelectDate.year();
this.curSelectedMonth = parseInt(currentSelectDate.format("M"), 10);
},
setCurSelectedYear: function setCurSelectedYear(year) {
var curSelectedYear = year ? parseInt("".concat(year), 10) : createDefaultCurDate().year();
if (!isNaN(curSelectedYear) && curSelectedYear > 0) {
this.curSelectedYear = curSelectedYear;
}
},
setCurSelectedMonth: function setCurSelectedMonth(month) {
var curSelectedMonth = month ? parseInt("".concat(month), 10) : parseInt(createDefaultCurDate().format("M"), 10);
if (!isNaN(curSelectedMonth) && curSelectedMonth > 0 && curSelectedMonth <= 12) {
this.curSelectedMonth = curSelectedMonth;
}
},
setCurrentDate: function setCurrentDate(value) {
if (Array.isArray(value)) {
this.curDate = value && value.length ? dayjs(value[0]) : createDefaultCurDate();
} else {
this.curDate = value ? dayjs(value) : createDefaultCurDate();
}
},
setCurrentDateList: function setCurrentDateList(value) {
if (Array.isArray(value)) {
this.curDateList = value && value.length ? value.map(function (item) {
return dayjs(item);
}) : [createDefaultCurDate()];
} else {
this.curDateList = value ? [dayjs(value)] : [createDefaultCurDate()];
}
},
checkMonthAndYearSelectorDisabled: function checkMonthAndYearSelectorDisabled(year, month) {
var disabled = false;
if (this.rangeFromTo && this.rangeFromTo.from && this.rangeFromTo.to) {
var beginYear = dayjs(this.rangeFromTo.from).year();
var endYear = dayjs(this.rangeFromTo.to).year();
if (year === beginYear) {
var beginMon = parseInt(dayjs(this.rangeFromTo.from).format("M"), 10);
disabled = month < beginMon;
} else if (year === endYear) {
var endMon = parseInt(dayjs(this.rangeFromTo.to).format("M"), 10);
disabled = month > endMon;
}
}
return disabled;
},
renderControl: function renderControl() {
var _this2 = this;
var h = this.$createElement;
var controllerOptions = this.controllerOptions;
return h("div", {
"class": "".concat(this.componentName, "__control")
}, [h("div", {
"class": "".concat(this.componentName, "__title")
}, [renderTNodeJSX(this, "head", {
params: controllerOptions
})]), h("div", {
"class": "".concat(this.componentName, "__control-section")
}, [this.isYearVisible && h("div", {
"class": "".concat(this.componentName, "__control-section-cell")
}, [h("t-select", helper([{
"attrs": {
"size": this.controlSize,
"disabled": this.isYearDisabled,
"autoWidth": true
}
}, {
"props": _objectSpread({}, this.controllerConfigData.year.selectProps)
}, {
"model": {
value: _this2.curSelectedYear,
callback: function callback($$v) {
_this2.curSelectedYear = $$v;
}
}
}]), [this.yearSelectOptionList.map(function (item) {
return h("t-option", {
"key": item.value,
"attrs": {
"value": item.value,
"label": item.label,
"disabled": item.disabled
}
}, [item.label]);
})])]), this.curSelectedMode === "month" && this.isMonthVisible && h("div", {
"class": "".concat(this.componentName, "__control-section-cell")
}, [h("t-select", helper([{
"attrs": {
"size": this.controlSize,
"disabled": this.isMonthDisabled,
"autoWidth": true
}
}, {
"props": _objectSpread({}, this.controllerConfigData.month.selectProps)
}, {
"model": {
value: _this2.curSelectedMonth,
callback: function callback($$v) {
_this2.curSelectedMonth = $$v;
}
}
}]), [this.monthSelectOptionList.map(function (item) {
return h("t-option", {
"key": item.value,
"attrs": {
"value": item.value,
"label": item.label,
"disabled": item.disabled
}
}, [item.label]);
})])]), this.isModeVisible && h("div", {
"class": "".concat(this.componentName, "__control-section-cell"),
"style": "height: auto"
}, [h("t-radio-group", helper([{
"attrs": {
"variant": "default-filled",
"size": this.controlSize,
"disabled": this.isModeDisabled
}
}, {
"props": _objectSpread({}, this.controllerConfigData.mode.radioGroupProps)
}, {
"on": {
"change": this.controllerChange
},
"model": {
value: _this2.curSelectedMode,
callback: function callback($$v) {
_this2.curSelectedMode = $$v;
}
}
}]), [this.modeSelectOptionList.map(function (item) {
return h("t-radio-button", {
"key": item.value,
"attrs": {
"value": item.value
}
}, [item.label]);
})])]), this.theme === "full" && this.curSelectedMode === "month" && this.isWeekendToggleVisible && h("div", {
"class": "".concat(this.componentName, "__control-section-cell")
}, [h("t-check-tag", helper([{
"class": "".concat(this.componentName, "__control-tag"),
"attrs": {
"defaultChecked": !this.isShowWeekend,
"disabled": this.isWeekendToggleDisabled,
"size": "large"
},
"on": {
"click": this.onWeekendToggleClick
}
}, {
"props": _objectSpread({}, this.weekendBtnVBind)
}]), [this.weekendBtnText])]), this.theme === "full" && this.isCurrentBtnVisible && h("div", {
"class": "".concat(this.componentName, "__control-section-cell")
}, [h("t-button", helper([{
"attrs": {
"size": this.controlSize,
"disabled": this.isCurrentBtnDisabled
},
"on": {
"click": function click() {
_this2.toToday();
}
}
}, {
"props": _objectSpread({}, this.currentBtnVBind)
}]), [this.currentBtnText])])])]);
}
},
render: function render() {
var _this3 = this;
var h = arguments[0];
var calendarCls = this.calendarCls,
calendarPanelCls = this.calendarPanelCls,
isControllerVisible = this.isControllerVisible,
cellColHeaders = this.cellColHeaders,
checkMonthCellColHeaderVisibled = this.checkMonthCellColHeaderVisibled;
var monthBody = function monthBody() {
return h("table", {
"class": "".concat(_this3.componentName, "__table")
}, [h("thead", {
"class": "".concat(_this3.componentName, "__table-head")
}, [h("tr", {
"class": "".concat(_this3.componentName, "__table-head-row")
}, [cellColHeaders.map(function (item, index) {
return checkMonthCellColHeaderVisibled(item) && h("th", {
"class": "".concat(_this3.componentName, "__table-head-cell")
}, [Array.isArray(_this3.week) ? _this3.week[index] : renderTNodeJSXDefault(_this3, "week", {
defaultNode: h("span", [item.display]),
params: _this3.getCalendarWeekSlotData(item)
})]);
})])]), h("tbody", {
"class": "".concat(_this3.componentName, "__table-body")
}, [_this3.monthCellsData.map(function (week, weekIndex) {
return h("tr", {
"class": "".concat(_this3.componentName, "__table-body-row")
}, [week.map(function (item, itemIndex) {
return _this3.checkMonthCellItemShowed(item) && h("calendar-cell-item", {
"key": "d-".concat(weekIndex, "-").concat(itemIndex),
"attrs": {
"item": item,
"theme": _this3.theme,
"t": _this3.t,
"global": _this3.global,
"cell": _this3.cell,
"fillWithZero": _this3.fillWithZero
},
"on": {
"click": function click(e) {
return _this3.clickCell(e, item);
},
"dblclick": function dblclick(e) {
return _this3.doubleClickCell(e, item);
},
"rightclick": function rightclick(e) {
return _this3.rightClickCell(e, item);
}
},
"scopedSlots": _objectSpread({}, _this3.$scopedSlots)
});
})]);
})])]);
};
var yearBody = function yearBody() {
return h("table", {
"class": "".concat(_this3.componentName, "__table")
}, [h("tbody", {
"class": "".concat(_this3.componentName, "__table-body")
}, [_this3.yearCellsData.map(function (cell, cellIndex) {
return h("tr", {
"class": "".concat(_this3.componentName, "__table-body-row")
}, [cell.map(function (item, itemIndex) {
return h("calendar-cell-item", {
"key": "m-".concat(cellIndex, "-").concat(itemIndex),
"attrs": {
"item": item,
"theme": _this3.theme,
"t": _this3.t,
"global": _this3.global,
"cell": _this3.cell,
"fillWithZero": _this3.fillWithZero
},
"on": {
"click": function click(e) {
return _this3.clickCell(e, item);
},
"dblclick": function dblclick(e) {
return _this3.doubleClickCell(e, item);
},
"rightclick": function rightclick(e) {
return _this3.rightClickCell(e, item);
}
},
"scopedSlots": _objectSpread({}, _this3.$scopedSlots)
});
})]);
})])]);
};
return h("div", {
"class": calendarCls
}, [isControllerVisible && this.renderControl(), h("div", {
"class": calendarPanelCls
}, [this.curSelectedMode === "month" ? monthBody() : yearBody()])]);
}
});
export { _Calendar as default };
//# sourceMappingURL=calendar.js.map