@farris/ui-vue 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/index.esm.js +16 -16
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +65 -65
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +13 -13
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +504 -490
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +247 -233
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +356 -344
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +159 -145
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +127 -128
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +15 -15
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/component/index.esm.js +101 -87
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +7 -5
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +181 -167
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.esm.js +4057 -4304
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +2450 -2467
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +789 -777
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +3593 -3585
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +257 -243
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +322 -306
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +177 -163
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/event-parameter/index.esm.js +163 -2643
- package/components/event-parameter/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +500 -486
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +37 -37
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.esm.js +485 -470
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.esm.js +2611 -2623
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.esm.js +3825 -3837
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.esm.js +3720 -3712
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +402 -388
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +201 -202
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +264 -245
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +157 -143
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +312 -296
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.esm.js +4748 -4992
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.esm.js +4215 -4462
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +169 -155
- package/components/nav/index.umd.cjs +2 -2
- package/components/number-range/index.esm.js +150 -137
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +207 -194
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +427 -414
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +22 -22
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +510 -492
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +192 -178
- package/components/pagination/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +234 -220
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.esm.js +288 -277
- package/components/property-editor/index.umd.cjs +2 -2
- package/components/property-panel/index.esm.js +62 -61
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.esm.js +3015 -3027
- package/components/query-solution/index.umd.cjs +5 -5
- package/components/radio-button/index.esm.js +64 -64
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +293 -280
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +222 -208
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +187 -173
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +554 -542
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +483 -469
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +632 -617
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +228 -214
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +419 -406
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +162 -148
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +308 -284
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +279 -265
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +183 -170
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +307 -294
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +320 -306
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +245 -231
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +260 -247
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.esm.js +409 -396
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +424 -410
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.esm.js +2994 -3006
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +749 -733
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +325 -311
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +304 -290
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +99 -85
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +947 -933
- package/components/weather/index.umd.cjs +4 -4
- package/farris.all.esm.js +7750 -7990
- package/farris.all.umd.cjs +12 -12
- package/package.json +1 -1
- package/types/data-view/composition/types.d.ts +0 -1
- package/types/entity-binding-selector/composition/use-entity-tree.d.ts +3 -0
- package/types/entity-binding-selector/composition/use-field-tree.d.ts +1 -0
- package/components/event-parameter/index.css +0 -1
- package/types/data-grid/src/components/data/data-grid-area.component.d.ts +0 -8
- package/types/data-grid/src/components/data/data-grid-area.props.d.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.calendar={},C.Vue,C.LodashES))})(this,function(C,e,J){"use strict";const X={},Z={};function U(t){const{properties:a,title:l,ignore:p}=t,f=p&&Array.isArray(p),i=Object.keys(a).reduce((c,s)=>((!f||!p.find(V=>V===s))&&(c[s]=a[s].type==="object"&&a[s].properties?U(a[s]):J.cloneDeep(a[s].default)),c),{});if(l&&(!f||!p.find(c=>c==="id"))){const c=l.toLowerCase().replace(/-/g,"_");i.id=`${c}_${Math.random().toString().slice(2,6)}`}return i}function x(t,a={},l){const p=X[t];if(p){let f=U(p);const i=Z[t];return f=i?i({getSchemaByType:x},f,a,l):f,f}return null}function re(t,a){const l=U(a);return Object.keys(l).reduce((p,f)=>(p[f]&&J.isPlainObject(p[f])&&J.isPlainObject(t[f]||!t[f])?Object.assign(p[f],t[f]||{}):p[f]=t[f],p),l),l}function oe(t,a){return Object.keys(t).filter(p=>t[p]!=null).reduce((p,f)=>{if(a.has(f)){const i=a.get(f);if(typeof i=="string")p[i]=t[f];else{const c=i(f,t[f],t);Object.assign(p,c)}}else p[f]=t[f];return p},{})}function ce(t,a,l=new Map){const p=re(t,a);return oe(p,l)}function se(t={}){function a(n,v,g,N){if(typeof g=="number")return N[n].length===g;if(typeof g=="object"){const u=Object.keys(g)[0],h=g[u];if(u==="not")return Number(N[n].length)!==Number(h);if(u==="moreThan")return Number(N[n].length)>=Number(h);if(u==="lessThan")return Number(N[n].length)<=Number(h)}return!1}function l(n,v,g,N){return N[n]&&N[n].propertyValue&&String(N[n].propertyValue.value)===String(g)}const p=new Map([["length",a],["getProperty",l]]);Object.keys(t).reduce((n,v)=>(n.set(v,t[v]),n),p);function f(n,v){const g=n;return typeof v=="number"?[{target:g,operator:"length",param:null,value:Number(v)}]:typeof v=="boolean"?[{target:g,operator:"getProperty",param:n,value:!!v}]:typeof v=="object"?Object.keys(v).map(N=>{if(N==="length")return{target:g,operator:"length",param:null,value:v[N]};const u=N,h=v[N];return{target:g,operator:"getProperty",param:u,value:h}}):[]}function i(n){return Object.keys(n).reduce((g,N)=>{const u=f(N,n[N]);return g.push(...u),g},[])}function c(n,v){if(p.has(n.operator)){const g=p.get(n.operator);return g&&g(n.target,n.param,n.value,v)||!1}return!1}function s(n,v){return i(n).reduce((u,h)=>u&&c(h,v),!0)}function V(n,v){const g=Object.keys(n),N=g.includes("allOf"),u=g.includes("anyOf"),h=N||u,d=(h?n[h?N?"allOf":"anyOf":"allOf"]:[n]).map(o=>s(o,v));return N?!d.includes(!1):d.includes(!0)}return{parseValueSchema:V}}const le={},ie={};se();function ue(t,a,l=new Map,p=(c,s,V,n)=>s,f={},i=c=>c){return X[a.title]=a,Z[a.title]=p,le[a.title]=f,ie[a.title]=i,(c={})=>{const s=ce(c,a,l),V=Object.keys(t).reduce((n,v)=>(n[v]=t[v].default,n),{});return Object.assign(V,s)}}function de(t,a){return{customClass:a.class,customStyle:a.style}}const fe=new Map([["appearance",de]]);function ye(t,a,l){return a}const he={$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:{}}},required:["id","type"]},me={title:"calendar",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},_={events:{Type:Array,default:[]},firstDayOfTheWeek:{type:String,default:"Sun."}},Q=ue(_,he,fe,ye,me),E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var j=(t=>(t[t.previous=1]="previous",t[t.current=2]="current",t[t.next=3]="next",t))(j||{});function G(){function t(){return{year:0,month:0,day:0}}function a(n){return new Date(n.year||0,n.month?n.month-1:0,n.day||0,n.hour?n.hour:0,n.minute?n.minute:0,n.second?n.second:0,0)}function l(n){const v=new Date;return n.year||(n.year=v.getFullYear()),n.month||(n.month=v.getMonth()+1),n.day||(n.day=1),new Date(n.year,n.month-1,n.day,n.hour?n.hour:0,n.minute?n.minute:0,n.second?n.second:0,0)}function p(n){return new Date(n.year||1,(n.month||1)-1,n.day,n.hour?n.hour:0,n.minute?n.minute:0,n.second?n.second:0,0).getDay()}function f(n){return E.indexOf(n)}function i(n){return a(n).getTime()}function c(n){return Math.round(i(n)/1e3)}function s(n,v,g){const N=i(v),u=i(g),h=i(n);return u-h>h-N?v:g}function V(){const n=new Date;return{year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate(),hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds()}}return{emptyDate:t,getDate:a,getDate2:l,getDayNumber:p,getEpocTime:c,getNearDate:s,getWeekdayIndex:f,getTimeInMilliseconds:i,getToday:V}}function pe(){function t(i,c){return new Date(c,i,0).getDate()}function a(i,c,s){return new Date(i,c-1,s,0,0,0,0)}function l(i,c){const s=a(c,i,1);return s.setMonth(s.getMonth()-1),t(s.getMonth()+1,s.getFullYear())}function p(i,c){const s={year:i===12?c+1:c},V=i===12?1:i+1;return s.month=V,s}function f(i,c){const s={year:i===1?c-1:c},V=i===1?12:i-1;return s.month=V,s}return{daysInMonth:t,daysInPreMonth:l,getNextMonth:p,getPreviousMonth:f}}function K(){const{getToday:t,getDayNumber:a}=G(),{daysInMonth:l,daysInPreMonth:p,getNextMonth:f,getPreviousMonth:i}=pe();function c(m){const k=E.indexOf(m);return k>0?7-k:0}function s(m){const{day:k,month:d,year:r}=m;if(k===void 0||d===void 0||r===void 0)throw new Error("invalided date.");const o=k===1,w=o?p(d,r):k-1,y=o?d-1:d,D=y<1,M=D?12:y;return{year:D?r-1:r,month:M,day:w}}function V(m){const{day:k,month:d,year:r}=m;if(k===void 0||d===void 0||r===void 0)throw new Error("invalided date.");const o=l(d,r),w=k===o,y=w?1:k+1,D=w?d+1:d,M=D>12,b=M?1:D;return{year:M?r+1:r,month:b,day:y}}function n(m){const k=i(m.month||1,m.year||1),d=l(k.month||1,k.year||1);return{day:(m.day||1)<=d?m.day:d,month:k.month,year:k.year}}function v(m){const k=f(m.month||1,m.year||1),d=l(k.month||1,k.year||1);return{day:(m.day||1)<=d?m.day:d,month:k.month,year:k.year}}function g(m){const d=(m.day||1)-7,r=d<1,o=r?l(m.month||1,m.year||1)+d:d,w=r?i(m.month||1,m.year||1):m;return{day:o,month:w.month,year:w.year}}function N(m){const d=(m.day||1)+7,r=l(m.month||1,m.year||1),o=d>r,w=o?d-r:d,y=o?f(m.month||1,m.year||1):m;return{day:w,month:y.month,year:y.year}}function u(m,k,d,r){const o={day:m,month:k,year:d},y=c(r)===0?1:0,D=a(o)+y,M=t();let b=s(o);const W=[];for(let S=D-1;S>=1;S--){const H=b.month!==o.month?j.previous:j.current,P=b.month===k&&b.day===M.day&&b.month===M.month&&b.year===M.year;W.push({date:b,monthTag:H,isCurrent:P}),S>1&&(b=s(b))}let O=V(o);const $=[];for(let S=D+1;S<=7;S++){const H=b.month!==o.month?j.next:j.current,P=O.day===M.day&&O.month===M.month&&O.year===M.year;$.push({date:O,monthTag:H,isCurrent:P}),S<7&&(O=V(O))}const T=m===M.day&&k===M.month&&d===M.year;return{days:[...W.reverse(),{date:o,monthTag:j.current,isCurrent:T},...$],weekNumber:0,year:d}}function h(m,k,d){const r=[],o=l(m,k);for(let w=1;w<=o;w+=7){const y=u(w,m,k,d);r.push(y)}return r}return{getMonthlyCalendar:h,getWeeklyCalendar:u,getPreviousDay:s,getNextDay:V,getDayInPreviousWeek:g,getDayInNextWeek:N,getDayInPreviousMonth:n,getDayInNextMonth:v}}function F(){const{getTimeInMilliseconds:t}=G();function a(u){return u&&u.year!==0&&u.month!==0&&u.day!==0}function l(u){return u&&u.year!==0&&u.month!==0}function p(u){return u&&u.year!==0}function f(u,h){return t(u)<t(h)}function i(u,h){return t(u)<=t(h)}function c(u,h){return t(u)===t(h)}function s(u,h){const m=t(h);return t(u.from)===m||t(u.to)===m}function V(u,h){return!h||!a(h.to)||!a(h.from)?!1:i(h.from,u)&&i(u,h.to)}function n(u,h){return a(h)&&t(u)>=t(h)}function v(u,h){return a(h)&&t(u)<=t(h)}function g(u,h){return t({year:u.year,month:u.month,day:u.day})===t({year:h.year,month:h.month,day:h.day})}function N(u,h){return t({hour:u.hour,minute:u.minute,second:u.second})===t({hour:h.hour,minute:h.minute,second:h.second})}return{isDateEarlier:f,equal:c,inPeriod:V,isPoint:s,equalOrEarlier:i,isInitializedDate:a,isInitializedMonth:l,isInitializedYear:p,isMonthDisabledByDisableSince:n,isMonthDisabledByDisableUntil:v,sameTime:N,sameDay:g}}const L={1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},ee={activeView:{Type:Number,default:3},title:{Type:String,default:""},dailyViewTitle:{Type:String,default:"Day"},weeklyViewTitle:{Type:String,default:"Week"},monthlyViewTitle:{Type:String,default:"Month"}},B=e.defineComponent({name:"FCalendarHeader",props:ee,emits:["ViewChange","Previous","Next","ResetToToday"],setup(t,a){const l=e.ref(t.title),p=e.ref(t.dailyViewTitle),f=e.ref(t.weeklyViewTitle),i=e.ref(t.monthlyViewTitle),c=2,s=62,V=e.ref(t.activeView),n=e.ref("Today");e.watch(()=>t.title,()=>{l.value=t.title});const v=e.computed(()=>({top:`${c}px`,left:`${V.value*(c+1)+(V.value-1)*(s+1)}px`})),g=e.computed(()=>V.value===1?p.value:V.value===2?f.value:i.value);function N(){V.value=1,a.emit("ViewChange",1)}function u(){V.value=2,a.emit("ViewChange",2)}function h(){V.value=3,a.emit("ViewChange",3)}function m(){a.emit("Previous",V.value)}function k(){a.emit("Next",V.value)}function d(){a.emit("ResetToToday")}return()=>e.createVNode("div",{class:"f-calendar-header"},[e.createVNode("div",{class:"f-calendar-title"},[l.value]),e.createVNode("div",{class:"f-calendar-navigator"},[e.createVNode("div",{class:"f-calendar-navigator-today btn btn-default",onClick:()=>d()},[n.value]),e.createVNode("div",{class:"f-calendar-navigator-button-group"},[e.createVNode("div",{class:"f-calendar-navigator-previous btn btn-default",onClick:()=>m()},[e.createVNode("i",{class:"f-icon f-icon-arrow-chevron-left"},null)]),e.createVNode("div",{class:"f-calendar-navigator-next btn btn-default",onClick:()=>k()},[e.createVNode("i",{class:"f-icon f-icon-arrow-chevron-right"},null)])])]),e.createVNode("div",{class:"f-calendar-view-switch"},[e.createVNode("div",{class:"f-calendar-view-switch-panel"},[e.createVNode("span",{class:"f-calendar-view-switch-daily",onClick:r=>N()},[p.value]),e.createVNode("span",{class:"f-calendar-view-switch-weekly",onClick:r=>u()},[f.value]),e.createVNode("span",{class:"f-calendar-view-switch-monthly",onClick:r=>h()},[i.value])]),e.createVNode("div",{class:"f-calendar-view-switch-active-view",style:v.value},[g.value])])])}}),te={dates:{Type:Array,default:[]},daysInWeek:{Type:Array,default:E},enableKeyboadNavigate:{Type:Boolean,default:!0},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]},activeDay:{Type:Object,default:null}};var Y=(t=>(t[t.enter=13]="enter",t[t.esc=27]="esc",t[t.space=32]="space",t[t.leftArrow=37]="leftArrow",t[t.upArrow=38]="upArrow",t[t.rightArrow=39]="rightArrow",t[t.downArrow=40]="downArrow",t[t.tab=9]="tab",t[t.shift=16]="shift",t))(Y||{});function ve(){function t(a){const l=a.key||a.keyCode;return l==="Enter"||l===13?13:l==="Escape"||l===27?27:l===" "||l===32?32:l==="ArrowLeft"||l===37?37:l==="ArrowUp"||l===38?38:l==="ArrowRight"||l===39?39:l==="ArrowDown"||l===40?40:l==="Tab"||l===9?9:l==="Shift"||l===16?16:-1}return{getKeyCodeFromEvent:t}}const R=e.defineComponent({name:"FCalendarMonthView",props:te,emits:["click","keyDown"],setup(t,a){const l=e.ref(t.daysInWeek),p=e.ref(t.enableKeyboadNavigate),f=e.ref(t.enableMarkCurrent),i=e.ref(t.activeDay),c=e.ref(t.events),{equal:s,sameDay:V}=F(),{getKeyCodeFromEvent:n}=ve();function v(d,r){return d.forEach(o=>{o.days.forEach(w=>{const y=r.filter(D=>V(D.starts,w.date));y&&y.length&&(w.events=[...y])})}),d}const g=e.ref(v(t.dates,c.value));e.watch(()=>t.dates,()=>{g.value=v(t.dates,c.value)}),e.watch(()=>t.activeDay,()=>{i.value=t.activeDay}),e.watch(()=>t.events,()=>{c.value=t.events});function N(d){return!!i.value&&s({year:i.value.year,month:i.value.month,day:i.value.day},d)}const u=(d,r,o)=>{const y={"f-datepicker-no-currmonth":d.monthTag===j.previous||d.monthTag===j.next},D=`d_${r}_${o}`;return y[D]=!0,y},h=d=>{const r=d.monthTag===j.current&&N(d.date),o=d.isCurrent&&f.value;return{"f-calendar-month-view-date":!0,"f-calendar-month-view-selected":r,"f-calendar-month-view-current":o}};function m(d,r){d.stopPropagation(),a.emit("click",r.date)}function k(d,r){const o=n(d);o!==Y.tab&&(d.preventDefault(),o===Y.enter||o===Y.space?m(d,r):p.value&&a.emit("keyDown",r.date))}return()=>e.createVNode("div",{class:"f-calendar-month-view"},[e.createVNode("table",{class:"f-datepicker-table",cellpadding:"0"},[e.createVNode("thead",null,[e.createVNode("tr",null,[l.value&&l.value.map(d=>e.createVNode("th",{scope:"col",style:"padding: 4px 4px 8px"},[d]))])]),e.createVNode("tbody",null,[g.value&&g.value.map((d,r)=>e.createVNode("tr",null,[d.days&&d.days.map((o,w)=>e.createVNode("td",{id:`d_${r}_${w}`,tabindex:"0",class:u(o,r,w),onClick:y=>m(y,o),onKeydown:y=>k(y,o)},[e.createVNode("div",{class:"f-calendar-month-view-title"},[e.createVNode("div",{class:h(o)},[o.date.day]),e.createVNode("div",{class:"f-calendar-month-view-date-month"},[o.date.day===1?L[o.date.month||1]:""])]),o.events&&o.events.length&&o.events.map(y=>e.createVNode("div",{class:"f-calendar-month-view-event-item"},[y.title]))]))]))])])])}}),ne={daysInWeek:{Type:Array,default:E},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]},week:{Type:Object,default:{days:[],weekNumber:0,year:0}}},I=e.defineComponent({name:"FCalendarWeekView",props:ne,emits:[],setup(t){const a=e.ref(),l=e.ref(),p=e.ref(t.daysInWeek),f=e.ref(t.week),i=e.ref(t.enableMarkCurrent),c=e.ref(t.events),s=e.ref([]),{equal:V}=F();function n(r){return f.value.days.map(w=>{const y={year:w.date.year,month:w.date.month,day:w.date.day,hour:r.hour,minute:r.minute,second:r.second},D=c.value.filter(M=>V(M.starts,y));return{day:y,events:D}})}function v(){const r=[];for(let o=0;o<24;o++){const w={hour:o,minute:0,second:0},y={hour:o,minute:30,second:0},D=n(w),M=n(y);r.push({time:w,events:D,title:o>0?`${o}:00`:"",part:"upper"}),r.push({time:y,events:M,title:`${o}:30`,part:"lower"})}s.value=r}v(),e.watch(()=>t.week,()=>{f.value=t.week,v()}),e.watch(()=>t.events,()=>{c.value=t.events,v()});const g=r=>({"f-calendar-week-view-date":!0,"f-calendar-week-view-current":r.isCurrent&&i.value});function N(){return e.createVNode("div",{class:"f-calendar-week-view-header"},[e.createVNode("div",{class:"f-calendar-week-view-header-corner"},null),e.createVNode("div",{class:"f-calendar-week-view-header-primary"},[e.createVNode("div",{class:"f-calendar-week-view-header-columns"},[p.value.map((r,o)=>e.createVNode("div",{class:"f-calendar-week-view-header-cell"},[e.createVNode("div",{class:g(f.value.days[o])},[f.value.days[o].date.day]),e.createVNode("span",null,[r])]))])])])}function u(){return e.createVNode("div",{class:"f-calendar-week-view-content-side"},[e.createVNode("div",{class:"f-calendar-side"},[s.value.map(r=>e.createVNode("div",{class:"f-calendar-side-row"},[e.createVNode("div",{class:"f-calendar-side-row-number"},[r.part==="upper"?r.title:""])]))])])}function h(r){return{"f-calendar-week-view-item":!0,"f-calendar-week-view-item-upper":r.part==="upper","f-calendar-week-view-item-lower":r.part==="lower"}}function m(r){const b=(r.starts.hour||0)+(r.starts.minute||0)/60;return{height:`${44*((r.ends.hour||0)+(r.ends.minute||0)/60-b)-2-2-1-1}px`}}function k(){return s.value.map(r=>e.createVNode("div",{class:h(r)},[r.events.map(o=>e.createVNode("div",{class:"f-calendar-week-view-item-cell"},[o.events.length>0&&o.events.map(w=>e.createVNode("div",{class:"f-calendar-event",style:m(w)},[w.title]))]))]))}function d(){return e.createVNode("div",{ref:l,class:"f-calendar-content-primary"},[e.createVNode("div",{class:"f-calendar-content-data"},[k()])])}return e.onMounted(()=>{a.value&&a.value.scrollTo(0,250)}),()=>e.createVNode("div",{class:"f-calendar-week-view"},[N(),e.createVNode("div",{class:"f-calendar-week-view-content",ref:a},[u(),d()])])}}),ae={day:{Type:Object,default:{}},dayInWeek:{Type:String,default:""},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]}},q=e.defineComponent({name:"FCalendarDayView",props:ae,emits:[],setup(t){const a=e.ref(),l=e.ref(),p=e.ref(t.dayInWeek),f=e.ref(t.day),i=e.ref(t.enableMarkCurrent),c=e.ref(t.events),s=e.ref([]),{equal:V}=F();function n(r){const o={year:f.value.date.year,month:f.value.date.month,day:f.value.date.day,hour:r.hour,minute:r.minute,second:r.second},w=c.value.filter(y=>V(y.starts,o));return[{day:o,events:w}]}function v(){const r=[];for(let o=0;o<24;o++){const w={hour:o,minute:0,second:0},y={hour:o,minute:30,second:0},D=n(w),M=n(y);r.push({time:w,events:D,title:o>0?`${o}:00`:"",part:"upper"}),r.push({time:y,events:M,title:`${o}:30`,part:"lower"})}s.value=r}v(),e.watch(()=>t.day,()=>{f.value=t.day,v()}),e.watch(()=>t.events,()=>{c.value=t.events,v()});const g=r=>({"f-calendar-day-view-date":!0,"f-calendar-day-view-current":r.isCurrent&&i.value});function N(){return e.createVNode("div",{class:"f-calendar-day-view-header"},[e.createVNode("div",{class:"f-calendar-day-view-header-corner"},null),e.createVNode("div",{class:"f-calendar-day-view-header-primary"},[e.createVNode("div",{class:"f-calendar-day-view-header-columns"},[e.createVNode("div",{class:"f-calendar-day-view-header-cell"},[e.createVNode("div",{class:g(f.value)},[f.value.date.day]),e.createVNode("span",null,[p.value])])])])])}function u(){return e.createVNode("div",{class:"f-calendar-day-view-content-side"},[e.createVNode("div",{class:"f-calendar-side"},[s.value.map(r=>e.createVNode("div",{class:"f-calendar-side-row"},[e.createVNode("div",{class:"f-calendar-side-row-number"},[r.part==="upper"?r.title:""])]))])])}function h(r){return{"f-calendar-day-view-item":!0,"f-calendar-day-view-item-upper":r.part==="upper","f-calendar-day-view-item-lower":r.part==="lower"}}function m(r){const b=(r.starts.hour||0)+(r.starts.minute||0)/60;return{height:`${44*((r.ends.hour||0)+(r.ends.minute||0)/60-b)-2-2-1-1}px`}}function k(){return s.value.map(r=>e.createVNode("div",{class:h(r)},[r.events.map(o=>e.createVNode("div",{class:"f-calendar-day-view-item-cell"},[o.events.length>0&&o.events.map(w=>e.createVNode("div",{class:"f-calendar-event",style:m(w)},[w.title]))]))]))}function d(){return e.createVNode("div",{ref:l,class:"f-calendar-content-primary"},[e.createVNode("div",{class:"f-calendar-content-data"},[k()])])}return e.onMounted(()=>{a.value&&a.value.scrollTo(0,250)}),()=>e.createVNode("div",{class:"f-calendar-day-view"},[N(),e.createVNode("div",{class:"f-calendar-day-view-content",ref:a},[u(),d()])])}}),A=e.defineComponent({name:"FCalendar",props:_,emits:[],setup(t){const{sameDay:a}=F(),{getToday:l}=G(),p=e.ref(t.firstDayOfTheWeek),f=e.ref(t.events),i=l(),c=e.ref({year:i.year||1,month:i.month||1,day:i.day||1}),s=e.ref(3),{getMonthlyCalendar:V,getWeeklyCalendar:n,getPreviousDay:v,getNextDay:g,getDayInPreviousWeek:N,getDayInNextWeek:u,getDayInPreviousMonth:h,getDayInNextMonth:m}=K(),k=e.computed(()=>`${L[c.value.month||1]} ${c.value.year}`),d=e.computed(()=>V(c.value.month||1,c.value.year||1,p.value)),r=e.computed(()=>n(c.value.day||1,c.value.month||1,c.value.year||1,p.value)),o=e.computed(()=>r.value.days.find(T=>a(T.date,c.value))||r.value.days[1]),w=e.computed(()=>{const T=r.value.days.findIndex(S=>a(S.date,c.value)),z=T>-1?T:1;return E[z]}),y=e.computed(()=>s.value===3),D=e.computed(()=>s.value===2),M=e.computed(()=>s.value===1);function b(T){s.value=T}function W(T){T===1&&(c.value=v(c.value)),T===2&&(c.value=N(c.value)),T===3&&(c.value=h(c.value))}function O(T){T===1&&(c.value=g(c.value)),T===2&&(c.value=u(c.value)),T===3&&(c.value=m(c.value))}function $(){c.value={year:i.year||1,month:i.month||1,day:i.day||1}}return()=>e.createVNode("div",{class:"f-calendar"},[e.createVNode(B,{activeView:s.value,title:k.value,onViewChange:T=>b(T),onPrevious:T=>W(T),onNext:T=>O(T),onResetToToday:()=>$()},null),e.createVNode("div",null,[M.value&&e.createVNode(q,{day:o.value,dayInWeek:w.value,events:f.value},null),D.value&&e.createVNode(I,{week:r.value,events:f.value},null),y.value&&e.createVNode(R,{activeDay:c.value,dates:d.value,events:f.value},null)])])}});function we(t,a,l){var w;const p="",f="",i=e.ref();function c(){return(a==null?void 0:a.schema.componentType)!=="frame"}function s(){return!1}function V(){return(a==null?void 0:a.schema.componentType)!=="frame"}function n(){return(a==null?void 0:a.schema.componentType)==="frame"}function v(y){if(!y||!y.value)return null;if(y.value.schema&&y.value.schema.type==="component")return y.value;const D=e.ref(y==null?void 0:y.value.parent),M=v(D);return M||null}function g(y=a){const{componentInstance:D,designerItemElementRef:M}=y;return!D||!D.value?null:D.value.canMove?M:g(y.parent)}function N(y){return!!l}function u(){return(a==null?void 0:a.schema.label)||(a==null?void 0:a.schema.title)||(a==null?void 0:a.schema.name)}function h(){}function m(y,D){}function k(y,D){const{componentType:M}=y;let b=x(M,y,D);const W=M.toLowerCase().replace(/-/g,"_");return b&&!b.id&&b.type===M&&(b.id=`${W}_${Math.random().toString().slice(2,6)}`),b}function d(y){}function r(...y){}function o(){a!=null&&a.schema.contents&&a.schema.contents.map(y=>{var b;let D=y.id;y.type==="component-ref"&&(D=y.component);const M=t.value.querySelector(`#${D}-design-item`);(b=M==null?void 0:M.componentInstance)!=null&&b.value.onRemoveComponent&&M.componentInstance.value.onRemoveComponent()})}return i.value={canMove:c(),canSelectParent:s(),canDelete:V(),canNested:!n(),contents:a==null?void 0:a.schema.contents,elementRef:t,parent:(w=a==null?void 0:a.parent)==null?void 0:w.componentInstance,schema:a==null?void 0:a.schema,styles:p,designerClass:f,canAccepts:N,getBelongedComponentInstance:v,getDraggableDesignItemElement:g,getDraggingDisplayText:u,getPropConfig:r,getDragScopeElement:h,onAcceptMovedChildElement:m,onChildElementMovedOut:d,addNewChildComponentSchema:k,triggerBelongedComponentToMoveWhenMoved:e.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:e.ref(!1),onRemoveComponent:o},i}const ge=e.defineComponent({name:"FCalendarDesign",props:_,emits:[],setup(t,a){const{sameDay:l}=F(),{getToday:p}=G(),f=e.ref(t.firstDayOfTheWeek),i=e.ref(t.events),c=p(),s=e.ref({year:c.year||1,month:c.month||1,day:c.day||1}),V=e.ref(3),n=e.ref(),v=e.inject("design-item-context"),g=we(n,v);e.onMounted(()=>{n.value.componentInstance=g}),a.expose(g.value);const{getMonthlyCalendar:N,getWeeklyCalendar:u,getPreviousDay:h,getNextDay:m,getDayInPreviousWeek:k,getDayInNextWeek:d,getDayInPreviousMonth:r,getDayInNextMonth:o}=K(),w=e.computed(()=>`${L[s.value.month||1]} ${s.value.year}`),y=e.computed(()=>N(s.value.month||1,s.value.year||1,f.value)),D=e.computed(()=>u(s.value.day||1,s.value.month||1,s.value.year||1,f.value)),M=e.computed(()=>D.value.days.find(P=>l(P.date,s.value))||D.value.days[1]),b=e.computed(()=>{const P=D.value.days.findIndex(ke=>l(ke.date,s.value)),Ve=P>-1?P:1;return E[Ve]}),W=e.computed(()=>V.value===3),O=e.computed(()=>V.value===2),$=e.computed(()=>V.value===1);function T(P){V.value=P}function z(P){P===1&&(s.value=h(s.value)),P===2&&(s.value=k(s.value)),P===3&&(s.value=r(s.value))}function S(P){P===1&&(s.value=m(s.value)),P===2&&(s.value=d(s.value)),P===3&&(s.value=o(s.value))}function H(){s.value={year:c.year||1,month:c.month||1,day:c.day||1}}return()=>e.createVNode("div",{ref:n,class:"f-calendar"},[e.createVNode(B,{activeView:V.value,title:w.value,onViewChange:P=>T(P),onPrevious:P=>z(P),onNext:P=>S(P),onResetToToday:()=>H()},null),e.createVNode("div",null,[$.value&&e.createVNode(q,{day:M.value,dayInWeek:b.value,events:i.value},null),O.value&&e.createVNode(I,{week:D.value,events:i.value},null),W.value&&e.createVNode(R,{activeDay:s.value,dates:y.value,events:i.value},null)])])}});A.install=t=>{t.component(A.name,A).component(q.name,q).component(B.name,B).component(R.name,R).component(I.name,I)},A.register=(t,a,l,p)=>{t.calendar=A,a.calendar=Q},A.registerDesigner=(t,a,l)=>{t.calendar=ge,a.calendar=Q},C.FCalendar=A,C.FCalendarDayView=q,C.FCalendarHeader=B,C.FCalendarMonthView=R,C.FCalendarWeekView=I,C.MonthTag=j,C.calendarProps=_,C.dayViewProps=ae,C.default=A,C.defaultNameOfMonths=L,C.headerProps=ee,C.monthViewProps=te,C.propsResolver=Q,C.weekDays=E,C.weekViewProps=ne,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.calendar={},C.Vue,C.LodashES))})(this,function(C,e,H){"use strict";const X={},Z={};function U(t){const{properties:n,title:i,ignore:h}=t,u=h&&Array.isArray(h),l=Object.keys(n).reduce((o,s)=>((!u||!h.find(V=>V===s))&&(o[s]=n[s].type==="object"&&n[s].properties?U(n[s]):H.cloneDeep(n[s].default)),o),{});if(i&&(!u||!h.find(o=>o==="id"))){const o=i.toLowerCase().replace(/-/g,"_");l.id=`${o}_${Math.random().toString().slice(2,6)}`}return l}function re(t){const{properties:n,title:i,required:h}=t;if(h&&Array.isArray(h)){const u=h.reduce((l,o)=>(l[o]=n[o].type==="object"&&n[o].properties?U(n[o]):H.cloneDeep(n[o].default),l),{});if(i&&h.find(l=>l==="id")){const l=i.toLowerCase().replace(/-/g,"_");u.id=`${l}_${Math.random().toString().slice(2,6)}`}return u}return{type:i}}function x(t,n={},i){const h=X[t];if(h){let u=re(h);const l=Z[t];return u=l?l({getSchemaByType:x},u,n,i):u,u}return null}function oe(t,n){const i=U(n);return Object.keys(i).reduce((h,u)=>(Object.prototype.hasOwnProperty.call(t,u)&&(h[u]&&H.isPlainObject(h[u])&&H.isPlainObject(t[u]||!t[u])?Object.assign(h[u],t[u]||{}):h[u]=t[u]),h),i),i}function ce(t,n){return Object.keys(t).filter(h=>t[h]!=null).reduce((h,u)=>{if(n.has(u)){const l=n.get(u);if(typeof l=="string")h[l]=t[u];else{const o=l(u,t[u],t);Object.assign(h,o)}}else h[u]=t[u];return h},{})}function se(t,n,i=new Map){const h=oe(t,n);return ce(h,i)}function le(t={}){function n(a,v,g,N){if(typeof g=="number")return N[a].length===g;if(typeof g=="object"){const d=Object.keys(g)[0],m=g[d];if(d==="not")return Number(N[a].length)!==Number(m);if(d==="moreThan")return Number(N[a].length)>=Number(m);if(d==="lessThan")return Number(N[a].length)<=Number(m)}return!1}function i(a,v,g,N){return N[a]&&N[a].propertyValue&&String(N[a].propertyValue.value)===String(g)}const h=new Map([["length",n],["getProperty",i]]);Object.keys(t).reduce((a,v)=>(a.set(v,t[v]),a),h);function u(a,v){const g=a;return typeof v=="number"?[{target:g,operator:"length",param:null,value:Number(v)}]:typeof v=="boolean"?[{target:g,operator:"getProperty",param:a,value:!!v}]:typeof v=="object"?Object.keys(v).map(N=>{if(N==="length")return{target:g,operator:"length",param:null,value:v[N]};const d=N,m=v[N];return{target:g,operator:"getProperty",param:d,value:m}}):[]}function l(a){return Object.keys(a).reduce((g,N)=>{const d=u(N,a[N]);return g.push(...d),g},[])}function o(a,v){if(h.has(a.operator)){const g=h.get(a.operator);return g&&g(a.target,a.param,a.value,v)||!1}return!1}function s(a,v){return l(a).reduce((d,m)=>d&&o(m,v),!0)}function V(a,v){const g=Object.keys(a),N=g.includes("allOf"),d=g.includes("anyOf"),m=N||d,f=(m?a[m?N?"allOf":"anyOf":"allOf"]:[a]).map(c=>s(c,v));return N?!f.includes(!1):f.includes(!0)}return{parseValueSchema:V}}const ie={},ue={};le();function de(t,n,i=new Map,h=(o,s,V,a)=>s,u={},l=o=>o){return X[n.title]=n,Z[n.title]=h,ie[n.title]=u,ue[n.title]=l,(o={})=>{const s=se(o,n,i),V=Object.keys(t).reduce((a,v)=>(a[v]=t[v].default,a),{});return Object.assign(V,s)}}function fe(t,n){return{customClass:n.class,customStyle:n.style}}const ye=new Map([["appearance",fe]]);function he(t,n,i){return n}const me={$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:{}}},required:["id","type"]},pe={title:"calendar",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},G={events:{Type:Array,default:[]},firstDayOfTheWeek:{type:String,default:"Sun."}},Q=de(G,me,ye,he,pe),E=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var j=(t=>(t[t.previous=1]="previous",t[t.current=2]="current",t[t.next=3]="next",t))(j||{});function L(){function t(){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 i(a){const v=new Date;return a.year||(a.year=v.getFullYear()),a.month||(a.month=v.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 h(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 E.indexOf(a)}function l(a){return n(a).getTime()}function o(a){return Math.round(l(a)/1e3)}function s(a,v,g){const N=l(v),d=l(g),m=l(a);return d-m>m-N?v:g}function V(){const a=new Date;return{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate(),hour:a.getHours(),minute:a.getMinutes(),second:a.getSeconds()}}return{emptyDate:t,getDate:n,getDate2:i,getDayNumber:h,getEpocTime:o,getNearDate:s,getWeekdayIndex:u,getTimeInMilliseconds:l,getToday:V}}function ve(){function t(l,o){return new Date(o,l,0).getDate()}function n(l,o,s){return new Date(l,o-1,s,0,0,0,0)}function i(l,o){const s=n(o,l,1);return s.setMonth(s.getMonth()-1),t(s.getMonth()+1,s.getFullYear())}function h(l,o){const s={year:l===12?o+1:o},V=l===12?1:l+1;return s.month=V,s}function u(l,o){const s={year:l===1?o-1:o},V=l===1?12:l-1;return s.month=V,s}return{daysInMonth:t,daysInPreMonth:i,getNextMonth:h,getPreviousMonth:u}}function K(){const{getToday:t,getDayNumber:n}=L(),{daysInMonth:i,daysInPreMonth:h,getNextMonth:u,getPreviousMonth:l}=ve();function o(p){const k=E.indexOf(p);return k>0?7-k:0}function s(p){const{day:k,month:f,year:r}=p;if(k===void 0||f===void 0||r===void 0)throw new Error("invalided date.");const c=k===1,w=c?h(f,r):k-1,y=c?f-1:f,D=y<1,M=D?12:y;return{year:D?r-1:r,month:M,day:w}}function V(p){const{day:k,month:f,year:r}=p;if(k===void 0||f===void 0||r===void 0)throw new Error("invalided date.");const c=i(f,r),w=k===c,y=w?1:k+1,D=w?f+1:f,M=D>12,b=M?1:D;return{year:M?r+1:r,month:b,day:y}}function a(p){const k=l(p.month||1,p.year||1),f=i(k.month||1,k.year||1);return{day:(p.day||1)<=f?p.day:f,month:k.month,year:k.year}}function v(p){const k=u(p.month||1,p.year||1),f=i(k.month||1,k.year||1);return{day:(p.day||1)<=f?p.day:f,month:k.month,year:k.year}}function g(p){const f=(p.day||1)-7,r=f<1,c=r?i(p.month||1,p.year||1)+f:f,w=r?l(p.month||1,p.year||1):p;return{day:c,month:w.month,year:w.year}}function N(p){const f=(p.day||1)+7,r=i(p.month||1,p.year||1),c=f>r,w=c?f-r:f,y=c?u(p.month||1,p.year||1):p;return{day:w,month:y.month,year:y.year}}function d(p,k,f,r){const c={day:p,month:k,year:f},y=o(r)===0?1:0,D=n(c)+y,M=t();let b=s(c);const W=[];for(let S=D-1;S>=1;S--){const _=b.month!==c.month?j.previous:j.current,P=b.month===k&&b.day===M.day&&b.month===M.month&&b.year===M.year;W.push({date:b,monthTag:_,isCurrent:P}),S>1&&(b=s(b))}let O=V(c);const $=[];for(let S=D+1;S<=7;S++){const _=b.month!==c.month?j.next:j.current,P=O.day===M.day&&O.month===M.month&&O.year===M.year;$.push({date:O,monthTag:_,isCurrent:P}),S<7&&(O=V(O))}const T=p===M.day&&k===M.month&&f===M.year;return{days:[...W.reverse(),{date:c,monthTag:j.current,isCurrent:T},...$],weekNumber:0,year:f}}function m(p,k,f){const r=[],c=i(p,k);for(let w=1;w<=c;w+=7){const y=d(w,p,k,f);r.push(y)}return r}return{getMonthlyCalendar:m,getWeeklyCalendar:d,getPreviousDay:s,getNextDay:V,getDayInPreviousWeek:g,getDayInNextWeek:N,getDayInPreviousMonth:a,getDayInNextMonth:v}}function F(){const{getTimeInMilliseconds:t}=L();function n(d){return d&&d.year!==0&&d.month!==0&&d.day!==0}function i(d){return d&&d.year!==0&&d.month!==0}function h(d){return d&&d.year!==0}function u(d,m){return t(d)<t(m)}function l(d,m){return t(d)<=t(m)}function o(d,m){return t(d)===t(m)}function s(d,m){const p=t(m);return t(d.from)===p||t(d.to)===p}function V(d,m){return!m||!n(m.to)||!n(m.from)?!1:l(m.from,d)&&l(d,m.to)}function a(d,m){return n(m)&&t(d)>=t(m)}function v(d,m){return n(m)&&t(d)<=t(m)}function g(d,m){return t({year:d.year,month:d.month,day:d.day})===t({year:m.year,month:m.month,day:m.day})}function N(d,m){return t({hour:d.hour,minute:d.minute,second:d.second})===t({hour:m.hour,minute:m.minute,second:m.second})}return{isDateEarlier:u,equal:o,inPeriod:V,isPoint:s,equalOrEarlier:l,isInitializedDate:n,isInitializedMonth:i,isInitializedYear:h,isMonthDisabledByDisableSince:a,isMonthDisabledByDisableUntil:v,sameTime:N,sameDay:g}}const Y={1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"},ee={activeView:{Type:Number,default:3},title:{Type:String,default:""},dailyViewTitle:{Type:String,default:"Day"},weeklyViewTitle:{Type:String,default:"Week"},monthlyViewTitle:{Type:String,default:"Month"}},B=e.defineComponent({name:"FCalendarHeader",props:ee,emits:["ViewChange","Previous","Next","ResetToToday"],setup(t,n){const i=e.ref(t.title),h=e.ref(t.dailyViewTitle),u=e.ref(t.weeklyViewTitle),l=e.ref(t.monthlyViewTitle),o=2,s=62,V=e.ref(t.activeView),a=e.ref("Today");e.watch(()=>t.title,()=>{i.value=t.title});const v=e.computed(()=>({top:`${o}px`,left:`${V.value*(o+1)+(V.value-1)*(s+1)}px`})),g=e.computed(()=>V.value===1?h.value:V.value===2?u.value:l.value);function N(){V.value=1,n.emit("ViewChange",1)}function d(){V.value=2,n.emit("ViewChange",2)}function m(){V.value=3,n.emit("ViewChange",3)}function p(){n.emit("Previous",V.value)}function k(){n.emit("Next",V.value)}function f(){n.emit("ResetToToday")}return()=>e.createVNode("div",{class:"f-calendar-header"},[e.createVNode("div",{class:"f-calendar-title"},[i.value]),e.createVNode("div",{class:"f-calendar-navigator"},[e.createVNode("div",{class:"f-calendar-navigator-today btn btn-default",onClick:()=>f()},[a.value]),e.createVNode("div",{class:"f-calendar-navigator-button-group"},[e.createVNode("div",{class:"f-calendar-navigator-previous btn btn-default",onClick:()=>p()},[e.createVNode("i",{class:"f-icon f-icon-arrow-chevron-left"},null)]),e.createVNode("div",{class:"f-calendar-navigator-next btn btn-default",onClick:()=>k()},[e.createVNode("i",{class:"f-icon f-icon-arrow-chevron-right"},null)])])]),e.createVNode("div",{class:"f-calendar-view-switch"},[e.createVNode("div",{class:"f-calendar-view-switch-panel"},[e.createVNode("span",{class:"f-calendar-view-switch-daily",onClick:r=>N()},[h.value]),e.createVNode("span",{class:"f-calendar-view-switch-weekly",onClick:r=>d()},[u.value]),e.createVNode("span",{class:"f-calendar-view-switch-monthly",onClick:r=>m()},[l.value])]),e.createVNode("div",{class:"f-calendar-view-switch-active-view",style:v.value},[g.value])])])}}),te={dates:{Type:Array,default:[]},daysInWeek:{Type:Array,default:E},enableKeyboadNavigate:{Type:Boolean,default:!0},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]},activeDay:{Type:Object,default:null}};var z=(t=>(t[t.enter=13]="enter",t[t.esc=27]="esc",t[t.space=32]="space",t[t.leftArrow=37]="leftArrow",t[t.upArrow=38]="upArrow",t[t.rightArrow=39]="rightArrow",t[t.downArrow=40]="downArrow",t[t.tab=9]="tab",t[t.shift=16]="shift",t))(z||{});function we(){function t(n){const i=n.key||n.keyCode;return i==="Enter"||i===13?13:i==="Escape"||i===27?27:i===" "||i===32?32:i==="ArrowLeft"||i===37?37:i==="ArrowUp"||i===38?38:i==="ArrowRight"||i===39?39:i==="ArrowDown"||i===40?40:i==="Tab"||i===9?9:i==="Shift"||i===16?16:-1}return{getKeyCodeFromEvent:t}}const R=e.defineComponent({name:"FCalendarMonthView",props:te,emits:["click","keyDown"],setup(t,n){const i=e.ref(t.daysInWeek),h=e.ref(t.enableKeyboadNavigate),u=e.ref(t.enableMarkCurrent),l=e.ref(t.activeDay),o=e.ref(t.events),{equal:s,sameDay:V}=F(),{getKeyCodeFromEvent:a}=we();function v(f,r){return f.forEach(c=>{c.days.forEach(w=>{const y=r.filter(D=>V(D.starts,w.date));y&&y.length&&(w.events=[...y])})}),f}const g=e.ref(v(t.dates,o.value));e.watch(()=>t.dates,()=>{g.value=v(t.dates,o.value)}),e.watch(()=>t.activeDay,()=>{l.value=t.activeDay}),e.watch(()=>t.events,()=>{o.value=t.events});function N(f){return!!l.value&&s({year:l.value.year,month:l.value.month,day:l.value.day},f)}const d=(f,r,c)=>{const y={"f-datepicker-no-currmonth":f.monthTag===j.previous||f.monthTag===j.next},D=`d_${r}_${c}`;return y[D]=!0,y},m=f=>{const r=f.monthTag===j.current&&N(f.date),c=f.isCurrent&&u.value;return{"f-calendar-month-view-date":!0,"f-calendar-month-view-selected":r,"f-calendar-month-view-current":c}};function p(f,r){f.stopPropagation(),n.emit("click",r.date)}function k(f,r){const c=a(f);c!==z.tab&&(f.preventDefault(),c===z.enter||c===z.space?p(f,r):h.value&&n.emit("keyDown",r.date))}return()=>e.createVNode("div",{class:"f-calendar-month-view"},[e.createVNode("table",{class:"f-datepicker-table",cellpadding:"0"},[e.createVNode("thead",null,[e.createVNode("tr",null,[i.value&&i.value.map(f=>e.createVNode("th",{scope:"col",style:"padding: 4px 4px 8px"},[f]))])]),e.createVNode("tbody",null,[g.value&&g.value.map((f,r)=>e.createVNode("tr",null,[f.days&&f.days.map((c,w)=>e.createVNode("td",{id:`d_${r}_${w}`,tabindex:"0",class:d(c,r,w),onClick:y=>p(y,c),onKeydown:y=>k(y,c)},[e.createVNode("div",{class:"f-calendar-month-view-title"},[e.createVNode("div",{class:m(c)},[c.date.day]),e.createVNode("div",{class:"f-calendar-month-view-date-month"},[c.date.day===1?Y[c.date.month||1]:""])]),c.events&&c.events.length&&c.events.map(y=>e.createVNode("div",{class:"f-calendar-month-view-event-item"},[y.title]))]))]))])])])}}),ne={daysInWeek:{Type:Array,default:E},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]},week:{Type:Object,default:{days:[],weekNumber:0,year:0}}},I=e.defineComponent({name:"FCalendarWeekView",props:ne,emits:[],setup(t){const n=e.ref(),i=e.ref(),h=e.ref(t.daysInWeek),u=e.ref(t.week),l=e.ref(t.enableMarkCurrent),o=e.ref(t.events),s=e.ref([]),{equal:V}=F();function a(r){return u.value.days.map(w=>{const y={year:w.date.year,month:w.date.month,day:w.date.day,hour:r.hour,minute:r.minute,second:r.second},D=o.value.filter(M=>V(M.starts,y));return{day:y,events:D}})}function v(){const r=[];for(let c=0;c<24;c++){const w={hour:c,minute:0,second:0},y={hour:c,minute:30,second:0},D=a(w),M=a(y);r.push({time:w,events:D,title:c>0?`${c}:00`:"",part:"upper"}),r.push({time:y,events:M,title:`${c}:30`,part:"lower"})}s.value=r}v(),e.watch(()=>t.week,()=>{u.value=t.week,v()}),e.watch(()=>t.events,()=>{o.value=t.events,v()});const g=r=>({"f-calendar-week-view-date":!0,"f-calendar-week-view-current":r.isCurrent&&l.value});function N(){return e.createVNode("div",{class:"f-calendar-week-view-header"},[e.createVNode("div",{class:"f-calendar-week-view-header-corner"},null),e.createVNode("div",{class:"f-calendar-week-view-header-primary"},[e.createVNode("div",{class:"f-calendar-week-view-header-columns"},[h.value.map((r,c)=>e.createVNode("div",{class:"f-calendar-week-view-header-cell"},[e.createVNode("div",{class:g(u.value.days[c])},[u.value.days[c].date.day]),e.createVNode("span",null,[r])]))])])])}function d(){return e.createVNode("div",{class:"f-calendar-week-view-content-side"},[e.createVNode("div",{class:"f-calendar-side"},[s.value.map(r=>e.createVNode("div",{class:"f-calendar-side-row"},[e.createVNode("div",{class:"f-calendar-side-row-number"},[r.part==="upper"?r.title:""])]))])])}function m(r){return{"f-calendar-week-view-item":!0,"f-calendar-week-view-item-upper":r.part==="upper","f-calendar-week-view-item-lower":r.part==="lower"}}function p(r){const b=(r.starts.hour||0)+(r.starts.minute||0)/60;return{height:`${44*((r.ends.hour||0)+(r.ends.minute||0)/60-b)-2-2-1-1}px`}}function k(){return s.value.map(r=>e.createVNode("div",{class:m(r)},[r.events.map(c=>e.createVNode("div",{class:"f-calendar-week-view-item-cell"},[c.events.length>0&&c.events.map(w=>e.createVNode("div",{class:"f-calendar-event",style:p(w)},[w.title]))]))]))}function f(){return e.createVNode("div",{ref:i,class:"f-calendar-content-primary"},[e.createVNode("div",{class:"f-calendar-content-data"},[k()])])}return e.onMounted(()=>{n.value&&n.value.scrollTo(0,250)}),()=>e.createVNode("div",{class:"f-calendar-week-view"},[N(),e.createVNode("div",{class:"f-calendar-week-view-content",ref:n},[d(),f()])])}}),ae={day:{Type:Object,default:{}},dayInWeek:{Type:String,default:""},enableMarkCurrent:{Type:Boolean,default:!0},events:{Type:Array,default:[]}},q=e.defineComponent({name:"FCalendarDayView",props:ae,emits:[],setup(t){const n=e.ref(),i=e.ref(),h=e.ref(t.dayInWeek),u=e.ref(t.day),l=e.ref(t.enableMarkCurrent),o=e.ref(t.events),s=e.ref([]),{equal:V}=F();function a(r){const c={year:u.value.date.year,month:u.value.date.month,day:u.value.date.day,hour:r.hour,minute:r.minute,second:r.second},w=o.value.filter(y=>V(y.starts,c));return[{day:c,events:w}]}function v(){const r=[];for(let c=0;c<24;c++){const w={hour:c,minute:0,second:0},y={hour:c,minute:30,second:0},D=a(w),M=a(y);r.push({time:w,events:D,title:c>0?`${c}:00`:"",part:"upper"}),r.push({time:y,events:M,title:`${c}:30`,part:"lower"})}s.value=r}v(),e.watch(()=>t.day,()=>{u.value=t.day,v()}),e.watch(()=>t.events,()=>{o.value=t.events,v()});const g=r=>({"f-calendar-day-view-date":!0,"f-calendar-day-view-current":r.isCurrent&&l.value});function N(){return e.createVNode("div",{class:"f-calendar-day-view-header"},[e.createVNode("div",{class:"f-calendar-day-view-header-corner"},null),e.createVNode("div",{class:"f-calendar-day-view-header-primary"},[e.createVNode("div",{class:"f-calendar-day-view-header-columns"},[e.createVNode("div",{class:"f-calendar-day-view-header-cell"},[e.createVNode("div",{class:g(u.value)},[u.value.date.day]),e.createVNode("span",null,[h.value])])])])])}function d(){return e.createVNode("div",{class:"f-calendar-day-view-content-side"},[e.createVNode("div",{class:"f-calendar-side"},[s.value.map(r=>e.createVNode("div",{class:"f-calendar-side-row"},[e.createVNode("div",{class:"f-calendar-side-row-number"},[r.part==="upper"?r.title:""])]))])])}function m(r){return{"f-calendar-day-view-item":!0,"f-calendar-day-view-item-upper":r.part==="upper","f-calendar-day-view-item-lower":r.part==="lower"}}function p(r){const b=(r.starts.hour||0)+(r.starts.minute||0)/60;return{height:`${44*((r.ends.hour||0)+(r.ends.minute||0)/60-b)-2-2-1-1}px`}}function k(){return s.value.map(r=>e.createVNode("div",{class:m(r)},[r.events.map(c=>e.createVNode("div",{class:"f-calendar-day-view-item-cell"},[c.events.length>0&&c.events.map(w=>e.createVNode("div",{class:"f-calendar-event",style:p(w)},[w.title]))]))]))}function f(){return e.createVNode("div",{ref:i,class:"f-calendar-content-primary"},[e.createVNode("div",{class:"f-calendar-content-data"},[k()])])}return e.onMounted(()=>{n.value&&n.value.scrollTo(0,250)}),()=>e.createVNode("div",{class:"f-calendar-day-view"},[N(),e.createVNode("div",{class:"f-calendar-day-view-content",ref:n},[d(),f()])])}}),A=e.defineComponent({name:"FCalendar",props:G,emits:[],setup(t){const{sameDay:n}=F(),{getToday:i}=L(),h=e.ref(t.firstDayOfTheWeek),u=e.ref(t.events),l=i(),o=e.ref({year:l.year||1,month:l.month||1,day:l.day||1}),s=e.ref(3),{getMonthlyCalendar:V,getWeeklyCalendar:a,getPreviousDay:v,getNextDay:g,getDayInPreviousWeek:N,getDayInNextWeek:d,getDayInPreviousMonth:m,getDayInNextMonth:p}=K(),k=e.computed(()=>`${Y[o.value.month||1]} ${o.value.year}`),f=e.computed(()=>V(o.value.month||1,o.value.year||1,h.value)),r=e.computed(()=>a(o.value.day||1,o.value.month||1,o.value.year||1,h.value)),c=e.computed(()=>r.value.days.find(T=>n(T.date,o.value))||r.value.days[1]),w=e.computed(()=>{const T=r.value.days.findIndex(S=>n(S.date,o.value)),J=T>-1?T:1;return E[J]}),y=e.computed(()=>s.value===3),D=e.computed(()=>s.value===2),M=e.computed(()=>s.value===1);function b(T){s.value=T}function W(T){T===1&&(o.value=v(o.value)),T===2&&(o.value=N(o.value)),T===3&&(o.value=m(o.value))}function O(T){T===1&&(o.value=g(o.value)),T===2&&(o.value=d(o.value)),T===3&&(o.value=p(o.value))}function $(){o.value={year:l.year||1,month:l.month||1,day:l.day||1}}return()=>e.createVNode("div",{class:"f-calendar"},[e.createVNode(B,{activeView:s.value,title:k.value,onViewChange:T=>b(T),onPrevious:T=>W(T),onNext:T=>O(T),onResetToToday:()=>$()},null),e.createVNode("div",null,[M.value&&e.createVNode(q,{day:c.value,dayInWeek:w.value,events:u.value},null),D.value&&e.createVNode(I,{week:r.value,events:u.value},null),y.value&&e.createVNode(R,{activeDay:o.value,dates:f.value,events:u.value},null)])])}});function ge(t,n,i){var w;const h="",u="",l=e.ref();function o(){return(n==null?void 0:n.schema.componentType)!=="frame"}function s(){return!1}function V(){return(n==null?void 0:n.schema.componentType)!=="frame"}function a(){return(n==null?void 0:n.schema.componentType)==="frame"}function v(y){if(!y||!y.value)return null;if(y.value.schema&&y.value.schema.type==="component")return y.value;const D=e.ref(y==null?void 0:y.value.parent),M=v(D);return M||null}function g(y=n){const{componentInstance:D,designerItemElementRef:M}=y;return!D||!D.value?null:D.value.canMove?M:g(y.parent)}function N(y){return!!i}function d(){return(n==null?void 0:n.schema.label)||(n==null?void 0:n.schema.title)||(n==null?void 0:n.schema.name)}function m(){}function p(y,D){}function k(y,D){const{componentType:M}=y;let b=x(M,y,D);const W=M.toLowerCase().replace(/-/g,"_");return b&&!b.id&&b.type===M&&(b.id=`${W}_${Math.random().toString().slice(2,6)}`),b}function f(y){}function r(...y){}function c(){n!=null&&n.schema.contents&&n.schema.contents.map(y=>{var b;let D=y.id;y.type==="component-ref"&&(D=y.component);const M=t.value.querySelector(`#${D}-design-item`);(b=M==null?void 0:M.componentInstance)!=null&&b.value.onRemoveComponent&&M.componentInstance.value.onRemoveComponent()})}return l.value={canMove:o(),canSelectParent:s(),canDelete:V(),canNested:!a(),contents:n==null?void 0:n.schema.contents,elementRef:t,parent:(w=n==null?void 0:n.parent)==null?void 0:w.componentInstance,schema:n==null?void 0:n.schema,styles:h,designerClass:u,canAccepts:N,getBelongedComponentInstance:v,getDraggableDesignItemElement:g,getDraggingDisplayText:d,getPropConfig:r,getDragScopeElement:m,onAcceptMovedChildElement:p,onChildElementMovedOut:f,addNewChildComponentSchema:k,triggerBelongedComponentToMoveWhenMoved:e.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:e.ref(!1),onRemoveComponent:c},l}const Ve=e.defineComponent({name:"FCalendarDesign",props:G,emits:[],setup(t,n){const{sameDay:i}=F(),{getToday:h}=L(),u=e.ref(t.firstDayOfTheWeek),l=e.ref(t.events),o=h(),s=e.ref({year:o.year||1,month:o.month||1,day:o.day||1}),V=e.ref(3),a=e.ref(),v=e.inject("design-item-context"),g=ge(a,v);e.onMounted(()=>{a.value.componentInstance=g}),n.expose(g.value);const{getMonthlyCalendar:N,getWeeklyCalendar:d,getPreviousDay:m,getNextDay:p,getDayInPreviousWeek:k,getDayInNextWeek:f,getDayInPreviousMonth:r,getDayInNextMonth:c}=K(),w=e.computed(()=>`${Y[s.value.month||1]} ${s.value.year}`),y=e.computed(()=>N(s.value.month||1,s.value.year||1,u.value)),D=e.computed(()=>d(s.value.day||1,s.value.month||1,s.value.year||1,u.value)),M=e.computed(()=>D.value.days.find(P=>i(P.date,s.value))||D.value.days[1]),b=e.computed(()=>{const P=D.value.days.findIndex(Ne=>i(Ne.date,s.value)),ke=P>-1?P:1;return E[ke]}),W=e.computed(()=>V.value===3),O=e.computed(()=>V.value===2),$=e.computed(()=>V.value===1);function T(P){V.value=P}function J(P){P===1&&(s.value=m(s.value)),P===2&&(s.value=k(s.value)),P===3&&(s.value=r(s.value))}function S(P){P===1&&(s.value=p(s.value)),P===2&&(s.value=f(s.value)),P===3&&(s.value=c(s.value))}function _(){s.value={year:o.year||1,month:o.month||1,day:o.day||1}}return()=>e.createVNode("div",{ref:a,class:"f-calendar"},[e.createVNode(B,{activeView:V.value,title:w.value,onViewChange:P=>T(P),onPrevious:P=>J(P),onNext:P=>S(P),onResetToToday:()=>_()},null),e.createVNode("div",null,[$.value&&e.createVNode(q,{day:M.value,dayInWeek:b.value,events:l.value},null),O.value&&e.createVNode(I,{week:D.value,events:l.value},null),W.value&&e.createVNode(R,{activeDay:s.value,dates:y.value,events:l.value},null)])])}});A.install=t=>{t.component(A.name,A).component(q.name,q).component(B.name,B).component(R.name,R).component(I.name,I)},A.register=(t,n,i,h)=>{t.calendar=A,n.calendar=Q},A.registerDesigner=(t,n,i)=>{t.calendar=Ve,n.calendar=Q},C.FCalendar=A,C.FCalendarDayView=q,C.FCalendarHeader=B,C.FCalendarMonthView=R,C.FCalendarWeekView=I,C.MonthTag=j,C.calendarProps=G,C.dayViewProps=ae,C.default=A,C.defaultNameOfMonths=Y,C.headerProps=ee,C.monthViewProps=te,C.propsResolver=Q,C.weekDays=E,C.weekViewProps=ne,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|