UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

48 lines (47 loc) 70.9 kB
(function(B,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("../dynamic-resolver/index.umd.js"),require("../designer-canvas/index.umd.js"),require("lodash-es"),require("../common/index.umd.js"),require("../popover/index.umd.js"),require("../locale/index.umd.js"),require("../property-panel/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","../dynamic-resolver/index.umd.js","../designer-canvas/index.umd.js","lodash-es","../common/index.umd.js","../popover/index.umd.js","../locale/index.umd.js","../property-panel/index.umd.js"],t):(B=typeof globalThis<"u"?globalThis:B||self,t(B.calendar={},B.Vue,B.dynamicResolver,B.designerCanvas,B.LodashES,B.common,B.FPopover,B.locale,B.propertyPanel))})(this,function(B,t,K,oe,Q,Y,ze,Ye,He){"use strict";var Cn=Object.defineProperty;var Dn=(B,t,K)=>t in B?Cn(B,t,{enumerable:!0,configurable:!0,writable:!0,value:K}):B[t]=K;var qe=(B,t,K)=>Dn(B,typeof t!="symbol"?t+"":t,K);const Se=new Map([["appearance",K.resolveAppearance]]),Ge="root-viewmodel";function _e(e,n){const{formSchemaUtils:r,designViewModelUtils:i}=n;function u(m){return{id:`${m.componentId}-component-viewmodel`,code:`${m.componentId}-component-viewmodel`,name:m.componentName,bindTo:m.bindTo,parent:Ge,fields:[],commands:[],states:[],enableValidation:!0}}function g(m){const a=e.getSchemaByType("component-ref");return Object.assign(a,{id:`${m.componentId}-component-ref`,component:`${m.componentId}-component`}),a}function p(m,a,c){var y,d,F,s;const h=(d=(y=a==null?void 0:a.parentComponentInstance)==null?void 0:y.schema)==null?void 0:d.type,o=(s=(F=r.getFormSchema())==null?void 0:F.module)==null?void 0:s.templateId;if(["double-list-template","tree-list-template","list-template"].includes(o))return m;const l=[oe.DgControl["content-container"].type,oe.DgControl["response-layout-item"].type,oe.DgControl["splitter-pane"].type,oe.DgControl.drawer.type];if(h&&l.includes(h)){const v=e.getSchemaByType("section",{parentComponentInstance:a.parentComponentInstance,mainTitle:a.componentName},n);if(v&&v.contents&&v.contents.length){const I=v.contents[0];return I.contents=[m],v}}return m}function D(m){const a=e.getSchemaByType("calendar");return Object.assign(a,{id:m.componentId+"-calendar",appearance:{class:""},type:"calendar",dataSource:m.dataSource||"",pagination:{enable:!1}}),[a]}function O(m){var l,y,d;const a=e.getSchemaByType("component"),c=D(m);let h=!1;const o=(d=(y=(l=m.parentComponentInstance)==null?void 0:l.schema)==null?void 0:y.appearance)==null?void 0:d.class;return o&&o.includes("f-page-main")&&(h=!0),Object.assign(a,{id:`${m.componentId}-component`,viewModel:`${m.componentId}-component-viewmodel`,componentType:m.componentType,appearance:{class:h?"f-utils-fill-flex-column f-utils-overflow-auto":"f-grid-is-sub f-utils-overflow-auto"},contents:c}),a}function C(m){const a=g(m),c=O(m),h=u(m),o=r.getFormSchema();return o.module.viewmodels.push(h),o.module.components.push(c),i.assembleDesignViewModel(),p(a,m)}return{createComponent:C}}function Fe(e,n,r,i){var g,p,D,O,C,m;const u=r.parentComponentInstance;if(u&&i){const a=Math.random().toString(36).slice(2,6),c={componentId:`calendar-${a}`,componentName:((g=r.bindingSourceContext)==null?void 0:g.entityTitle)||((D=(p=r.bindingSourceContext)==null?void 0:p.bindingEntity)==null?void 0:D.name)||`日历-${a}`,componentType:"calendar",parentContainerId:u.schema.id,parentComponentInstance:u,bindTo:((O=r.bindingSourceContext)==null?void 0:O.bindTo)||"",dataSource:(m=(C=r.bindingSourceContext)==null?void 0:C.bindingEntity)==null?void 0:m.label},{createComponent:h}=_e(e,i);return h(c)}else return n}const be={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/calendar.schema.json",title:"calendar",description:"A Farris Input Component",type:"object",properties:{id:{description:"The unique identifier for calendar",type:"string"},type:{description:"The type string of calendar",type:"string",default:"calendar"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},dataSource:{description:"",type:"string",default:""},visible:{description:"",type:"boolean",default:!0},fit:{description:"填充父容器",type:"boolean",default:!0},width:{description:"宽度",type:"Number",default:600},height:{description:"高度",type:"Number",default:500},firstDayOfTheWeek:{description:"每周起始日",type:"String",default:"Sun"},highLightWeekend:{description:"是否高亮周末",type:"Boolean",default:!0},eventDateField:{description:"事件日期字段",type:"String",default:""},activeDate:{description:"默认日期",type:"String",default:""},eventItemFormatter:{description:"自定义事件内容格式化",type:"String",default:""},customEventStyles:{description:"自定义事件样式",type:"String",default:""},textField:{description:"事件文本字段",type:"String",default:"title"},idField:{description:"事件id字段",type:"String",default:"id"},enableMoreView:{description:"是否启用多视图",type:"Boolean",default:!1},defaultView:{description:"默认视图",type:"String",default:"month"},enableCrossDay:{description:"是否允许跨天",type:"Boolean",default:!1},startDateField:{description:"事件开始日期字段",type:"String",default:""},endDateField:{description:"事件结束日期字段",type:"String",default:""}},required:["id","type"],events:{onEventClick:"日程点击事件",onDateChange:"日期切换事件",onMoreClick:"更多点击事件",onViewChange:"视图切换事件"}},le={events:{type:Array,default:[]},firstDayOfTheWeek:{type:String,default:"Sun"},enableMoreView:{type:Boolean,default:!1},defaultView:{type:String,default:"month"},fit:{type:Boolean,default:!0},height:{type:Number,default:600},width:{type:Number,default:800},highLightWeekend:{type:Boolean,default:!1},eventItemFormatter:{type:Function},customEventStyles:{type:Function},eventDateField:{type:String,default:"startDate"},customClass:{type:String,default:""},startDateField:{type:String,default:"startDate"},endDateField:{type:String,default:"endDate"},enableCrossDay:{type:Boolean,default:!1},idField:{type:String,default:"id"},activeDate:{type:Date,default:new Date},textField:{type:String,default:"title"},customStyle:{type:String,default:""},enableWeekdayBorder:{type:Boolean,default:!1},visible:{type:Boolean,default:!0}},Ue=K.createPropsResolver(le,be,Se,Fe),we=K.getPropsResolverGenerator(be,be,Se,Fe),U=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var ee=(e=>(e[e.previous=1]="previous",e[e.current=2]="current",e[e.next=3]="next",e))(ee||{});function ie(){function e(){return{year:0,month:0,day:0}}function n(a){return new Date(a.year||0,a.month?a.month-1:0,a.day||0,a.hour?a.hour:0,a.minute?a.minute:0,a.second?a.second:0,0)}function r(a){const c=new Date;return a.year||(a.year=c.getFullYear()),a.month||(a.month=c.getMonth()+1),a.day||(a.day=1),new Date(a.year,a.month-1,a.day,a.hour?a.hour:0,a.minute?a.minute:0,a.second?a.second:0,0)}function i(a){return new Date(a.year||1,(a.month||1)-1,a.day,a.hour?a.hour:0,a.minute?a.minute:0,a.second?a.second:0,0).getDay()}function u(a){return U.indexOf(a)}function g(a){return n(a).getTime()}function p(a){return Math.round(g(a)/1e3)}function D(a,c,h){const o=g(c),l=g(h),y=g(a);return l-y>y-o?c:h}function O(){const a=new Date;return{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate(),hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()}}function C(a){return a?{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate(),hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()}:e()}function m(a){const c=i(a);return c===0||c===6}return{convertDateToDateObject:C,emptyDate:e,getDate:n,getDate2:r,getDayNumber:i,getEpocTime:p,getNearDate:D,getWeekdayIndex:u,getTimeInMilliseconds:g,getToday:O,isWeekEnd:m}}function Je(){function e(g,p){return new Date(p,g,0).getDate()}function n(g,p,D){return new Date(g,p-1,D,0,0,0,0)}function r(g,p){const D=n(p,g,1);return D.setMonth(D.getMonth()-1),e(D.getMonth()+1,D.getFullYear())}function i(g,p){const D={year:g===12?p+1:p},O=g===12?1:g+1;return D.month=O,D}function u(g,p){const D={year:g===1?p-1:p},O=g===1?12:g-1;return D.month=O,D}return{daysInMonth:e,daysInPreMonth:r,getNextMonth:i,getPreviousMonth:u}}function Xe(){const{getToday:e,getDayNumber:n,isWeekEnd:r}=ie(),{daysInMonth:i,daysInPreMonth:u,getNextMonth:g,getPreviousMonth:p}=Je();function D(d){const{day:F,month:s,year:v}=d;if(F===void 0||s===void 0||v===void 0)throw new Error("invalided date.");const I=F===1,N=I?u(s,v):F-1,R=I?s-1:s,M=R<1,x=M?12:R;return{year:M?v-1:v,month:x,day:N}}function O(d){const{day:F,month:s,year:v}=d;if(F===void 0||s===void 0||v===void 0)throw new Error("invalided date.");const I=i(s,v),N=F===I,R=N?1:F+1,M=N?s+1:s,x=M>12,k=x?1:M;return{year:x?v+1:v,month:k,day:R}}function C(d){const F=p(d.month||1,d.year||1),s=i(F.month||1,F.year||1);return{day:(d.day||1)<=s?d.day:s,month:F.month,year:F.year}}function m(d){const F=g(d.month||1,d.year||1),s=i(F.month||1,F.year||1);return{day:(d.day||1)<=s?d.day:s,month:F.month,year:F.year}}function a(d){return{day:d.day,month:d.month,year:(d.year||1)+1}}function c(d){return{day:d.day,month:d.month,year:(d.year||1)-1}}function h(d){const s=(d.day||1)-7,v=s<1,I=v?i(d.month||1,d.year||1)+s:s,N=v?p(d.month||1,d.year||1):d;return{day:I,month:N.month,year:N.year}}function o(d){const s=(d.day||1)+7,v=i(d.month||1,d.year||1),I=s>v,N=I?s-v:s,R=I?g(d.month||1,d.year||1):d;return{day:N,month:R.month,year:R.year}}function l(d,F,s,v,I){if(d<1||F<1||s<1)throw new Error("Invalid date input");const N={day:d,month:F,year:s},R=U.indexOf(v);if(R===-1)throw new Error("Invalid firstDayOfWeek value");const x=(n(N)-R+7)%7,k=e(),b=P=>P.day===k.day&&P.month===k.month&&P.year===k.year,f=[];let T={...N};for(let P=0;P<x;P++)T=D(T);for(let P=0;P<7;P++){let w;if(T.month===I.month&&T.year===I.year)w=ee.current;else{const S=p(N.month,N.year);T.month===S.month&&T.year===S.year?w=ee.previous:w=ee.next}const L=b(T),E=r(T);f.push({date:T,monthTag:w,isCurrent:L,weekEnd:E}),P<6&&(T=O(T))}return{days:f,weekNumber:0,year:s}}function y(d,F,s,v){const I=[],N={day:1,month:d,year:F},R=n(N),M=U.indexOf(s);if(M===-1)throw new Error("Invalid firstDayOfWeek value");const x=(R-M+7)%7;let k=N;for(let f=0;f<x;f++)k=D(k);let b=k;for(let f=0;f<6;f++){const T=l(b.day,b.month,b.year,s,v);I.push(T);for(let j=0;j<7;j++)b=O(b)}return I}return{getMonthlyCalendar:y,getWeeklyCalendar:l,getPreviousDay:D,getNextDay:O,getDayInPreviousWeek:h,getDayInNextWeek:o,getDayInPreviousMonth:C,getDayInNextMonth:m,getNextYear:a,getPreviousYear:c}}const ne=["year","month","week","day"];var se=(e=>(e[e.Equal=0]="Equal",e[e.NotEqual=1]="NotEqual",e[e.Greater=2]="Greater",e[e.GreaterOrEqual=3]="GreaterOrEqual",e[e.Less=4]="Less",e[e.LessOrEqual=5]="LessOrEqual",e[e.Like=6]="Like",e[e.LikeStartWith=7]="LikeStartWith",e[e.LikeEndWith=8]="LikeEndWith",e[e.NotLike=9]="NotLike",e[e.NotLikeStartWith=10]="NotLikeStartWith",e[e.NotLikeEndWith=11]="NotLikeEndWith",e[e.Is=12]="Is",e[e.IsNot=13]="IsNot",e[e.In=14]="In",e[e.NotIn=15]="NotIn",e))(se||{}),ce=(e=>(e[e.Empty=0]="Empty",e[e.And=1]="And",e[e.Or=2]="Or",e))(ce||{});function Ce(){const{getTimeInMilliseconds:e}=ie();function n(o){return o&&o.year!==0&&o.month!==0&&o.day!==0}function r(o){return o&&o.year!==0&&o.month!==0}function i(o){return o&&o.year!==0}function u(o,l){return e(o)<e(l)}function g(o){return e({year:o.year,month:o.month,day:o.day})}function p(o,l,y=!0){return y?e(o)<=e(l):g(o)<=g(l)}function D(o,l){return e(o)===e(l)}function O(o,l){const y=e(l);return e(o.from)===y||e(o.to)===y}function C(o,l){return!l||!n(l.to)||!n(l.from)?!1:p(l.from,o)&&p(o,l.to)}function m(o,l){return n(l)&&e(o)>=e(l)}function a(o,l){return n(l)&&e(o)<=e(l)}function c(o,l){return e({year:o.year,month:o.month,day:o.day})===e({year:l.year,month:l.month,day:l.day})}function h(o,l){return e({hour:o.hour,minute:o.minute,second:o.second})===e({hour:l.hour,minute:l.minute,second:l.second})}return{isDateEarlier:u,equal:D,inPeriod:C,isPoint:O,equalOrEarlier:p,isInitializedDate:n,isInitializedMonth:r,isInitializedYear:i,isMonthDisabledByDisableSince:m,isMonthDisabledByDisableUntil:a,sameTime:h,sameDay:c}}const xe={activeView:{type:Number,default:3},title:{type:String,default:""},dailyViewTitle:{type:String,default:"Day"},weeklyViewTitle:{type:String,default:"Week"},monthlyViewTitle:{type:String,default:"Month"},todayText:{type:String,default:"Today"},previousText:{type:String,default:"Previous"},nextText:{type:String,default:"Next"},enableMoreView:{type:Boolean,default:!1},isCurrent:{type:Boolean,default:!1},yearViewTitle:{type:String,default:"Year"}},de=t.defineComponent({name:"FCalendarHeader",props:xe,emits:["viewChange","previous","next","resetToToday"],setup(e,n){const r=t.ref(e.title),i=t.ref(e.dailyViewTitle),u=t.ref(e.weeklyViewTitle),g=t.ref(e.monthlyViewTitle),p=t.ref(e.yearViewTitle),D=2,O=62,C=t.ref(e.activeView);t.watch(()=>e.activeView,(y,d)=>{C.value=y}),t.watch(()=>e.title,()=>{r.value=e.title});const m=t.computed(()=>({top:`${D}px`,left:`${C.value*(D+1)+(C.value-1)*(O+1)}px`})),a=t.computed(()=>C.value===4?i.value:C.value===3?u.value:C.value===1?p.value:g.value);function c(y){const d=ne.indexOf(y)+1;C.value=d,n.emit("viewChange",d)}function h(){n.emit("previous",C.value)}function o(){n.emit("next",C.value)}function l(){n.emit("resetToToday")}return()=>t.createVNode("div",{class:"f-calendar-header align-items-center"},[t.createVNode("div",{class:"f-calendar-title"},[r.value]),t.createVNode("div",{class:"f-calendar-navigator pl-3",style:"height:26px"},[t.createVNode("button",{class:"btn btn-secondary mr-2",onClick:()=>l(),disabled:e.isCurrent},[e.todayText||"Today"]),t.createVNode("div",{class:"f-calendar-navigator-button-group"},[t.createVNode("div",{class:"f-calendar-navigator-previous btn btn-default",onClick:()=>h(),title:e.previousText},[t.createVNode("i",{class:"f-icon f-icon-arrow-chevron-left"},null)]),t.createVNode("div",{class:"f-calendar-navigator-next btn btn-default",onClick:()=>o(),title:e.nextText},[t.createVNode("i",{class:"f-icon f-icon-arrow-chevron-right"},null)])])]),e.enableMoreView&&t.createVNode("div",{class:"f-calendar-view-switch"},[t.createVNode("div",{class:"f-calendar-view-switch-panel",style:"width: 134px;"},[t.createVNode("span",{class:"f-calendar-view-switch-monthly",onClick:y=>c("year")},[p.value]),t.createVNode("span",{class:"f-calendar-view-switch-monthly",onClick:y=>c("month")},[g.value])]),t.createVNode("div",{class:"f-calendar-view-switch-active-view",style:m.value},[a.value])])])}}),Ee={dates:{type:Array,default:[]},daysInWeek:{type:Array,default:U},enableKeyboadNavigate:{type:Boolean,default:!0},enableMarkCurrent:{type:Boolean,default:!0},events:{type:Array,default:[]},activeDay:{type:Object,default:null},width:{type:Number,default:0},height:{type:Number,default:0},disabled:{type:Boolean,default:!1},monthLabels:{type:Object,default:{}},eventDateField:{type:String,default:"startDate"},enableCrossDay:{type:Boolean,default:!1},startDateField:{type:String,default:"startDate"},endDateField:{type:String,default:"endDate"},idField:{type:String,default:"id"},customEventStyles:{type:Function,default:null},eventItemFormatter:{type:Function,default:null},popoverRef:{type:Object,default:null},showBorder:{type:Boolean,default:!1},moreText:{type:String,default:"更多"}},ue=t.defineComponent({name:"FCalendarMonthView",props:Ee,emits:["click","keyDown","moreClick"],setup(e,n){const r=t.ref(e.daysInWeek);t.ref(e.enableKeyboadNavigate);const i=t.ref(e.enableMarkCurrent),u=t.ref(e.activeDay),g=t.ref(e.events),{assignEventsToWeeks:p,assignEventsToDays:D,renderEventItem:O,useCompareCompsition:C}=t.inject("eventsComposition"),{equal:m}=C,a=t.ref();function c(b,f){return e.enableCrossDay?p(b,f):D(b,f)}const h=t.ref(c(e.dates,g.value));t.watch(()=>e.enableCrossDay,()=>{h.value=c(e.dates,e.events)}),t.watch(()=>e.dates,()=>{h.value=c(e.dates,g.value)}),t.watch(()=>e.activeDay,()=>{u.value=e.activeDay}),t.watch(()=>e.events,()=>{g.value=e.events,h.value=c(e.dates,e.events)}),t.watch(()=>e.daysInWeek,(b,f)=>{r.value=b});function o(b){return!!u.value&&m({year:u.value.year,month:u.value.month,day:u.value.day},b)}const l=(b,f,T)=>{const P={"f-datepicker-no-currmonth":b.monthTag===ee.previous||b.monthTag===ee.next,"f-calendar-weekday":b.weekEnd,"f-calendar-workday":!b.weekEnd,"f-calendar-today":b.isCurrent},w=`d_${f}_${T}`;return P[w]=!0,P},y=b=>{const f=b.monthTag===ee.current&&o(b.date),T=b.isCurrent&&i.value;return{"f-calendar-month-view-date":!0,"f-calendar-month-view-selected":f,"f-calendar-month-view-current":T}};function d(b,f){e.disabled||f.showMore||(b.stopPropagation(),n.emit("click",{date:f.date,view:"month"}))}function F(b,f){e.disabled||n.emit("moreClick",{date:f.date,view:"month"})}const s=t.computed(()=>({width:`${e.width}px`,height:`${e.height}px`})),v=t.ref(0),I=()=>{const b=a.value;if(!b)return 0;const f=b.querySelector(".f-calendar--daygrid-row");if(!f)return 0;const T=f.offsetHeight;return Math.max(0,Math.floor(T/19)-1)};function N(){return t.createVNode("div",{class:"w-100"},[t.createVNode("table",{class:{"w-100":!0,"show-border":e.showBorder}},[r.value&&r.value.map(b=>t.createVNode("th",null,[b]))])])}function R(b,f){return t.createVNode("div",{class:"f-calendar--daygrid-row-header"},[t.createVNode("table",null,[t.createVNode("tbody",null,[t.createVNode("tr",null,[b.days&&b.days.map((T,j)=>t.createVNode("td",{class:l(T,f,j),onClick:P=>d(P,T),style:"position: relative;"},null))])])])])}function M(b,f){return b.days&&b.days.map((T,j)=>t.createVNode("td",{class:l(T,f,j)},[t.createVNode("div",{class:"f-calendar-month-view-title"},[t.createVNode("div",{class:y(T)},[T.date.day]),t.createVNode("div",{class:"f-calendar-month-view-date-month"},[T.date.day===1?e.monthLabels[T.date.month||1]:""])])]))}function x(b){const f=Math.max(0,v.value||I()),T=!!(b.events&&b.events.length>f),j=Q.cloneDeep([...b.events||[]]),P=T?j.slice(0,f):j;return T&&P&&P.length>0&&P[P.length-1].forEach(w=>{w.data&&(w.showMore=!0,w.moreCount=b.events.length-f+1)}),P.map((w,L)=>t.createVNode("tr",null,[w.map((E,S)=>E.showMore?t.createVNode("td",{colspan:1,rowspan:1,onClick:q=>d(q,E)},[t.createVNode("a",{class:"f-calendar-event p-0 m-0 pl-1 more-events ",onClick:q=>F(q,b.days[S])},[t.createVNode("div",{class:"event-title"},[e.moreText.replace("#count#",E.moreCount)])])]):t.createVNode("td",{colspan:E.colspan||1,rowspan:E.rowspan||1,onClick:q=>d(q,b.days[S])},[E.data&&O(E)]))]))}function k(){return t.createVNode("div",{class:"w-100 h-100"},[t.createVNode("div",{class:"f-calendar--daygrid"},[h.value.map((b,f)=>t.createVNode("div",{class:"f-calendar--daygrid-row"},[R(b,f),t.createVNode("div",{class:"f-calendar--daygrid-content"},[t.createVNode("table",null,[t.createVNode("thead",null,[t.createVNode("tr",null,[M(b,f)])]),t.createVNode("tbody",null,[x(b)])])])]))])])}return t.watch(()=>e.height,(b,f)=>{b!==f&&t.nextTick(()=>{v.value=I(),h.value=[...h.value]})}),t.onMounted(()=>{v.value=I()}),()=>t.createVNode("div",{class:"f-calendar-month-view",ref:a},[t.createVNode("table",{class:"f-calendar-table",cellpadding:"0",style:s.value},[t.createVNode("thead",null,[t.createVNode("tr",null,[t.createVNode("td",{class:"f-calendar-header"},[N()])])]),t.createVNode("tbody",null,[t.createVNode("tr",{style:"height: 100%"},[t.createVNode("td",{class:"f-calendar-content"},[k()])])])])])}}),Ie={daysInWeek:{type:Array,default:U},enableMarkCurrent:{type:Boolean,default:!0},events:{type:Array,default:[]},week:{type:Object,default:{days:[],weekNumber:0,year:0}},dateField:{type:String,default:"date"},startDateField:{type:String,default:"startDate"},endDateField:{type:String,default:"endDate"}},fe=t.defineComponent({name:"FCalendarWeekView",props:Ie,emits:[],setup(e){const n=t.ref(),r=t.ref(),i=t.ref(e.daysInWeek),u=t.ref(e.week),g=t.ref(e.enableMarkCurrent),p=t.ref(e.events),D=t.ref([]),{equal:O}=Ce(),{convertDateToDateObject:C}=ie();function m(s){return u.value.days.map(I=>{const N={year:I.date.year,month:I.date.month,day:I.date.day,hour:s.hour,minute:s.minute,second:s.second},R=p.value.filter(M=>O(C(M[e.startDateField]),N));return{day:N,events:R}})}function a(){const s=[];for(let v=0;v<24;v++){const I={hour:v,minute:0,second:0},N={hour:v,minute:30,second:0},R=m(I),M=m(N);s.push({time:I,events:R,title:v>0?`${v}:00`:"",part:"upper"}),s.push({time:N,events:M,title:`${v}:30`,part:"lower"})}D.value=s}a(),t.watch(()=>e.week,()=>{u.value=e.week,a()}),t.watch(()=>e.events,()=>{p.value=e.events,a()});const c=s=>({"f-calendar-week-view-date":!0,"f-calendar-week-view-current":s.isCurrent&&g.value});function h(){return t.createVNode("div",{class:"f-calendar-week-view-header"},[t.createVNode("div",{class:"f-calendar-week-view-header-corner"},null),t.createVNode("div",{class:"f-calendar-week-view-header-primary"},[t.createVNode("div",{class:"f-calendar-week-view-header-columns"},[i.value.map((s,v)=>t.createVNode("div",{class:"f-calendar-week-view-header-cell"},[t.createVNode("div",{class:c(u.value.days[v])},[u.value.days[v].date.day]),t.createVNode("span",null,[s])]))])])])}function o(){return t.createVNode("div",{class:"f-calendar-week-view-content-side"},[t.createVNode("div",{class:"f-calendar-side"},[D.value.map(s=>t.createVNode("div",{class:"f-calendar-side-row"},[t.createVNode("div",{class:"f-calendar-side-row-number"},[s.part==="upper"?s.title:""])]))])])}function l(s){return{"f-calendar-week-view-item":!0,"f-calendar-week-view-item-upper":s.part==="upper","f-calendar-week-view-item-lower":s.part==="lower"}}function y(s){const x=(s[e.startDateField].hour||0)+(s[e.startDateField].minute||0)/60;return{height:`${44*((s.ends.hour||0)+(s.ends.minute||0)/60-x)-2-2-1-1}px`}}function d(){return D.value.map(s=>t.createVNode("div",{class:l(s)},[s.events.map(v=>t.createVNode("div",{class:"f-calendar-week-view-item-cell"},[v.events.length>0&&v.events.map(I=>t.createVNode("div",{class:"f-calendar-event",style:y(I)},[I.title]))]))]))}function F(){return t.createVNode("div",{ref:r,class:"f-calendar-content-primary"},[t.createVNode("div",{class:"f-calendar-content-data"},[d()])])}return t.onMounted(()=>{n.value&&n.value.scrollTo(0,250)}),()=>t.createVNode("div",{class:"f-calendar-week-view"},[h(),t.createVNode("div",{class:"f-calendar-week-view-content",ref:n},[o(),F()])])}}),Oe={day:{type:Object,default:{}},dayInWeek:{type:String,default:""},enableMarkCurrent:{type:Boolean,default:!0},events:{type:Array,default:[]},dateField:{type:String,default:"date"}},me=t.defineComponent({name:"FCalendarDayView",props:Oe,emits:[],setup(e){const n=t.ref(),r=t.ref(),i=t.ref(e.dayInWeek),u=t.ref(e.day),g=t.ref(e.enableMarkCurrent),p=t.ref(e.events),D=t.ref([]),{convertDateToDateObject:O}=ie(),{equal:C}=Ce();function m(s){const v={year:u.value.date.year,month:u.value.date.month,day:u.value.date.day,hour:s.hour,minute:s.minute,second:s.second},I=p.value.filter(N=>C(O(N[e.dateField]),v));return[{day:v,events:I}]}function a(){const s=[];for(let v=0;v<24;v++){const I={hour:v,minute:0,second:0},N={hour:v,minute:30,second:0},R=m(I),M=m(N);s.push({time:I,events:R,title:v>0?`${v}:00`:"",part:"upper"}),s.push({time:N,events:M,title:`${v}:30`,part:"lower"})}D.value=s}a(),t.watch(()=>e.day,()=>{u.value=e.day,a()}),t.watch(()=>e.events,()=>{p.value=e.events,a()});const c=s=>({"f-calendar-day-view-date":!0,"f-calendar-day-view-current":s.isCurrent&&g.value});function h(){return t.createVNode("div",{class:"f-calendar-day-view-header"},[t.createVNode("div",{class:"f-calendar-day-view-header-corner"},null),t.createVNode("div",{class:"f-calendar-day-view-header-primary"},[t.createVNode("div",{class:"f-calendar-day-view-header-columns"},[t.createVNode("div",{class:"f-calendar-day-view-header-cell"},[t.createVNode("div",{class:c(u.value)},[u.value.date.day]),t.createVNode("span",null,[i.value])])])])])}function o(){return t.createVNode("div",{class:"f-calendar-day-view-content-side"},[t.createVNode("div",{class:"f-calendar-side"},[D.value.map(s=>t.createVNode("div",{class:"f-calendar-side-row"},[t.createVNode("div",{class:"f-calendar-side-row-number"},[s.part==="upper"?s.title:""])]))])])}function l(s){return{"f-calendar-day-view-item":!0,"f-calendar-day-view-item-upper":s.part==="upper","f-calendar-day-view-item-lower":s.part==="lower"}}function y(s){var T,j,P,w;const x=(((T=s.starts)==null?void 0:T.hour)||0)+(((j=s.starts)==null?void 0:j.minute)||0)/60;return{height:`${44*((((P=s.ends)==null?void 0:P.hour)||0)+(((w=s.ends)==null?void 0:w.minute)||0)/60-x)-2-2-1-1}px`}}function d(){return D.value.map(s=>t.createVNode("div",{class:l(s)},[s.events.map(v=>t.createVNode("div",{class:"f-calendar-day-view-item-cell"},[v.events.length>0&&v.events.map(I=>t.createVNode("div",{class:"f-calendar-event",style:y(I)},[I.title]))]))]))}function F(){return t.createVNode("div",{ref:r,class:"f-calendar-content-primary"},[t.createVNode("div",{class:"f-calendar-content-data"},[d()])])}return t.onMounted(()=>{n.value&&n.value.scrollTo(0,250)}),()=>t.createVNode("div",{class:"f-calendar-day-view"},[h(),t.createVNode("div",{class:"f-calendar-day-view-content",ref:n},[o(),F()])])}}),Qe=t.defineComponent({name:"FCalendarYearView",props:{monthLabels:{type:Object,default:null},height:{type:Number,default:300},events:{type:Array,default:[]},dateField:{type:String,default:"date"},activeYear:{type:Number,default:2025},moreText:{type:String,default:"更多"}},emits:["moreClick"],setup(e,n){const r=t.ref(),i=t.ref(e.monthLabels),{assignEventsToMonths:u,renderEventItemForMonths:g}=t.inject("eventsComposition"),p=t.ref(0),D=()=>{const a=r.value;if(!a)return 0;const h=a.querySelector(".yearview-monthitem").offsetHeight;return Math.max(0,Math.floor((h-40)/24))},O=a=>{const c=!!(a&&a.length>p.value);if(c){const h=Q.cloneDeep(a),o=c?h==null?void 0:h.slice(0,p.value):h;if(o&&o.length>0){const l=o[o.length-1];l.data&&(l.showMore=!0,l.moreCount=a.length-p.value+1)}return o}return a},C=t.computed(()=>u(e.activeYear,e.events));function m(a,c){const h={year:e.activeYear,month:parseInt(c,10)};n.emit("moreClick",a,{date:h,view:"year"})}return t.watch(()=>e.height,(a,c)=>{a!==c&&t.nextTick(()=>{p.value=D(),i.value={...e.monthLabels}})}),t.onMounted(()=>{p.value=D()}),()=>t.createVNode("div",{class:"h-100 w-100 f-calendar-year-view",ref:r},[t.createVNode("ul",{style:"height: 100%;overflow: auto; display: flex;flex-wrap: wrap;"},[Object.keys(e.monthLabels).map((a,c)=>{var h;return t.createVNode("li",{key:c,class:"col-md-4 col-lg-3 col-sm-12 yearview-monthitem"},[t.createVNode("div",{class:"f-calendar-year-view-content w-100 h-100 d-flex flex-column",style:"overflow: hidden;"},[t.createVNode("div",{class:"f-calendar-month-view-title px-2"},[e.monthLabels[a]]),t.createVNode("div",{class:"f-calendar-month-events p-2"},[t.createVNode("ul",{class:"events"},[(h=O(C.value[a]))==null?void 0:h.map((o,l)=>o.showMore?t.createVNode("li",{class:"event-item more-events ",key:l},[t.createVNode("a",{class:"f-calendar-event p-0 mt-0 pl-1 ",onClick:y=>m(y,a)},[e.moreText.replace("#count#",o.moreCount)])]):g(o))])])])])})])])}}),Ze=t.defineComponent({name:"MoreEventList",props:{events:Array,popoverOffsetX:Number},setup(e,n){const r=t.ref(),i=t.computed(()=>r),u=t.computed(()=>e.events),{renderEventItemForMore:g}=t.inject("eventsComposition"),p=t.ref(0);return n.expose({popoverRef:i}),()=>t.createVNode(ze,{id:"calendar-more-events",customStyles:{filter:"drop-shadow(#c5c5c5 0px 0px 6px)"},offsetX:p,ref:r,placement:"auto",keepWidthWithReference:!1,fitContent:!0},{default:()=>{var D;return[t.createVNode("div",{style:"height: 400px; width: 300px;overflow: hidden;"},[t.createVNode("div",{class:"f-calendar-more-events-list h-100",style:"overflow:auto;"},[t.createVNode("ul",null,[(D=u.value)==null?void 0:D.map(O=>g(O))])])])]}})}});function Ke(){const{getLocaleValue:e,getLocale:n}=Ye.LocaleService,r={1:e("calendar.monthLabels.1"),2:e("calendar.monthLabels.2"),3:e("calendar.monthLabels.3"),4:e("calendar.monthLabels.4"),5:e("calendar.monthLabels.5"),6:e("calendar.monthLabels.6"),7:e("calendar.monthLabels.7"),8:e("calendar.monthLabels.8"),9:e("calendar.monthLabels.9"),10:e("calendar.monthLabels.10"),11:e("calendar.monthLabels.11"),12:e("calendar.monthLabels.12")},i={Sun:e("calendar.dayLabels.Sun"),Mon:e("calendar.dayLabels.Mon"),Tue:e("calendar.dayLabels.Tue"),Wed:e("calendar.dayLabels.Wed"),Thu:e("calendar.dayLabels.Thu"),Fri:e("calendar.dayLabels.Fri"),Sat:e("calendar.dayLabels.Sat")},u=e("calendar.today"),g=e("calendar.thisYear"),p=e("calendar.yearView"),D=e("calendar.monthView"),O=e("calendar.weekView"),C=e("calendar.dayView"),m=e("calendar.titleFormat"),a=e("calendar.yearViewTitleFormat"),c=e("calendar.prevMonth"),h=e("calendar.nextMonth"),o=e("calendar.prevWeek"),l=e("calendar.nextWeek"),y=e("calendar.prevDay"),d=e("calendar.nextDay"),F=e("calendar.prevYear"),s=e("calendar.nextYear"),v=e("calendar.more","")||"还有 #count# 项...";return{monthLabels:r,weekDayLabels:i,today:u,monthViewTitle:D,weekViewTitle:O,dayViewTitle:C,titleFormat:m,prevMonth:c,nextMonth:h,prevWeek:o,nextWeek:l,prevDay:y,nextDay:d,yearViewTitle:p,yearViewTitleFormat:a,thisYear:g,prevYear:F,nextYear:s,moreText:v,locale:n()}}function et(e){const n=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&n==="[object Date]"?new e.constructor(+e):typeof e=="number"||n==="[object Number]"||typeof e=="string"||n==="[object String]"?new Date(e):new Date(NaN)}function tt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function nt(e){if(!tt(e)&&typeof e!="number")return!1;const n=et(e);return!isNaN(Number(n))}function rt(e,n,r,i,u,g,p){const{equalOrEarlier:D,sameDay:O}=i,{convertDateToDateObject:C}=n,{parseToDate:m,formatTo:a}=r;function c(M,x){M.forEach(f=>{f.days.forEach(T=>{T.events=[]})});const k=new Map,b=f=>{if(!f)return null;if(k.has(f))return k.get(f);const T=m(f,"yyyy-MM-dd");if(!T)return null;const j=C(T);return k.set(f,j),j};return x.forEach(f=>{const{eventDateField:T,startDateField:j}=e,P=Y.resolveField(f,T)||Y.resolveField(f,j),w=b(P);w&&M.forEach(L=>{L.days.forEach(E=>{var S;O(E.date,w)&&((S=E.events)==null||S.push({id:f[e.idField],data:{...f},eventDate:w,isSingleDay:!0}))})})}),M.forEach(f=>{const T=[],j=f.days.map((w,L)=>w.events&&w.events.length>0?w.events.map((E,S)=>({...E,colspan:1,rowspan:1,startIndex:L,endIndex:L})):[]),P=Math.max(...j.map(w=>w.length),0);for(let w=0;w<P;w++){const L=[];for(let E=0;E<7;E++)j[E][w]?L.push(j[E][w]):L.push({colspan:1,rowspan:1,data:null});T.push(L)}f.events=T}),M}function h(M,x){M.forEach(f=>{f.events=[]});const k=new Map,b=f=>{if(!f)return null;if(k.has(f))return k.get(f);const T=m(f,"yyyy-MM-dd");if(!T)return null;const j=C(T);return k.set(f,j),j};return x.forEach(f=>{const{startDateField:T,endDateField:j}=e,P=b(Y.resolveField(f,T)),w=b(Y.resolveField(f,j));!P||!w||M.forEach(L=>{var W,A,H,_;const E=L.days[0].date,S=L.days[L.days.length-1].date;if(!(D(w,E,!1)||D(S,P,!1)))if(O(P,w))(W=L.events)==null||W.push({id:f[e.idField],data:{...f},eventDate:P,isSingleDay:!0});else{const J=D(E,P,!1)?P:E,z=D(w,S,!1)?w:S;let X=-1,re=-1;L.days.forEach((pe,he)=>{O(pe.date,J)&&(X=he),O(pe.date,z)&&(re=he)}),X!==-1&&re!==-1&&((A=L.events)==null||A.push({id:f[e.idField],data:{...f},eventDate:P,startDate:J,endDate:z,startIndex:X,endIndex:re,colspan:re-X+1,isCrossDay:!0}))}else O(P,S)&&!O(w,S)&&((H=L.events)==null||H.push({id:`${f[e.idField]}_start`,data:{...f},eventDate:P,isSingleDay:!0,isOverlapping:!0,originalId:f[e.idField]})),O(w,E)&&!O(P,E)&&((_=L.events)==null||_.push({id:`${f[e.idField]}_end`,data:{...f},eventDate:w,isSingleDay:!0,isOverlapping:!0,originalId:f[e.idField]}))})}),M.forEach(f=>{f.days.forEach((T,j)=>{var E;const P=(E=f.events)==null?void 0:E.filter(S=>S.isCrossDay?j>=S.startIndex&&j<=S.endIndex:S.isSingleDay?O({year:S.eventDate.year,month:S.eventDate.month,day:S.eventDate.day},{year:T.date.year,month:T.date.month,day:T.date.day}):!1),w=P==null?void 0:P.find(S=>S.isCrossDay),L=(P==null?void 0:P.filter(S=>S.isSingleDay))||[];w&&L.length>0&&L.forEach(S=>{var W,A;((W=f.events)==null?void 0:W.some(H=>(H.originalId===S.id||H.id===S.id)&&O({year:H.eventDate.year,month:H.eventDate.month,day:H.eventDate.day},{year:T.date.year,month:T.date.month,day:T.date.day})))||(A=f.events)==null||A.push({id:S.id,data:{...S.data},eventDate:T.date,isSingleDay:!0,isOverlapping:!0,originalId:S.id})})})}),M.forEach(f=>{const T=[];for(let w=0;w<10;w++)T[w]=Array(7).fill(null);[...f.events].sort((w,L)=>{if(w.isCrossDay&&!L.isCrossDay)return-1;if(!w.isCrossDay&&L.isCrossDay)return 1;if(w.isCrossDay&&L.isCrossDay)return w.startIndex-L.startIndex;const E=w.eventDate,S=L.eventDate;return E.year!==S.year?E.year-S.year:E.month!==S.month?E.month-S.month:E.day-S.day}).forEach(w=>{let L=0,E=!1,S=0,q=1;for(w.isCrossDay?(S=w.startIndex,q=w.colspan):(S=f.days.findIndex(W=>O({year:w.eventDate.year,month:w.eventDate.month,day:w.eventDate.day},{year:W.date.year,month:W.date.month,day:W.date.day})),q=1);!E&&L<T.length;){let W=!0;for(let A=S;A<S+q;A++)if(T[L][A]!==null){W=!1;break}if(W){for(let A=S;A<S+q;A++)T[L][A]=A===S?w:{...w,isPlaceholder:!0,colspan:A===S?q:0};E=!0}else L++}});const P=[];T.forEach(w=>{if(w.some(L=>L!==null)){const L=[];for(let E=0;E<w.length;E++){const S=w[E];S===null?L.push({colspan:1,rowspan:1,data:null}):S.isPlaceholder||L.push(S),S&&(S.colspan=S.colspan||1,S.colspan>1&&(E+=S.colspan-1))}P.push(L)}}),f.events=P}),M}function o(M,x){const k={};return x.forEach(b=>{const{eventDateField:f,startDateField:T}=e,j=Y.resolveField(b,f)||Y.resolveField(b,T);if(!j)return;const P=C(m(j,"yyyy-MM-dd"));if(P.year===M){const w=""+P.month;k[w]=k[w]||[],k[w].push({data:{...b},eventDate:P})}}),k}function l(){return ne[g.value-1]}function y(M,x){M.stopPropagation(),!e.disabled&&u.emit("eventClick",{data:x.data,view:l()})}const d=(M,x,k)=>{const b=Y.resolveField(M,x);return typeof b=="string"?b:b!==null&&typeof b=="object"&&!Array.isArray(b)&&k?b[k]||"":b||""};function F(M){return Q.isFunction(e.eventItemFormatter)?e.eventItemFormatter(M.data,{parseToDate:m,formatTo:a,getValue:d,view:l(),locale:p}):Y.resolveField(M.data,e.textField||"title")}function s(M){return Q.isFunction(e.eventItemFormatter)?"":d(M.data,e.textField||"title",p)}const v=M=>{if(!M||!M.data)return{};if(!Q.isFunction(e.customEventStyles))return{styles:{"background-color":"#f3f3f3"}};const x=e.customEventStyles(M.data,{parseToDate:m,formatTo:a,getValue:d,view:l(),locale:p});return x&&Object.keys(x).length>0?x:{}};function I(M){const{cls:x,styles:k}=v(M);return t.createVNode("a",{onClick:b=>y(b,M),style:k||{},class:"f-calendar-event p-0 mx-1 my-0 "+(x||"")},[t.createVNode("div",{class:"event-title",innerHTML:F(M),title:s(M)},null)])}function N(M){return t.createVNode("li",null,[t.createTextVNode(" "),F(M)])}function R(M){const{cls:x,styles:k}=v(M);return t.createVNode("li",{style:{...k||{},"padding-bottom":"2px"},class:x,onClick:b=>y(b,M)},[t.createVNode("div",{class:"event-title pb-0 text-truncate",innerHTML:F(M),title:s(M)},null)])}return{assignEventsToDays:c,assignEventsToWeeks:h,renderEventItem:I,useCompareCompsition:i,useDateComposition:n,useDateFormatComposition:r,renderEventItemForMore:N,assignEventsToMonths:o,renderEventItemForMonths:R,getEventItemStyles:v}}const Z=t.defineComponent({name:"FCalendar",props:le,emits:["dayClick","dateChange","eventClick","moreClick","viewChange"],setup(e,n){const{titleFormat:r,today:i,prevMonth:u,nextMonth:g,dayViewTitle:p,monthViewTitle:D,weekViewTitle:O,weekDayLabels:C,monthLabels:m,prevWeek:a,nextWeek:c,prevDay:h,nextDay:o,yearViewTitle:l,yearViewTitleFormat:y,thisYear:d,prevYear:F,nextYear:s,moreText:v,locale:I}=Ke(),N=Ce(),R=Y.useDateFormat(),M=ie(),{sameDay:x}=N,{getToday:k,convertDateToDateObject:b}=M,{parseToDate:f}=R,T=t.ref(e.firstDayOfTheWeek),j=t.ref(e.events),P=t.ref(e.enableCrossDay),w=k(),L=t.ref(e.activeDate),E=t.ref(0),S=t.ref(e.visible),q=rt(e,M,R,N,n,E,I);t.provide("eventsComposition",q);const W=t.ref({year:w.year||1,month:w.month||1,day:w.day||1});function A(){typeof L.value=="string"&&(L.value=f(L.value,"yyyy-MM-dd")),nt(L.value)&&(W.value=b(L.value))}A(),t.watch(()=>e.activeDate,()=>{L.value=e.activeDate,A()}),t.watch(()=>e.firstDayOfTheWeek,(V,$)=>{V!==$&&(T.value=V)}),t.watch(()=>e.enableCrossDay,(V,$)=>{V!==$&&(P.value=V)});const H=t.ref(e.width),_=t.ref(e.height),J=t.ref();function z(){const V=ne.some($=>$===e.defaultView)?e.defaultView:"month";E.value=ne.indexOf(V)+1}z(),t.watch(()=>e.defaultView,(V,$)=>{z()});const{getMonthlyCalendar:X,getWeeklyCalendar:re,getPreviousDay:pe,getNextDay:he,getDayInPreviousWeek:qt,getDayInNextWeek:zt,getDayInPreviousMonth:Yt,getDayInNextMonth:Ht,getNextYear:Gt,getPreviousYear:_t}=Xe(),Ut=t.computed(()=>E.value===1?y.replace("yyyy",""+W.value.year):r.replace("yyyy",""+W.value.year).replace("MM",""+W.value.month)),Jt=t.computed(()=>E.value===1?d:i),Xt=t.computed(()=>{const V=[],$=U.indexOf(T.value);if($!==-1){let G=$;for(let te=0;te<U.length;te++)V.push(C[U[G]]),G=U[G]==="Sat"?0:G+1}return V}),De=t.computed(()=>X(W.value.month||1,W.value.year||1,T.value,W.value)),ve=t.computed(()=>re(W.value.day||1,W.value.month||1,W.value.year||1,T.value,W.value)),Qt=t.computed(()=>ve.value.days.find(V=>x(V.date,W.value))||ve.value.days[1]),Zt=t.computed(()=>{const V=ve.value.days.findIndex(G=>x(G.date,W.value)),$=V>-1?V:1;return U[$]}),Kt=t.computed(()=>(E.value===1||W.value.month===w.month)&&W.value.year===w.year),Be=(V,$)=>[{filterField:e.eventDateField,value:`${V.year}-${V.month}-${V.day} 00:00:00`,lbracket:"",rbracket:"",relation:ce.And,compare:se.GreaterOrEqual},{filterField:e.eventDateField,value:`${$.year}-${$.month}-${$.day} 23:59:59`,lbracket:"",rbracket:"",relation:ce.Empty,compare:se.LessOrEqual}],Te=()=>{const V=De.value[0].days[0].date,$=De.value[5].days[6].date;n.emit("dateChange",{conditions:Be(V,$),start:V,end:$,view:"month"})},Ve=()=>{const V={year:W.value.year,month:1,day:1},$={year:W.value.year,month:12,day:31};n.emit("dateChange",{conditions:Be(V,$),start:V,end:$,view:"year"})};function en(V){V===1&&(W.value=_t(W.value),Ve()),V===2&&(W.value=Yt(W.value),Te()),V===3&&(W.value=qt(W.value)),V===4&&(W.value=pe(W.value))}function tn(V){V===1&&(W.value=Gt(W.value),Ve()),V===2&&(W.value=Ht(W.value),Te()),V===3&&(W.value=zt(W.value)),V===4&&(W.value=he(W.value))}const Re=()=>{ne[E.value-1]==="year"?Ve():Te()},nn=t.computed(()=>[F,u,a,h][E.value-1]),rn=t.computed(()=>[s,g,c,o][E.value-1]);function an(){W.value={year:w.year||1,month:w.month||1,day:w.day||1},Re()}const on=V=>{n.emit("dayClick",V)};function ln(V){if(!V)return{width:0,height:0};if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1){const $=window.getComputedStyle(V),G=V.getBoundingClientRect(),te=parseInt($.paddingLeft)||0,Me=parseInt($.paddingRight)||0,ke=parseInt($.paddingTop)||0,ge=parseInt($.paddingBottom)||0,pn=parseFloat($.borderLeftWidth)||0,hn=parseFloat($.borderRightWidth)||0,vn=parseFloat($.borderTopWidth)||0,gn=parseFloat($.borderBottomWidth)||0,bn=G.width-te-Me-pn-hn,wn=G.height-ke-ge-vn-gn;return{width:bn,height:wn}}else return{width:V.clientWidth,height:V.clientHeight}}const Ne=()=>{if(e.fit&&J.value){const V=J.value,G=window.getComputedStyle(V).minHeight;let te=800;if(G&&G.endsWith("px")){const ge=parseInt(G.replace("px",""),10);isNaN(ge)||(te=ge)}const{width:Me,height:ke}=ln(V);H.value=Me,_.value=ke,navigator.userAgent.toLowerCase().indexOf("firefox")>-1?_.value-=35:_.value=_.value>te?_.value:te}};function sn(V){E.value=V,Re(),t.nextTick(()=>{Ne()})}let ae=null;t.watch(()=>e.visible,(V,$)=>{V!==$&&(S.value=V,V?setTimeout(()=>{ae=Y.useResizeObserver(J.value,Ne)}):ae&&ae())}),t.onMounted(()=>{setTimeout(()=>{S.value&&(ae=Y.useResizeObserver(J.value,Ne))})}),t.onUnmounted(()=>{ae&&ae()});const cn=t.computed(()=>Y.getCustomClass({"f-calendar d-flex f-calendar-cross-day h-100 flex-column":!0,"f-calendar-highlight-weekend":e.highLightWeekend,["f-calendar-activeview-"+ne[E.value-1]]:!0},e.customClass));function dn(V){j.value=V||[]}const $e=t.ref([]),Ae=t.ref();function un(V){$e.value=V.events||[],n.emit("moreClick",V)}function fn(V,$){n.emit("moreClick",$)}const mn=t.computed(()=>{var V;return(V=Ae.value)==null?void 0:V.popoverRef}),yn=t.computed(()=>{const V={minHeight:"800px"};return Y.getCustomStyle(V,e==null?void 0:e.customStyle)});return n.expose({loadEvents:dn}),()=>S.value&&t.createVNode("div",{class:cn.value,ref:J,style:yn.value},[t.createVNode(de,{activeView:E.value,isCurrent:Kt.value,todayText:Jt.value,title:Ut.value,enableMoreView:e.enableMoreView,previousText:nn.value,nextText:rn.value,monthlyViewTitle:D,weeklyViewTitle:O,dailyViewTitle:p,yearViewTitle:l,onViewChange:V=>sn(V),onPrevious:V=>en(V),onNext:V=>tn(V),onResetToToday:()=>an()},null),t.createVNode("div",{class:"f-utils-fill"},[E.value===4&&t.createVNode(me,{day:Qt.value,dayInWeek:Zt.value,events:j.value},null),E.value===3&&t.createVNode(fe,{week:ve.value,events:j.value},null),E.value===2&&t.createVNode(ue,{daysInWeek:Xt.value,monthLabels:m,activeDay:W.value,dates:De.value,events:j.value,width:H.value,height:_.value-60,eventDateField:e.eventDateField,startDateField:e.startDateField,endDateField:e.endDateField,customEventStyles:e.customEventStyles,enableCrossDay:P.value,eventItemFormatter:e.eventItemFormatter,popoverRef:mn.value,moreText:v,onClick:on,showBorder:e.enableWeekdayBorder,onMoreClick:un},null),E.value===1&&t.createVNode(Qe,{activeYear:W.value.year,monthLabels:m,events:j.value,height:_.value-60,moreText:v,onMoreClick:(V,$)=>fn(V,$)},null)]),t.createVNode(Ze,{ref:Ae,events:$e.value},null)])}}),ye={button:{type:"button",name:"按钮"},"response-toolbar":{type:"response-toolbar",name:"工具栏"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮"},"content-container":{type:"content-container",name:"容器"},"input-group":{type:"input-group",name:"文本"},textarea:{type:"textarea",name:"多行文本"},lookup:{type:"lookup",name:"帮助"},"number-spinner":{type:"number-spinner",name:"数值"},"date-picker":{type:"date-picker",name:"日期"},switch:{type:"switch",name:"开关"},"radio-group":{type:"radio-group",name:"单选组"},"check-box":{type:"check-box",name:"复选框"},"check-group":{type:"check-group",name:"复选框组"},"combo-list":{type:"combo-list",name:"下拉列表"},"response-form":{type:"response-form",name:"卡片面板"},"response-layout":{type:"response-layout",name:"布局容器",icon:"response-layout-3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"response-layout-1"},"tree-grid":{type:"tree-grid",name:"树表格"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块"},component:{type:"component",name:"组件"},tabs:{type:"tabs",name:"标签页"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮"},"drawer-toolbar-item":{type:"drawer-toolbar-item",name:"抽屉工具栏按钮"},"html-template":{type:"html-template",name:"模板容器"},"time-picker":{type:"time-picker",name:"时间选择"},section:{type:"section",name:"分组面板"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传"},"page-header":{type:"page-header",name:"页头"},"page-footer":{type:"page-footer",name:"页脚"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏"},"drawer-toolbar":{type:"drawer-toolbar",name:"抽屉工具栏"},fieldset:{type:"fieldset",name:"分组"},"query-solution":{type:"query-solution",name:"筛选方案"},drawer:{type:"drawer",name:"抽屉"},"external-container":{type:"external-container",name:"外部容器",icon:"content-container"},"list-nav":{type:"list-nav",name:"列表导航"},nav:{type:"nav",name:"标签类导航"},"list-view":{type:"list-view",name:"列表"},"filter-bar":{type:"filter-bar",name:"筛选条"},"language-textbox":{type:"language-textbox",name:"多语输入框"},image:{type:"image",name:"图像"},avatar:{type:"avatar",name:"头像"},"discussion-editor":{type:"discussion-editor",name:"评论编辑区"},"discussion-list":{type:"discussion-list",name:"评论列表"},comment:{type:"comment",name:"评论区"},"approval-logs":{type:"approval-logs",name:"审批记录"},"rich-text-editor":{type:"rich-text-editor",name:"富文本",icon:"rich-text-box"},calendar:{type:"calendar",name:"日历",icon:"date-picker"},wizard:{type:"wizard",name:"向导",icon:"wizard"},"wizard-page":{type:"wizard-page",name:"向导页",icon:"wizard"},"wizard-page-detail":{type:"wizard-page-detail",name:"向导详情",icon:"wizard"},step:{type:"step",name:"步骤条",icon:"step"},"dynamic-form":{type:"dynamic-form",name:"动态表单"}};function Pe(e,n){return t.createVNode("h5",{style:"display: flex;justify-content: space-between;align-items: center;"},[t.createTextVNode("示例代码:"),t.createVNode("button",{class:"btn btn-link",onClick:()=>e.value.setValue(n)},[t.createVNode("span",{class:"f-icon f-icon-source-code mr-1"},null),t.createTextVNode("应用代码")])])}const We=(e=!0)=>`/* data: 日程数据 context: 提供一些时间转换方法,以及获取日程数据的方法 // 将日期转换为Date对象 parseToDate('2021-01-01', 'yyyy-MM-dd') parseToDate: (date: string, format: string) => Date, // 将日期转换为指定格式的字符串 fromatTo(new Date(), 'yyyy-MM-dd') formatTo: (date: Date, format: string) => string, // 获取日程数据的方法 getValue(data, 'name') // 如果字段为多语字段,需要指定语言编码 getValue(data, 'name', locale) getValue: (data: any, field: string, locale?:string) => string, // 当前视图 view: 'year' | 'month' | 'week' | 'day', // 当前语言编码 locale: string ${e?"此方法返回一个字符串,可包括HTML代码,如:<div>...</div>":"此方法返回一个对象,包含cls和styles两个属性,cls为事件样式类名,styles为事件样式对象"} */`,at=e=>{const n=`(data, context) => { /** * const {formatTo, view, locale, getValue} = context; * 多语字段需要指定语言编码,如 getValue(data, 'name', locale) */ const clsNames = [ 'red', 'yellow', 'green', 'blue', 'light-green' ]; const level = data.zylevel; return { cls: 'event-bg-' + clsNames[level], styles: { fontWeight: 'bold' } } }`;return t.createVNode(t.Fragment,null,[Pe(e,n),t.createVNode("pre",{style:"height: calc(100% - 35px);margin: 0;"},[t.createVNode("code",null,[t.createTextVNode(" "),`${We(!1)} ${n} `])])])},ot=e=>{const n=`(data, context) => { const {formatTo, view, locale, getValue} = context; const timeFmt = view== 'year'? 'MM-dd HH:mm':'HH:mm'; const timeWidth = view == 'year'? '80px': '40px'; const styles = 'width:' + timeWidth + ';text-align: right;'; /* 多语字段需要指定语言编码,如 getValue(data, 'name', locale) */ // dotted: 展示日程前的圆点 return \` <div class="d-flex" style="justify-content: space-between;"> <div class="f-utils-fill text-truncate dotted" title="\${data.title}">\${data.title}</div> <div style="\${styles}">\${formatTo(data.beginTime, timeFmt)}</div> </div>\` }`;return t.createVNode(t.Fragment,null,[Pe(e,n),t.createVNode("pre",{style:"height: calc(100% - 35px);margin: 0;"},[t.createVNode("code",null,[t.createTextVNode(" "),`${We()} ${n} `])])])};class it extends He.BaseControlProperty{constructor(r,i){super(r,i);qe(this,"treeNodeStatus",r=>((r.raw.$type!=="SimpleField"||r.raw.selectable===!1)&&(r.disabled=!0),r))}getPropertyConfig(r){return this.getBasicPropConfig(r),this.propertyConfig.categories.appearance=this.getAppearanceConfig(r),this.propertyConfig.categories.behavior=this.getBehaviorConfig(r),this.propertyConfig.categories.calendar=this.getCalendarConfig(r),this.propertyConfig.categories.eventsEditor=this.getEventPropConfig(r),this.propertyConfig}getBehaviorConfig(r){const i=this;return{description:"Basic Infomation",title:"行为",properties:{visible:{description:"运行时组件是否可见",title:"是否可见",type:"boolean",editor:this.getPropertyEditorParams(r,["Const","Variable"])}},setPropertyRelates(u,g){if(u)switch(u.propertyID){case"visible":i.afterMutilEditorChanged(r,u);break}}}}getBasicPropConfig(r){var D,O,C;const i=(C=(O=(D=this.formSchemaUtils.getFormSchema())==null?void 0:D.module)==null?void 0:O.entity[0])==null?void 0:C.entities[0],u=this.assembleSchemaEntityToTree(i,0),g=this,p=super.getBasicPropConfig(r);this.propertyConfig.categories.basic={description:"Basic Information",title:"基本信息",properties:{...p.properties,dataSource:{description:"绑定数据源",title:"绑定数据源",refreshPanelAfterChanged:!0,editor:{type:"combo-tree",textField:"name",valueField:"label",data:u,editable:!1,idField:"label",enableClear:!1},readonly:!1}},setPropertyRelates(m,a){switch(m&&m.propertyID){case"dataSource":{const c=g.formSchemaUtils.getViewModelById(g.viewModelId);if(c){const h=u.find(o=>o.label===m.propertyValue);c.bindTo=h.bindTo}g.designViewModelUtils.assembleDesignViewModel();break}}}}}assembleSchemaEntityToTree(r,i,u,g="",p=[]){const D=g?`${g}/${r.label}`:"/";return p.push({id:r.id,name:r.name,label:r.label,layer:i,parent:u&&u.id,bindTo:D.replace("//","/")}),r.type.entities&&r.type.entities.length&&r.type.entities.map(O=>this.assembleSchemaEntityToTree(O,i+1,r,D,p)),p}onlySelectDateField(r){return r.filter(i=>{var u,g;((u=i.data.type)==null?void 0:u.$type)==="DateType"||((g=i.data.type)==null?void 0:g.$type)==="DateTimeType"?i.selectable=!0:i.selectable=!1,i.children&&i.children.length&&this.onlySelectDateField(i.children)}),r}showOptionsForMonth(r){return r.enableMoreView==null&&(r.enableMoreView=!1),r.defaultView==="month"||r.enableMoreView}getCalendarConfig(r){const i=this,u=this.designViewModelUtils.getAllFields2TreeByVMId(this.viewModelId),g=this.onlySelectDateField(Q.cloneDeep(u));r.defaultView==null&&(r.defaultView="month");const p={idField:"bindingPath",type:"combo-tree",textField:"name",valueField:"bindingPath",data:u,editable:!1,enableClear:!1};return{description:"日历组件配置",title:"日历配置",properties:{activeDate:{description:"",title:"默认显示日期",type:"string",editor:{...this.getPropertyEditorParams(r,["Variable","Expression"],"",{},{newVariablePrefix:"",newVariableType:"Date"},"compute"),enableClear:!1}},enableMoreView:{description:"",title:"启用多视图",type:"boolean",default:!1,refreshPanelAfterChanged:!0},defaultView:{description:"",title:"默认视图",type:"string",refreshPanelAfterChanged:!0,editor:{type:"combo-list",idField:"value",valueField:"value",textField:"label",data:[{label:"