mp-colorui
Version:
MP ColorUI 是一款基于 Taro 框架并且联合 Color-UI CSS 库开发的多端 UI 组件库(支持小程序端和H5端)
1,138 lines (1,001 loc) • 54.4 kB
JavaScript
(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["components/calendar/weapp/index"],{
/***/ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/calendar/weapp/index.tsx?taro&type=script&parse=COMPONENT&":
/*!********************************************************************************************************************************************************************!*\
!*** ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./src/components/calendar/weapp/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 _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 _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 _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 _this = undefined;
var Calendar_weapp = function (_Taro$Component) {
_inherits(Calendar_weapp, _Taro$Component);
function Calendar_weapp() {
var _ref;
var _temp, _this2, _ret;
_classCallCheck(this, Calendar_weapp);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this2 = _possibleConstructorReturn(this, (_ref = Calendar_weapp.__proto__ || Object.getPrototypeOf(Calendar_weapp)).call.apply(_ref, [this].concat(args))), _this2), _this2.$usedState = ["anonymousState__temp23", "anonymousState__temp24", "anonymousState__temp27", "loopArray122", "loopArray123", "loopArray124", "loopArray125", "$compid__1617", "$compid__1618", "$compid__1619", "$compid__1620", "$compid__1621", "$compid__1622", "$compid__1623", "$compid__1624", "$compid__1625", "$compid__1626", "$compid__1627", "$compid__1628", "$compid__1629", "$compid__1630", "preWeek", "thisWeek", "nextWeek", "preMonth", "thisMonth", "nextMonth", "months", "backToToday", "currentActive", "calendarType"], _this2.anonymousFunc0Map = {}, _this2.anonymousFunc1Map = {}, _this2.anonymousFunc4Map = {}, _this2.customComponents = ["ClText", "ClGrid", "ClLayout", "ClFlex", "ClCard", "ClTip", "ClIcon", "ClButton"], _temp), _possibleConstructorReturn(_this2, _ret);
}
_createClass(Calendar_weapp, [{
key: "_constructor",
value: function _constructor(props) {
_get(Calendar_weapp.prototype.__proto__ || Object.getPrototypeOf(Calendar_weapp.prototype), "_constructor", this).call(this, props);
this.$$refs = new _taroWeapp2.default.RefsArray();
}
}, {
key: "_createData",
value: function _createData() {
var _this3 = 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__1617"),
_genCompid2 = _slicedToArray(_genCompid, 2),
$prevCompid__1617 = _genCompid2[0],
$compid__1617 = _genCompid2[1];
var _genCompid3 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1618"),
_genCompid4 = _slicedToArray(_genCompid3, 2),
$prevCompid__1618 = _genCompid4[0],
$compid__1618 = _genCompid4[1];
var _genCompid5 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1619"),
_genCompid6 = _slicedToArray(_genCompid5, 2),
$prevCompid__1619 = _genCompid6[0],
$compid__1619 = _genCompid6[1];
var _genCompid7 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1620"),
_genCompid8 = _slicedToArray(_genCompid7, 2),
$prevCompid__1620 = _genCompid8[0],
$compid__1620 = _genCompid8[1];
var _genCompid9 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1621"),
_genCompid10 = _slicedToArray(_genCompid9, 2),
$prevCompid__1621 = _genCompid10[0],
$compid__1621 = _genCompid10[1];
var _genCompid11 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1622"),
_genCompid12 = _slicedToArray(_genCompid11, 2),
$prevCompid__1622 = _genCompid12[0],
$compid__1622 = _genCompid12[1];
var _genCompid13 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1623"),
_genCompid14 = _slicedToArray(_genCompid13, 2),
$prevCompid__1623 = _genCompid14[0],
$compid__1623 = _genCompid14[1];
var _genCompid15 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1624"),
_genCompid16 = _slicedToArray(_genCompid15, 2),
$prevCompid__1624 = _genCompid16[0],
$compid__1624 = _genCompid16[1];
var _genCompid17 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1625"),
_genCompid18 = _slicedToArray(_genCompid17, 2),
$prevCompid__1625 = _genCompid18[0],
$compid__1625 = _genCompid18[1];
var _genCompid19 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1626"),
_genCompid20 = _slicedToArray(_genCompid19, 2),
$prevCompid__1626 = _genCompid20[0],
$compid__1626 = _genCompid20[1];
var _genCompid21 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1627"),
_genCompid22 = _slicedToArray(_genCompid21, 2),
$prevCompid__1627 = _genCompid22[0],
$compid__1627 = _genCompid22[1];
var _genCompid23 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1628"),
_genCompid24 = _slicedToArray(_genCompid23, 2),
$prevCompid__1628 = _genCompid24[0],
$compid__1628 = _genCompid24[1];
var _genCompid25 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1629"),
_genCompid26 = _slicedToArray(_genCompid25, 2),
$prevCompid__1629 = _genCompid26[0],
$compid__1629 = _genCompid26[1];
var _genCompid27 = (0, _taroWeapp.genCompid)(__prefix + "$compid__1630"),
_genCompid28 = _slicedToArray(_genCompid27, 2),
$prevCompid__1630 = _genCompid28[0],
$compid__1630 = _genCompid28[1];
var props = this.__props;
var highlightWeekendColor = props.highlightWeekendColor,
calendarType = props.calendarType,
showType = props.showType,
activeColor = props.activeColor,
tipDay = props.tipDay,
backToToday = props.backToToday,
disabledDay = props.disabledDay,
badge = props.badge,
onChange = props.onChange,
onClick = props.onClick,
highlightWeekend = props.highlightWeekend,
specialDay = props.specialDay;
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 today = (0, _dayjs2.default)().format(FORMAT_DATE);
var mapChangeWeekIndex = [PRE_WEEK, THIS_WEEK, NEXT_WEEK];
var mapChangeMonthIndex = [PRE_MONTH, THIS_MONTH, NEXT_MONTH];
var _useState = (0, _taroWeapp.useState)([]),
_useState2 = _slicedToArray(_useState, 2),
thisWeek = _useState2[0],
setThisWeek = _useState2[1];
var _useState3 = (0, _taroWeapp.useState)([]),
_useState4 = _slicedToArray(_useState3, 2),
preWeek = _useState4[0],
setPreWeek = _useState4[1];
var _useState5 = (0, _taroWeapp.useState)([]),
_useState6 = _slicedToArray(_useState5, 2),
nextWeek = _useState6[0],
setNextWeek = _useState6[1];
var _useState7 = (0, _taroWeapp.useState)([]),
_useState8 = _slicedToArray(_useState7, 2),
thisMonth = _useState8[0],
setThisMonth = _useState8[1];
var _useState9 = (0, _taroWeapp.useState)([]),
_useState10 = _slicedToArray(_useState9, 2),
preMonth = _useState10[0],
setPreMonth = _useState10[1];
var _useState11 = (0, _taroWeapp.useState)([]),
_useState12 = _slicedToArray(_useState11, 2),
nextMonth = _useState12[0],
setNextMonth = _useState12[1];
var _useState13 = (0, _taroWeapp.useState)(today),
_useState14 = _slicedToArray(_useState13, 2),
chooseDate = _useState14[0],
setChooseDate = _useState14[1];
var _useState15 = (0, _taroWeapp.useState)(dealYearMonth((0, _dayjs2.default)(today))),
_useState16 = _slicedToArray(_useState15, 2),
currentDate = _useState16[0],
setCurrentDate = _useState16[1];
var _useState17 = (0, _taroWeapp.useState)(1),
_useState18 = _slicedToArray(_useState17, 2),
currentActive = _useState18[0],
setCurrentActive = _useState18[1];
var _useState19 = (0, _taroWeapp.useState)(5),
_useState20 = _slicedToArray(_useState19, 2),
currentActiveLines = _useState20[0],
setCurrentActiveLines = _useState20[1];
var _useState21 = (0, _taroWeapp.useState)(false),
_useState22 = _slicedToArray(_useState21, 2),
showMonths = _useState22[0],
setShowMonths = _useState22[1];
var _useState23 = (0, _taroWeapp.useState)((0, _dayjs2.default)().year()),
_useState24 = _slicedToArray(_useState23, 2),
currentYear = _useState24[0],
setCurrentYear = _useState24[1];
var selectDate = function selectDate(month) {
var year = currentYear;
var date = year + "-" + (month + 1) + "-01";
changeMonth(date);
setShowMonths(false);
setCurrentDate(dealYearMonth((0, _dayjs2.default)(date)));
};
function dealYearMonth(day) {
return day.year() + "\u5E74" + (day.month() + 1) + "\u6708";
}
var clickDate = function clickDate(_ref2) {
var item = _ref2.item;
if (item.disabled) {
return;
}if (item.empty) {
return;
}if (calendarType === "week") {
var weeks = {
thisWeek: thisWeek,
preWeek: preWeek,
nextWeek: nextWeek
};
Object.keys(weeks).forEach(function (week) {
weeks[week].forEach(function (item) {
return item.active = false;
});
});
} else {
var _months = {
thisMonth: thisMonth,
preMonth: preMonth,
nextMonth: nextMonth
};
Object.keys(_months).forEach(function (month) {
_months[month].forEach(function (item) {
return item.active = false;
});
});
}
item.active = true;
setChooseDate(item.date);
onClick && onClick(item.date);
};
var getPreNextArray = function getPreNextArray(index, data) {
var _current;
var varChange = calendarType === "week" ? {
PRE: PRE_WEEK,
THIS: THIS_WEEK,
NEXT: NEXT_WEEK
} : {
PRE: PRE_MONTH,
THIS: THIS_MONTH,
NEXT: NEXT_MONTH
};
var dataChange = 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;
};
var changeDate = function changeDate(arrayIndex) {
var currentDate = "";
if (calendarType === "week") {
var oldWeeks = {
thisWeek: thisWeek,
preWeek: preWeek,
nextWeek: nextWeek
};
var showWeeks = oldWeeks[mapChangeWeekIndex[arrayIndex]];
setCurrentDate(dealYearMonth((0, _dayjs2.default)(showWeeks[3].date)));
currentDate = (0, _dayjs2.default)(showWeeks[3].date).format("YYYY-MM");
var newWeeks = getWeeks(oldWeeks[mapChangeWeekIndex[arrayIndex]][3].date);
var current = getPreNextArray(arrayIndex, newWeeks);
setCurrentActive(arrayIndex);
setPreWeek(current[PRE_WEEK]);
setNextWeek(current[NEXT_WEEK]);
setThisWeek(current[THIS_WEEK]);
} else {
var oldMonths = {
thisMonth: thisMonth,
preMonth: preMonth,
nextMonth: nextMonth
};
var _showMonths = oldMonths[mapChangeMonthIndex[arrayIndex]];
currentDate = (0, _dayjs2.default)(_showMonths[8].date).format("YYYY-MM");
setCurrentDate(dealYearMonth((0, _dayjs2.default)(_showMonths[8].date)));
setCurrentActiveLines(Math.ceil(_showMonths.length / 7));
var newMonths = getMonths(oldMonths[mapChangeMonthIndex[arrayIndex]][8].date);
var _current2 = getPreNextArray(arrayIndex, newMonths);
setCurrentActive(arrayIndex);
setPreMonth(_current2[PRE_MONTH]);
setNextMonth(_current2[NEXT_MONTH]);
setThisMonth(_current2[THIS_MONTH]);
}
onChange && onChange(currentDate);
};
function changeMonth(date) {
if (calendarType === "week") {
var weeks = getWeeks(date);
var newIndex = currentActive + 1 > 2 ? 0 : currentActive + 1;
setCurrentActive(newIndex);
var current = getPreNextArray(newIndex, weeks);
setPreWeek(current[PRE_WEEK]);
setNextWeek(current[NEXT_WEEK]);
setThisWeek(current[THIS_WEEK]);
} else {
var _months2 = getMonths(date);
var _newIndex = currentActive + 1 > 2 ? 0 : currentActive + 1;
setCurrentActive(_newIndex);
var _current3 = getPreNextArray(_newIndex, _months2);
setPreMonth(_current3[PRE_MONTH]);
setNextMonth(_current3[NEXT_MONTH]);
setThisMonth(_current3[THIS_MONTH]);
}
}
var handleBackToToday = function handleBackToToday() {
setChooseDate(today);
changeMonth(today);
};
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 = tipDay || [];
var dateData = {
timeStamp: day.valueOf(),
date: day.format(FORMAT_DATE),
month: day.get("month"),
day: day.get("date"),
year: day.get("year"),
today: today === day.format(FORMAT_DATE),
old: (0, _dayjs2.default)(today).valueOf() - day.valueOf() > 0,
active: chooseDate === day.format(FORMAT_DATE),
tipTop: "",
tipBottom: "",
badge: {
show: false,
color: "red",
num: ""
},
disabled: false,
special: {
show: false,
color: "green"
},
highlight: 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 badge === "string" && dateData.date === badge) {
Object.assign(dateData.badge, { show: true });
} else if (badge instanceof Array) {
badge.forEach(function (item) {
if (item.date === dateData.date) {
Object.assign(dateData.badge, {
show: true,
color: item.color || "red",
num: item.num || ""
});
}
});
}
// disabledDay
if (disabledDay instanceof Array) {
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 (specialDay instanceof Array) {
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;
}
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 = 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
};
}
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;
}
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 thisDays = (0, _dayjs2.default)(date).date();
var nextMonthDays = (0, _dayjs2.default)(date).add(1, "month").daysInMonth();
var i = -preMonthDays + 1;
while (1) {
if (i > nextMonthDays + thisMonthDays) {
break;
}var dateData = 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: fillMonths(tempThisMonth),
tempPreMonth: fillMonths(tempPreMonth),
tempNextMonth: fillMonths(tempNextMonth)
};
}
// useEffect(() => {}, [preWeek, nextWeek, thisWeek]);
(0, _taroWeapp.useEffect)(function () {
if (calendarType === "week") {
var weeks = getWeeks(today);
setPreWeek(weeks.tempPreWeek);
setThisWeek(weeks.tempThisWeek);
setNextWeek(weeks.tempNextWeek);
} else {
var _months3 = getMonths(today);
setPreMonth(_months3.tempPreMonth);
setThisMonth(_months3.tempThisMonth);
setNextMonth(_months3.tempNextMonth);
}
}, [calendarType]);
var BGClassName = _model.BG_COLOR_LIST[activeColor || "blue"];
var oldTextClassName = _model.TEXT_COLOR_LIST["gray"];
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 () {
setCurrentYear(currentYear - 1);
};
var anonymousState__temp24 = currentYear + "";
this.anonymousFunc3 = function () {
setCurrentYear(currentYear + 1);
};
this.anonymousFunc5 = function () {
setShowMonths(!showMonths);
};
this.anonymousFunc6 = function () {
handleBackToToday();
};
var anonymousState__temp27 = (0, _taroWeapp.internal_inline_style)({
width: "100%",
height: calendarType === "week" ? (0, _taroWeapp.pxTransform)(120) : (0, _taroWeapp.pxTransform)(120 * currentActiveLines)
});
this.anonymousFunc7 = function (e) {
if (currentActive !== e.detail.current) {
changeDate(e.detail.current);
}
};
var loopArray122 = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"].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 + "chfzzzzzzz" + index, true),
_genCompid30 = _slicedToArray(_genCompid29, 2),
$prevCompid__1600 = _genCompid30[0],
$compid__1600 = _genCompid30[1];
_taroWeapp.propsManager.set({
"align": "center",
"size": "small",
"lineSpacing": "small",
"textColor": $loopState__temp2
}, $compid__1600, $prevCompid__1600);
return {
$loopState__temp2: $loopState__temp2,
$compid__1600: $compid__1600,
$original: week.$original
};
});
var loopArray123 = [preWeek, thisWeek, nextWeek].map(function (week, index) {
week = {
$original: (0, _taroWeapp.internal_get_original)(week)
};
var $anonymousCallee__12 = week.$original.map(function (item, __index0) {
var _ref4;
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var _$indexKey = "chczz" + index + "-" + __index0;
_this3.anonymousFunc0Map[_$indexKey] = clickDate.bind(_this3, {
item: item.$original,
type: mapChangeWeekIndex[index]
});
var $loopState__temp4 = (0, _taroWeapp.internal_inline_style)({
position: "relative"
});
var $loopState__temp6 = (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)]);
var $loopState__temp8 = (0, _index.classNames)([_defineProperty({}, "cu-tag badge", item.$original.badge.show), _model.BG_COLOR_LIST[item.$original.badge.color]]);
var $loopState__temp10 = { maxWidth: (0, _taroWeapp.pxTransform)(50) };
var $loopState__temp12 = { maxWidth: (0, _taroWeapp.pxTransform)(50) };
var _genCompid31 = (0, _taroWeapp.genCompid)(__prefix + "chgzzzzzzz" + index + "-" + __index0, true),
_genCompid32 = _slicedToArray(_genCompid31, 2),
$prevCompid__1601 = _genCompid32[0],
$compid__1601 = _genCompid32[1];
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "vertical"
}, $compid__1601, $prevCompid__1601);
var _genCompid33 = (0, _taroWeapp.genCompid)(__prefix + "chhzzzzzzz" + index + "-" + __index0, true),
_genCompid34 = _slicedToArray(_genCompid33, 2),
$prevCompid__1602 = _genCompid34[0],
$compid__1602 = _genCompid34[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center"
}, $compid__1602, $prevCompid__1602);
var _genCompid35 = (0, _taroWeapp.genCompid)(__prefix + "chizzzzzzz" + index + "-" + __index0, true),
_genCompid36 = _slicedToArray(_genCompid35, 2),
$prevCompid__1603 = _genCompid36[0],
$compid__1603 = _genCompid36[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center",
"direction": "column"
}, $compid__1603, $prevCompid__1603);
var _genCompid37 = (0, _taroWeapp.genCompid)(__prefix + "chjzzzzzzz" + index + "-" + __index0, true),
_genCompid38 = _slicedToArray(_genCompid37, 2),
$prevCompid__1604 = _genCompid38[0],
$compid__1604 = _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__1604, $prevCompid__1604);
var _genCompid39 = (0, _taroWeapp.genCompid)(__prefix + "ciazzzzzzz" + index + "-" + __index0, true),
_genCompid40 = _slicedToArray(_genCompid39, 2),
$prevCompid__1605 = _genCompid40[0],
$compid__1605 = _genCompid40[1];
_taroWeapp.propsManager.set({
"text": item.$original.day,
"textColor": !item.$original.active && !item.$original.disabled && item.$original.highlight ? highlightWeekendColor : undefined
}, $compid__1605, $prevCompid__1605);
var _genCompid41 = (0, _taroWeapp.genCompid)(__prefix + "cibzzzzzzz" + index + "-" + __index0, true),
_genCompid42 = _slicedToArray(_genCompid41, 2),
$prevCompid__1606 = _genCompid42[0],
$compid__1606 = _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__1606, $prevCompid__1606);
return {
_$indexKey: _$indexKey,
$loopState__temp4: $loopState__temp4,
$loopState__temp6: $loopState__temp6,
$loopState__temp8: $loopState__temp8,
$loopState__temp10: $loopState__temp10,
$loopState__temp12: $loopState__temp12,
$compid__1601: $compid__1601,
$compid__1602: $compid__1602,
$compid__1603: $compid__1603,
$compid__1604: $compid__1604,
$compid__1605: $compid__1605,
$compid__1606: $compid__1606,
$original: item.$original
};
});
var _genCompid43 = (0, _taroWeapp.genCompid)(__prefix + "ciczzzzzzz" + index, true),
_genCompid44 = _slicedToArray(_genCompid43, 2),
$prevCompid__1607 = _genCompid44[0],
$compid__1607 = _genCompid44[1];
_taroWeapp.propsManager.set({
"col": 7
}, $compid__1607, $prevCompid__1607);
return {
$anonymousCallee__12: $anonymousCallee__12,
$compid__1607: $compid__1607,
$original: week.$original
};
});
var loopArray124 = [preMonth, thisMonth, nextMonth].map(function (month, index) {
month = {
$original: (0, _taroWeapp.internal_get_original)(month)
};
var $anonymousCallee__13 = month.$original.map(function (item, __index1) {
var _ref6;
item = {
$original: (0, _taroWeapp.internal_get_original)(item)
};
var _$indexKey2 = "chdzz" + index + "-" + __index1;
_this3.anonymousFunc1Map[_$indexKey2] = clickDate.bind(_this3, {
item: item.$original,
type: mapChangeWeekIndex[index]
});
var $loopState__temp14 = (0, _taroWeapp.internal_inline_style)({
position: "relative"
});
var $loopState__temp16 = (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)]);
var $loopState__temp18 = (0, _index.classNames)([_defineProperty({}, "cu-tag badge", item.$original.badge.show), _model.BG_COLOR_LIST[item.$original.badge.color]]);
var $loopState__temp20 = { maxWidth: (0, _taroWeapp.pxTransform)(50) };
var $loopState__temp22 = { maxWidth: (0, _taroWeapp.pxTransform)(50) };
var _genCompid45 = (0, _taroWeapp.genCompid)(__prefix + "cidzzzzzzz" + index + "-" + __index1, true),
_genCompid46 = _slicedToArray(_genCompid45, 2),
$prevCompid__1608 = _genCompid46[0],
$compid__1608 = _genCompid46[1];
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "vertical"
}, $compid__1608, $prevCompid__1608);
var _genCompid47 = (0, _taroWeapp.genCompid)(__prefix + "ciezzzzzzz" + index + "-" + __index1, true),
_genCompid48 = _slicedToArray(_genCompid47, 2),
$prevCompid__1609 = _genCompid48[0],
$compid__1609 = _genCompid48[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center"
}, $compid__1609, $prevCompid__1609);
var _genCompid49 = (0, _taroWeapp.genCompid)(__prefix + "cifzzzzzzz" + index + "-" + __index1, true),
_genCompid50 = _slicedToArray(_genCompid49, 2),
$prevCompid__1610 = _genCompid50[0],
$compid__1610 = _genCompid50[1];
_taroWeapp.propsManager.set({
"align": "center",
"justify": "center",
"direction": "column"
}, $compid__1610, $prevCompid__1610);
var _genCompid51 = (0, _taroWeapp.genCompid)(__prefix + "cigzzzzzzz" + index + "-" + __index1, true),
_genCompid52 = _slicedToArray(_genCompid51, 2),
$prevCompid__1611 = _genCompid52[0],
$compid__1611 = _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__1611, $prevCompid__1611);
var _genCompid53 = (0, _taroWeapp.genCompid)(__prefix + "cihzzzzzzz" + index + "-" + __index1, true),
_genCompid54 = _slicedToArray(_genCompid53, 2),
$prevCompid__1612 = _genCompid54[0],
$compid__1612 = _genCompid54[1];
_taroWeapp.propsManager.set({
"text": item.$original.day,
"textColor": !item.$original.active && !item.$original.disabled && item.$original.highlight ? highlightWeekendColor : undefined
}, $compid__1612, $prevCompid__1612);
var _genCompid55 = (0, _taroWeapp.genCompid)(__prefix + "ciizzzzzzz" + index + "-" + __index1, true),
_genCompid56 = _slicedToArray(_genCompid55, 2),
$prevCompid__1613 = _genCompid56[0],
$compid__1613 = _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__1613, $prevCompid__1613);
return {
_$indexKey2: _$indexKey2,
$loopState__temp14: $loopState__temp14,
$loopState__temp16: $loopState__temp16,
$loopState__temp18: $loopState__temp18,
$loopState__temp20: $loopState__temp20,
$loopState__temp22: $loopState__temp22,
$compid__1608: $compid__1608,
$compid__1609: $compid__1609,
$compid__1610: $compid__1610,
$compid__1611: $compid__1611,
$compid__1612: $compid__1612,
$compid__1613: $compid__1613,
$original: item.$original
};
});
var _genCompid57 = (0, _taroWeapp.genCompid)(__prefix + "cijzzzzzzz" + index, true),
_genCompid58 = _slicedToArray(_genCompid57, 2),
$prevCompid__1614 = _genCompid58[0],
$compid__1614 = _genCompid58[1];
_taroWeapp.propsManager.set({
"col": 7
}, $compid__1614, $prevCompid__1614);
return {
$anonymousCallee__13: $anonymousCallee__13,
$compid__1614: $compid__1614,
$original: month.$original
};
});
var loopArray125 = 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 = "chezz" + index;
_this3.anonymousFunc4Map[_$indexKey3] = function () {
selectDate(index);
};
var _genCompid59 = (0, _taroWeapp.genCompid)(__prefix + "cjazzzzzzz" + index, true),
_genCompid60 = _slicedToArray(_genCompid59, 2),
$prevCompid__1615 = _genCompid60[0],
$compid__1615 = _genCompid60[1];
_taroWeapp.propsManager.set({
"margin": "small",
"marginDirection": "vertical"
}, $compid__1615, $prevCompid__1615);
var _genCompid61 = (0, _taroWeapp.genCompid)(__prefix + "cjbzzzzzzz" + index, true),
_genCompid62 = _slicedToArray(_genCompid61, 2),
$prevCompid__1616 = _genCompid62[0],
$compid__1616 = _genCompid62[1];
_taroWeapp.propsManager.set({
"size": "small",
"bgColor": "light-gray",
"shadow": false,
"long": true,
"text": item.$original,
"onClick": _this3.anonymousFunc4.bind(_this3, _$indexKey3)
}, $compid__1616, $prevCompid__1616);
return {
$loopState__temp26: $loopState__temp26,
_$indexKey3: _$indexKey3,
$compid__1615: $compid__1615,
$compid__1616: $compid__1616,
$original: item.$original
};
});
_taroWeapp.propsManager.set({
"type": showType
}, $compid__1617, $prevCompid__1617);
_taroWeapp.propsManager.set({
"padding": "small",
"paddingDirection": "bottom"
}, $compid__1618, $prevCompid__1618);
_taroWeapp.propsManager.set({
"justify": "between",
"align": "center"
}, $compid__1619, $prevCompid__1619);
_taroWeapp.propsManager.set({
"mode": "click",
"width": 300,
"show": showMonths,
"onChange": this.anonymousFunc5
}, $compid__1620, $prevCompid__1620);
_taroWeapp.propsManager.set({
"align": "center",
"justify": "between"
}, $compid__1621, $prevCompid__1621);
_taroWeapp.propsManager.set({
"iconName": "pullleft"
}, $compid__1622, $prevCompid__1622);
_taroWeapp.propsManager.set({
"text": anonymousState__temp24
}, $compid__1623, $prevCompid__1623);
_taroWeapp.propsManager.set({
"iconName": "pullright"
}, $compid__1624, $prevCompid__1624);
_taroWeapp.propsManager.set({
"col": 4
}, $compid__1625, $prevCompid__1625);
_taroWeapp.propsManager.set({
"shape": "round",
"shadow": false,
"size": "small"
}, $compid__1626, $prevCompid__1626);
_taroWeapp.propsManager.set({
"className": "chooseDate",
"lineSpacing": "normal",
"text": currentDate
}, $compid__1627, $prevCompid__1627);
backToToday && _taroWeapp.propsManager.set({
"shadow": false,
"size": "small"
}, $compid__1628, $prevCompid__1628);
backToToday && _taroWeapp.propsManager.set({
"className": "backToToday",
"lineSpacing": "normal"
}, $compid__1629, $prevCompid__1629);
_taroWeapp.propsManager.set({
"col": 7,
"className": "solid-bottom"
}, $compid__1630, $prevCompid__1630);
Object.assign(this.__state, {
anonymousState__temp23: anonymousState__temp23,
anonymousState__temp24: anonymousState__temp24,
anonymousState__temp27: anonymousState__temp27,
loopArray122: loopArray122,
loopArray123: loopArray123,
loopArray124: loopArray124,
loopArray125: loopArray125,
$compid__1617: $compid__1617,
$compid__1618: $compid__1618,
$compid__1619: $compid__1619,
$compid__1620: $compid__1620,
$compid__1621: $compid__1621,
$compid__1622: $compid__1622,
$compid__1623: $compid__1623,
$compid__1624: $compid__1624,
$compid__1625: $compid__1625,
$compid__1626: $compid__1626,
$compid__1627: $compid__1627,
$compid__1628: $compid__1628,
$compid__1629: $compid__1629,
$compid__1630: $compid__1630,
preWeek: preWeek,
thisWeek: thisWeek,
nextWeek: nextWeek,
preMonth: preMonth,
thisMonth: thisMonth,
nextMonth: nextMonth,
months: months,
backToToday: backToToday,
currentActive: currentActive,
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_weapp;
}(_taroWeapp2.default.Component);
Calendar_weapp.$$events = ["anonymousFunc0", "anonymousFunc1", "anonymousFunc2", "anonymousFunc3", "anonymousFunc6", "anonymousFunc7"];
Calendar_weapp.$$componentPath = "components/calendar/weapp/index";
Calendar_weapp.options = {
addGlobalClass: true
};
exports.default = Calendar_weapp;
Component(__webpack_require__(/*! @tarojs/taro-weapp */ "./node_modules/@tarojs/taro-weapp/index.js").default.createComponent(Calendar_weapp));
/***/ }),
/***/ "./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/weapp/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/weapp/index.tsx?taro&type=template&parse=COMPONENT& ***!
\***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "components/calendar/weapp/index.wxml";
/***/ }),
/***/ "./src/components/calendar/weapp/index.tsx":
/*!*************************************************!*\
!*** ./src/components/calendar/weapp/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/weapp/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/weapp/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/weapp/index.tsx?taro&type=script&parse=COMPONENT&":
/*!***********************************************************************************!*\
!*** ./src/components/calendar/weapp/index.tsx?taro&type=script&parse=COMPONENT& ***!
\***********************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js??ref--4-0!./index.tsx?taro&type=script&parse=COMPONENT& */ "./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js?!./src/components/calendar/weapp/index.tsx?taro&type=script&parse=COMPONENT&");
/* harmony import */ var _node_modules_tarojs_mini_runner_dist_loaders_wxTransformerLoader_js_ref_4_0_index_tsx_taro_type_script_parse_COMPONENT___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_m