@nocobase/plugin-calendar 1.3.21-beta → 1.3.22-beta

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.
@@ -100,4 +100,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
100
100
  border-bottom-left-radius: 0;
101
101
  border-bottom-right-radius: 0;
102
102
  }
103
- `;yf.displayName="GlobalStyle";const uD=()=>{const e=x.useDataBlockHeight(),{heightProps:t}=x.useBlockHeightProps(),{title:r}=t,{token:n}=ye.theme.useToken();if(!e)return;const a=2*n.paddingLG,i=r?n.fontSizeLG*n.lineHeightLG+n.padding*2-1:0;return e-a-i},cD=x.genStyleHook("nb-calendar",e=>{const{componentCls:t}=e;return{[t]:{".rbc-btn":{color:"inherit",font:"inherit",margin:"0"},"button.rbc-btn":{overflow:"visible",textTransform:"none",WebkitAppearance:"button",cursor:"pointer"},"button[disabled].rbc-btn":{cursor:"not-allowed"},"button.rbc-input::-moz-focus-inner":{border:"0",padding:"0"},".rbc-button-link":{border:"none",backgroundColor:"transparent"},".rbc-calendar":{boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"stretch",height:"100%"},".rbc-calendar *,\n.rbc-calendar *:before,\n.rbc-calendar *:after":{boxSizing:"inherit"},".rbc-abs-full,\n.rbc-row-bg":{overflow:"hidden",position:"absolute",top:"0",left:"0",right:"0",bottom:"0"},".rbc-ellipsis,\n.rbc-event-label,\n.rbc-row-segment .rbc-event-content,\n.rbc-show-more":{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},".rbc-rtl":{direction:"rtl"},".rbc-off-range":{color:e.colorTextDisabled},".rbc-header":{overflow:"hidden",flex:"1 0 0%",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:`${e.paddingXXS}px ${e.paddingSM}px`,verticalAlign:"middle",minHeight:e.sizeXL,color:e.colorText,margin:`0 ${e.marginXXS}px`,borderBottom:`2px solid ${e.colorBorderSecondary}`},".rbc-rtl .rbc-header + .rbc-header":{borderLeftWidth:"0",borderRight:`1px solid ${e.colorBorderSecondary}`},".rbc-header > a,\n.rbc-header > a:active,\n.rbc-header > a:visited":{color:"inherit",textDecoration:"none"},".rbc-row-content":{position:"relative",userSelect:"none",WebkitUserSelect:"none",zIndex:4},".rbc-row-content-scrollable":{display:"flex",flexDirection:"column",height:"100%"},".rbc-row-content-scrollable .rbc-row-content-scroll-container":{height:"100%",overflowY:"scroll",msOverflowStyle:"none",scrollbarWidth:"none"},".rbc-row-content-scrollable .rbc-row-content-scroll-container::-webkit-scrollbar":{display:"none"},".rbc-toolbar":{display:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",marginBottom:e.marginXS,fontSize:e.fontSize},".rbc-toolbar .rbc-toolbar-label":{flexGrow:1,padding:`0 ${e.paddingXS}px`,textAlign:"center"},".rbc-toolbar button":{outline:"none",fontSize:e.fontSize,lineHeight:[e.lineHeight,"normal"],height:e.controlHeight,color:e.colorTextLabel,display:"inline-block",margin:"0",position:"relative",zIndex:1,textAlign:"center",verticalAlign:"middle",background:"none",backgroundImage:"none",border:`1px solid ${e.colorBorder}`,padding:`${e.paddingXXS}px ${e.paddingSM+e.paddingXXS}px`,borderRadius:e.borderRadiusXS,whiteSpace:"nowrap"},".rbc-toolbar button:active,\n.rbc-toolbar button.rbc-active":{zIndex:2,color:"#1890ff",borderColor:"#1890ff"},".rbc-toolbar button:active:hover,\n.rbc-toolbar button:active:focus,\n.rbc-toolbar button.rbc-active:hover,\n.rbc-toolbar button.rbc-active:focus":{zIndex:2,color:"#40a9ff",borderColor:"#40a9ff"},".rbc-toolbar button:hover":{zIndex:2,color:"#40a9ff",borderColor:"#40a9ff"},".rbc-btn-group":{display:"inline-block",whiteSpace:"nowrap"},".rbc-btn-group > button:first-child:not(:last-child)":{borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-btn-group > button:last-child:not(:first-child)":{borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-rtl .rbc-btn-group > button:first-child:not(:last-child)":{borderRadius:"4px",borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-rtl .rbc-btn-group > button:last-child:not(:first-child)":{borderRadius:"4px",borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-btn-group > button:not(:first-child):not(:last-child)":{borderRadius:"0"},".rbc-btn-group button + button":{marginLeft:"-1px"},".rbc-rtl .rbc-btn-group button + button":{marginLeft:"0",marginRight:"-1px"},".rbc-btn-group + .rbc-btn-group,\n.rbc-btn-group + button":{marginLeft:"10px"},".rbc-event":{border:"none",boxSizing:"border-box",boxShadow:"none",margin:"0",padding:"2px 5px",backgroundColor:e.colorBorderSecondary,borderRadius:e.borderRadiusXS,cursor:"pointer",fontSize:e.fontSizeSM,width:"100%",textAlign:"left","&:hover":{backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText}},".rbc-slot-selecting .rbc-event":{cursor:"inherit",pointerEvents:"none"},".rbc-event.rbc-selected":{backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText},".rbc-event-label":{fontSize:"80%"},".rbc-event-overlaps":{boxShadow:"-1px 1px 5px 0px rgba(51, 51, 51, 0.5)"},".rbc-event-continues-prior":{borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-event-continues-after":{borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-event-continues-earlier":{borderTopLeftRadius:"0",borderTopRightRadius:"0"},".rbc-event-continues-later":{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},".rbc-row":{display:"flex",flexDirection:"row"},".rbc-row-segment":{padding:"0 4px 1px 4px"},".rbc-selected-cell":{backgroundColor:"rgba(0, 0, 0, 0.1)"},".rbc-show-more":{zIndex:4,fontWeight:"bold",fontSize:"85%",height:"auto",lineHeight:"normal",color:"inherit",padding:"2px 5px"},".rbc-month-view":{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 0",width:"100%",userSelect:"none",WebkitUserSelect:"none",height:"68vh",".rbc-day-bg":{borderTop:`2px solid ${e.colorBorderSecondary}`},".rbc-today":{borderColor:`${e.colorPrimaryBorder} !important`,backgroundColor:`${e.colorPrimaryBg} !important`},".rbc-header":{borderBottom:"0 !important"}},".rbc-month-header":{display:"flex",flexDirection:"row"},".rbc-month-row":{display:"flex",position:"relative",flexDirection:"column",flex:"1 0 0",flexBasis:"0px",overflow:"hidden",height:"100%"},".rbc-date-cell":{flex:"1 1 0",minWidth:"0",paddingLeft:"12px",paddingTop:"4px"},".rbc-date-cell.rbc-now span":{color:"#1890ff"},".rbc-date-cell a,\n.rbc-date-cell a:active,\n.rbc-date-cell a:visited":{color:"inherit",textDecoration:"none"},".rbc-date-cell a:hover":{color:"#1890ff"},".rbc-date-cell .rbc-date-solar":{fontWeight:500},".rbc-date-cell .rbc-date-lunar":{paddingLeft:"12px"},".rbc-date-cell:not(.rbc-off-range) .rbc-date-lunar":{color:"#aaa"},".rbc-date-cell .rbc-date-lunar:hover":{color:"inherit"},".rbc-row-bg":{display:"flex",flexDirection:"row",flex:"1 0 0",overflow:"hidden"},".rbc-day-bg":{flex:"1 0 0%",margin:"0 4px","&:hover":{background:e.colorFillQuaternary}},".rbc-agenda-view":{display:"flex",flexDirection:"column",flex:"1 0 0",overflow:"auto"},".rbc-agenda-view table.rbc-agenda-table":{width:"100%",border:"1px solid #f0f0f0",borderSpacing:"0",borderCollapse:"collapse"},".rbc-agenda-view table.rbc-agenda-table tbody > tr > td":{padding:"5px 10px",verticalAlign:"top"},".rbc-agenda-view table.rbc-agenda-table .rbc-agenda-time-cell":{paddingLeft:"15px",paddingRight:"15px",textTransform:"lowercase"},".rbc-agenda-view table.rbc-agenda-table tbody > tr > td + td":{borderLeft:"1px solid #f0f0f0"},".rbc-rtl .rbc-agenda-view table.rbc-agenda-table tbody > tr > td + td":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-agenda-view table.rbc-agenda-table tbody > tr + tr":{borderTop:"1px solid #f0f0f0"},".rbc-agenda-view table.rbc-agenda-table thead > tr > th":{padding:"3px 5px",textAlign:"left",borderBottom:"1px solid #f0f0f0"},".rbc-rtl .rbc-agenda-view table.rbc-agenda-table thead > tr > th":{textAlign:"right"},".rbc-agenda-time-cell":{textTransform:"lowercase"},".rbc-agenda-time-cell .rbc-continues-after:after":{content:"' »'"},".rbc-agenda-time-cell .rbc-continues-prior:before":{content:"'« '"},".rbc-agenda-date-cell,\n.rbc-agenda-time-cell":{whiteSpace:"nowrap"},".rbc-agenda-event-cell":{width:"100%"},".rbc-time-column":{display:"flex",flexDirection:"column",minHeight:"100%"},".rbc-time-column .rbc-timeslot-group":{flex:1},".rbc-timeslot-group":{borderBottom:"1px solid #f0f0f0",minHeight:"40px",lineHeight:"39px",display:"flex",flexFlow:"column nowrap","&:hover":{background:"#f0f0f0"}},".rbc-time-gutter,\n.rbc-header-gutter":{flex:"none"},".rbc-label":{padding:"0 5px"},".rbc-day-slot":{position:"relative"},".rbc-day-slot .rbc-events-container":{bottom:"0",left:"0",position:"absolute",right:"0",marginRight:"10px",top:"0"},".rbc-day-slot .rbc-events-container.rbc-rtl":{left:"10px",right:"0"},".rbc-day-slot .rbc-event":{border:"1px solid #265985",display:"flex",maxHeight:"100%",minHeight:"20px",flexFlow:"column wrap",alignItems:"flex-start",overflow:"hidden",position:"absolute"},".rbc-day-slot .rbc-event-label":{flex:"none",paddingRight:"5px",width:"auto"},".rbc-day-slot .rbc-event-content":{width:"100%",flex:"1 1 0",wordWrap:"break-word",lineHeight:1,height:"100%",minHeight:"1em"},".rbc-time-header-gutter":{lineHeight:"40px"},".rbc-time-header-cell":{minHeight:"32px !important"},".rbc-time-header-cell .rbc-header":{display:"flex"},".rbc-time-header-cell .rbc-header.rbc-today":{borderColor:e.colorPrimaryBorder,backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText},".rbc-time-header-cell .rbc-header a":{display:"flex",flexDirection:"column"},".rbc-time-header-cell .rbc-date-wrap":{display:"flex",alignItems:"center"},".rbc-time-header-cell .rbc-date-solar":{fontSize:"18px"},".rbc-time-header-cell .rbc-date-lunar":{marginLeft:"4px"},".rbc-time-header-cell .rbc-header:not(.rbc-today) .rbc-date-lunar":{color:"#aaa"},".rbc-calendar.view-week":{".rbc-time-header-cell":{marginTop:"-32px",marginBottom:"4px"},".rbc-time-view":{paddingTop:"32px",borderTop:"0"},".rbc-header":{padding:"4px 8px"},".rbc-time-header-content":{padding:"4px 0"},".rbc-time-header-gutter":{padding:"0",paddingTop:"2px","> div":{borderTop:"2px solid #f0f0f0",padding:"0 5px"}}},".rbc-time-view-resources .rbc-time-gutter,\n.rbc-time-view-resources .rbc-time-header-gutter":{position:"sticky",left:"0",backgroundColor:"white",borderRight:"1px solid #f0f0f0",zIndex:10,marginRight:"-1px"},".rbc-time-view-resources .rbc-time-header":{overflow:"hidden"},".rbc-time-view-resources .rbc-time-header-content":{minWidth:"auto",flex:"1 0 0",flexBasis:"0px"},".rbc-time-view-resources .rbc-time-header-cell-single-day":{display:"none"},".rbc-time-view-resources .rbc-day-slot":{minWidth:"140px"},".rbc-time-view-resources .rbc-header,\n.rbc-time-view-resources .rbc-day-bg":{width:"140px",flex:"1 1 0",flexBasis:"0 px"},".rbc-time-header-content + .rbc-time-header-content":{marginLeft:"-1px"},".rbc-time-slot":{flex:"1 0 0"},".rbc-time-slot.rbc-now":{fontWeight:"bold"},".rbc-day-header":{textAlign:"center"},".rbc-slot-selection":{zIndex:10,position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",fontSize:"75%",width:"100%",padding:"3px"},".rbc-slot-selecting":{cursor:"move"},".rbc-time-view":{display:"flex",flexDirection:"column",flex:1,width:"100%",borderTop:"1px solid #f0f0f0",minHeight:"0"},".rbc-time-view .rbc-time-gutter":{whiteSpace:"nowrap"},".rbc-time-view .rbc-allday-cell":{boxSizing:"content-box",width:"100%",height:"100%",position:"relative"},".rbc-time-view .rbc-allday-cell + .rbc-allday-cell":{borderLeft:"1px solid #f0f0f0"},".rbc-time-view .rbc-allday-events":{position:"relative",zIndex:4},".rbc-time-view .rbc-row":{boxSizing:"border-box",minHeight:"20px"},".rbc-time-header":{display:"flex",flex:"0 0 auto",flexDirection:"row"},".rbc-time-header.rbc-overflowing":{borderRight:"1px solid #f0f0f0"},".rbc-rtl .rbc-time-header.rbc-overflowing":{borderRightWidth:"0",borderLeft:"1px solid #f0f0f0"},".rbc-time-header > .rbc-row:first-child":{borderBottom:"1px solid #f0f0f0"},".rbc-time-header > .rbc-row.rbc-row-resource":{borderBottom:"1px solid #f0f0f0"},".rbc-time-header-cell-single-day":{display:"none"},".rbc-time-header-content":{flex:1,minWidth:"0",flexDirection:"column"},".rbc-rtl .rbc-time-header-content":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-time-header-content > .rbc-row.rbc-row-resource":{borderBottom:"1px solid #f0f0f0",flexShrink:0},".rbc-time-content":{display:"flex",flex:"1 0 0%",alignItems:"flex-start",width:"100%",borderTop:"1px solid #f0f0f0",overflowY:"auto",position:"relative"},".rbc-time-content > .rbc-time-gutter":{flex:"none"},".rbc-rtl .rbc-time-content > * + * > *":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-time-content > .rbc-day-slot":{width:"100%",userSelect:"none",WebkitUserSelect:"none"},".rbc-current-time-indicator":{position:"absolute",zIndex:3,left:"0",right:"0",height:"1px",backgroundColor:"#74ad31",pointerEvents:"none"},"@media only screen and (max-width: 800px)":{".view-type-calendar .action-buttons":{position:"relative !important",left:"0 !important",".filter-action-button":{left:"0 !important"}},".rbc-toolbar .rbc-toolbar-label":{position:"absolute",top:"28px",left:"50%",transform:"translateX(-50%)"},".rbc-toolbar":{justifyContent:"space-between !important"},".rbc-header":{padding:"4px !important"}}}}}),fD=["month","week","day"],dD=eD(Pe),wf=b.createContext({close:()=>{}});function hD(e){const t=Z.useFieldSchema(),r=b.useMemo(()=>t.reduceProperties((n,a)=>a["x-component"].endsWith(".ActionBar")?a:n,null),[]);return k.jsx(Ir.Provider,{value:e,children:k.jsx(Z.RecursionField,{name:r.name,schema:r})})}const mD=(e,t,r,n)=>{var s;const{t:a}=Je(),{fields:i}=x.useCollection(),o=(s=i.find(l=>l.name===(t==null?void 0:t.title)))==null?void 0:s.uiSchema;return b.useMemo(()=>{if(!Array.isArray(e))return[];const l=[];return e.forEach(u=>{const{cron:c,exclude:f=[]}=u,d=Pe(Xn(u,t.start)||Pe()),p=Pe(Xn(u,t.end)||d).diff(d,"millisecond",!0),m=Pe(r);let g=m.clone().startOf("month"),v=g.clone().endOf("month");n==="month"&&(g=g.startOf("week"),v=v.endOf("week"));const y=(S=d.clone())=>{if(S.isBefore(d)||!S.isBetween(g,v))return;let T=!1;if(f==null?void 0:f.some(E=>E.endsWith("_after")?(E=E.replace(/_after$/,""),T=!0,S.isSameOrAfter(E)):S.isSame(E)))return T;const O=x.getLabelFormatValue(o,Xn(u,t.title),!0),D={id:Xn(u,t.id||"id"),title:O||a("Untitle"),start:S.toDate(),end:S.add(p,"millisecond").toDate()};l.push(D)};if(c==="every_week"){let S=d.clone().year(g.year()).month(g.month()).date(g.date()).day(d.day());for(;S.isBefore(v)&&!y(S.clone());)S=S.add(1,"week")}else if(c==="every_month")y(d.clone().year(m.year()).month(m.month()));else if(c==="every_year")y(d.clone().year(m.year()));else{if(y(),!c)return;try{const S=Zh.parseExpression(c,{startDate:g.toDate(),endDate:v.toDate(),iterator:!0,currentDate:d.toDate(),utc:!0});for(;S.hasNext();){const{value:T}=S.next();if(y(Pe(T.toDate())))break}}catch(S){console.error(S)}}}),l},[e,t.start,t.end,t.id,t.title,r,n,a])},wt=x.withDynamicSchemaProps(Z.observer(e=>{const[t,r]=b.useState(!1),{openPopup:n}=x.usePopupUtils({setVisible:r}),{dataSource:a,fieldNames:i,showLunar:o}=x.useProps(e),s=uD(),[l,u]=b.useState(new Date),[c,f]=b.useState("month"),d=mD(a,i,l,c),[h,p]=b.useState({}),{wrapSSR:m,hashId:g,componentCls:v}=cD(),y=x.useCollectionParentRecordData(),S=Z.useFieldSchema(),T=b.useMemo(()=>({toolbar:O=>k.jsx(hD,ct(ue({},O),{showLunar:o})),month:{dateHeader:O=>k.jsx(oD,ct(ue({},O),{showLunar:o}))}}),[o]),w={allDay:"",previous:k.jsx("div",{children:k.jsx(ft.LeftOutlined,{})}),next:k.jsx("div",{children:k.jsx(ft.RightOutlined,{})}),today:He("Today"),month:He("Month"),week:He("Week"),work_week:He("Work week"),day:He("Day"),agenda:He("Agenda"),date:He("Date"),time:He("Time"),event:He("Event"),noEventsInRange:He("None"),showMore:O=>He("{{count}} more items",{count:O})};return m(k.jsx("div",{className:`${g} ${v}`,style:{height:s||700},children:k.jsxs(x.PopupContextProvider,{visible:t,setVisible:r,children:[k.jsx(yf,{}),k.jsx(x.RecordProvider,{record:h,parent:y,children:k.jsx(aD,{})}),k.jsx(GT,{popup:!0,selectable:!0,events:d,view:c,views:fD,date:l,step:60,showMultiDayTimes:!0,messages:w,onNavigate:u,onView:f,onSelectSlot:O=>{console.log("onSelectSlot",O)},onDoubleClickEvent:()=>{console.log("onDoubleClickEvent")},onSelectEvent:O=>{const D=a==null?void 0:a.find(E=>E[i.id]===O.id);D&&(D.__event=ct(ue({},O),{start:Wo(Pe(O.start)),end:Wo(Pe(O.end))}),p(D),n({recordData:D,customActionSchema:gf(S)}))},formats:{monthHeaderFormat:"YYYY-M",agendaDateFormat:"M-DD",dayHeaderFormat:"YYYY-M-DD",dayRangeHeaderFormat:({start:O,end:D},E,C)=>mf.eq(O,D,"month")?C.format(O,"YYYY-M",E):`${C.format(O,"YYYY-M",E)} - ${C.format(D,"YYYY-M",E)}`},components:T,localizer:dD})]})}))},{displayName:"Calendar"})),pD=()=>{const{name:e,title:t}=x.useCollection(),r=x.useSchemaTemplate();return k.jsx(x.GeneralSchemaDesigner,{schemaSettings:"blockSettings:calendar",template:r,title:t||e})},{Text:vD}=ye.Typography,gD=Z.observer(()=>{var y;const{visible:e,setVisible:t}=x.useActionContext(),v=x.useRecord(),{exclude:r=[],cron:n}=v,a=Yo(v,["exclude","cron"]),{close:i}=b.useContext(wf),o=Wo(Pe((y=a.__parent)==null?void 0:y.__event.start)),s=x.useFilterByTk(),{resource:l,service:u,__parent:c}=x.useBlockRequestContext(),[f,d]=b.useState(o),[h,p]=b.useState(!1),m=()=>lr(this,null,function*(){var S,T,w;p(!0),f==="all"||!n?yield l.destroy({filterByTk:s}):yield l.update({filterByTk:s,values:{exclude:(r||[]).concat(f)}}),p(!1),(T=(S=c==null?void 0:c.service)==null?void 0:S.refresh)==null||T.call(S),(w=u==null?void 0:u.refresh)==null||w.call(u),t==null||t(!1,!0),i()}),{t:g}=Je();return Re.createPortal(k.jsx(ye.Modal,{title:n?g("Delete events"):null,open:e,onCancel:()=>t(!1),onOk:()=>m(),confirmLoading:h,children:n?k.jsx(ye.Radio.Group,{value:f,onChange:S=>d(S.target.value),children:k.jsxs(ye.Space,{direction:"vertical",children:[k.jsx(ye.Radio,{value:o,children:g("This event")}),k.jsx(ye.Radio,{value:`${o}_after`,children:g("This and following events")}),k.jsx(ye.Radio,{value:"all",children:g("All events")})]})}):k.jsx(vD,{strong:!0,style:{fontSize:"18px"},children:g("Delete this event?")})}),document.body)},{displayName:"DeleteEvent"}),bD=Z.observer(e=>{const{visible:t,setVisible:r}=x.useActionContext(),n=x.useCollectionRecordData(),a=x.useCollection(),i=b.useCallback(()=>{r(!1)},[r]);return k.jsx(x.PopupContextProvider,{visible:t,setVisible:r,children:k.jsx(wf.Provider,{value:{close:i},children:k.jsx(x.VariablePopupRecordProvider,{recordData:n,collection:a,children:e.children})})})},{displayName:"Event"}),yD=Z.observer(()=>{const{DesignableBar:e}=x.useDesignable(),{onNavigate:t}=b.useContext(Ir);return k.jsxs(ye.Button.Group,{children:[k.jsx(ye.Button,{icon:k.jsx(ft.LeftOutlined,{}),onClick:()=>t(ge.PREVIOUS)}),k.jsx(ye.Button,{icon:k.jsx(ft.RightOutlined,{}),onClick:()=>t(ge.NEXT)}),k.jsx(e,{})]})},{displayName:"Nav"}),wD=Z.observer(()=>{const{DesignableBar:e}=x.useDesignable(),{date:t,view:r,label:n,showLunar:a}=b.useContext(Ir),i=b.useMemo(()=>{if(!(!a||r!=="day"))return k.jsx("span",{children:bf(t)})},[r,t,a]);return k.jsxs(ye.Button.Group,{style:{fontSize:"1.75em",fontWeight:300},children:[k.jsx("span",{children:n}),k.jsx("span",{style:{marginLeft:"4px"},children:i}),k.jsx(e,{})]})},{displayName:"Title"}),SD=Z.observer(e=>{const{DesignableBar:t}=x.useDesignable(),{onNavigate:r}=b.useContext(Ir),{t:n}=Je();return k.jsxs(ye.Button,{onClick:()=>{r(ge.TODAY)},children:[n("Today"),k.jsx(t,{})]})},{displayName:"Today"}),OD=Z.observer(e=>{const{DesignableBar:t}=x.useDesignable(),{views:r,view:n,onView:a,localizer:{messages:i}}=b.useContext(Ir);return k.jsxs("div",{className:"ant-btn-group",children:[k.jsx(ye.Select,{popupMatchSelectWidth:!1,value:n,onChange:a,children:r.map(o=>k.jsx(ye.Select.Option,{value:o,children:i[o]},o))}),k.jsx(t,{})]})},{displayName:"ViewSelect"});wt.ActionBar=x.ActionBar,wt.Event=bD,wt.DeleteEvent=gD,wt.Title=wD,wt.Today=SD,wt.Nav=yD,wt.ViewSelect=OD,wt.Designer=pD;const TD=wt;function Sf(e){var i;const{filter:t,parseVariableLoading:r}=x.useParsedFilter({filterOption:(i=e.params)==null?void 0:i.filter}),n=b.useMemo(()=>{var u,c;const o=[],s=(u=e.fieldNames)==null?void 0:u.start,l=(c=e.fieldNames)==null?void 0:c.end;return Array.isArray(s)&&s.length>=2&&o.push(s[0]),Array.isArray(l)&&l.length>=2&&o.push(l[0]),o},[e.fieldNames]);return{params:b.useMemo(()=>ct(ue({},e.params),{appends:[...n,...e.params.appends||[]],paginate:!1,filter:t}),[n,JSON.stringify(t),e.params]),parseVariableLoading:r}}const Ro=b.createContext({});Ro.displayName="CalendarBlockContext";const DD=e=>{var o;const{fieldNames:t,showLunar:r}=e,n=Z.useField(),{resource:a,service:i}=x.useBlockRequestContext();return k.jsx(x.FixedBlockWrapper,{children:k.jsx(Ro.Provider,{value:{field:n,service:i,resource:a,fieldNames:t,showLunar:r,fixedBlock:(o=n==null?void 0:n.decoratorProps)==null?void 0:o.fixedBlock},children:e.children})})},ED=e=>Z.useFieldSchema()["x-use-decorator-props"]?{params:e.params,parseVariableLoading:e.parseVariableLoading}:Sf(e),xD=x.withDynamicSchemaProps(e=>{const{params:t,parseVariableLoading:r}=ED(e);return r?null:k.jsx(x.BlockProvider,ct(ue({name:"calendar"},e),{params:t,children:k.jsx(DD,ue({},e))}))},{displayName:"CalendarBlockProvider"}),Ia=()=>b.useContext(Ro),CD=()=>{var r;const e=Ia(),t=Z.useField();return b.useEffect(()=>{var n,a,i;(n=e==null?void 0:e.service)!=null&&n.loading||(t.componentProps.dataSource=(i=(a=e==null?void 0:e.service)==null?void 0:a.data)==null?void 0:i.data)},[(r=e==null?void 0:e.service)==null?void 0:r.loading]),{fieldNames:e.fieldNames,showLunar:e.showLunar,fixedBlock:e.fixedBlock}},_D=()=>{const e=Z.useField(),{t}=Je(),r=Z.useFieldSchema(),{dn:n}=x.useDesignable();return k.jsx(x.SchemaSettingsSwitchItem,{title:t("Show lunar"),checked:e.decoratorProps.showLunar,onChange:a=>{e.decoratorProps.showLunar=a,r["x-decorator-props"].showLunar=a,n.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":e.decoratorProps}}),n.refresh()}})},MD=new x.SchemaSettings({name:"blockSettings:calendar",items:[{name:"title",Component:x.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:x.SchemaSettingsBlockHeightItem},{name:"titleField",Component:x.SchemaSettingsSelectItem,useComponentProps(){var u;const{t:e}=Je(),t=Z.useFieldSchema(),r=((u=t==null?void 0:t["x-decorator-props"])==null?void 0:u.fieldNames)||{},{service:n}=Ia(),{getCollectionFieldsOptions:a}=x.useCollectionManager_deprecated(),{name:i,title:o}=x.useCollection(),s=Z.useField(),{dn:l}=x.useDesignable();return{title:e("Title field"),value:r.title,options:a(i,"string"),onChange:c=>{const f=s.decoratorProps.fieldNames||{};f.title=c,s.decoratorProps.params=f,t["x-decorator-props"].params=f,t["x-decorator-props"].fieldNames=f,n.refresh(),l.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":s.decoratorProps}}),l.refresh()}}}},{name:"showLunar",Component:_D},{name:"startDateField",Component:x.SchemaSettingsCascaderItem,useComponentProps(){var l;const{getCollectionFieldsOptions:e}=x.useCollectionManager_deprecated(),{t}=Je(),r=Z.useFieldSchema(),n=((l=r==null?void 0:r["x-decorator-props"])==null?void 0:l.fieldNames)||{},a=Z.useField(),{dn:i}=x.useDesignable(),{service:o}=Ia(),{name:s}=x.useCollection();return{title:t("Start date field"),value:n.start,options:e(s,"date",{association:["o2o","obo","oho","m2o"]}),onChange:u=>{const c=a.decoratorProps.fieldNames||{};c.start=u,a.decoratorProps.fieldNames=c,r["x-decorator-props"].fieldNames=c,o.refresh(),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"endDateField",Component:x.SchemaSettingsCascaderItem,useComponentProps(){var l;const{t:e}=Je(),t=Z.useFieldSchema(),r=Z.useField(),{service:n}=Ia(),{getCollectionFieldsOptions:a}=x.useCollectionManager_deprecated(),{dn:i}=x.useDesignable(),{name:o}=x.useCollection(),s=((l=t==null?void 0:t["x-decorator-props"])==null?void 0:l.fieldNames)||{};return{title:e("End date field"),value:s.end,options:a(o,"date",{association:["o2o","obo","oho","m2o"]}),onChange:u=>{const c=r.decoratorProps.fieldNames||{};c.end=u,r.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,n.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),i.refresh()}}}},{name:"dataScope",Component:x.SchemaSettingsDataScope,useComponentProps(){var i,o;const{name:e}=x.useCollection(),t=Z.useFieldSchema(),{form:r}=x.useFormBlockContext(),n=Z.useField(),{dn:a}=x.useDesignable();return{collectionName:e,defaultFilter:((o=(i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.params)==null?void 0:o.filter)||{},form:r,onSubmit:({filter:s})=>{s=x.removeNullCondition(s);const l=n.decoratorProps.params||{};l.filter=s,n.decoratorProps.params=l,t["x-decorator-props"].params=l,a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}})}}}},{name:"divider",type:"divider"},{name:"template",Component:x.SchemaSettingsTemplate,useComponentProps(){var a,i;const{name:e}=x.useCollection(),t=Z.useFieldSchema(),{componentNamePrefix:r}=x.useBlockTemplateContext(),n=((a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.resource)||((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.association);return{componentName:`${r}Calendar`,collectionName:e,resourceName:n}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});B("Calendar collection"),B("Repeats"),B("Daily"),B("Weekly"),B("Monthly"),B("Yearly"),x.getConfigurableProperties("title","name","inherits","category","description","presetFields");class $D extends x.CollectionTemplate{constructor(){super(...arguments);Pt(this,"name","calendar");Pt(this,"title",B("Calendar collection"));Pt(this,"order",2);Pt(this,"color","orange");Pt(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,sortable:!0,fields:[{name:"cron",type:"string",uiSchema:{type:"string",title:B("Repeats"),"x-component":"CronSet","x-component-props":"allowClear",enum:[{label:B("Daily"),value:"0 0 0 * * ?"},{label:B("Weekly"),value:"every_week"},{label:B("Monthly"),value:"every_month"},{label:B("Yearly"),value:"every_year"}]},interface:"select"},{name:"exclude",type:"json"}]});Pt(this,"availableFieldInterfaces",{include:[]});Pt(this,"configurableProperties",x.getConfigurableProperties("title","name","inherits","category","description","presetFields"))}}function AD(e){const{params:t,parseVariableLoading:r}=Sf(e);let n;return e.association&&(n=x.useParentRecordCommon(e.association)),{params:t,parentRecord:n,parseVariableLoading:r}}const Fa=e=>{const t=x.useSchemaInitializerItem();return k.jsx(x.InitializerWithSwitch,ct(ue(ue({},t),e),{item:t,type:"x-action"}))},Of={title:B("Configure actions"),icon:"SettingOutlined",style:{marginLeft:8},items:[{name:"today",title:B("Today"),Component:Fa,schema:{title:B("Today"),"x-component":"CalendarV2.Today","x-action":"calendar:today","x-align":"left"}},{name:"turnPages",title:B("Turn pages"),Component:Fa,schema:{title:B("Turn pages"),"x-component":"CalendarV2.Nav","x-action":"calendar:nav","x-align":"left"}},{name:"title",title:B("Title"),Component:Fa,schema:{title:B("Title"),"x-component":"CalendarV2.Title","x-action":"calendar:title","x-align":"left"}},{name:"selectView",title:B("Select view"),Component:Fa,schema:{title:B("Select view"),"x-component":"CalendarV2.ViewSelect","x-action":"calendar:viewSelect","x-align":"right","x-designer":"Action.Designer"}},{name:"filter",title:B("Filter"),Component:"FilterActionInitializer",schema:{"x-align":"right"}},{name:"addNew",title:B("Add new"),Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>x.useActionAvailable("create")}]},Tf=new x.CompatibleSchemaInitializer(ue({name:"CalendarActionInitializers"},Of)),kD=new x.CompatibleSchemaInitializer(ue({name:"calendar:configureActions"},Of),Tf),PD=e=>{const t={title:'{{ t("Delete Event") }}',"x-action":"deleteEvent","x-acl-action":"destroy","x-component":"Action","x-designer":"Action.Designer","x-component-props":{icon:"DeleteOutlined"},properties:{modal:{"x-component":"CalendarV2.DeleteEvent"}}};return k.jsx(x.ActionInitializerItem,ct(ue({},e),{schema:t}))},Df={name:"deleteEvent",title:B("Delete Event"),Component:PD,schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible(){return x.useCollection_deprecated().template==="calendar"}},ND=new x.SchemaInitializer({title:B("Configure actions"),name:"CalendarFormActionInitializers",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:B("Enable actions"),children:[{name:"edit",title:B("Edit"),Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}},useVisible:()=>x.useActionAvailable("update")},{name:"delete",title:B("Delete"),Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible:()=>x.useActionAvailable("destroy")},Df]},{name:"divider",type:"divider"},{type:"subMenu",name:"customize",title:B("Customize"),children:[{name:"popup",title:B("Popup"),Component:"CustomizeActionInitializer",schema:{type:"void",title:B("Popup"),"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:popup","x-component":"Action","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:B("Popup"),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:B("Details"),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}}},{name:"updateRecord",title:B("Update record"),Component:"CustomizeActionInitializer",schema:{title:B("Update record"),"x-component":"Action","x-use-component-props":"useCustomizeUpdateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:updateRecord","x-acl-action":"update","x-action":"customize:update","x-action-settings":{assignedValues:{},onSuccess:{manualClose:!0,redirecting:!1,successMessage:B("Updated successfully")},triggerWorkflows:[]}},useVisible:()=>x.useActionAvailable("update")},{name:"customRequest",title:B("Custom request"),Component:"CustomRequestInitializer"}]}]}),Ho=e=>{const{collectionName:t,dataSource:r,fieldNames:n,association:a}=e;return{type:"void","x-acl-action":`${a||t}:list`,"x-decorator":"CalendarBlockProvider","x-use-decorator-props":"useCalendarBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:r,association:a,action:"list",fieldNames:ue({id:"id"},n),params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:calendar","x-component":"CardItem",properties:{[zf.uid()]:{type:"void","x-component":"CalendarV2","x-use-component-props":"useCalendarBlockProps",properties:{toolBar:{type:"void","x-component":"CalendarV2.ActionBar","x-component-props":{style:{marginBottom:24}},"x-initializer":"calendar:configureActions"},event:{type:"void","x-component":"CalendarV2.Event",properties:{drawer:{type:"void","x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:B("View record"),properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"popup:common:addBlock"},properties:{tab1:{type:"void",title:B("Details"),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer-props":{actionInitializers:"details:configureActions"},"x-initializer":"popup:common:addBlock"}}}}}}}}}}}}}},ID=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:n,showAssociationFields:a})=>{const i=x.useSchemaInitializerItem(),{createCalendarBlock:o}=Ef();return k.jsx(x.DataBlockInitializer,ct(ue({},i),{componentType:"Calendar",icon:k.jsx(ft.FormOutlined,{}),onCreateBlockSchema:s=>lr(this,null,function*(){if(n)return n(s);o(s)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:a}))},Ef=()=>{const{insert:e}=x.useSchemaInitializer(),{t}=Je(),{getCollectionField:r,getCollectionFieldsOptions:n}=x.useCollectionManager_deprecated(),a=b.useContext(Z.SchemaOptionsContext),{theme:i}=x.useGlobalTheme();return{createCalendarBlock:l=>lr(this,[l],function*({item:s}){const u=n(s.name,"string",{dataSource:s.dataSource}),c=n(s.name,"date",{association:["o2o","obo","oho","m2o"],dataSource:s.dataSource}),f=yield x.FormDialog(t("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:a.scope,components:ue({},a.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:u,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:c,required:!0,default:r(`${s.name}.createdAt`)?"createdAt":null,"x-component":"Cascader","x-decorator":"FormItem"},end:{title:t("End date field"),enum:c,"x-component":"Cascader","x-decorator":"FormItem"}}}})})}),i).open({initialValues:{}});e(Ho({collectionName:s.name,dataSource:s.dataSource,fieldNames:ue({},f)}))})}},FD=()=>{const e=x.useSchemaInitializerItem(),p=e,{onCreateBlockSchema:t,componentType:r,createBlockSchema:n}=p,a=Yo(p,["onCreateBlockSchema","componentType","createBlockSchema"]),{insert:i}=x.useSchemaInitializer(),{getTemplateSchemaByMode:o}=x.useSchemaTemplateManager(),{t:s}=Je(),l=b.useContext(Z.SchemaOptionsContext),{getCollection:u}=x.useCollectionManager_deprecated(),c=e.field,f=u(c.target),d=`${c.collectionName}.${c.name}`,{theme:h}=x.useGlobalTheme();return k.jsx(x.SchemaInitializerItem,ct(ue({icon:k.jsx(ft.TableOutlined,{})},a),{onClick:g=>lr(this,[g],function*({item:m}){var v,y,S,T;if(m.template){const w=yield o(m);i(w)}else{const w=(y=(v=f==null?void 0:f.fields)==null?void 0:v.filter(E=>E.type==="string"))==null?void 0:y.map(E=>{var C;return{label:(C=E==null?void 0:E.uiSchema)==null?void 0:C.title,value:E.name}}),O=(T=(S=f==null?void 0:f.fields)==null?void 0:S.filter(E=>E.type==="date"))==null?void 0:T.map(E=>{var C;return{label:(C=E==null?void 0:E.uiSchema)==null?void 0:C.title,value:E.name}}),D=yield x.FormDialog(s("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:l.scope,components:ue({},l.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:s("Title field"),enum:w,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:s("Start date field"),enum:O,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:s("End date field"),enum:O,"x-component":"Select","x-decorator":"FormItem"}}}})})}),h).open({initialValues:{}});i(Ho({association:d,dataSource:m.dataSource,fieldNames:ue({},D)}))}}),items:x.useRecordCollectionDataSourceItems("Calendar",e,c.target,d)}))};function LD(){const{insert:e}=x.useSchemaInitializer(),{getCollection:t}=x.useCollectionManager_deprecated(),{t:r}=Je(),n=b.useContext(Z.SchemaOptionsContext),{theme:a}=x.useGlobalTheme();return{createAssociationCalendarBlock:s=>lr(this,[s],function*({item:o}){var h,p,m,g;const l=o.associationField,u=t(l.target),c=(p=(h=u==null?void 0:u.fields)==null?void 0:h.filter(v=>v.type==="string"))==null?void 0:p.map(v=>{var y;return{label:(y=v==null?void 0:v.uiSchema)==null?void 0:y.title,value:v.name}}),f=(g=(m=u==null?void 0:u.fields)==null?void 0:m.filter(v=>v.type==="date"))==null?void 0:g.map(v=>{var y;return{label:(y=v==null?void 0:v.uiSchema)==null?void 0:y.title,value:v.name}}),d=yield x.FormDialog(r("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:n.scope,components:ue({},n.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:r("Title field"),enum:c,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:r("Start date field"),enum:f,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:r("End date field"),enum:f,"x-component":"Select","x-decorator":"FormItem"}}}})})}),a).open({initialValues:{}});e(Ho({association:`${l.collectionName}.${l.name}`,dataSource:o.dataSource,fieldNames:ue({},d)}))})}}class xf extends x.Plugin{load(){return lr(this,null,function*(){this.app.dataSourceManager.addCollectionTemplates([$D]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer",useComponentProps(){const{createAssociationCalendarBlock:t}=LD(),{createCalendarBlock:r}=Ef();return{onlyCurrentDataSource:!0,filterCollections({associationField:n}){return n?["hasMany","belongsToMany"].includes(n.type):!1},createBlockSchema:({item:n,fromOthersInPopup:a})=>{if(a)return r({item:n});t({item:n})},showAssociationFields:!0,hideSearch:!0}}}),this.app.addComponents({CalendarBlockProvider:xD,CalendarBlockInitializer:ID,RecordAssociationCalendarBlockInitializer:FD,CalendarV2:TD}),this.app.addScopes({useCalendarBlockProps:CD,useCalendarBlockDecoratorProps:AD}),this.schemaSettingsManager.add(MD),this.app.schemaInitializerManager.add(Tf),this.app.schemaInitializerManager.add(kD),this.app.schemaInitializerManager.add(ND),this.app.schemaInitializerManager.get("details:configureActions").add("enableActions.deleteEvent",Df)})}}R.PluginCalendarClient=xf,R.default=xf,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
103
+ `;yf.displayName="GlobalStyle";const uD=()=>{const e=x.useDataBlockHeight(),{heightProps:t}=x.useBlockHeightProps(),{title:r}=t,{token:n}=ye.theme.useToken();if(!e)return;const a=2*n.paddingLG,i=r?n.fontSizeLG*n.lineHeightLG+n.padding*2-1:0;return e-a-i},cD=x.genStyleHook("nb-calendar",e=>{const{componentCls:t}=e;return{[t]:{".rbc-btn":{color:"inherit",font:"inherit",margin:"0"},"button.rbc-btn":{overflow:"visible",textTransform:"none",WebkitAppearance:"button",cursor:"pointer"},"button[disabled].rbc-btn":{cursor:"not-allowed"},"button.rbc-input::-moz-focus-inner":{border:"0",padding:"0"},".rbc-button-link":{border:"none",backgroundColor:"transparent"},".rbc-calendar":{boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"stretch",height:"100%"},".rbc-calendar *,\n.rbc-calendar *:before,\n.rbc-calendar *:after":{boxSizing:"inherit"},".rbc-abs-full,\n.rbc-row-bg":{overflow:"hidden",position:"absolute",top:"0",left:"0",right:"0",bottom:"0"},".rbc-ellipsis,\n.rbc-event-label,\n.rbc-row-segment .rbc-event-content,\n.rbc-show-more":{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},".rbc-rtl":{direction:"rtl"},".rbc-off-range":{color:e.colorTextDisabled},".rbc-header":{overflow:"hidden",flex:"1 0 0%",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:`${e.paddingXXS}px ${e.paddingSM}px`,verticalAlign:"middle",minHeight:e.sizeXL,color:e.colorText,margin:`0 ${e.marginXXS}px`,borderBottom:`2px solid ${e.colorBorderSecondary}`},".rbc-rtl .rbc-header + .rbc-header":{borderLeftWidth:"0",borderRight:`1px solid ${e.colorBorderSecondary}`},".rbc-header > a,\n.rbc-header > a:active,\n.rbc-header > a:visited":{color:"inherit",textDecoration:"none"},".rbc-row-content":{position:"relative",userSelect:"none",WebkitUserSelect:"none",zIndex:4},".rbc-row-content-scrollable":{display:"flex",flexDirection:"column",height:"100%"},".rbc-row-content-scrollable .rbc-row-content-scroll-container":{height:"100%",overflowY:"scroll",msOverflowStyle:"none",scrollbarWidth:"none"},".rbc-row-content-scrollable .rbc-row-content-scroll-container::-webkit-scrollbar":{display:"none"},".rbc-toolbar":{display:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",marginBottom:e.marginXS,fontSize:e.fontSize},".rbc-toolbar .rbc-toolbar-label":{flexGrow:1,padding:`0 ${e.paddingXS}px`,textAlign:"center"},".rbc-toolbar button":{outline:"none",fontSize:e.fontSize,lineHeight:[e.lineHeight,"normal"],height:e.controlHeight,color:e.colorTextLabel,display:"inline-block",margin:"0",position:"relative",zIndex:1,textAlign:"center",verticalAlign:"middle",background:"none",backgroundImage:"none",border:`1px solid ${e.colorBorder}`,padding:`${e.paddingXXS}px ${e.paddingSM+e.paddingXXS}px`,borderRadius:e.borderRadiusXS,whiteSpace:"nowrap"},".rbc-toolbar button:active,\n.rbc-toolbar button.rbc-active":{zIndex:2,color:"#1890ff",borderColor:"#1890ff"},".rbc-toolbar button:active:hover,\n.rbc-toolbar button:active:focus,\n.rbc-toolbar button.rbc-active:hover,\n.rbc-toolbar button.rbc-active:focus":{zIndex:2,color:"#40a9ff",borderColor:"#40a9ff"},".rbc-toolbar button:hover":{zIndex:2,color:"#40a9ff",borderColor:"#40a9ff"},".rbc-btn-group":{display:"inline-block",whiteSpace:"nowrap"},".rbc-btn-group > button:first-child:not(:last-child)":{borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-btn-group > button:last-child:not(:first-child)":{borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-rtl .rbc-btn-group > button:first-child:not(:last-child)":{borderRadius:"4px",borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-rtl .rbc-btn-group > button:last-child:not(:first-child)":{borderRadius:"4px",borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-btn-group > button:not(:first-child):not(:last-child)":{borderRadius:"0"},".rbc-btn-group button + button":{marginLeft:"-1px"},".rbc-rtl .rbc-btn-group button + button":{marginLeft:"0",marginRight:"-1px"},".rbc-btn-group + .rbc-btn-group,\n.rbc-btn-group + button":{marginLeft:"10px"},".rbc-event":{border:"none",boxSizing:"border-box",boxShadow:"none",margin:"0",padding:"2px 5px",backgroundColor:e.colorBorderSecondary,borderRadius:e.borderRadiusXS,cursor:"pointer",fontSize:e.fontSizeSM,width:"100%",textAlign:"left","&:hover":{backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText}},".rbc-slot-selecting .rbc-event":{cursor:"inherit",pointerEvents:"none"},".rbc-event.rbc-selected":{backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText},".rbc-event-label":{fontSize:"80%"},".rbc-event-overlaps":{boxShadow:"-1px 1px 5px 0px rgba(51, 51, 51, 0.5)"},".rbc-event-continues-prior":{borderTopLeftRadius:"0",borderBottomLeftRadius:"0"},".rbc-event-continues-after":{borderTopRightRadius:"0",borderBottomRightRadius:"0"},".rbc-event-continues-earlier":{borderTopLeftRadius:"0",borderTopRightRadius:"0"},".rbc-event-continues-later":{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"},".rbc-row":{display:"flex",flexDirection:"row"},".rbc-row-segment":{padding:"0 4px 1px 4px"},".rbc-selected-cell":{backgroundColor:"rgba(0, 0, 0, 0.1)"},".rbc-show-more":{zIndex:4,fontWeight:"bold",fontSize:"85%",height:"auto",lineHeight:"normal",color:"inherit",padding:"2px 5px"},".rbc-month-view":{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 0",width:"100%",userSelect:"none",WebkitUserSelect:"none",height:"68vh",".rbc-day-bg":{borderTop:`2px solid ${e.colorBorderSecondary}`},".rbc-today":{borderColor:`${e.colorPrimaryBorder} !important`,backgroundColor:`${e.colorPrimaryBg} !important`},".rbc-header":{borderBottom:"0 !important"}},".rbc-month-header":{display:"flex",flexDirection:"row"},".rbc-month-row":{display:"flex",position:"relative",flexDirection:"column",flex:"1 0 0",flexBasis:"0px",overflow:"hidden",height:"100%"},".rbc-date-cell":{flex:"1 1 0",minWidth:"0",paddingLeft:"12px",paddingTop:"4px"},".rbc-date-cell.rbc-now span":{color:"#1890ff"},".rbc-date-cell a,\n.rbc-date-cell a:active,\n.rbc-date-cell a:visited":{color:"inherit",textDecoration:"none"},".rbc-date-cell a:hover":{color:"#1890ff"},".rbc-date-cell .rbc-date-solar":{fontWeight:500},".rbc-date-cell .rbc-date-lunar":{paddingLeft:"12px"},".rbc-date-cell:not(.rbc-off-range) .rbc-date-lunar":{color:"#aaa"},".rbc-date-cell .rbc-date-lunar:hover":{color:"inherit"},".rbc-row-bg":{display:"flex",flexDirection:"row",flex:"1 0 0",overflow:"hidden"},".rbc-day-bg":{flex:"1 0 0%",margin:"0 4px","&:hover":{background:e.colorFillQuaternary}},".rbc-agenda-view":{display:"flex",flexDirection:"column",flex:"1 0 0",overflow:"auto"},".rbc-agenda-view table.rbc-agenda-table":{width:"100%",border:"1px solid #f0f0f0",borderSpacing:"0",borderCollapse:"collapse"},".rbc-agenda-view table.rbc-agenda-table tbody > tr > td":{padding:"5px 10px",verticalAlign:"top"},".rbc-agenda-view table.rbc-agenda-table .rbc-agenda-time-cell":{paddingLeft:"15px",paddingRight:"15px",textTransform:"lowercase"},".rbc-agenda-view table.rbc-agenda-table tbody > tr > td + td":{borderLeft:"1px solid #f0f0f0"},".rbc-rtl .rbc-agenda-view table.rbc-agenda-table tbody > tr > td + td":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-agenda-view table.rbc-agenda-table tbody > tr + tr":{borderTop:"1px solid #f0f0f0"},".rbc-agenda-view table.rbc-agenda-table thead > tr > th":{padding:"3px 5px",textAlign:"left",borderBottom:"1px solid #f0f0f0"},".rbc-rtl .rbc-agenda-view table.rbc-agenda-table thead > tr > th":{textAlign:"right"},".rbc-agenda-time-cell":{textTransform:"lowercase"},".rbc-agenda-time-cell .rbc-continues-after:after":{content:"' »'"},".rbc-agenda-time-cell .rbc-continues-prior:before":{content:"'« '"},".rbc-agenda-date-cell,\n.rbc-agenda-time-cell":{whiteSpace:"nowrap"},".rbc-agenda-event-cell":{width:"100%"},".rbc-time-column":{display:"flex",flexDirection:"column",minHeight:"100%"},".rbc-time-column .rbc-timeslot-group":{flex:1},".rbc-timeslot-group":{borderBottom:"1px solid #f0f0f0",minHeight:"40px",lineHeight:"39px",display:"flex",flexFlow:"column nowrap","&:hover":{background:"#f0f0f0"}},".rbc-time-gutter,\n.rbc-header-gutter":{flex:"none"},".rbc-label":{padding:"0 5px"},".rbc-day-slot":{position:"relative"},".rbc-day-slot .rbc-events-container":{bottom:"0",left:"0",position:"absolute",right:"0",marginRight:"10px",top:"0"},".rbc-day-slot .rbc-events-container.rbc-rtl":{left:"10px",right:"0"},".rbc-day-slot .rbc-event":{border:"1px solid #265985",display:"flex",maxHeight:"100%",minHeight:"20px",flexFlow:"column wrap",alignItems:"flex-start",overflow:"hidden",position:"absolute"},".rbc-day-slot .rbc-event-label":{flex:"none",paddingRight:"5px",width:"auto"},".rbc-day-slot .rbc-event-content":{width:"100%",flex:"1 1 0",wordWrap:"break-word",lineHeight:1,height:"100%",minHeight:"1em"},".rbc-time-header-gutter":{lineHeight:"40px"},".rbc-time-header-cell":{minHeight:"32px !important"},".rbc-time-header-cell .rbc-header":{display:"flex"},".rbc-time-header-cell .rbc-header.rbc-today":{borderColor:e.colorPrimaryBorder,backgroundColor:e.colorPrimaryBg,color:e.colorPrimaryText},".rbc-time-header-cell .rbc-header a":{display:"flex",flexDirection:"column"},".rbc-time-header-cell .rbc-date-wrap":{display:"flex",alignItems:"center"},".rbc-time-header-cell .rbc-date-solar":{fontSize:"18px"},".rbc-time-header-cell .rbc-date-lunar":{marginLeft:"4px"},".rbc-time-header-cell .rbc-header:not(.rbc-today) .rbc-date-lunar":{color:"#aaa"},".rbc-calendar.view-week":{".rbc-time-header-cell":{marginTop:"-32px",marginBottom:"4px"},".rbc-time-view":{paddingTop:"32px",borderTop:"0"},".rbc-header":{padding:"4px 8px"},".rbc-time-header-content":{padding:"4px 0"},".rbc-time-header-gutter":{padding:"0",paddingTop:"2px","> div":{borderTop:"2px solid #f0f0f0",padding:"0 5px"}}},".rbc-time-view-resources .rbc-time-gutter,\n.rbc-time-view-resources .rbc-time-header-gutter":{position:"sticky",left:"0",backgroundColor:"white",borderRight:"1px solid #f0f0f0",zIndex:10,marginRight:"-1px"},".rbc-time-view-resources .rbc-time-header":{overflow:"hidden"},".rbc-time-view-resources .rbc-time-header-content":{minWidth:"auto",flex:"1 0 0",flexBasis:"0px"},".rbc-time-view-resources .rbc-time-header-cell-single-day":{display:"none"},".rbc-time-view-resources .rbc-day-slot":{minWidth:"140px"},".rbc-time-view-resources .rbc-header,\n.rbc-time-view-resources .rbc-day-bg":{width:"140px",flex:"1 1 0",flexBasis:"0 px"},".rbc-time-header-content + .rbc-time-header-content":{marginLeft:"-1px"},".rbc-time-slot":{flex:"1 0 0"},".rbc-time-slot.rbc-now":{fontWeight:"bold"},".rbc-day-header":{textAlign:"center"},".rbc-slot-selection":{zIndex:10,position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",fontSize:"75%",width:"100%",padding:"3px"},".rbc-slot-selecting":{cursor:"move"},".rbc-time-view":{display:"flex",flexDirection:"column",flex:1,width:"100%",borderTop:"1px solid #f0f0f0",minHeight:"0"},".rbc-time-view .rbc-time-gutter":{whiteSpace:"nowrap"},".rbc-time-view .rbc-allday-cell":{boxSizing:"content-box",width:"100%",height:"100%",position:"relative"},".rbc-time-view .rbc-allday-cell + .rbc-allday-cell":{borderLeft:"1px solid #f0f0f0"},".rbc-time-view .rbc-allday-events":{position:"relative",zIndex:4},".rbc-time-view .rbc-row":{boxSizing:"border-box",minHeight:"20px"},".rbc-time-header":{display:"flex",flex:"0 0 auto",flexDirection:"row"},".rbc-time-header.rbc-overflowing":{borderRight:"1px solid #f0f0f0"},".rbc-rtl .rbc-time-header.rbc-overflowing":{borderRightWidth:"0",borderLeft:"1px solid #f0f0f0"},".rbc-time-header > .rbc-row:first-child":{borderBottom:"1px solid #f0f0f0"},".rbc-time-header > .rbc-row.rbc-row-resource":{borderBottom:"1px solid #f0f0f0"},".rbc-time-header-cell-single-day":{display:"none"},".rbc-time-header-content":{flex:1,minWidth:"0",flexDirection:"column"},".rbc-rtl .rbc-time-header-content":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-time-header-content > .rbc-row.rbc-row-resource":{borderBottom:"1px solid #f0f0f0",flexShrink:0},".rbc-time-content":{display:"flex",flex:"1 0 0%",alignItems:"flex-start",width:"100%",borderTop:"1px solid #f0f0f0",overflowY:"auto",position:"relative"},".rbc-time-content > .rbc-time-gutter":{flex:"none"},".rbc-rtl .rbc-time-content > * + * > *":{borderLeftWidth:"0",borderRight:"1px solid #f0f0f0"},".rbc-time-content > .rbc-day-slot":{width:"100%",userSelect:"none",WebkitUserSelect:"none"},".rbc-current-time-indicator":{position:"absolute",zIndex:3,left:"0",right:"0",height:"1px",backgroundColor:"#74ad31",pointerEvents:"none"},"@media only screen and (max-width: 800px)":{".view-type-calendar .action-buttons":{position:"relative !important",left:"0 !important",".filter-action-button":{left:"0 !important"}},".rbc-toolbar .rbc-toolbar-label":{position:"absolute",top:"28px",left:"50%",transform:"translateX(-50%)"},".rbc-toolbar":{justifyContent:"space-between !important"},".rbc-header":{padding:"4px !important"}}}}}),fD=["month","week","day"],dD=eD(Pe),wf=b.createContext({close:()=>{}});function hD(e){const t=Z.useFieldSchema(),r=b.useMemo(()=>t.reduceProperties((n,a)=>a["x-component"].endsWith(".ActionBar")?a:n,null),[]);return k.jsx(Ir.Provider,{value:e,children:k.jsx(Z.RecursionField,{name:r.name,schema:r})})}const mD=(e,t,r,n)=>{var s;const{t:a}=Je(),{fields:i}=x.useCollection(),o=(s=i.find(l=>l.name===(t==null?void 0:t.title)))==null?void 0:s.uiSchema;return b.useMemo(()=>{if(!Array.isArray(e))return[];const l=[];return e.forEach(u=>{const{cron:c,exclude:f=[]}=u,d=Pe(Xn(u,t.start)||Pe()),p=Pe(Xn(u,t.end)||d).diff(d,"millisecond",!0),m=Pe(r);let g=m.clone().startOf("month"),v=g.clone().endOf("month");n==="month"&&(g=g.startOf("week"),v=v.endOf("week"));const y=(S=d.clone())=>{if(S.isBefore(d))return;let T=!1;const w=f==null?void 0:f.some(E=>E.endsWith("_after")?(E=E.replace(/_after$/,""),T=!0,S.isSameOrAfter(E)):S.isSame(E));if(console.log(99),w)return T;const O=x.getLabelFormatValue(o,Xn(u,t.title),!0),D={id:Xn(u,t.id||"id"),title:O||a("Untitle"),start:S.toDate(),end:S.add(p,"millisecond").toDate()};l.push(D)};if(c==="every_week"){let S=d.clone().year(g.year()).month(g.month()).date(g.date()).day(d.day());for(;S.isBefore(v)&&!y(S.clone());)S=S.add(1,"week")}else if(c==="every_month")y(d.clone().year(m.year()).month(m.month()));else if(c==="every_year")y(d.clone().year(m.year()));else{if(y(),!c)return;try{const S=Zh.parseExpression(c,{startDate:g.toDate(),endDate:v.toDate(),iterator:!0,currentDate:d.toDate(),utc:!0});for(;S.hasNext();){const{value:T}=S.next();if(y(Pe(T.toDate())))break}}catch(S){console.error(S)}}}),l},[e,t.start,t.end,t.id,t.title,r,n,a])},wt=x.withDynamicSchemaProps(Z.observer(e=>{const[t,r]=b.useState(!1),{openPopup:n}=x.usePopupUtils({setVisible:r}),{dataSource:a,fieldNames:i,showLunar:o}=x.useProps(e),s=uD(),[l,u]=b.useState(new Date),[c,f]=b.useState("month"),d=mD(a,i,l,c),[h,p]=b.useState({}),{wrapSSR:m,hashId:g,componentCls:v}=cD(),y=x.useCollectionParentRecordData(),S=Z.useFieldSchema(),T=b.useMemo(()=>({toolbar:O=>k.jsx(hD,ct(ue({},O),{showLunar:o})),month:{dateHeader:O=>k.jsx(oD,ct(ue({},O),{showLunar:o}))}}),[o]),w={allDay:"",previous:k.jsx("div",{children:k.jsx(ft.LeftOutlined,{})}),next:k.jsx("div",{children:k.jsx(ft.RightOutlined,{})}),today:He("Today"),month:He("Month"),week:He("Week"),work_week:He("Work week"),day:He("Day"),agenda:He("Agenda"),date:He("Date"),time:He("Time"),event:He("Event"),noEventsInRange:He("None"),showMore:O=>He("{{count}} more items",{count:O})};return console.log(d,a,i,l,c),m(k.jsx("div",{className:`${g} ${v}`,style:{height:s||700},children:k.jsxs(x.PopupContextProvider,{visible:t,setVisible:r,children:[k.jsx(yf,{}),k.jsx(x.RecordProvider,{record:h,parent:y,children:k.jsx(aD,{})}),k.jsx(GT,{popup:!0,selectable:!0,events:d,view:c,views:fD,date:l,step:60,showMultiDayTimes:!0,messages:w,onNavigate:u,onView:f,onSelectSlot:O=>{console.log("onSelectSlot",O)},onDoubleClickEvent:()=>{console.log("onDoubleClickEvent")},onSelectEvent:O=>{const D=a==null?void 0:a.find(E=>E[i.id]===O.id);D&&(D.__event=ct(ue({},O),{start:Wo(Pe(O.start)),end:Wo(Pe(O.end))}),p(D),n({recordData:D,customActionSchema:gf(S)}))},formats:{monthHeaderFormat:"YYYY-M",agendaDateFormat:"M-DD",dayHeaderFormat:"YYYY-M-DD",dayRangeHeaderFormat:({start:O,end:D},E,C)=>mf.eq(O,D,"month")?C.format(O,"YYYY-M",E):`${C.format(O,"YYYY-M",E)} - ${C.format(D,"YYYY-M",E)}`},components:T,localizer:dD})]})}))},{displayName:"Calendar"})),pD=()=>{const{name:e,title:t}=x.useCollection(),r=x.useSchemaTemplate();return k.jsx(x.GeneralSchemaDesigner,{schemaSettings:"blockSettings:calendar",template:r,title:t||e})},{Text:vD}=ye.Typography,gD=Z.observer(()=>{var y;const{visible:e,setVisible:t}=x.useActionContext(),v=x.useRecord(),{exclude:r=[],cron:n}=v,a=Yo(v,["exclude","cron"]),{close:i}=b.useContext(wf),o=Wo(Pe((y=a.__parent)==null?void 0:y.__event.start)),s=x.useFilterByTk(),{resource:l,service:u,__parent:c}=x.useBlockRequestContext(),[f,d]=b.useState(o),[h,p]=b.useState(!1),m=()=>lr(this,null,function*(){var S,T,w;p(!0),f==="all"||!n?yield l.destroy({filterByTk:s}):yield l.update({filterByTk:s,values:{exclude:(r||[]).concat(f)}}),p(!1),(T=(S=c==null?void 0:c.service)==null?void 0:S.refresh)==null||T.call(S),(w=u==null?void 0:u.refresh)==null||w.call(u),t==null||t(!1,!0),i()}),{t:g}=Je();return Re.createPortal(k.jsx(ye.Modal,{title:n?g("Delete events"):null,open:e,onCancel:()=>t(!1),onOk:()=>m(),confirmLoading:h,children:n?k.jsx(ye.Radio.Group,{value:f,onChange:S=>d(S.target.value),children:k.jsxs(ye.Space,{direction:"vertical",children:[k.jsx(ye.Radio,{value:o,children:g("This event")}),k.jsx(ye.Radio,{value:`${o}_after`,children:g("This and following events")}),k.jsx(ye.Radio,{value:"all",children:g("All events")})]})}):k.jsx(vD,{strong:!0,style:{fontSize:"18px"},children:g("Delete this event?")})}),document.body)},{displayName:"DeleteEvent"}),bD=Z.observer(e=>{const{visible:t,setVisible:r}=x.useActionContext(),n=x.useCollectionRecordData(),a=x.useCollection(),i=b.useCallback(()=>{r(!1)},[r]);return k.jsx(x.PopupContextProvider,{visible:t,setVisible:r,children:k.jsx(wf.Provider,{value:{close:i},children:k.jsx(x.VariablePopupRecordProvider,{recordData:n,collection:a,children:e.children})})})},{displayName:"Event"}),yD=Z.observer(()=>{const{DesignableBar:e}=x.useDesignable(),{onNavigate:t}=b.useContext(Ir);return k.jsxs(ye.Button.Group,{children:[k.jsx(ye.Button,{icon:k.jsx(ft.LeftOutlined,{}),onClick:()=>t(ge.PREVIOUS)}),k.jsx(ye.Button,{icon:k.jsx(ft.RightOutlined,{}),onClick:()=>t(ge.NEXT)}),k.jsx(e,{})]})},{displayName:"Nav"}),wD=Z.observer(()=>{const{DesignableBar:e}=x.useDesignable(),{date:t,view:r,label:n,showLunar:a}=b.useContext(Ir),i=b.useMemo(()=>{if(!(!a||r!=="day"))return k.jsx("span",{children:bf(t)})},[r,t,a]);return k.jsxs(ye.Button.Group,{style:{fontSize:"1.75em",fontWeight:300},children:[k.jsx("span",{children:n}),k.jsx("span",{style:{marginLeft:"4px"},children:i}),k.jsx(e,{})]})},{displayName:"Title"}),SD=Z.observer(e=>{const{DesignableBar:t}=x.useDesignable(),{onNavigate:r}=b.useContext(Ir),{t:n}=Je();return k.jsxs(ye.Button,{onClick:()=>{r(ge.TODAY)},children:[n("Today"),k.jsx(t,{})]})},{displayName:"Today"}),OD=Z.observer(e=>{const{DesignableBar:t}=x.useDesignable(),{views:r,view:n,onView:a,localizer:{messages:i}}=b.useContext(Ir);return k.jsxs("div",{className:"ant-btn-group",children:[k.jsx(ye.Select,{popupMatchSelectWidth:!1,value:n,onChange:a,children:r.map(o=>k.jsx(ye.Select.Option,{value:o,children:i[o]},o))}),k.jsx(t,{})]})},{displayName:"ViewSelect"});wt.ActionBar=x.ActionBar,wt.Event=bD,wt.DeleteEvent=gD,wt.Title=wD,wt.Today=SD,wt.Nav=yD,wt.ViewSelect=OD,wt.Designer=pD;const TD=wt;function Sf(e){var i;const{filter:t,parseVariableLoading:r}=x.useParsedFilter({filterOption:(i=e.params)==null?void 0:i.filter}),n=b.useMemo(()=>{var u,c;const o=[],s=(u=e.fieldNames)==null?void 0:u.start,l=(c=e.fieldNames)==null?void 0:c.end;return Array.isArray(s)&&s.length>=2&&o.push(s[0]),Array.isArray(l)&&l.length>=2&&o.push(l[0]),o},[e.fieldNames]);return{params:b.useMemo(()=>ct(ue({},e.params),{appends:[...n,...e.params.appends||[]],paginate:!1,filter:t}),[n,JSON.stringify(t),e.params]),parseVariableLoading:r}}const Ro=b.createContext({});Ro.displayName="CalendarBlockContext";const DD=e=>{var o;const{fieldNames:t,showLunar:r}=e,n=Z.useField(),{resource:a,service:i}=x.useBlockRequestContext();return k.jsx(x.FixedBlockWrapper,{children:k.jsx(Ro.Provider,{value:{field:n,service:i,resource:a,fieldNames:t,showLunar:r,fixedBlock:(o=n==null?void 0:n.decoratorProps)==null?void 0:o.fixedBlock},children:e.children})})},ED=e=>Z.useFieldSchema()["x-use-decorator-props"]?{params:e.params,parseVariableLoading:e.parseVariableLoading}:Sf(e),xD=x.withDynamicSchemaProps(e=>{const{params:t,parseVariableLoading:r}=ED(e);return r?null:k.jsx(x.BlockProvider,ct(ue({name:"calendar"},e),{params:t,children:k.jsx(DD,ue({},e))}))},{displayName:"CalendarBlockProvider"}),Ia=()=>b.useContext(Ro),CD=()=>{var r;const e=Ia(),t=Z.useField();return b.useEffect(()=>{var n,a,i;(n=e==null?void 0:e.service)!=null&&n.loading||(t.componentProps.dataSource=(i=(a=e==null?void 0:e.service)==null?void 0:a.data)==null?void 0:i.data)},[(r=e==null?void 0:e.service)==null?void 0:r.loading]),{fieldNames:e.fieldNames,showLunar:e.showLunar,fixedBlock:e.fixedBlock}},_D=()=>{const e=Z.useField(),{t}=Je(),r=Z.useFieldSchema(),{dn:n}=x.useDesignable();return k.jsx(x.SchemaSettingsSwitchItem,{title:t("Show lunar"),checked:e.decoratorProps.showLunar,onChange:a=>{e.decoratorProps.showLunar=a,r["x-decorator-props"].showLunar=a,n.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":e.decoratorProps}}),n.refresh()}})},MD=new x.SchemaSettings({name:"blockSettings:calendar",items:[{name:"title",Component:x.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:x.SchemaSettingsBlockHeightItem},{name:"titleField",Component:x.SchemaSettingsSelectItem,useComponentProps(){var u;const{t:e}=Je(),t=Z.useFieldSchema(),r=((u=t==null?void 0:t["x-decorator-props"])==null?void 0:u.fieldNames)||{},{service:n}=Ia(),{getCollectionFieldsOptions:a}=x.useCollectionManager_deprecated(),{name:i,title:o}=x.useCollection(),s=Z.useField(),{dn:l}=x.useDesignable();return{title:e("Title field"),value:r.title,options:a(i,"string"),onChange:c=>{const f=s.decoratorProps.fieldNames||{};f.title=c,s.decoratorProps.params=f,t["x-decorator-props"].params=f,t["x-decorator-props"].fieldNames=f,n.refresh(),l.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":s.decoratorProps}}),l.refresh()}}}},{name:"showLunar",Component:_D},{name:"startDateField",Component:x.SchemaSettingsCascaderItem,useComponentProps(){var l;const{getCollectionFieldsOptions:e}=x.useCollectionManager_deprecated(),{t}=Je(),r=Z.useFieldSchema(),n=((l=r==null?void 0:r["x-decorator-props"])==null?void 0:l.fieldNames)||{},a=Z.useField(),{dn:i}=x.useDesignable(),{service:o}=Ia(),{name:s}=x.useCollection();return{title:t("Start date field"),value:n.start,options:e(s,"date",{association:["o2o","obo","oho","m2o"]}),onChange:u=>{const c=a.decoratorProps.fieldNames||{};c.start=u,a.decoratorProps.fieldNames=c,r["x-decorator-props"].fieldNames=c,o.refresh(),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"endDateField",Component:x.SchemaSettingsCascaderItem,useComponentProps(){var l;const{t:e}=Je(),t=Z.useFieldSchema(),r=Z.useField(),{service:n}=Ia(),{getCollectionFieldsOptions:a}=x.useCollectionManager_deprecated(),{dn:i}=x.useDesignable(),{name:o}=x.useCollection(),s=((l=t==null?void 0:t["x-decorator-props"])==null?void 0:l.fieldNames)||{};return{title:e("End date field"),value:s.end,options:a(o,"date",{association:["o2o","obo","oho","m2o"]}),onChange:u=>{const c=r.decoratorProps.fieldNames||{};c.end=u,r.decoratorProps.fieldNames=c,t["x-decorator-props"].fieldNames=c,n.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),i.refresh()}}}},{name:"dataScope",Component:x.SchemaSettingsDataScope,useComponentProps(){var i,o;const{name:e}=x.useCollection(),t=Z.useFieldSchema(),{form:r}=x.useFormBlockContext(),n=Z.useField(),{dn:a}=x.useDesignable();return{collectionName:e,defaultFilter:((o=(i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.params)==null?void 0:o.filter)||{},form:r,onSubmit:({filter:s})=>{s=x.removeNullCondition(s);const l=n.decoratorProps.params||{};l.filter=s,n.decoratorProps.params=l,t["x-decorator-props"].params=l,a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}})}}}},{name:"divider",type:"divider"},{name:"template",Component:x.SchemaSettingsTemplate,useComponentProps(){var a,i;const{name:e}=x.useCollection(),t=Z.useFieldSchema(),{componentNamePrefix:r}=x.useBlockTemplateContext(),n=((a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.resource)||((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.association);return{componentName:`${r}Calendar`,collectionName:e,resourceName:n}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});B("Calendar collection"),B("Repeats"),B("Daily"),B("Weekly"),B("Monthly"),B("Yearly"),x.getConfigurableProperties("title","name","inherits","category","description","presetFields");class $D extends x.CollectionTemplate{constructor(){super(...arguments);Pt(this,"name","calendar");Pt(this,"title",B("Calendar collection"));Pt(this,"order",2);Pt(this,"color","orange");Pt(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,sortable:!0,fields:[{name:"cron",type:"string",uiSchema:{type:"string",title:B("Repeats"),"x-component":"CronSet","x-component-props":"allowClear",enum:[{label:B("Daily"),value:"0 0 0 * * ?"},{label:B("Weekly"),value:"every_week"},{label:B("Monthly"),value:"every_month"},{label:B("Yearly"),value:"every_year"}]},interface:"select"},{name:"exclude",type:"json"}]});Pt(this,"availableFieldInterfaces",{include:[]});Pt(this,"configurableProperties",x.getConfigurableProperties("title","name","inherits","category","description","presetFields"))}}function AD(e){const{params:t,parseVariableLoading:r}=Sf(e);let n;return e.association&&(n=x.useParentRecordCommon(e.association)),{params:t,parentRecord:n,parseVariableLoading:r}}const Fa=e=>{const t=x.useSchemaInitializerItem();return k.jsx(x.InitializerWithSwitch,ct(ue(ue({},t),e),{item:t,type:"x-action"}))},Of={title:B("Configure actions"),icon:"SettingOutlined",style:{marginLeft:8},items:[{name:"today",title:B("Today"),Component:Fa,schema:{title:B("Today"),"x-component":"CalendarV2.Today","x-action":"calendar:today","x-align":"left"}},{name:"turnPages",title:B("Turn pages"),Component:Fa,schema:{title:B("Turn pages"),"x-component":"CalendarV2.Nav","x-action":"calendar:nav","x-align":"left"}},{name:"title",title:B("Title"),Component:Fa,schema:{title:B("Title"),"x-component":"CalendarV2.Title","x-action":"calendar:title","x-align":"left"}},{name:"selectView",title:B("Select view"),Component:Fa,schema:{title:B("Select view"),"x-component":"CalendarV2.ViewSelect","x-action":"calendar:viewSelect","x-align":"right","x-designer":"Action.Designer"}},{name:"filter",title:B("Filter"),Component:"FilterActionInitializer",schema:{"x-align":"right"}},{name:"addNew",title:B("Add new"),Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>x.useActionAvailable("create")}]},Tf=new x.CompatibleSchemaInitializer(ue({name:"CalendarActionInitializers"},Of)),kD=new x.CompatibleSchemaInitializer(ue({name:"calendar:configureActions"},Of),Tf),PD=e=>{const t={title:'{{ t("Delete Event") }}',"x-action":"deleteEvent","x-acl-action":"destroy","x-component":"Action","x-designer":"Action.Designer","x-component-props":{icon:"DeleteOutlined"},properties:{modal:{"x-component":"CalendarV2.DeleteEvent"}}};return k.jsx(x.ActionInitializerItem,ct(ue({},e),{schema:t}))},Df={name:"deleteEvent",title:B("Delete Event"),Component:PD,schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible(){return x.useCollection_deprecated().template==="calendar"}},ND=new x.SchemaInitializer({title:B("Configure actions"),name:"CalendarFormActionInitializers",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:B("Enable actions"),children:[{name:"edit",title:B("Edit"),Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}},useVisible:()=>x.useActionAvailable("update")},{name:"delete",title:B("Delete"),Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible:()=>x.useActionAvailable("destroy")},Df]},{name:"divider",type:"divider"},{type:"subMenu",name:"customize",title:B("Customize"),children:[{name:"popup",title:B("Popup"),Component:"CustomizeActionInitializer",schema:{type:"void",title:B("Popup"),"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:popup","x-component":"Action","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:B("Popup"),"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:B("Details"),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock",properties:{}}}}}}}}}}},{name:"updateRecord",title:B("Update record"),Component:"CustomizeActionInitializer",schema:{title:B("Update record"),"x-component":"Action","x-use-component-props":"useCustomizeUpdateActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:updateRecord","x-acl-action":"update","x-action":"customize:update","x-action-settings":{assignedValues:{},onSuccess:{manualClose:!0,redirecting:!1,successMessage:B("Updated successfully")},triggerWorkflows:[]}},useVisible:()=>x.useActionAvailable("update")},{name:"customRequest",title:B("Custom request"),Component:"CustomRequestInitializer"}]}]}),Ho=e=>{const{collectionName:t,dataSource:r,fieldNames:n,association:a}=e;return{type:"void","x-acl-action":`${a||t}:list`,"x-decorator":"CalendarBlockProvider","x-use-decorator-props":"useCalendarBlockDecoratorProps","x-decorator-props":{collection:t,dataSource:r,association:a,action:"list",fieldNames:ue({id:"id"},n),params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:calendar","x-component":"CardItem",properties:{[zf.uid()]:{type:"void","x-component":"CalendarV2","x-use-component-props":"useCalendarBlockProps",properties:{toolBar:{type:"void","x-component":"CalendarV2.ActionBar","x-component-props":{style:{marginBottom:24}},"x-initializer":"calendar:configureActions"},event:{type:"void","x-component":"CalendarV2.Event",properties:{drawer:{type:"void","x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},title:B("View record"),properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab","x-initializer-props":{gridInitializer:"popup:common:addBlock"},properties:{tab1:{type:"void",title:B("Details"),"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer-props":{actionInitializers:"details:configureActions"},"x-initializer":"popup:common:addBlock"}}}}}}}}}}}}}},ID=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:n,showAssociationFields:a})=>{const i=x.useSchemaInitializerItem(),{createCalendarBlock:o}=Ef();return k.jsx(x.DataBlockInitializer,ct(ue({},i),{componentType:"Calendar",icon:k.jsx(ft.FormOutlined,{}),onCreateBlockSchema:s=>lr(this,null,function*(){if(n)return n(s);o(s)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:a}))},Ef=()=>{const{insert:e}=x.useSchemaInitializer(),{t}=Je(),{getCollectionField:r,getCollectionFieldsOptions:n}=x.useCollectionManager_deprecated(),a=b.useContext(Z.SchemaOptionsContext),{theme:i}=x.useGlobalTheme();return{createCalendarBlock:l=>lr(this,[l],function*({item:s}){const u=n(s.name,"string",{dataSource:s.dataSource}),c=n(s.name,"date",{association:["o2o","obo","oho","m2o"],dataSource:s.dataSource}),f=yield x.FormDialog(t("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:a.scope,components:ue({},a.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:u,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:c,required:!0,default:r(`${s.name}.createdAt`)?"createdAt":null,"x-component":"Cascader","x-decorator":"FormItem"},end:{title:t("End date field"),enum:c,"x-component":"Cascader","x-decorator":"FormItem"}}}})})}),i).open({initialValues:{}});e(Ho({collectionName:s.name,dataSource:s.dataSource,fieldNames:ue({},f)}))})}},FD=()=>{const e=x.useSchemaInitializerItem(),p=e,{onCreateBlockSchema:t,componentType:r,createBlockSchema:n}=p,a=Yo(p,["onCreateBlockSchema","componentType","createBlockSchema"]),{insert:i}=x.useSchemaInitializer(),{getTemplateSchemaByMode:o}=x.useSchemaTemplateManager(),{t:s}=Je(),l=b.useContext(Z.SchemaOptionsContext),{getCollection:u}=x.useCollectionManager_deprecated(),c=e.field,f=u(c.target),d=`${c.collectionName}.${c.name}`,{theme:h}=x.useGlobalTheme();return k.jsx(x.SchemaInitializerItem,ct(ue({icon:k.jsx(ft.TableOutlined,{})},a),{onClick:g=>lr(this,[g],function*({item:m}){var v,y,S,T;if(m.template){const w=yield o(m);i(w)}else{const w=(y=(v=f==null?void 0:f.fields)==null?void 0:v.filter(E=>E.type==="string"))==null?void 0:y.map(E=>{var C;return{label:(C=E==null?void 0:E.uiSchema)==null?void 0:C.title,value:E.name}}),O=(T=(S=f==null?void 0:f.fields)==null?void 0:S.filter(E=>E.type==="date"))==null?void 0:T.map(E=>{var C;return{label:(C=E==null?void 0:E.uiSchema)==null?void 0:C.title,value:E.name}}),D=yield x.FormDialog(s("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:l.scope,components:ue({},l.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:s("Title field"),enum:w,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:s("Start date field"),enum:O,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:s("End date field"),enum:O,"x-component":"Select","x-decorator":"FormItem"}}}})})}),h).open({initialValues:{}});i(Ho({association:d,dataSource:m.dataSource,fieldNames:ue({},D)}))}}),items:x.useRecordCollectionDataSourceItems("Calendar",e,c.target,d)}))};function LD(){const{insert:e}=x.useSchemaInitializer(),{getCollection:t}=x.useCollectionManager_deprecated(),{t:r}=Je(),n=b.useContext(Z.SchemaOptionsContext),{theme:a}=x.useGlobalTheme();return{createAssociationCalendarBlock:s=>lr(this,[s],function*({item:o}){var h,p,m,g;const l=o.associationField,u=t(l.target),c=(p=(h=u==null?void 0:u.fields)==null?void 0:h.filter(v=>v.type==="string"))==null?void 0:p.map(v=>{var y;return{label:(y=v==null?void 0:v.uiSchema)==null?void 0:y.title,value:v.name}}),f=(g=(m=u==null?void 0:u.fields)==null?void 0:m.filter(v=>v.type==="date"))==null?void 0:g.map(v=>{var y;return{label:(y=v==null?void 0:v.uiSchema)==null?void 0:y.title,value:v.name}}),d=yield x.FormDialog(r("Create calendar block"),()=>k.jsx(x.SchemaComponentOptions,{scope:n.scope,components:ue({},n.components),children:k.jsx(Wa.FormLayout,{layout:"vertical",children:k.jsx(x.SchemaComponent,{schema:{properties:{title:{title:r("Title field"),enum:c,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:r("Start date field"),enum:f,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:r("End date field"),enum:f,"x-component":"Select","x-decorator":"FormItem"}}}})})}),a).open({initialValues:{}});e(Ho({association:`${l.collectionName}.${l.name}`,dataSource:o.dataSource,fieldNames:ue({},d)}))})}}class xf extends x.Plugin{load(){return lr(this,null,function*(){this.app.dataSourceManager.addCollectionTemplates([$D]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.calendar",{title:B("Calendar"),Component:"CalendarBlockInitializer",useComponentProps(){const{createAssociationCalendarBlock:t}=LD(),{createCalendarBlock:r}=Ef();return{onlyCurrentDataSource:!0,filterCollections({associationField:n}){return n?["hasMany","belongsToMany"].includes(n.type):!1},createBlockSchema:({item:n,fromOthersInPopup:a})=>{if(a)return r({item:n});t({item:n})},showAssociationFields:!0,hideSearch:!0}}}),this.app.addComponents({CalendarBlockProvider:xD,CalendarBlockInitializer:ID,RecordAssociationCalendarBlockInitializer:FD,CalendarV2:TD}),this.app.addScopes({useCalendarBlockProps:CD,useCalendarBlockDecoratorProps:AD}),this.schemaSettingsManager.add(MD),this.app.schemaInitializerManager.add(Tf),this.app.schemaInitializerManager.add(kD),this.app.schemaInitializerManager.add(ND),this.app.schemaInitializerManager.get("details:configureActions").add("enableActions.deleteEvent",Df)})}}R.PluginCalendarClient=xf,R.default=xf,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,10 +8,10 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.3.21-beta",
11
+ "@nocobase/client": "1.3.22-beta",
12
12
  "react-i18next": "11.18.6",
13
- "@nocobase/server": "1.3.21-beta",
14
- "@nocobase/test": "1.3.21-beta",
13
+ "@nocobase/server": "1.3.22-beta",
14
+ "@nocobase/test": "1.3.22-beta",
15
15
  "react": "18.2.0",
16
16
  "@ant-design/icons": "5.2.6",
17
17
  "@formily/react": "2.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-calendar",
3
- "version": "1.3.21-beta",
3
+ "version": "1.3.22-beta",
4
4
  "displayName": "Calendar",
5
5
  "displayName.zh-CN": "日历",
6
6
  "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.",
@@ -36,7 +36,7 @@
36
36
  "url": "git+https://github.com/nocobase/nocobase.git",
37
37
  "directory": "packages/plugins/calendar"
38
38
  },
39
- "gitHead": "540c3aa093da67afe54c7781e4e4530809bb868d",
39
+ "gitHead": "9969eda8a594de7fb7c00ea79274ce8e3c1a9803",
40
40
  "keywords": [
41
41
  "Collections",
42
42
  "Blocks"