123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __export = (target, all) => {
- for (var name2 in all)
- __defProp(target, name2, { get: all[name2], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
- var stdin_exports = {};
- __export(stdin_exports, {
- default: () => stdin_default
- });
- module.exports = __toCommonJS(stdin_exports);
- var import_vue = require("vue");
- var import_vue2 = require("vue");
- var import_utils = require("../utils");
- var import_utils2 = require("./utils");
- const [name] = (0, import_utils.createNamespace)("calendar-day");
- var stdin_default = (0, import_vue2.defineComponent)({
- name,
- props: {
- item: (0, import_utils.makeRequiredProp)(Object),
- color: String,
- index: Number,
- offset: (0, import_utils.makeNumberProp)(0),
- rowHeight: String
- },
- emits: ["click"],
- setup(props, {
- emit,
- slots
- }) {
- const style = (0, import_vue2.computed)(() => {
- var _a;
- const {
- item,
- index,
- color,
- offset,
- rowHeight
- } = props;
- const style2 = {
- height: rowHeight
- };
- if (item.type === "placeholder") {
- style2.width = "100%";
- return style2;
- }
- if (index === 0) {
- style2.marginLeft = `${100 * offset / 7}%`;
- }
- if (color) {
- switch (item.type) {
- case "end":
- case "start":
- case "start-end":
- case "multiple-middle":
- case "multiple-selected":
- style2.background = color;
- break;
- case "middle":
- style2.color = color;
- break;
- }
- }
- if (offset + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
- style2.marginBottom = 0;
- }
- return style2;
- });
- const onClick = () => {
- if (props.item.type !== "disabled") {
- emit("click", props.item);
- }
- };
- const renderTopInfo = () => {
- const {
- topInfo
- } = props.item;
- if (topInfo || slots["top-info"]) {
- return (0, import_vue.createVNode)("div", {
- "class": (0, import_utils2.bem)("top-info")
- }, [slots["top-info"] ? slots["top-info"](props.item) : topInfo]);
- }
- };
- const renderBottomInfo = () => {
- const {
- bottomInfo
- } = props.item;
- if (bottomInfo || slots["bottom-info"]) {
- return (0, import_vue.createVNode)("div", {
- "class": (0, import_utils2.bem)("bottom-info")
- }, [slots["bottom-info"] ? slots["bottom-info"](props.item) : bottomInfo]);
- }
- };
- const renderContent = () => {
- const {
- item,
- color,
- rowHeight
- } = props;
- const {
- type,
- text
- } = item;
- const Nodes = [renderTopInfo(), text, renderBottomInfo()];
- if (type === "selected") {
- return (0, import_vue.createVNode)("div", {
- "class": (0, import_utils2.bem)("selected-day"),
- "style": {
- width: rowHeight,
- height: rowHeight,
- background: color
- }
- }, [Nodes]);
- }
- return Nodes;
- };
- return () => {
- const {
- type,
- className
- } = props.item;
- if (type === "placeholder") {
- return (0, import_vue.createVNode)("div", {
- "class": (0, import_utils2.bem)("day"),
- "style": style.value
- }, null);
- }
- return (0, import_vue.createVNode)("div", {
- "role": "gridcell",
- "style": style.value,
- "class": [(0, import_utils2.bem)("day", type), className],
- "tabindex": type === "disabled" ? void 0 : -1,
- "onClick": onClick
- }, [renderContent()]);
- };
- }
- });
|