处理数据看板

This commit is contained in:
2026-01-16 04:34:39 +08:00
parent 345ee6dbb0
commit 74679328e9
113 changed files with 1984 additions and 5744 deletions

View File

@@ -0,0 +1,708 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_nutuiUni_components__constants_event = require("../_constants/event.js");
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
const uni_modules_nutuiUni_components__utils_date = require("../_utils/date.js");
const uni_modules_nutuiUni_components__utils_env = require("../_utils/env.js");
const uni_modules_nutuiUni_components__utils_raf = require("../_utils/raf.js");
const uni_modules_nutuiUni_components__utils_style = require("../_utils/style.js");
require("../../locale/locale.js");
const uni_modules_nutuiUni_locale_useTranslate = require("../../locale/useTranslate.js");
const uni_modules_nutuiUni_components__utils_props = require("../_utils/props.js");
const calendaritemProps = {
...uni_modules_nutuiUni_components__utils_props.commonProps,
/**
* @description 是否可见
*/
visible: Boolean,
/**
* @description 类型,日期单选 `one`,区间选择 `range`,日期多选 `multiple`,周选择 `week`
*/
type: uni_modules_nutuiUni_components__utils_props.makeStringProp("one"),
/**
* @description 是否弹窗状态展示
*/
poppable: uni_modules_nutuiUni_components__utils_props.truthProp,
/**
* @description 自动回填
*/
isAutoBackFill: Boolean,
/**
* @description 显示标题
*/
title: uni_modules_nutuiUni_components__utils_props.makeStringProp("日期选择"),
/**
* @description 默认值,单个日期选择为 `string`,其他为 `string[]`
*/
defaultValue: {
type: [String, Array]
},
/**
* @description 开始日期
*/
startDate: uni_modules_nutuiUni_components__utils_props.makeStringProp(uni_modules_nutuiUni_components__utils_date.getDay(0)),
/**
* @description 结束日期
*/
endDate: uni_modules_nutuiUni_components__utils_props.makeStringProp(uni_modules_nutuiUni_components__utils_date.getDay(365)),
/**
* @description 范围选择,开始信息文案
*/
startText: uni_modules_nutuiUni_components__utils_props.makeStringProp("开始"),
/**
* @description 范围选择,结束信息文案
*/
endText: uni_modules_nutuiUni_components__utils_props.makeStringProp("结束"),
/**
* @description 底部确认按钮文案
*/
confirmText: uni_modules_nutuiUni_components__utils_props.makeStringProp("确认"),
/**
* @description 是否展示今天标记
*/
showToday: uni_modules_nutuiUni_components__utils_props.truthProp,
/**
* @description 是否在展示日历标题
*/
showTitle: uni_modules_nutuiUni_components__utils_props.truthProp,
/**
* @description 是否展示日期标题
*/
showSubTitle: uni_modules_nutuiUni_components__utils_props.truthProp,
/**
* @description 是否启动滚动动画
*/
toDateAnimation: uni_modules_nutuiUni_components__utils_props.truthProp,
/**
* @description 设置周起始日
*/
firstDayOfWeek: uni_modules_nutuiUni_components__utils_props.makeNumberProp(0),
/**
* @description 一个用来判断该日期是否被禁用的函数,接受一个 `年 - 月 - 日` 作为参数。 应该返回一个 Boolean 值。
* @default undefined
*/
disabledDate: Function,
/**
* @description 是否使用 footer 插槽,如果使用,此值必须为 true
*/
footerSlot: Boolean,
/**
* @description 是否使用 btn 插槽,如果使用,此值必须为 true
*/
btnSlot: Boolean
};
const calendaritemEmits = {
[uni_modules_nutuiUni_components__constants_event.CHOOSE_EVENT]: (value) => true,
[uni_modules_nutuiUni_components__constants_event.SELECT_EVENT]: (value) => true,
update: () => true,
close: () => true
};
const __default__ = common_vendor.defineComponent({
name: `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-calendar-item`,
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: "shared"
}
});
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: calendaritemProps,
emits: calendaritemEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emit = __emit;
common_vendor.useSlots();
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-calendar-item`;
const { translate } = uni_modules_nutuiUni_locale_useTranslate.useTranslate(componentName);
const state = common_vendor.reactive({
yearMonthTitle: "",
defaultRange: [],
containerHeight: "100%",
currDate: "",
propStartDate: "",
propEndDate: "",
unLoadPrev: false,
touchParams: {
startY: 0,
endY: 0,
startTime: 0,
endTime: 0,
lastY: 0,
lastTime: 0
},
transformY: 0,
translateY: 0,
scrollDistance: 0,
defaultData: [],
chooseData: [],
monthsData: [],
dayPrefix: "nut-calendar__day",
startData: "",
endData: "",
isRange: props.type === "range",
timer: 0,
currentIndex: 0,
avgHeight: 0,
scrollTop: 0,
monthsNum: 0
});
const classes = common_vendor.computed(() => {
return uni_modules_nutuiUni_components__utils_style.getMainClass(props, componentName, {
"nut-calendar--nopop": !props.poppable,
"nut-calendar--nofooter": props.isAutoBackFill
});
});
const weekdays = translate("weekdays").map((day, index) => ({
day,
weekend: index === 0 || index === 6
}));
const weeks = common_vendor.ref([...weekdays.slice(props.firstDayOfWeek, 7), ...weekdays.slice(0, props.firstDayOfWeek)]);
const months = common_vendor.ref(null);
const scalePx = common_vendor.ref(2);
const viewHeight = common_vendor.ref(0);
const compConthsData = common_vendor.computed(() => {
return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
});
const scrollWithAnimation = common_vendor.ref(false);
function splitDate(date) {
return date.split("-");
}
function isStart(currDate) {
return uni_modules_nutuiUni_components__utils_date.isEqual(state.currDate[0], currDate);
}
function isEnd(currDate) {
return uni_modules_nutuiUni_components__utils_date.isEqual(state.currDate[1], currDate);
}
function isMultiple(currDate) {
var _a, _b;
if (((_a = state.currDate) == null ? void 0 : _a.length) > 0) {
return (_b = state.currDate) == null ? void 0 : _b.some((item) => {
return uni_modules_nutuiUni_components__utils_date.isEqual(item, currDate);
});
} else {
return false;
}
}
function getCurrDate(day, month) {
return `${month.curData[0]}-${month.curData[1]}-${uni_modules_nutuiUni_components__utils_date.getNumTwoBit(+day.day)}`;
}
function getClass(day, month, index) {
const res = [];
if (typeof index === "number" && ((index + 1 + props.firstDayOfWeek) % 7 === 0 || (index + props.firstDayOfWeek) % 7 === 0)) {
res.push("weekend");
}
const currDate = getCurrDate(day, month);
const { type } = props;
if (day.type === "curr") {
if (uni_modules_nutuiUni_components__utils_date.isEqual(state.currDate, currDate) || (type === "range" || type === "week") && (isStart(currDate) || isEnd(currDate)) || type === "multiple" && isMultiple(currDate)) {
res.push(`${state.dayPrefix}--active`);
} else if (state.propStartDate && uni_modules_nutuiUni_components__utils_date.compareDate(currDate, state.propStartDate) || state.propEndDate && uni_modules_nutuiUni_components__utils_date.compareDate(state.propEndDate, currDate) || props.disabledDate && props.disabledDate(currDate)) {
res.push(`${state.dayPrefix}--disabled`);
} else if ((type === "range" || type === "week") && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate[0], currDate) && uni_modules_nutuiUni_components__utils_date.compareDate(currDate, state.currDate[1])) {
res.push(`${state.dayPrefix}--choose`);
}
} else {
res.push(`${state.dayPrefix}--disabled`);
}
return res;
}
function confirm() {
const { type } = props;
if (type === "range" && state.chooseData.length === 2 || type !== "range") {
let selectData = state.chooseData.slice(0);
if (type === "week") {
selectData = {
weekDate: [handleWeekDate(state.chooseData[0]), handleWeekDate(state.chooseData[1])]
};
}
emit(uni_modules_nutuiUni_components__constants_event.CHOOSE_EVENT, selectData);
if (props.poppable)
emit("update");
}
}
function chooseDay(day, month, isFirst = false) {
var _a, _b;
if (!getClass(day, month).includes(`${state.dayPrefix}--disabled`)) {
const { type } = props;
const [y, m] = month.curData;
const days = [...month.curData];
days[2] = uni_modules_nutuiUni_components__utils_date.getNumTwoBit(Number(day.day));
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
days[4] = uni_modules_nutuiUni_components__utils_date.getWhatDay(+days[0], +days[1], +days[2]);
if (type === "multiple") {
if (((_a = state.currDate) == null ? void 0 : _a.length) > 0) {
let hasIndex;
(_b = state.currDate) == null ? void 0 : _b.forEach((item, index) => {
if (item === days[3])
hasIndex = index;
});
if (isFirst) {
state.chooseData.push([...days]);
} else {
if (hasIndex !== void 0) {
state.currDate.splice(hasIndex, 1);
state.chooseData.splice(hasIndex, 1);
} else {
state.currDate.push(days[3]);
state.chooseData.push([...days]);
}
}
} else {
state.currDate = [days[3]];
state.chooseData = [[...days]];
}
} else if (type === "range") {
const curDataLength = Object.values(state.currDate).length;
if (curDataLength === 2 || curDataLength === 0) {
state.currDate = [days[3]];
} else {
if (uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate[0], days[3]))
Array.isArray(state.currDate) && state.currDate.push(days[3]);
else
Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
}
if (state.chooseData.length === 2 || !state.chooseData.length) {
state.chooseData = [[...days]];
} else {
if (uni_modules_nutuiUni_components__utils_date.compareDate(state.chooseData[0][3], days[3]))
state.chooseData = [...state.chooseData, [...days]];
else
state.chooseData = [[...days], ...state.chooseData];
}
} else if (type === "week") {
const weekArr = uni_modules_nutuiUni_components__utils_date.getWeekDate(y, m, day.day, props.firstDayOfWeek);
if (state.propStartDate && uni_modules_nutuiUni_components__utils_date.compareDate(weekArr[0], state.propStartDate))
weekArr.splice(0, 1, state.propStartDate);
if (state.propEndDate && uni_modules_nutuiUni_components__utils_date.compareDate(state.propEndDate, weekArr[1]))
weekArr.splice(1, 1, state.propEndDate);
state.currDate = weekArr;
state.chooseData = [uni_modules_nutuiUni_components__utils_date.formatResultDate(weekArr[0]), uni_modules_nutuiUni_components__utils_date.formatResultDate(weekArr[1])];
} else {
state.currDate = days[3];
state.chooseData = [...days];
}
if (!isFirst) {
let selectData = state.chooseData;
if (type === "week") {
selectData = {
weekDate: [
handleWeekDate(state.chooseData[0]),
handleWeekDate(state.chooseData[1])
]
};
}
emit(uni_modules_nutuiUni_components__constants_event.SELECT_EVENT, selectData);
if (props.isAutoBackFill || !props.poppable)
confirm();
}
}
}
function handleWeekDate(weekDate) {
const [y, m, d] = weekDate;
return {
date: weekDate,
monthWeekNum: uni_modules_nutuiUni_components__utils_date.getMonthWeek(y, m, d, props.firstDayOfWeek),
yearWeekNum: uni_modules_nutuiUni_components__utils_date.getYearWeek(y, m, d)
};
}
function getCurrData(type) {
const monthData = type === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
let year = Number.parseInt(monthData.curData[0]);
let month = Number.parseInt(monthData.curData[1].toString().replace(/^0/, ""));
switch (type) {
case "prev":
month === 1 && (year -= 1);
month = month === 1 ? 12 : --month;
break;
case "next":
month === 12 && (year += 1);
month = month === 12 ? 1 : ++month;
break;
}
return [`${year}`, uni_modules_nutuiUni_components__utils_date.getNumTwoBit(month), `${uni_modules_nutuiUni_components__utils_date.getMonthDays(String(year), String(month))}`];
}
function getDaysStatus(days, type, dateInfo) {
const { year, month } = dateInfo;
if (type === "prev" && days >= 7)
days -= 7;
return Array.from(Array.from({ length: days }), (v, k) => {
return {
day: String(k + 1),
type,
year,
month
};
});
}
function getPreDaysStatus(days, type, dateInfo, preCurrMonthDays) {
days = days - props.firstDayOfWeek;
const { year, month } = dateInfo;
if (type === "prev" && days >= 7)
days -= 7;
const months2 = Array.from(Array.from({ length: preCurrMonthDays }), (v, k) => {
return {
day: String(k + 1),
type,
year,
month
};
});
return months2.slice(preCurrMonthDays - days);
}
function getMonth(curData, type) {
const preMonthDays = uni_modules_nutuiUni_components__utils_date.getMonthPreDay(+curData[0], +curData[1]);
let preMonth = Number(curData[1]) - 1;
let preYear = Number(curData[0]);
if (preMonth <= 0) {
preMonth = 12;
preYear += 1;
}
const currMonthDays = uni_modules_nutuiUni_components__utils_date.getMonthDays(String(curData[0]), String(curData[1]));
const preCurrMonthDays = uni_modules_nutuiUni_components__utils_date.getMonthDays(`${preYear}`, `${preMonth}`);
const title = {
year: curData[0],
month: curData[1]
};
const monthInfo = {
curData,
title: translate("monthTitle", title.year, title.month),
monthData: [
...getPreDaysStatus(
preMonthDays,
"prev",
{ month: String(preMonth), year: String(preYear) },
preCurrMonthDays
),
...getDaysStatus(currMonthDays, "curr", title)
],
cssHeight: 0,
cssScrollHeight: 0
};
let titleHeight, itemHeight;
if (uni_modules_nutuiUni_components__utils_env.isH5) {
titleHeight = 46 * scalePx.value + 16 * scalePx.value * 2;
itemHeight = 128 * scalePx.value;
} else {
titleHeight = Math.floor(46 * scalePx.value) + Math.floor(16 * scalePx.value) * 2;
itemHeight = Math.floor(128 * scalePx.value);
}
monthInfo.cssHeight = titleHeight + (monthInfo.monthData.length > 35 ? itemHeight * 6 : itemHeight * 5);
let cssScrollHeight = 0;
if (state.monthsData.length > 0) {
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
}
monthInfo.cssScrollHeight = cssScrollHeight;
if (type === "next") {
if (!state.endData || !uni_modules_nutuiUni_components__utils_date.compareDate(
`${state.endData[0]}-${state.endData[1]}-${uni_modules_nutuiUni_components__utils_date.getMonthDays(state.endData[0], state.endData[1])}`,
`${curData[0]}-${curData[1]}-${curData[2]}`
)) {
state.monthsData.push(monthInfo);
}
} else {
if (!state.startData || !uni_modules_nutuiUni_components__utils_date.compareDate(
`${curData[0]}-${curData[1]}-${curData[2]}`,
`${state.startData[0]}-${state.startData[1]}-01`
)) {
state.monthsData.unshift(monthInfo);
} else {
state.unLoadPrev = true;
}
}
}
function initData() {
const propStartDate = props.startDate ? props.startDate : uni_modules_nutuiUni_components__utils_date.getDay(0);
const propEndDate = props.endDate ? props.endDate : uni_modules_nutuiUni_components__utils_date.getDay(365);
state.propStartDate = propStartDate;
state.propEndDate = propEndDate;
state.startData = splitDate(propStartDate);
state.endData = splitDate(propEndDate);
if (props.defaultValue || Array.isArray(props.defaultValue) && props.defaultValue.length > 0) {
state.currDate = props.type !== "one" ? [...props.defaultValue] : props.defaultValue;
}
const startDate = {
year: Number(state.startData[0]),
month: Number(state.startData[1])
};
const endDate = {
year: Number(state.endData[0]),
month: Number(state.endData[1])
};
let monthsNum = endDate.month - startDate.month;
if (endDate.year - startDate.year > 0)
monthsNum = monthsNum + 12 * (endDate.year - startDate.year);
if (monthsNum <= 0)
monthsNum = 1;
getMonth(state.startData, "next");
let i = 1;
do
getMonth(getCurrData("next"), "next");
while (i++ < monthsNum);
state.monthsNum = monthsNum;
if (props.type === "range" && Array.isArray(state.currDate)) {
if (state.currDate.length > 0) {
if (propStartDate && uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate[0], propStartDate))
state.currDate.splice(0, 1, propStartDate);
if (propEndDate && uni_modules_nutuiUni_components__utils_date.compareDate(propEndDate, state.currDate[1]))
state.currDate.splice(1, 1, propEndDate);
state.defaultData = [...splitDate(state.currDate[0]), ...splitDate(state.currDate[1])];
}
} else if (props.type === "multiple" && Array.isArray(state.currDate)) {
if (state.currDate.length > 0) {
const defaultArr = [];
const obj = {};
state.currDate.forEach((item) => {
if (propStartDate && !uni_modules_nutuiUni_components__utils_date.compareDate(item, propStartDate) && propEndDate && !uni_modules_nutuiUni_components__utils_date.compareDate(propEndDate, item)) {
if (!Object.hasOwnProperty.call(obj, item)) {
defaultArr.push(item);
obj[item] = item;
}
}
});
state.currDate = [...defaultArr];
state.defaultData = [...splitDate(defaultArr[0])];
}
} else if (props.type === "week" && Array.isArray(state.currDate)) {
if (state.currDate.length > 0) {
const [y, m, d] = splitDate(state.currDate[0]);
state.currDate = uni_modules_nutuiUni_components__utils_date.getWeekDate(y, m, d, props.firstDayOfWeek);
if (propStartDate && uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate[0], propStartDate))
state.currDate.splice(0, 1, propStartDate);
if (propEndDate && uni_modules_nutuiUni_components__utils_date.compareDate(propEndDate, state.currDate[1]))
state.currDate.splice(1, 1, propEndDate);
state.defaultData = [...splitDate(state.currDate[0]), ...splitDate(state.currDate[1])];
}
} else {
if (state.currDate) {
if (propStartDate && uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate, propStartDate))
state.currDate = propStartDate;
else if (propEndDate && !uni_modules_nutuiUni_components__utils_date.compareDate(state.currDate, propEndDate))
state.currDate = propEndDate;
state.defaultData = [...splitDate(state.currDate)];
}
}
let current = 0;
let lastCurrent = 0;
if (state.defaultData.length > 0) {
state.monthsData.forEach((item, index) => {
if (item.title === translate("monthTitle", state.defaultData[0], state.defaultData[1]))
current = index;
if (props.type === "range" || props.type === "week") {
if (item.title === translate("monthTitle", state.defaultData[3], state.defaultData[4]))
lastCurrent = index;
}
});
}
setDefaultRange(monthsNum, current);
state.currentIndex = current;
state.yearMonthTitle = state.monthsData[state.currentIndex].title;
if (state.defaultData.length > 0) {
if (state.isRange) {
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[lastCurrent], true);
} else if (props.type === "week") {
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
} else if (props.type === "multiple") {
[...state.currDate].forEach((item) => {
const dateArr = splitDate(item);
let current2 = state.currentIndex;
state.monthsData.forEach((item2, index) => {
if (item2.title === translate("monthTitle", dateArr[0], dateArr[1]))
current2 = index;
});
chooseDay({ day: dateArr[2], type: "curr" }, state.monthsData[current2], true);
});
} else {
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
}
}
const lastItem = state.monthsData[state.monthsData.length - 1];
const containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
state.containerHeight = `${containerHeight}px`;
state.scrollTop = Math.ceil(state.monthsData[state.currentIndex].cssScrollHeight);
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
if (months == null ? void 0 : months.value)
viewHeight.value = months.value.clientHeight;
}
function scrollToDate(date) {
if (uni_modules_nutuiUni_components__utils_date.compareDate(date, state.propStartDate))
date = state.propStartDate;
else if (!uni_modules_nutuiUni_components__utils_date.compareDate(date, state.propEndDate))
date = state.propEndDate;
const dateArr = splitDate(date);
state.monthsData.forEach((item, index) => {
if (item.title === translate("monthTitle", dateArr[0], dateArr[1])) {
state.scrollTop += 1;
scrollWithAnimation.value = props.toDateAnimation;
uni_modules_nutuiUni_components__utils_raf.requestAniFrame(() => {
setTimeout(() => {
state.scrollTop = state.monthsData[index].cssScrollHeight;
setTimeout(() => {
scrollWithAnimation.value = false;
}, 200);
}, 10);
});
}
});
}
function initPosition() {
state.scrollTop = Math.ceil(state.monthsData[state.currentIndex].cssScrollHeight);
}
function setDefaultRange(monthsNum, current) {
if (monthsNum >= 3) {
if (current > 0 && current < monthsNum)
state.defaultRange = [current - 1, current + 3];
else if (current === 0)
state.defaultRange = [current, current + 4];
else if (current === monthsNum)
state.defaultRange = [current - 2, current + 2];
} else {
state.defaultRange = [0, monthsNum + 2];
}
state.translateY = state.monthsData[state.defaultRange[0]].cssScrollHeight;
}
function isActive(day, month) {
return (props.type === "range" || props.type === "week") && day.type === "curr" && getClass(day, month).includes("nut-calendar__day--active");
}
function isStartTip(day, month) {
return isActive(day, month) && isStart(getCurrDate(day, month));
}
function isEndTip(day, month) {
if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month)))
return isActive(day, month);
return false;
}
function rangeTip() {
if (state.currDate.length >= 2)
return uni_modules_nutuiUni_components__utils_date.isEqual(state.currDate[0], state.currDate[1]);
}
function isCurrDay(dateInfo) {
const date = `${dateInfo.year}-${dateInfo.month}-${Number(dateInfo.day) < 10 ? `0${dateInfo.day}` : dateInfo.day}`;
return uni_modules_nutuiUni_components__utils_date.isEqual(date, uni_modules_nutuiUni_components__utils_date.date2Str(/* @__PURE__ */ new Date()));
}
function mothsViewScroll(e) {
if (state.monthsData.length <= 1)
return;
const currentScrollTop = e.detail.scrollTop;
let current = Math.floor(currentScrollTop / state.avgHeight);
if (current === 0) {
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight)
current += 1;
} else if (current > 0 && current < state.monthsNum - 1) {
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight)
current += 1;
if (currentScrollTop < state.monthsData[current].cssScrollHeight)
current -= 1;
}
if (state.currentIndex !== current) {
state.currentIndex = current;
setDefaultRange(state.monthsNum, current);
}
state.yearMonthTitle = state.monthsData[current].title;
}
function resetRender() {
state.chooseData.splice(0);
state.monthsData.splice(0);
initData();
}
common_vendor.watch(() => props.defaultValue, (value) => {
if (value) {
if (props.poppable) {
resetRender();
}
}
});
common_vendor.onMounted(() => {
common_vendor.index.getSystemInfo({
success(res) {
let scale = 2;
let toFixed = 3;
if (uni_modules_nutuiUni_components__utils_env.isH5) {
toFixed = 5;
const fontSize = document.documentElement.style.fontSize;
scale = Number((Number.parseInt(fontSize) / 40).toFixed(toFixed));
} else {
const screenWidth = res.screenWidth;
scale = Number((screenWidth / 750).toFixed(toFixed));
}
scalePx.value = scale;
initData();
}
});
});
__expose({
scrollToDate,
initPosition
});
return (_ctx, _cache) => {
return common_vendor.e({
a: props.showTitle
}, props.showTitle ? {
b: common_vendor.t(props.title || common_vendor.unref(translate)("title"))
} : {}, {
c: props.btnSlot
}, props.btnSlot ? {} : {}, {
d: props.showSubTitle
}, props.showSubTitle ? {
e: common_vendor.t(state.yearMonthTitle)
} : {}, {
f: common_vendor.f(weeks.value, (item, index, i0) => {
return {
a: common_vendor.t(item.day),
b: index,
c: item.weekend ? 1 : ""
};
}),
g: common_vendor.f(compConthsData.value, (month, index, i0) => {
return {
a: common_vendor.t(month.title),
b: common_vendor.f(month.monthData, (day, i, i1) => {
return common_vendor.e({
a: common_vendor.t(day.type === "curr" ? day.day : ""),
b: props.showToday && isCurrDay(day)
}, props.showToday && isCurrDay(day) ? {
c: common_vendor.t(common_vendor.unref(translate)("today"))
} : {}, {
d: isStartTip(day, month)
}, isStartTip(day, month) ? {
e: common_vendor.t(props.startText || common_vendor.unref(translate)("start")),
f: rangeTip() ? 1 : ""
} : {}, {
g: isEndTip(day, month)
}, isEndTip(day, month) ? {
h: common_vendor.t(props.endText || common_vendor.unref(translate)("end"))
} : {}, {
i: common_vendor.n(getClass(day, month, i)),
j: common_vendor.o(($event) => chooseDay(day, month), i),
k: i
});
}),
c: index
};
}),
h: props.type === "range" ? 1 : "",
i: `translateY(${state.translateY}px)`,
j: state.containerHeight,
k: state.scrollTop,
l: scrollWithAnimation.value,
m: common_vendor.o(mothsViewScroll),
n: props.poppable && !props.isAutoBackFill
}, props.poppable && !props.isAutoBackFill ? common_vendor.e({
o: props.footerSlot
}, props.footerSlot ? {
p: common_vendor.r("footer", {
date: state.chooseData
})
} : {
q: common_vendor.t(props.confirmText || common_vendor.unref(translate)("confirm")),
r: common_vendor.o(confirm)
}) : {}, {
s: common_vendor.n(classes.value),
t: common_vendor.s(props.customStyle)
});
};
}
});
wx.createComponent(_sfc_main);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/calendaritem/calendaritem.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="{{s}}" style="{{t}}"><view class="nut-calendar__header"><view wx:if="{{a}}" class="nut-calendar__header-title">{{b}}</view><view wx:if="{{c}}" class="nut-calendar__header-slot"><slot name="btn"/></view><view wx:if="{{d}}" class="nut-calendar__header-subtitle">{{e}}</view><view class="nut-calendar__weekdays"><view wx:for="{{f}}" wx:for-item="item" wx:key="b" class="{{['nut-calendar__weekday', item.c && 'weekend']}}">{{item.a}}</view></view></view><scroll-view ref="months" class="nut-calendar__content" scroll-y="{{true}}" scroll-top="{{k}}" scroll-with-animation="{{l}}" bindscroll="{{m}}"><view class="nut-calendar__panel" style="{{'height:' + j}}"><view class="nut-calendar__body" style="{{'transform:' + i}}"><view wx:for="{{g}}" wx:for-item="month" wx:key="c" class="nut-calendar__month"><view class="nut-calendar__month-title">{{month.a}}</view><view class="nut-calendar__days"><view class="{{['nut-calendar__days-item', h && 'nut-calendar__days-item--range']}}"><block wx:for="{{month.b}}" wx:for-item="day" wx:key="k"><view class="{{['nut-calendar__day', day.i]}}" bindtap="{{day.j}}"><view class="nut-calendar__day-value">{{day.a}}</view><view wx:if="{{day.b}}" class="nut-calendar__day-tips--curr">{{day.c}}</view><view wx:if="{{day.d}}" class="{{['nut-calendar__day-tip', day.f && 'nut-calendar__day-tips--top']}}">{{day.e}}</view><view wx:if="{{day.g}}" class="nut-calendar__day-tip">{{day.h}}</view></view></block></view></view></view></view></view></scroll-view><view wx:if="{{n}}" class="nut-calendar__footer"><slot wx:if="{{o}}" name="footer"/><view wx:else class="nut-calendar__confirm" bindtap="{{r}}">{{q}}</view></view></view>

View File

@@ -0,0 +1,253 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.nut-theme-dark .nut-calendar-item {
color: var(--nut-dark-color, var(--nut-white, #fff));
background: var(--nut-dark-background, #131313);
}
.nut-theme-dark .nut-calendar__header {
color: var(--nut-dark-color, var(--nut-white, #fff));
background: var(--nut-dark-background, #131313);
}
.nut-theme-dark .nut-calendar__content .nut-theme-dark .nut-calendar__panel .nut-theme-dark .nut-calendar__days .nut-theme-dark .nut-calendar__day--disabled {
color: var(--nut-dark-calendar-disabled, #646566) !important;
}
.nut-theme-dark .nut-calendar__content .nut-theme-dark .nut-calendar__panel .nut-theme-dark .nut-calendar__days .calendar-month-day-choose {
color: var(--nut-calendar-choose-font-color, var(--nut-primary-color, #fa2c19));
background-color: var(--nut-dark-calendar-choose-color, rgba(227, 227, 227, 0.2));
}
.nut-theme-dark .nut-calendar__footer {
color: var(--nut-dark-color, var(--nut-white, #fff));
background: var(--nut-dark-background2, #1b1b1b);
}
.nut-calendar-item {
position: relative;
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
overflow: hidden;
font-size: 16px;
color: #333;
background-color: var(--nut-white, #fff);
}
.nut-calendar.nut-calendar--nopop .nut-calendar__header .nut-calendar__header-title {
font-size: var(--nut-calendar-base-font, var(--nut-font-size-3, 16px));
}
.nut-calendar .popup-box {
height: 100%;
}
.nut-calendar ::-webkit-scrollbar {
display: none;
}
.nut-calendar__header {
display: flex;
flex-direction: column;
padding-top: 1px;
text-align: center;
background-color: var(--nut-white, #fff);
}
.nut-calendar__header-title {
font-size: var(--nut-calendar-title-font, var(--nut-font-size-4, 18px));
font-weight: var(--nut-calendar-title-font-weight, 500);
line-height: 44px;
}
.nut-calendar__header-slot {
min-height: 24px;
}
.nut-calendar__header-subtitle {
padding: 7px 0;
font-size: var(--nut-calendar-sub-title-font, var(--nut-font-size-2, 14px));
line-height: 22px;
}
.nut-calendar__header .nut-calendar__weekdays {
display: flex;
align-items: center;
justify-content: space-around;
height: 36px;
border-radius: 0 0 12px 12px;
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.06);
}
.nut-calendar__header .nut-calendar__weekdays .nut-calendar__weekday.weekend {
color: var(--nut-calendar-day67-font-color, var(--nut-primary-color, #fa2c19));
}
.nut-calendar__content {
display: block;
flex: 1;
width: 100%;
overflow-y: auto;
}
.nut-calendar__content .nut-calendar__panel {
position: relative;
box-sizing: border-box;
display: block;
width: 100%;
height: auto;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__body {
display: block;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__month {
display: flex;
flex-direction: column;
text-align: center;
}
.nut-calendar__content .nut-calendar__panel view:nth-of-type(2) .nut-calendar__month-title {
padding-top: 0;
}
.nut-calendar__content .nut-calendar__panel .calendar-loading-tip {
position: absolute;
top: -50px;
right: 0;
left: 0;
height: 50px;
font-size: var(--nut-calendar-text-font, var(--nut-font-size-1, 12px));
line-height: 50px;
color: var(--nut-text-color, #808080);
text-align: center;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__month-title {
height: 23px;
margin: 8px 0;
font-size: var(--nut-calendar-month-title-font-size, inherit);
line-height: 23px;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days {
overflow: hidden;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
float: left;
width: 14.28%;
height: 64px;
font-weight: var(--nut-calendar-day-font-weight, 500);
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day.weekend {
color: var(--nut-calendar-day67-font-color, var(--nut-primary-color, #fa2c19));
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-tips {
position: absolute;
width: 100%;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-tips--curr {
position: absolute;
bottom: 6px;
width: 100%;
font-size: 12px;
line-height: 14px;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-tip {
position: absolute;
bottom: 6px;
width: 100%;
font-size: 12px;
line-height: 14px;
color: var(--nut-calendar-primary-color, var(--nut-primary-color, #fa2c19));
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-tips--top {
top: 6px;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-tips--bottom {
bottom: 6px;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--active {
color: var(--nut-white, #fff) !important;
background-color: var(--nut-calendar-primary-color, var(--nut-primary-color, #fa2c19));
border-radius: var(--nut-calendar-day-active-border-radius, 0);
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--active .nut-calendar__day-tips {
visibility: hidden;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--active .nut-calendar__day-tips--curr {
visibility: hidden;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--active .nut-calendar__day-tip {
color: var(--nut-white, #fff);
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--disabled {
color: var(--nut-calendar-disable-color, #d1d0d0) !important;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--choose {
color: var(--nut-calendar-choose-font-color, var(--nut-primary-color, #fa2c19));
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day--choose::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: "";
background-color: var(--nut-calendar-choose-color, var(--nut-primary-color, #fa2c19));
opacity: 0.09;
}
.nut-calendar__content .nut-calendar__panel .nut-calendar__days .nut-calendar__day .nut-calendar__day-value {
padding: 2px 0;
font-size: var(--nut-calendar-day-font, 16px);
}
.nut-calendar__footer {
display: flex;
width: 100%;
height: 62px;
background-color: var(--nut-white, #fff);
}
.nut-calendar__footer .nut-calendar__confirm {
width: 100%;
height: 44px;
margin: 10px 18px;
line-height: 44px;
color: var(--nut-white, #fff);
text-align: center;
background: var(--nut-button-primary-background-color, linear-gradient(135deg, var(--nut-primary-color, var(--nut-primary-color, #fa2c19)) 0%, var(--nut-primary-color, var(--nut-primary-color, #fa2c19)) 100%));
border-radius: 22px;
}