mp-colorui
Version:
MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)
1,185 lines (1,059 loc) • 55.1 kB
JavaScript
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["components/calendar/h5/index"],{
/***/ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/calendar/h5/index.tsx?taro&type=script&parse=COMPONENT&":
/*!*****************************************************************************************************************************************************************!*\
!*** ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/calendar/h5/index.tsx?taro&type=script&parse=COMPONENT& ***!
\*****************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _taroWeapp = __webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js");
var _taroWeapp2 = _interopRequireDefault(_taroWeapp);
var _dayjs = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
var _dayjs2 = _interopRequireDefault(_dayjs);
var _index = __webpack_require__(/*! ../../../lib/index */ "./src/lib/index.ts");
var _model = __webpack_require__(/*! ../../../lib/model */ "./src/lib/model.ts");
__webpack_require__(/*! ../index.scss */ "./src/components/calendar/index.scss");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var FORMAT_DATE = "YYYY-MM-DD";
var THIS_WEEK = "thisWeek";
var PRE_WEEK = "preWeek";
var NEXT_WEEK = "nextWeek";
var PRE_MONTH = "preMonth";
var THIS_MONTH = "thisMonth";
var NEXT_MONTH = "nextMonth";
var mapChangeWeekIndex = [PRE_WEEK, THIS_WEEK, NEXT_WEEK];
var mapChangeMonthIndex = [PRE_MONTH, THIS_MONTH, NEXT_MONTH];
var render = false;
function dealYearMonth(day) {
return day.year() + "\u5E74" + (day.month() + 1) + "\u6708";
}
var Calendar_h5 = function (_Taro$Component) {
_inherits(Calendar_h5, _Taro$Component);
function Calendar_h5() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Calendar_h5);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Calendar_h5.__proto__ || Object.getPrototypeOf(Calendar_h5)).call.apply(_ref, [this].concat(args))), _this), _this.$usedState = ["anonymousState__temp23", "anonymousState__temp24", "anonymousState__temp27", "anonymousState__temp28", "loopArray126", "loopArray127", "loopArray128", "loopArray129", "$compid__1648", "$compid__1649", "$compid__1650", "$compid__1651", "$compid__1652", "$compid__1653", "$compid__1654", "$compid__1655", "$compid__1656", "$compid__1657", "$compid__1658", "$compid__1659", "$compid__1660", "$compid__1661", "preWeek", "thisWeek", "nextWeek", "anonymousState__temp29", "preMonth", "thisMonth", "nextMonth", "months", "backToToday", "calendarType", "currentYear", "chooseDate", "currentDate", "currentActive", "currentActiveLines", "showMonths", "today", "tipDay", "highlightWeekend", "badge", "disabledDay", "specialDay", "highlightWeekendColor", "activeColor", "showType"], _this.anonymousFunc0Map = {}, _this.anonymousFunc1Map = {}, _this.anonymousFunc4Map = {}, _this.customComponents = ["ClText", "ClGrid", "ClLayout", "ClFlex", "ClCard", "ClTip", "ClIcon", "ClButton"], _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Calendar_h5, [{
key: "_constructor",
value: function _constructor(props) {
_get(Calendar_h5.prototype.__proto__ || Object.getPrototypeOf(Calendar_h5.prototype), "_constructor", this).call(this, props);
var today = (0, _dayjs2.default)().format(FORMAT_DATE);
this.state = {
thisWeek: [],
preWeek: [],
nextWeek: [],
thisMonth: [],
nextMonth: [],
preMonth: [],
currentYear: (0, _dayjs2.default)().year(),
chooseDate: today,
currentDate: dealYearMonth((0, _dayjs2.default)(today)),
currentActive: 1,
currentActiveLines: 5,
showMonths: false,
today: today
};
this.$$refs = new _taroWeapp2.default.RefsArray();
}
}, {
key: "selectDate",
value: function selectDate(month) {
var year = this.state.currentYear;
var date = year + "-" + (month + 1) + "-01";
this.changeMonth(date);
this.setState({
showMonths: false,
currentDate: dealYearMonth((0, _dayjs2.default)(date))
});
}
}, {
key: "clickDate",
value: function clickDate(_ref2) {
var item = _ref2.item;
if (item.disabled) {
return;
}if (item.empty) {
return;
}if (this.props.calendarType === "week") {
var weeks = {
thisWeek: this.state.thisWeek,
preWeek: this.state.preWeek,
nextWeek: this.state.nextWeek
};
Object.keys(weeks).forEach(function (week) {
weeks[week].forEach(function (item) {
return item.active = false;
});
});
} else {
var months = {
thisMonth: this.state.thisMonth,
preMonth: this.state.preMonth,
nextMonth: this.state.nextMonth
};
Object.keys(months).forEach(function (month) {
months[month].forEach(function (item) {
return item.active = false;
});
});
}
item.active = true;
this.setState({
chooseDate: item.date
});
this.props.onClick && this.props.onClick(item.date);
}
}, {
key: "getPreNextArray",
value: function getPreNextArray(index, data) {
var _current;
var varChange = this.props.calendarType === "week" ? {
PRE: PRE_WEEK,
THIS: THIS_WEEK,
NEXT: NEXT_WEEK
} : {
PRE: PRE_MONTH,
THIS: THIS_MONTH,
NEXT: NEXT_MONTH
};
var dataChange = this.props.calendarType === "week" ? {
PRE: "tempPreWeek",
THIS: "tempThisWeek",
NEXT: "tempNextWeek"
} : {
PRE: "tempPreMonth",
THIS: "tempThisMonth",
NEXT: "tempNextMonth"
};
var current = (_current = {}, _defineProperty(_current, varChange.PRE, data[dataChange.PRE]), _defineProperty(_current, varChange.THIS, data[dataChange.THIS]), _defineProperty(_current, varChange.NEXT, data[dataChange.NEXT]), _current);
if (index === 0) {
current[varChange.PRE] = data[dataChange.THIS];
current[varChange.THIS] = data[dataChange.NEXT];
current[varChange.NEXT] = data[dataChange.PRE];
}
if (index === 2) {
current[varChange.PRE] = data[dataChange.NEXT];
current[varChange.THIS] = data[dataChange.PRE];
current[varChange.NEXT] = data[dataChange.THIS];
}
return current;
}
}, {
key: "changeDate",
value: function changeDate(e) {
var arrayIndex = e.detail.current;
if (render) {
arrayIndex = 1;
render = false;
}
var currentChangeDate = "";
if (this.props.calendarType === "week") {
var oldWeeks = {
thisWeek: this.state.thisWeek,
preWeek: this.state.preWeek,
nextWeek: this.state.nextWeek
};
var showWeeks = oldWeeks[mapChangeWeekIndex[arrayIndex]];
if (showWeeks && showWeeks.length) {
this.setState({
currentDate: dealYearMonth((0, _dayjs2.default)(showWeeks[3].date))
});
currentChangeDate = (0, _dayjs2.default)(showWeeks[3].date).format("YYYY-MM");
var newWeeks = this.getWeeks(oldWeeks[mapChangeWeekIndex[arrayIndex]][3].date);
var current = this.getPreNextArray(arrayIndex, newWeeks);
this.setState({
preWeek: current[PRE_WEEK],
nextWeek: current[NEXT_WEEK],
thisWeek: current[THIS_WEEK]
});
}
} else {
var oldMonths = {
thisMonth: this.state.thisMonth,
preMonth: this.state.preMonth,
nextMonth: this.state.nextMonth
};
var showMonths = oldMonths[mapChangeMonthIndex[arrayIndex]];
if (showMonths && showMonths.length) {
currentChangeDate = (0, _dayjs2.default)(showMonths[8].date).format("YYYY-MM");
this.setState({
currentDate: dealYearMonth((0, _dayjs2.default)(showMonths[8].date)),
currentActiveLines: Math.ceil(showMonths.length / 7)
});
var newMonths = this.getMonths(oldMonths[mapChangeMonthIndex[arrayIndex]][8].date);
var _current2 = this.getPreNextArray(arrayIndex, newMonths);
this.setState({
preMonth: _current2[PRE_MONTH],
nextMonth: _current2[NEXT_MONTH],
thisMonth: _current2[THIS_MONTH]
});
}
}
this.setState({
currentActive: arrayIndex
});
this.props.onChange && this.props.onChange(currentChangeDate);
}
}, {
key: "changeMonth",
value: function changeMonth(date) {
if (this.props.calendarType === "week") {
var weeks = this.getWeeks(date);
var newIndex = this.state.currentActive + 1 > 2 ? 0 : this.state.currentActive + 1;
var current = this.getPreNextArray(newIndex, weeks);
this.setState({
currentActive: newIndex,
preWeek: current[PRE_WEEK],
nextWeek: current[NEXT_WEEK],
thisWeek: current[THIS_WEEK]
});
} else {
var months = this.getMonths(date);
var _newIndex = this.state.currentActive + 1 > 2 ? 0 : this.state.currentActive + 1;
var _current3 = this.getPreNextArray(_newIndex, months);
this.setState({
currentActive: _newIndex,
preMonth: _current3[PRE_MONTH],
nextMonth: _current3[NEXT_MONTH],
thisMonth: _current3[THIS_MONTH]
});
}
}
}, {
key: "handleBackToToday",
value: function handleBackToToday() {
this.setState({
chooseDate: this.state.today
});
this.changeMonth(this.state.today);
}
}, {
key: "dealEveryDay",
value: function dealEveryDay(_ref3) {
var i = _ref3.i,
currentDay = _ref3.currentDay,
date = _ref3.date;
var thisNum = i - currentDay;
var method = thisNum > 0 ? "add" : "subtract";
var day = (0, _dayjs2.default)(date)[method](Math.abs(thisNum), "day");
var tipDayArray = this.props.tipDay || [];
var dateData = {
timeStamp: day.valueOf(),
date: day.format(FORMAT_DATE),
month: day.get("month"),
day: day.get("date"),
year: day.get("year"),
today: this.state.today === day.format(FORMAT_DATE),
old: (0, _dayjs2.default)(this.state.today).valueOf() - day.valueOf() > 0,
active: this.state.chooseDate === day.format(FORMAT_DATE),
tipTop: "",
tipBottom: "",
badge: {
show: false,
color: "red",
num: ""
},
disabled: false,
special: {
show: false,
color: "green"
},
highlight: this.props.highlightWeekend ? [0, 6].includes(day.get("day")) : false
};
// tip
var tipIndex = tipDayArray.findIndex(function (item) {
return item.date === dateData.date;
});
if (tipIndex >= 0) {
var tipData = tipDayArray[tipIndex];
dateData = Object.assign(dateData, {
tipTop: tipData.tipTop || "",
tipBottom: tipData.tipBottom || "",
tipTopColor: tipData.tipTopColor,
tipBottomColor: tipData.tipBottomColor
});
}
// badge
if (typeof this.props.badge === "string" && dateData.date === this.props.badge) {
Object.assign(dateData.badge, { show: true });
} else if (this.props.badge instanceof Array) {
this.props.badge.forEach(function (item) {
if (item.date === dateData.date) {
Object.assign(dateData.badge, {
show: true,
color: item.color || "red",
num: item.num || ""
});
}
});
}
// disabledDay
if (this.props.disabledDay instanceof Array) {
this.props.disabledDay.forEach(function (item) {
if (typeof item === "string") {
dateData.disabled = dateData.date === item;
} else if (item instanceof Array) {
var minDate = item[0] && (0, _dayjs2.default)(item[0]).valueOf();
var maxDate = item[1] && (0, _dayjs2.default)(item[1]).valueOf();
if (minDate && maxDate) {
dateData.disabled = dateData.timeStamp > minDate && dateData.timeStamp < maxDate;
} else if (minDate) {
dateData.disabled = dateData.timeStamp > minDate;
} else if (maxDate) {
dateData.disabled = dateData.timeStamp < maxDate;
}
}
});
}
// specialDay
if (this.props.specialDay instanceof Array) {
this.props.specialDay.forEach(function (item) {
if (typeof item === "string") {
dateData.special.show = item === dateData.date;
} else if ((typeof item === "undefined" ? "undefined" : _typeof(item)) === "object") {
var _date = item.date;
var color = item.color;
Object.assign(dateData.special, {
date: _date === dateData.date,
color: color
});
}
});
}
return dateData;
}
}, {
key: "getWeeks",
value: function getWeeks(date) {
var weekday = (0, _dayjs2.default)(date).day();
var tempThisWeek = [];
var tempPreWeek = [];
var tempNextWeek = [];
var i = -7;
while (1) {
if (i >= 14) {
break;
}var dateData = this.dealEveryDay({
i: i,
currentDay: weekday,
date: date
});
if (i < 0) {
tempPreWeek.push(dateData);
} else if (i >= 7) {
tempNextWeek.push(dateData);
} else {
tempThisWeek.push(dateData);
}
i++;
}
return {
tempThisWeek: tempThisWeek,
tempPreWeek: tempPreWeek,
tempNextWeek: tempNextWeek
};
}
}, {
key: "fillMonths",
value: function fillMonths(months) {
var firstDay = months[0];
var weekday = (0, _dayjs2.default)(firstDay.date).day();
while (weekday) {
months.unshift({
timeStamp: weekday,
date: "",
month: "",
day: "",
year: "",
today: false,
old: false,
active: false,
tipTop: "",
tipBottom: "",
badge: {
show: false,
color: "red",
num: ""
},
disabled: false,
special: {
show: false,
color: "green"
},
empty: true
});
weekday--;
}
return months;
}
}, {
key: "getMonths",
value: function getMonths(date) {
var tempThisMonth = [];
var tempPreMonth = [];
var tempNextMonth = [];
var preMonthDays = (0, _dayjs2.default)(date).subtract(1, "month").daysInMonth();
var thisMonthDays = (0, _dayjs2.default)(date).daysInMonth();
var nextMonthDays = (0, _dayjs2.default)(date).add(1, "month").daysInMonth();
var thisDays = (0, _dayjs2.default)(date).date();
var i = -preMonthDays + 1;
while (1) {
if (i > nextMonthDays + thisMonthDays) {
break;
}var dateData = this.dealEveryDay({
i: i,
currentDay: thisDays,
date: date
});
if (i <= 0) {
tempPreMonth.push(dateData);
} else if (i > thisMonthDays) {
tempNextMonth.push(dateData);
} else {
tempThisMonth.push(dateData);
}
i++;
}
return {
tempThisMonth: this.fillMonths(tempThisMonth),
tempPreMonth: this.fillMonths(tempPreMonth),
tempNextMonth: this.fillMonths(tempNextMonth)
};
}
}, {
key: "initCalendar",
value: function initCalendar() {
if (this.props.calendarType === "week") {
var weeks = this.getWeeks(this.state.today);
this.setState({
preWeek: weeks.tempPreWeek,
thisWeek: weeks.tempThisWeek,
nextWeek: weeks.tempNextWeek
});
} else {
var months = this.getMonths(this.state.today);
this.setState({
preMonth: months.tempPreMonth,
thisMonth: months.tempThisMonth,
nextMonth: months.tempNextMonth
});
}
render = true;
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
this.initCalendar();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps, prevState, snapshot) {
if (prevProps.calendarType !== this.props.calendarType) {
this.initCalendar();
}
}
}, {
key: "_createData",
value: function _createData() {
var _this2 = this;
this.__state = arguments[0] || this.state || {};
this.__props = arguments[1] || this.props || {};
var __isRunloopRef = arguments[2];
var __prefix = this.$prefix;
;
var _genCompid = (0, _taroWeapp.genCompid)(__prefix + "$compid__1648"),
_genCompid2 = _slicedToArray(_genCompid, 2),
$prevCompid__1648 = _genCompid2[0],
$compid__1648 = _genCompid2[1];
var _genCompid3 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1649"),
_genCompid4 = _slicedToArray(_genCompid3, 2),
$prevCompid__1649 = _genCompid4[0],
$compid__1649 = _genCompid4[1];
var _genCompid5 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1650"),
_genCompid6 = _slicedToArray(_genCompid5, 2),
$prevCompid__1650 = _genCompid6[0],
$compid__1650 = _genCompid6[1];
var _genCompid7 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1651"),
_genCompid8 = _slicedToArray(_genCompid7, 2),
$prevCompid__1651 = _genCompid8[0],
$compid__1651 = _genCompid8[1];
var _genCompid9 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1652"),
_genCompid10 = _slicedToArray(_genCompid9, 2),
$prevCompid__1652 = _genCompid10[0],
$compid__1652 = _genCompid10[1];
var _genCompid11 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1653"),
_genCompid12 = _slicedToArray(_genCompid11, 2),
$prevCompid__1653 = _genCompid12[0],
$compid__1653 = _genCompid12[1];
var _genCompid13 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1654"),
_genCompid14 = _slicedToArray(_genCompid13, 2),
$prevCompid__1654 = _genCompid14[0],
$compid__1654 = _genCompid14[1];
var _genCompid15 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1655"),
_genCompid16 = _slicedToArray(_genCompid15, 2),
$prevCompid__1655 = _genCompid16[0],
$compid__1655 = _genCompid16[1];
var _genCompid17 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1656"),
_genCompid18 = _slicedToArray(_genCompid17, 2),
$prevCompid__1656 = _genCompid18[0],
$compid__1656 = _genCompid18[1];
var _genCompid19 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1657"),
_genCompid20 = _slicedToArray(_genCompid19, 2),
$prevCompid__1657 = _genCompid20[0],
$compid__1657 = _genCompid20[1];
var _genCompid21 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1658"),
_genCompid22 = _slicedToArray(_genCompid21, 2),
$prevCompid__1658 = _genCompid22[0],
$compid__1658 = _genCompid22[1];
var _genCompid23 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1659"),
_genCompid24 = _slicedToArray(_genCompid23, 2),
$prevCompid__1659 = _genCompid24[0],
$compid__1659 = _genCompid24[1];
var _genCompid25 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1660"),
_genCompid26 = _slicedToArray(_genCompid25, 2),
$prevCompid__1660 = _genCompid26[0],
$compid__1660 = _genCompid26[1];
var _genCompid27 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1661"),
_genCompid28 = _slicedToArray(_genCompid27, 2),
$prevCompid__1661 = _genCompid28[0],
$compid__1661 = _genCompid28[1];
var _state = this.__state,
thisWeek = _state.thisWeek,
thisMonth = _state.thisMonth,
preWeek = _state.preWeek,
preMonth = _state.preMonth,
nextWeek = _state.nextWeek,
nextMonth = _state.nextMonth,
showMonths = _state.showMonths,
currentDate = _state.currentDate,
currentActiveLines = _state.currentActiveLines,
currentYear = _state.currentYear;
var _props = this.__props,
highlightWeekend = _props.highlightWeekend,
highlightWeekendColor = _props.highlightWeekendColor,
activeColor = _props.activeColor,
showType = _props.showType,
backToToday = _props.backToToday,
calendarType = _props.calendarType;
var BGClassName = _model.BG_COLOR_LIST[activeColor || "blue"];
var oldTextClassName = _model.TEXT_COLOR_LIST["gray"];
var anonymousState__temp29 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.length > 0;
});
var months = Array.from(Array(12)).map(function (item, index) {
return index + 1 + "\u6708";
});
var anonymousState__temp23 = (0, _index.classNames)([_model.BG_COLOR_LIST["white"], "cuCalendar"]);
this.anonymousFunc2 = function () {
_this2.setState({
currentYear: currentYear - 1
});
};
var anonymousState__temp24 = currentYear + "";
this.anonymousFunc3 = function () {
_this2.setState({
currentYear: currentYear + 1
});
};
this.anonymousFunc5 = function () {
var currentShow = !showMonths;
_this2.setState({
showMonths: currentShow
});
};
this.anonymousFunc6 = function () {
_this2.handleBackToToday();
};
var anonymousState__temp27 = 'key-' + Math.random();
var anonymousState__temp28 = (0, _taroWeapp.internal_inline_style)({
width: "100%",
height: calendarType === "week" ? (0, _taroWeapp.pxTransform)(120) : (0, _taroWeapp.pxTransform)(120 * currentActiveLines)
});
this.anonymousFunc7 = function (e) {
if (_this2.__state.currentActive !== e.detail.current) {
_this2.changeDate(e);
}
};
var loopArray126 = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"].map(function (week, index) {
week = {
$original: (0, _taroWeapp.internal_get_original)(week)
};
var $loopState__temp2 = highlightWeekend ? [0, 6].includes(index) ? highlightWeekendColor : "black" : "black";
var _genCompid29 = (0, _taroWeapp.genCompid)(__prefix + "cjfzzzzzzz" + index, true),
_genCompid30 = _slicedToArray(_genCompid29, 2),
$prevCompid__1631 = _genCompid30[0],
$compid__1631 = _genCompid30[1];
_taroWeapp.propsManager.set({
"align": "center",
"size": "small",
"lineSpacing": "small",
"textColor": $loopState__temp2
}, $compid__1631, $prevCompid__1631);
return {
$loopState__temp2: $loopState__temp2,
$compid__1631: $compid__1631,
$original: week.$original
};
});
var loopArray127 = preWeek.length ? [preWeek, thisWeek, nextWeek].map(function (week, index) {
week = {
$original: (0, _taroWeapp.internal_get_original)(week)
};
var $anonymousCallee__14 = preWeek.length ? week.$original.map(function (item, __index0) {
var _ref4;
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var _$indexKey = "cjczz" + index + "-" + __index0;
_this2.anonymousFunc0Map[_$indexKey] = function () {
_this2.clickDate({
item: item.$original
});
};
var $loopState__temp4 = preWeek.length ? (0, _taroWeapp.internal_inline_style)({
position: "relative"
}) : null;
var $loopState__temp6 = preWeek.length ? (0, _index.classNames)(["day-normal", "" + (item.$original.disabled ? _model.BG_COLOR_LIST["gray"] : ""), "" + (item.$original.special.show && !item.$original.active ? _model.BG_COLOR_LIST[item.$original.special.color] : ""), (_ref4 = {}, _defineProperty(_ref4, BGClassName, !item.$original.disabled && item.$original.active), _defineProperty(_ref4, oldTextClassName, item.$original.old), _ref4)]) : null;
var $loopState__temp8 = preWeek.length ? (0, _index.classNames)([_defineProperty({}, "cu-tag badge", item.$original.badge.show), _model.BG_COLOR_LIST[item.$original.badge.color]]) : null;
var $loopState__temp10 = preWeek.length ? { maxWidth: (0, _taroWeapp.pxTransform)(50) } : null;
var $loopState__temp12 = preWeek.length ? { maxWidth: (0, _taroWeapp.pxTransform)(50) } : null;
var _genCompid31 = (0, _taroWeapp.genCompid)(__prefix + "cjgzzzzzzz" + index + "-" + __index0, true),
_genCompid32 = _slicedToArray(_genCompid31, 2),
$prevCompid__1632 = _genCompid32[0],
$compid__1632 = _genCompid32[1];
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "vertical"
}, $compid__1632, $prevCompid__1632);
var _genCompid33 = (0, _taroWeapp.genCompid)(__prefix + "cjhzzzzzzz" + index + "-" + __index0, true),
_genCompid34 = _slicedToArray(_genCompid33, 2),
$prevCompid__1633 = _genCompid34[0],
$compid__1633 = _genCompid34[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center"
}, $compid__1633, $prevCompid__1633);
var _genCompid35 = (0, _taroWeapp.genCompid)(__prefix + "cjizzzzzzz" + index + "-" + __index0, true),
_genCompid36 = _slicedToArray(_genCompid35, 2),
$prevCompid__1634 = _genCompid36[0],
$compid__1634 = _genCompid36[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center",
"direction": "column"
}, $compid__1634, $prevCompid__1634);
var _genCompid37 = (0, _taroWeapp.genCompid)(__prefix + "cjjzzzzzzz" + index + "-" + __index0, true),
_genCompid38 = _slicedToArray(_genCompid37, 2),
$prevCompid__1635 = _genCompid38[0],
$compid__1635 = _genCompid38[1];
_taroWeapp.propsManager.set({
"size": 12,
"align": "center",
"cut": true,
"style": $loopState__temp10,
"textColor": item.$original.active && !item.$original.disabled ? undefined : item.$original.tipTopColor,
"text": item.$original.tipTop
}, $compid__1635, $prevCompid__1635);
var _genCompid39 = (0, _taroWeapp.genCompid)(__prefix + "daazzzzzzz" + index + "-" + __index0, true),
_genCompid40 = _slicedToArray(_genCompid39, 2),
$prevCompid__1636 = _genCompid40[0],
$compid__1636 = _genCompid40[1];
_taroWeapp.propsManager.set({
"text": item.$original.day,
"textColor": !item.$original.active && !item.$original.disabled && item.$original.highlight ? highlightWeekendColor : undefined
}, $compid__1636, $prevCompid__1636);
var _genCompid41 = (0, _taroWeapp.genCompid)(__prefix + "dabzzzzzzz" + index + "-" + __index0, true),
_genCompid42 = _slicedToArray(_genCompid41, 2),
$prevCompid__1637 = _genCompid42[0],
$compid__1637 = _genCompid42[1];
_taroWeapp.propsManager.set({
"size": 12,
"align": "center",
"cut": true,
"style": $loopState__temp12,
"textColor": item.$original.active && !item.$original.disabled ? undefined : item.$original.tipBottomColor,
"text": item.$original.tipBottom
}, $compid__1637, $prevCompid__1637);
return {
_$indexKey: _$indexKey,
$loopState__temp4: $loopState__temp4,
$loopState__temp6: $loopState__temp6,
$loopState__temp8: $loopState__temp8,
$loopState__temp10: $loopState__temp10,
$loopState__temp12: $loopState__temp12,
$compid__1632: $compid__1632,
$compid__1633: $compid__1633,
$compid__1634: $compid__1634,
$compid__1635: $compid__1635,
$compid__1636: $compid__1636,
$compid__1637: $compid__1637,
$original: item.$original
};
}) : [];
var _genCompid43 = (0, _taroWeapp.genCompid)(__prefix + "daczzzzzzz" + index, true),
_genCompid44 = _slicedToArray(_genCompid43, 2),
$prevCompid__1638 = _genCompid44[0],
$compid__1638 = _genCompid44[1];
_taroWeapp.propsManager.set({
"col": 7
}, $compid__1638, $prevCompid__1638);
return {
$anonymousCallee__14: $anonymousCallee__14,
$compid__1638: $compid__1638,
$original: week.$original
};
}) : [];
var loopArray128 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.length > 0;
}) ? [preMonth, thisMonth, nextMonth].map(function (month, index) {
month = {
$original: (0, _taroWeapp.internal_get_original)(month)
};
var $anonymousCallee__15 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.length > 0;
}) ? month.$original.map(function (item, __index1) {
var _ref6;
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var _$indexKey2 = "cjdzz" + index + "-" + __index1;
_this2.anonymousFunc1Map[_$indexKey2] = function () {
_this2.clickDate({
item: item.$original
});
};
var $loopState__temp14 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.$original.length > 0;
}) ? (0, _taroWeapp.internal_inline_style)({
position: "relative"
}) : null;
var $loopState__temp16 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.$original.length > 0;
}) ? (0, _index.classNames)(["day-normal", "" + (item.$original.disabled ? _model.BG_COLOR_LIST["gray"] : ""), "" + (item.$original.special.show && !item.$original.active ? _model.BG_COLOR_LIST[item.$original.special.color] : ""), (_ref6 = {}, _defineProperty(_ref6, BGClassName, !item.$original.disabled && item.$original.active), _defineProperty(_ref6, oldTextClassName, item.$original.old), _ref6)]) : null;
var $loopState__temp18 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.$original.length > 0;
}) ? (0, _index.classNames)([_defineProperty({}, "cu-tag badge", item.$original.badge.show), _model.BG_COLOR_LIST[item.$original.badge.color]]) : null;
var $loopState__temp20 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.$original.length > 0;
}) ? { maxWidth: (0, _taroWeapp.pxTransform)(50) } : null;
var $loopState__temp22 = [preMonth, thisMonth, nextMonth].every(function (item) {
return item.$original.length > 0;
}) ? { maxWidth: (0, _taroWeapp.pxTransform)(50) } : null;
var _genCompid45 = (0, _taroWeapp.genCompid)(__prefix + "dadzzzzzzz" + index + "-" + __index1, true),
_genCompid46 = _slicedToArray(_genCompid45, 2),
$prevCompid__1639 = _genCompid46[0],
$compid__1639 = _genCompid46[1];
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "vertical"
}, $compid__1639, $prevCompid__1639);
var _genCompid47 = (0, _taroWeapp.genCompid)(__prefix + "daezzzzzzz" + index + "-" + __index1, true),
_genCompid48 = _slicedToArray(_genCompid47, 2),
$prevCompid__1640 = _genCompid48[0],
$compid__1640 = _genCompid48[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center"
}, $compid__1640, $prevCompid__1640);
var _genCompid49 = (0, _taroWeapp.genCompid)(__prefix + "dafzzzzzzz" + index + "-" + __index1, true),
_genCompid50 = _slicedToArray(_genCompid49, 2),
$prevCompid__1641 = _genCompid50[0],
$compid__1641 = _genCompid50[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center",
"direction": "column"
}, $compid__1641, $prevCompid__1641);
var _genCompid51 = (0, _taroWeapp.genCompid)(__prefix + "dagzzzzzzz" + index + "-" + __index1, true),
_genCompid52 = _slicedToArray(_genCompid51, 2),
$prevCompid__1642 = _genCompid52[0],
$compid__1642 = _genCompid52[1];
_taroWeapp.propsManager.set({
"size": 12,
"align": "center",
"cut": true,
"style": $loopState__temp20,
"textColor": item.$original.active && !item.$original.disabled ? undefined : item.$original.tipTopColor,
"text": item.$original.tipTop
}, $compid__1642, $prevCompid__1642);
var _genCompid53 = (0, _taroWeapp.genCompid)(__prefix + "dahzzzzzzz" + index + "-" + __index1, true),
_genCompid54 = _slicedToArray(_genCompid53, 2),
$prevCompid__1643 = _genCompid54[0],
$compid__1643 = _genCompid54[1];
_taroWeapp.propsManager.set({
"text": item.$original.day,
"textColor": !item.$original.active && !item.$original.disabled && item.$original.highlight ? highlightWeekendColor : undefined
}, $compid__1643, $prevCompid__1643);
var _genCompid55 = (0, _taroWeapp.genCompid)(__prefix + "daizzzzzzz" + index + "-" + __index1, true),
_genCompid56 = _slicedToArray(_genCompid55, 2),
$prevCompid__1644 = _genCompid56[0],
$compid__1644 = _genCompid56[1];
_taroWeapp.propsManager.set({
"size": 12,
"align": "center",
"cut": true,
"style": $loopState__temp22,
"textColor": item.$original.active && !item.$original.disabled ? undefined : item.$original.tipBottomColor,
"text": item.$original.tipBottom
}, $compid__1644, $prevCompid__1644);
return {
_$indexKey2: _$indexKey2,
$loopState__temp14: $loopState__temp14,
$loopState__temp16: $loopState__temp16,
$loopState__temp18: $loopState__temp18,
$loopState__temp20: $loopState__temp20,
$loopState__temp22: $loopState__temp22,
$compid__1639: $compid__1639,
$compid__1640: $compid__1640,
$compid__1641: $compid__1641,
$compid__1642: $compid__1642,
$compid__1643: $compid__1643,
$compid__1644: $compid__1644,
$original: item.$original
};
}) : [];
var _genCompid57 = (0, _taroWeapp.genCompid)(__prefix + "dajzzzzzzz" + index, true),
_genCompid58 = _slicedToArray(_genCompid57, 2),
$prevCompid__1645 = _genCompid58[0],
$compid__1645 = _genCompid58[1];
_taroWeapp.propsManager.set({
"col": 7
}, $compid__1645, $prevCompid__1645);
return {
$anonymousCallee__15: $anonymousCallee__15,
$compid__1645: $compid__1645,
$original: month.$original
};
}) : [];
var loopArray129 = months.map(function (item, index) {
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var $loopState__temp26 = (0, _index.classNames)(["flex justify-center align-center"]);
var _$indexKey3 = "cjezz" + index;
_this2.anonymousFunc4Map[_$indexKey3] = function () {
_this2.selectDate(index);
};
var _genCompid59 = (0, _taroWeapp.genCompid)(__prefix + "dbazzzzzzz" + index, true),
_genCompid60 = _slicedToArray(_genCompid59, 2),
$prevCompid__1646 = _genCompid60[0],
$compid__1646 = _genCompid60[1];
_taroWeapp.propsManager.set({
"margin": "small",
"marginDirection": "vertical"
}, $compid__1646, $prevCompid__1646);
var _genCompid61 = (0, _taroWeapp.genCompid)(__prefix + "dbbzzzzzzz" + index, true),
_genCompid62 = _slicedToArray(_genCompid61, 2),
$prevCompid__1647 = _genCompid62[0],
$compid__1647 = _genCompid62[1];
_taroWeapp.propsManager.set({
"size": "small",
"bgColor": "light-gray",
"shadow": false,
"long": true,
"text": item.$original,
"onClick": _this2.anonymousFunc4.bind(_this2, _$indexKey3)
}, $compid__1647, $prevCompid__1647);
return {
$loopState__temp26: $loopState__temp26,
_$indexKey3: _$indexKey3,
$compid__1646: $compid__1646,
$compid__1647: $compid__1647,
$original: item.$original
};
});
_taroWeapp.propsManager.set({
"type": showType
}, $compid__1648, $prevCompid__1648);
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "bottom"
}, $compid__1649, $prevCompid__1649);
_taroWeapp.propsManager.set({
"justify": "between",
"align": "center"
}, $compid__1650, $prevCompid__1650);
_taroWeapp.propsManager.set({
"mode": "click",
"width": 300,
"show": this.__state.showMonths,
"onChange": this.anonymousFunc5
}, $compid__1651, $prevCompid__1651);
_taroWeapp.propsManager.set({
"align": "center",
"justify": "between"
}, $compid__1652, $prevCompid__1652);
_taroWeapp.propsManager.set({
"iconName": "pullleft"
}, $compid__1653, $prevCompid__1653);
_taroWeapp.propsManager.set({
"text": anonymousState__temp24
}, $compid__1654, $prevCompid__1654);
_taroWeapp.propsManager.set({
"iconName": "pullright"
}, $compid__1655, $prevCompid__1655);
_taroWeapp.propsManager.set({
"col": 4
}, $compid__1656, $prevCompid__1656);
_taroWeapp.propsManager.set({
"shape": "round",
"shadow": false,
"size": "small"
}, $compid__1657, $prevCompid__1657);
_taroWeapp.propsManager.set({
"className": "chooseDate",
"lineSpacing": "normal",
"text": currentDate
}, $compid__1658, $prevCompid__1658);
backToToday && _taroWeapp.propsManager.set({
"shadow": false,
"size": "small"
}, $compid__1659, $prevCompid__1659);
backToToday && _taroWeapp.propsManager.set({
"className": "backToToday",
"lineSpacing": "normal"
}, $compid__1660, $prevCompid__1660);
_taroWeapp.propsManager.set({
"col": 7,
"className": "solid-bottom"
}, $compid__1661, $prevCompid__1661);
Object.assign(this.__state, {
anonymousState__temp23: anonymousState__temp23,
anonymousState__temp24: anonymousState__temp24,
anonymousState__temp27: anonymousState__temp27,
anonymousState__temp28: anonymousState__temp28,
loopArray126: loopArray126,
loopArray127: loopArray127,
loopArray128: loopArray128,
loopArray129: loopArray129,
$compid__1648: $compid__1648,
$compid__1649: $compid__1649,
$compid__1650: $compid__1650,
$compid__1651: $compid__1651,
$compid__1652: $compid__1652,
$compid__1653: $compid__1653,
$compid__1654: $compid__1654,
$compid__1655: $compid__1655,
$compid__1656: $compid__1656,
$compid__1657: $compid__1657,
$compid__1658: $compid__1658,
$compid__1659: $compid__1659,
$compid__1660: $compid__1660,
$compid__1661: $compid__1661,
anonymousState__temp29: anonymousState__temp29,
months: months,
backToToday: backToToday,
calendarType: calendarType
});
return this.__state;
}
}, {
key: "anonymousFunc0",
value: function anonymousFunc0(_$indexKey) {
var _anonymousFunc0Map;
;
for (var _len2 = arguments.length, e = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
e[_key2 - 1] = arguments[_key2];
}
return this.anonymousFunc0Map[_$indexKey] && (_anonymousFunc0Map = this.anonymousFunc0Map)[_$indexKey].apply(_anonymousFunc0Map, e);
}
}, {
key: "anonymousFunc1",
value: function anonymousFunc1(_$indexKey2) {
var _anonymousFunc1Map;
;
for (var _len3 = arguments.length, e = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
e[_key3 - 1] = arguments[_key3];
}
return this.anonymousFunc1Map[_$indexKey2] && (_anonymousFunc1Map = this.anonymousFunc1Map)[_$indexKey2].apply(_anonymousFunc1Map, e);
}
}, {
key: "anonymousFunc2",
value: function anonymousFunc2(e) {
;
}
}, {
key: "anonymousFunc3",
value: function anonymousFunc3(e) {
;
}
}, {
key: "anonymousFunc4",
value: function anonymousFunc4(_$indexKey3) {
var _anonymousFunc4Map;
;
for (var _len4 = arguments.length, e = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
e[_key4 - 1] = arguments[_key4];
}
return this.anonymousFunc4Map[_$indexKey3] && (_anonymousFunc4Map = this.anonymousFunc4Map)[_$indexKey3].apply(_anonymousFunc4Map, e);
}
}, {
key: "anonymousFunc5",
value: function anonymousFunc5(e) {
;
}
}, {
key: "anonymousFunc6",
value: function anonymousFunc6(e) {
;
}
}, {
key: "anonymousFunc7",
value: function anonymousFunc7(e) {
;
}
}]);
return Calendar_h5;
}(_taroWeapp2.default.Component);
Calendar_h5.$$events = ["anonymousFunc0", "anonymousFunc1", "anonymousFunc2", "anonymousFunc3", "anonymousFunc6", "anonymousFunc7"];
Calendar_h5.$$componentPath = "components/calendar/h5/index";
Calendar_h5.options = {
addGlobalClass: true
};
exports.default = Calendar_h5;
Component(__webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js").default.createComponent(Calendar_h5));
/***/ }),
/***/ "./node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!./node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/calendar/h5/index.tsx?taro&type=template&parse=COMPONENT&":
/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/file-loader/dist/cjs.js?name=[path][name].wxml&context=/Users/jinbai/Documents/develop/github/mp-colorui-old/mp-colorui/src!./node_modules/@tarojs/mini-runner/dist/loaders/miniTemplateLoader.js!./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/calendar/h5/index.tsx?taro&type=template&parse=COMPONENT& ***!
\************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "components/calendar/h5/index.wxml";
/***/ }),
/***/ "./src/components/calendar/h5/index.tsx":
/*!**********************************************!*\
!*** ./src/components/calendar/h5/index.tsx ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _index_tsx_taro_type_template_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.tsx?taro&type=template&parse=COMPONENT& */ "./src/components/calendar/h5/index.tsx?taro&type=template&parse=COMPONENT&");
/* harmony import */ var _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.tsx?taro&type=script&parse=COMPONENT& */ "./src/components/calendar/h5/index.tsx?taro&type=script&parse=COMPONENT&");
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/***/ }),
/***/ "./src/components/calendar/h5/index.tsx?taro&type=script&parse=COMPONENT&":
/*!********************************************************************************!*\
!*** ./src/components/calendar/h5/index.tsx?taro&type=script&parse=COMPONENT& ***!
\********************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);