UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

48 lines (47 loc) 71.5 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(y){return{id:`${y.componentId}-component-viewmodel`,code:`${y.componentId}-component-viewmodel`,name:y.componentName,bindTo:y.bindTo,parent:Ge,fields:[],commands:[],states:[],enableValidation:!0}}function m(y){const a=e.getSchemaByType("component-ref");return Object.assign(a,{id:`${y.componentId}-component-ref`,component:`${y.componentId}-component`}),a}function h(y,a,c){var p,d,F,s;const v=(d=(p=a==null?void 0:a.parentComponentInstance)==null?void 0:p.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 y;const l=[oe.DgControl["content-container"].type,oe.DgControl["response-layout-item"].type,oe.DgControl["splitter-pane"].type,oe.DgControl.drawer.type];if(v&&l.includes(v)){const g=e.getSchemaByType("section",{parentComponentInstance:a.parentComponentInstance,mainTitle:a.componentName},n);if(g&&g.contents&&g.contents.length){const I=g.contents[0];return I.contents=[y],g}}return y}function D(y){const a=e.getSchemaByType("calendar");return Object.assign(a,{id:y.componentId+"-calendar",appearance:{class:""},type:"calendar",dataSource:y.dataSource||"",pagination:{enable:!1}}),[a]}function O(y){var l,p,d;const a=e.getSchemaByType("component"),c=D(y);let v=!1;const o=(d=(p=(l=y.parentComponentInstance)==null?void 0:l.schema)==null?void 0:p.appearance)==null?void 0:d.class;return o&&o.includes("f-page-main")&&(v=!0),Object.assign(a,{id:`${y.componentId}-component`,viewModel:`${y.componentId}-component-viewmodel`,componentType:y.componentType,appearance:{class:v?"f-utils-fill-flex-column f-utils-overflow-auto":"f-grid-is-sub f-utils-overflow-auto"},contents:c}),a}function C(y){const a=m(y),c=O(y),v=u(y),o=r.getFormSchema();return o.module.viewmodels.push(v),o.module.components.push(c),i.assembleDesignViewModel(),h(a,y)}return{createComponent:C}}function Fe(e,n,r,i){var m,h,D,O,C,y;const u=r.parentComponentInstance;if(u&&i){const a=Math.random().toString(36).slice(2,6),c={componentId:`calendar-${a}`,componentName:((m=r.bindingSourceContext)==null?void 0:m.entityTitle)||((D=(h=r.bindingSourceContext)==null?void 0:h.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:(y=(C=r.bindingSourceContext)==null?void 0:C.bindingEntity)==null?void 0:y.label},{createComponent:v}=_e(e,i);return v(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 m(a){return n(a).getTime()}function h(a){return Math.round(m(a)/1e3)}function D(a,c,v){const o=m(c),l=m(v),p=m(a);return l-p>p-o?c:v}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 y(a){const c=i(a);return c===0||c===6}return{convertDateToDateObject:C,emptyDate:e,getDate:n,getDate2:r,getDayNumber:i,getEpocTime:h,getNearDate:D,getWeekdayIndex:u,getTimeInMilliseconds:m,getToday:O,isWeekEnd:y}}function Je(){function e(m,h){return new Date(h,m,0).getDate()}function n(m,h,D){return new Date(m,h-1,D,0,0,0,0)}function r(m,h){const D=n(h,m,1);return D.setMonth(D.getMonth()-1),e(D.getMonth()+1,D.getFullYear())}function i(m,h){const D={year:m===12?h+1:h},O=m===12?1:m+1;return D.month=O,D}function u(m,h){const D={year:m===1?h-1:h},O=m===1?12:m-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:m,getPreviousMonth:h}=Je();function D(d){const{day:F,month:s,year:g}=d;if(F===void 0||s===void 0||g===void 0)throw new Error("invalided date.");const I=F===1,V=I?u(s,g):F-1,R=I?s-1:s,M=R<1,x=M?12:R;return{year:M?g-1:g,month:x,day:V}}function O(d){const{day:F,month:s,year:g}=d;if(F===void 0||s===void 0||g===void 0)throw new Error("invalided date.");const I=i(s,g),V=F===I,R=V?1:F+1,M=V?s+1:s,x=M>12,k=x?1:M;return{year:x?g+1:g,month:k,day:R}}function C(d){const F=h(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 y(d){const F=m(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 v(d){const s=(d.day||1)-7,g=s<1,I=g?i(d.month||1,d.year||1)+s:s,V=g?h(d.month||1,d.year||1):d;return{day:I,month:V.month,year:V.year}}function o(d){const s=(d.day||1)+7,g=i(d.month||1,d.year||1),I=s>g,V=I?s-g:s,R=I?m(d.month||1,d.year||1):d;return{day:V,month:R.month,year:R.year}}function l(d,F,s,g,I){if(d<1||F<1||s<1)throw new Error("Invalid date input");const V={day:d,month:F,year:s},R=U.indexOf(g);if(R===-1)throw new Error("Invalid firstDayOfWeek value");const x=(n(V)-R+7)%7,k=e(),b=P=>P.day===k.day&&P.month===k.month&&P.year===k.year,f=[];let T={...V};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=h(V.month,V.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 p(d,F,s,g){const I=[],V={day:1,month:d,year:F},R=n(V),M=U.indexOf(s);if(M===-1)throw new Error("Invalid firstDayOfWeek value");const x=(R-M+7)%7;let k=V;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,g);I.push(T);for(let j=0;j<7;j++)b=O(b)}return I}return{getMonthlyCalendar:p,getWeeklyCalendar:l,getPreviousDay:D,getNextDay:O,getDayInPreviousWeek:v,getDayInNextWeek:o,getDayInPreviousMonth:C,getDayInNextMonth:y,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 m(o){return e({year:o.year,month:o.month,day:o.day})}function h(o,l,p=!0){return p?e(o)<=e(l):m(o)<=m(l)}function D(o,l){return e(o)===e(l)}function O(o,l){const p=e(l);return e(o.from)===p||e(o.to)===p}function C(o,l){return!l||!n(l.to)||!n(l.from)?!1:h(l.from,o)&&h(o,l.to)}function y(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 v(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:h,isInitializedDate:n,isInitializedMonth:r,isInitializedYear:i,isMonthDisabledByDisableSince:y,isMonthDisabledByDisableUntil:a,sameTime:v,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),m=t.ref(e.monthlyViewTitle),h=t.ref(e.yearViewTitle),D=2,O=62,C=t.ref(e.activeView);t.watch(()=>e.activeView,(p,d)=>{C.value=p}),t.watch(()=>e.title,()=>{r.value=e.title});const y=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?h.value:m.value);function c(p){const d=ne.indexOf(p)+1;C.value=d,n.emit("viewChange",d)}function v(){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:()=>v(),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:p=>c("year")},[h.value]),t.createVNode("span",{class:"f-calendar-view-switch-monthly",onClick:p=>c("month")},[m.value])]),t.createVNode("div",{class:"f-calendar-view-switch-active-view",style:y.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),m=t.ref(e.events),{assignEventsToWeeks:h,assignEventsToDays:D,renderEventItem:O,useCompareCompsition:C}=t.inject("eventsComposition"),{equal:y}=C,a=t.ref();function c(b,f){return e.enableCrossDay?h(b,f):D(b,f)}const v=t.ref(c(e.dates,m.value));t.watch(()=>e.enableCrossDay,()=>{v.value=c(e.dates,e.events)}),t.watch(()=>e.dates,()=>{v.value=c(e.dates,m.value)}),t.watch(()=>e.activeDay,()=>{u.value=e.activeDay}),t.watch(()=>e.events,()=>{m.value=e.events,v.value=c(e.dates,e.events)}),t.watch(()=>e.daysInWeek,(b,f)=>{r.value=b});function o(b){return!!u.value&&y({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},p=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`})),g=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 V(){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:p(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,g.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"},[v.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(()=>{g.value=I(),v.value=[...v.value]})}),t.onMounted(()=>{g.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"},[V()])])]),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),m=t.ref(e.enableMarkCurrent),h=t.ref(e.events),D=t.ref([]),{equal:O}=Ce(),{convertDateToDateObject:C}=ie();function y(s){return u.value.days.map(I=>{const V={year:I.date.year,month:I.date.month,day:I.date.day,hour:s.hour,minute:s.minute,second:s.second},R=h.value.filter(M=>O(C(M[e.startDateField]),V));return{day:V,events:R}})}function a(){const s=[];for(let g=0;g<24;g++){const I={hour:g,minute:0,second:0},V={hour:g,minute:30,second:0},R=y(I),M=y(V);s.push({time:I,events:R,title:g>0?`${g}:00`:"",part:"upper"}),s.push({time:V,events:M,title:`${g}:30`,part:"lower"})}D.value=s}a(),t.watch(()=>e.week,()=>{u.value=e.week,a()}),t.watch(()=>e.events,()=>{h.value=e.events,a()});const c=s=>({"f-calendar-week-view-date":!0,"f-calendar-week-view-current":s.isCurrent&&m.value});function v(){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,g)=>t.createVNode("div",{class:"f-calendar-week-view-header-cell"},[t.createVNode("div",{class:c(u.value.days[g])},[u.value.days[g].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 p(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(g=>t.createVNode("div",{class:"f-calendar-week-view-item-cell"},[g.events.length>0&&g.events.map(I=>t.createVNode("div",{class:"f-calendar-event",style:p(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"},[v(),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),m=t.ref(e.enableMarkCurrent),h=t.ref(e.events),D=t.ref([]),{convertDateToDateObject:O}=ie(),{equal:C}=Ce();function y(s){const g={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=h.value.filter(V=>C(O(V[e.dateField]),g));return[{day:g,events:I}]}function a(){const s=[];for(let g=0;g<24;g++){const I={hour:g,minute:0,second:0},V={hour:g,minute:30,second:0},R=y(I),M=y(V);s.push({time:I,events:R,title:g>0?`${g}:00`:"",part:"upper"}),s.push({time:V,events:M,title:`${g}:30`,part:"lower"})}D.value=s}a(),t.watch(()=>e.day,()=>{u.value=e.day,a()}),t.watch(()=>e.events,()=>{h.value=e.events,a()});const c=s=>({"f-calendar-day-view-date":!0,"f-calendar-day-view-current":s.isCurrent&&m.value});function v(){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 p(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(g=>t.createVNode("div",{class:"f-calendar-day-view-item-cell"},[g.events.length>0&&g.events.map(I=>t.createVNode("div",{class:"f-calendar-event",style:p(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"},[v(),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:m}=t.inject("eventsComposition"),h=t.ref(0),D=()=>{const a=r.value;if(!a)return 0;const v=a.querySelector(".yearview-monthitem").offsetHeight;return Math.max(0,Math.floor((v-40)/24))},O=a=>{const c=!!(a&&a.length>h.value);if(c){const v=Q.cloneDeep(a),o=c?v==null?void 0:v.slice(0,h.value):v;if(o&&o.length>0){const l=o[o.length-1];l.data&&(l.showMore=!0,l.moreCount=a.length-h.value+1)}return o}return a},C=t.computed(()=>u(e.activeYear,e.events));function y(a,c){const v={year:e.activeYear,month:parseInt(c,10)};n.emit("moreClick",a,{date:v,view:"year"})}return t.watch(()=>e.height,(a,c)=>{a!==c&&t.nextTick(()=>{h.value=D(),i.value={...e.monthLabels}})}),t.onMounted(()=>{h.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 v;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"},[(v=O(C.value[a]))==null?void 0:v.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:p=>y(p,a)},[e.moreText.replace("#count#",o.moreCount)])]):m(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:m}=t.inject("eventsComposition"),h=t.ref(0);return n.expose({popoverRef:i}),()=>t.createVNode(ze,{id:"calendar-more-events",customStyles:{filter:"drop-shadow(#c5c5c5 0px 0px 6px)"},offsetX:h,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=>m(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"),m=e("calendar.thisYear"),h=e("calendar.yearView"),D=e("calendar.monthView"),O=e("calendar.weekView"),C=e("calendar.dayView"),y=e("calendar.titleFormat"),a=e("calendar.yearViewTitleFormat"),c=e("calendar.prevMonth"),v=e("calendar.nextMonth"),o=e("calendar.prevWeek"),l=e("calendar.nextWeek"),p=e("calendar.prevDay"),d=e("calendar.nextDay"),F=e("calendar.prevYear"),s=e("calendar.nextYear"),g=e("calendar.more","")||"还有 #count# 项...";return{monthLabels:r,weekDayLabels:i,today:u,monthViewTitle:D,weekViewTitle:O,dayViewTitle:C,titleFormat:y,prevMonth:c,nextMonth:v,prevWeek:o,nextWeek:l,prevDay:p,nextDay:d,yearViewTitle:h,yearViewTitleFormat:a,thisYear:m,prevYear:F,nextYear:s,moreText:g,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,m,h){const{equalOrEarlier:D,sameDay:O}=i,{convertDateToDateObject:C}=n,{parseToDate:y,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=y(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 v(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=y(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(y(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[m.value-1]}function p(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:y,formatTo:a,getValue:d,view:l(),locale:h}):Y.resolveField(M.data,e.textField||"title")}function s(M){return Q.isFunction(e.eventItemFormatter)?"":d(M.data,e.textField||"title",h)}const g=M=>{if(!M||!M.data)return{};if(!Q.isFunction(e.customEventStyles))return{styles:{"background-color":"#f3f3f3"}};const x=e.customEventStyles(M.data,{parseToDate:y,formatTo:a,getValue:d,view:l(),locale:h});return x&&Object.keys(x).length>0?x:{}};function I(M){const{cls:x,styles:k}=g(M);return t.createVNode("a",{onClick:b=>p(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 V(M){return t.createVNode("li",null,[t.createTextVNode(" "),F(M)])}function R(M){const{cls:x,styles:k}=g(M);return t.createVNode("li",{style:{...k||{},"padding-bottom":"2px"},class:x,onClick:b=>p(b,M)},[t.createVNode("div",{class:"event-title pb-0 text-truncate",innerHTML:F(M),title:s(M)},null)])}return{assignEventsToDays:c,assignEventsToWeeks:v,renderEventItem:I,useCompareCompsition:i,useDateComposition:n,useDateFormatComposition:r,renderEventItemForMore:V,assignEventsToMonths:o,renderEventItemForMonths:R,getEventItemStyles:g}}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:m,dayViewTitle:h,monthViewTitle:D,weekViewTitle:O,weekDayLabels:C,monthLabels:y,prevWeek:a,nextWeek:c,prevDay:v,nextDay:o,yearViewTitle:l,yearViewTitleFormat:p,thisYear:d,prevYear:F,nextYear:s,moreText:g,locale:I}=Ke(),V=Ce(),R=Y.useDateFormat(),M=ie(),{sameDay:x}=V,{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,V,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,(N,$)=>{N!==$&&(T.value=N)}),t.watch(()=>e.enableCrossDay,(N,$)=>{N!==$&&(P.value=N)});const H=t.ref(e.width),_=t.ref(e.height),J=t.ref();function z(){const N=ne.some($=>$===e.defaultView)?e.defaultView:"month";E.value=ne.indexOf(N)+1}z(),t.watch(()=>e.defaultView,(N,$)=>{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?p.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 N=[],$=U.indexOf(T.value);if($!==-1){let G=$;for(let te=0;te<U.length;te++)N.push(C[U[G]]),G=U[G]==="Sat"?0:G+1}return N}),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(N=>x(N.date,W.value))||ve.value.days[1]),Zt=t.computed(()=>{const N=ve.value.days.findIndex(G=>x(G.date,W.value)),$=N>-1?N:1;return U[$]}),Kt=t.computed(()=>(E.value===1||W.value.month===w.month)&&W.value.year===w.year),Be=(N,$)=>[{filterField:e.eventDateField,value:`${N.year}-${N.month}-${N.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 N=De.value[0].days[0].date,$=De.value[5].days[6].date;n.emit("dateChange",{conditions:Be(N,$),start:N,end:$,view:"month"})},Ne=()=>{const N={year:W.value.year,month:1,day:1},$={year:W.value.year,month:12,day:31};n.emit("dateChange",{conditions:Be(N,$),start:N,end:$,view:"year"})};function en(N){N===1&&(W.value=_t(W.value),Ne()),N===2&&(W.value=Yt(W.value),Te()),N===3&&(W.value=qt(W.value)),N===4&&(W.value=pe(W.value))}function tn(N){N===1&&(W.value=Gt(W.value),Ne()),N===2&&(W.value=Ht(W.value),Te()),N===3&&(W.value=zt(W.value)),N===4&&(W.value=he(W.value))}const Re=()=>{ne[E.value-1]==="year"?Ne():Te()},nn=t.computed(()=>[F,u,a,v][E.value-1]),rn=t.computed(()=>[s,m,c,o][E.value-1]);function an(){W.value={year:w.year||1,month:w.month||1,day:w.day||1},Re()}const on=N=>{n.emit("dayClick",N)};function ln(N){if(!N)return{width:0,height:0};if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1){const $=window.getComputedStyle(N),G=N.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:N.clientWidth,height:N.clientHeight}}const Ve=()=>{if(e.fit&&J.value){const N=J.value,G=window.getComputedStyle(N).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(N);H.value=Me,_.value=ke,navigator.userAgent.toLowerCase().indexOf("firefox")>-1?_.value-=35:_.value=_.value>te?_.value:te}};function sn(N){E.value=N,Re(),t.nextTick(()=>{Ve()})}let ae=null;t.watch(()=>e.visible,(N,$)=>{N!==$&&(S.value=N,N?setTimeout(()=>{ae=Y.useResizeObserver(J.value,Ve)}):ae&&ae())}),t.onMounted(()=>{setTimeout(()=>{S.value&&(ae=Y.useResizeObserver(J.value,Ve))})}),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(N){j.value=N||[]}const $e=t.ref([]),Ae=t.ref();function un(N){$e.value=N.events||[],n.emit("moreClick",N)}function fn(N,$){n.emit("moreClick",$)}const mn=t.computed(()=>{var N;return(N=Ae.value)==null?void 0:N.popoverRef}),yn=t.computed(()=>{const N={minHeight:"800px"};return Y.getCustomStyle(N,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:h,yearViewTitle:l,onViewChange:N=>sn(N),onPrevious:N=>en(N),onNext:N=>tn(N),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:y,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:g,onClick:on,showBorder:e.enableWeekdayBorder,onMoreClick:un},null),E.value===1&&t.createVNode(Qe,{activeYear:W.value.year,monthLabels:y,events:j.value,height:_.value-60,moreText:g,onMoreClick:(N,$)=>fn(N,$)},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:"容器"},table:{type:"table",name:"表格布局"},"table-td":{type:"table-td",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,m){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),m=this,h=super.getBasicPropConfig(r);this.propertyConfig.categories.basic={description:"Basic Information",title:"基本信息",properties:{...h.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(y,a){switch(y&&y.propertyID){case"dataSource":{const c=m.formSchemaUtils.getViewModelById(m.viewModelId);if(c){const v=u.find(o=>o.label===y.propertyValue);c.bindTo=v.bindTo}m.designViewModelUtils.assembleDesignViewModel();break}}}}}assembleSchemaEntityToTree(r,i,u,m="",h=[]){const D=m?`${m}/${r.label}`:"/";return h.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,h)),h}onlySelectDateField(r){return r.filter(i=>{var u,m;((u=i.data.type)==null?void 0:u.$type)==="DateType"||((m=i.data.type)==null?void 0:m.$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),m=this.onlySelectDateField(Q.cloneDeep(u));r.defaultView==null&&(r.defaultView="month");const h={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-