UNPKG

t-fighting-design

Version:

Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.

2 lines (1 loc) 4.17 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),B=require("./index3.js"),m=require("../../button/index.js"),x=require("../../text/index.js"),c=require("../../_utils/index3.js"),N=require("../../_utils/index10.js"),w=require("../../_hooks/use-calculi-time/index.js");require("../../_hooks/use-message/index.js");require("../../loading-bar/src/index2.js");const V={key:0,class:"f-calendar__header"},D={class:"f-calendar__time"},S={class:"f-calendar__time-now"},$={class:"f-calendar__option"},j=e.createTextVNode("\u4E0A\u4E2A\u6708"),F=e.createTextVNode("\u4ECA\u5929"),M=e.createTextVNode("\u4E0B\u4E2A\u6708"),b={class:"f-calendar__week"},q={class:"f-calendar__day"},z=["onClick"],T={class:"f-calendar__solar"},A={key:0,class:"f-calendar__lunar"},L={key:1,class:"f-calendar__memorandum"},H=e.defineComponent({name:"FCalendar"}),O=e.defineComponent({...H,props:B.Props,setup(h){const o=h,l=e.ref(o.date.getFullYear()),r=e.ref(o.date.getMonth()),s=e.ref(o.date.getDate()),{AllMonthDays:p,changeLastMonth:_,changeNextMonth:f}=w.useCalculiTime(l,r),k=(t,a)=>a===s.value&&t===r.value+1?"f-calendar__day-today":t!==r.value+1?"f-calendar__not-month":"",i=t=>{({last:()=>_(),next:()=>f(),now:()=>{r.value=o.date.getMonth(),l.value=o.date.getFullYear(),s.value=o.date.getDate()}})[t]()},g=e.computed(()=>`${l.value}\u5E74 ${c.addZero(r.value+1)}\u6708 ${c.addZero(s.value)}\u65E5`),v=(t,a)=>{s.value=a,t<r.value+1?_():t>r.value+1&&f(),o.changeDate&&o.changeDate({year:l.value,month:t||r.value,date:a})},y=e.computed(()=>{const{borderColor:t,dayCellHeight:a,weekCellHeight:n}=o;return{"--f-calendar-border-color":t,"--f-calendar-day-height":c.sizeChange(a),"--f-calendar-week-height":c.sizeChange(n)}}),C=t=>o.memorandum?Object.keys(o.memorandum).includes(t):!1;return e.watch(()=>r.value,t=>{o.changeSwitch&&o.changeSwitch({year:l.value,month:t+1,date:s.value})}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["f-calendar",{"f-calendar__border":t.border}]),style:e.normalizeStyle(e.unref(y))},[t.showHeader?(e.openBlock(),e.createElementBlock("header",V,[e.createElementVNode("div",D,[e.createElementVNode("span",S,e.toDisplayString(e.unref(g)),1)]),e.createElementVNode("div",$,[e.createElementVNode("div",{class:"f-calendar__last",onClick:a[0]||(a[0]=n=>i("last"))},[e.renderSlot(t.$slots,"last-change",{},()=>[e.createVNode(e.unref(m.FButton),{text:"",size:"mini",type:"primary"},{default:e.withCtx(()=>[j]),_:1})])]),e.createElementVNode("div",{class:"f-calendar__now",onClick:a[1]||(a[1]=n=>i("now"))},[e.renderSlot(t.$slots,"now-change",{},()=>[e.createVNode(e.unref(m.FButton),{text:"",size:"mini",type:"primary"},{default:e.withCtx(()=>[F]),_:1})])]),e.createElementVNode("div",{class:"f-calendar__next",onClick:a[2]||(a[2]=n=>i("next"))},[e.renderSlot(t.$slots,"next-change",{},()=>[e.createVNode(e.unref(m.FButton),{text:"",size:"mini",type:"primary"},{default:e.withCtx(()=>[M]),_:1})])])])])):e.createCommentVNode("",!0),e.createElementVNode("ul",b,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(N.WEEK_DATA),(n,d)=>(e.openBlock(),e.createElementBlock("li",{key:d,class:"f-calendar__week-li"},e.toDisplayString(n),1))),128))]),e.createElementVNode("ul",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(n,d)=>(e.openBlock(),e.createElementBlock("li",{key:d,class:e.normalizeClass(["f-calendar__day-li",k(n.cMonth,n.cDay)]),onClick:u=>v(n.cMonth,n.cDay)},[e.createElementVNode("span",T,e.toDisplayString(n.cDay),1),t.lunar?(e.openBlock(),e.createElementBlock("span",A,e.toDisplayString(n.festival||n.IDayCn),1)):e.createCommentVNode("",!0),C(n.date)?(e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.memorandum[n.date],(u,E)=>(e.openBlock(),e.createBlock(e.unref(x.FText),{key:E,type:u.type||"default",size:14,center:"",class:"f-calendar__memorandum-item"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.content),1)]),_:2},1032,["type"]))),128))])):e.createCommentVNode("",!0)],10,z))),128))])],6))}});exports.default=O;