@tachybase/plugin-block-calendar 0.23.35 → 0.23.41

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.
@@ -90,4 +90,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
90
90
  border-bottom-left-radius: 0;
91
91
  border-bottom-right-radius: 0;
92
92
  }
93
- `;_f.displayName="GlobalStyle";const u_=$.genStyleHook("tb-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"}}}}}),f_=["month","week","day"],d_=r_(ke),Mf=g.createContext({close:()=>{}});function h_(e){const t=ee.useFieldSchema(),r=g.useMemo(()=>t.reduceProperties((n,a)=>a["x-component"].endsWith(".ActionBar")?a:n,null),[]);return A.jsx(Er.Provider,{value:e,children:A.jsx(ee.RecursionField,{name:r.name,schema:r})})}const p_=(e,t,r,n)=>{const{t:a}=et();return g.useMemo(()=>{if(!Array.isArray(e))return[];const i=[];return e.forEach(o=>{const{cron:s,exclude:l=[]}=o,c=ke(jn(o,t.start)||ke()),f=ke(jn(o,t.end)||c).diff(c,"millisecond",!0),d=ke(r);let h=d.clone().startOf("month"),m=h.clone().endOf("month");n==="month"&&(h=h.startOf("week"),m=m.endOf("week"));const p=(v=c.clone())=>{if(v.isBefore(c)||!v.isBetween(h,m))return;let b=!1;if(l==null?void 0:l.some(S=>S.endsWith("_after")?(S=S.replace(/_after$/,""),b=!0,v.isSameOrAfter(S)):v.isSame(S)))return b;const O={id:jn(o,t.id||"id"),title:jn(o,t.title)||a("Untitle"),start:v.toDate(),end:v.add(f,"millisecond").toDate()};i.push(O)};if(s==="every_week"){const v=c.clone().year(h.year()).month(h.month()).date(h.date()).day(c.day());for(;v.isBefore(m)&&!p(v.clone());)v.add(1,"week")}else if(s==="every_month")p(c.clone().year(d.year()).month(d.month()));else if(s==="every_year")p(c.clone().year(d.year()));else{if(p(),!s)return;try{const v=tp.parseExpression(s,{startDate:h.toDate(),endDate:m.toDate(),iterator:!0,currentDate:c.toDate(),utc:!0});for(;v.hasNext();){const{value:b}=v.next();if(p(ke(b.toDate())))break}}catch(v){console.error(v)}}}),i},[e,t,r,n])},m_=e=>{const{visible:t,setVisible:r,record:n}=e,a=$.useCollectionParentRecordData(),i=ee.useFieldSchema(),o=g.useMemo(()=>i.reduceProperties((l,c)=>c["x-component"].endsWith(".Event")?c:l,null),[]),s=g.useCallback(()=>{r(!1)},[]);return o&&A.jsx(Mf.Provider,{value:{close:s},children:A.jsx($.ActionContextProvider,{value:{visible:t,setVisible:r},children:A.jsx($.RecordProvider,{record:n,parent:a,children:A.jsx(ee.RecursionField,{schema:o,name:o.name})})})})},dt=$.withDynamicSchemaProps(ee.observer(e=>{const{dataSource:t,fieldNames:r,showLunar:n,fixedBlock:a}=$.useProps(e),[i,o]=g.useState(new Date),[s,l]=g.useState("month"),c=p_(t,r,i,s),[u,f]=g.useState(!1),[d,h]=g.useState({}),{wrapSSR:m,hashId:p,componentCls:v}=u_(),b=g.useMemo(()=>({toolbar:O=>A.jsx(h_,ve(z({},O),{showLunar:n})),month:{dateHeader:O=>A.jsx(s_,ve(z({},O),{showLunar:n}))}}),[n]),y={allDay:"",previous:A.jsx("div",{children:A.jsx(ht.LeftOutlined,{})}),next:A.jsx("div",{children:A.jsx(ht.RightOutlined,{})}),today:qe("Today"),month:qe("Month"),week:qe("Week"),work_week:qe("Work week"),day:qe("Day"),agenda:qe("Agenda"),date:qe("Date"),time:qe("Time"),event:qe("Event"),noEventsInRange:qe("None"),showMore:O=>qe("{{count}} more items",{count:O})};return m(A.jsxs("div",{className:`${p} ${v}`,style:{height:a?"100%":700},children:[A.jsx(_f,{}),A.jsx(m_,{visible:u,setVisible:f,record:d}),A.jsx(KC,{popup:!0,selectable:!0,events:c,view:s,views:f_,date:i,step:60,showMultiDayTimes:!0,messages:y,onNavigate:o,onView:l,onSelectSlot:O=>{console.log("onSelectSlot",O)},onDoubleClickEvent:()=>{console.log("onDoubleClickEvent")},onSelectEvent:O=>{const S=t==null?void 0:t.find(w=>w[r.id]===O.id);S&&(S.__event=ve(z({},O),{start:bo(ke(O.start)),end:bo(ke(O.end))}),h(S),f(!0))},formats:{monthHeaderFormat:"YYYY-M",agendaDateFormat:"M-DD",dayHeaderFormat:"YYYY-M-DD",dayRangeHeaderFormat:({start:O,end:S},w,D)=>xf.eq(O,S,"month")?D.format(O,"YYYY-M",w):`${D.format(O,"YYYY-M",w)} - ${D.format(S,"YYYY-M",w)}`},components:b,localizer:d_})]}))},{displayName:"Calendar"})),v_=()=>{const{name:e,title:t}=$.useCollection(),r=$.useSchemaTemplate();return A.jsx($.GeneralSchemaDesigner,{schemaSettings:"blockSettings:calendar",template:r,title:t||e})},{Text:g_}=Ae.Typography,b_=ee.observer(()=>{var y;const{visible:e,setVisible:t}=$.useActionContext(),b=$.useRecord(),{exclude:r=[],cron:n}=b,a=wn(b,["exclude","cron"]),{close:i}=g.useContext(Mf),o=bo(ke((y=a.__parent)==null?void 0:y.__event.start)),s=$.useFilterByTk(),{resource:l,service:c,__parent:u}=$.useBlockRequestContext(),[f,d]=g.useState(o),[h,m]=g.useState(!1),p=()=>Zt(this,null,function*(){var O,S,w;m(!0),f==="all"||!n?yield l.destroy({filterByTk:s}):yield l.update({filterByTk:s,values:{exclude:(r||[]).concat(f)}}),m(!1),(S=(O=u==null?void 0:u.service)==null?void 0:O.refresh)==null||S.call(O),(w=c==null?void 0:c.refresh)==null||w.call(c),t==null||t(!1,!0),i()}),{t:v}=et();return Ye.createPortal(A.jsx(Ae.Modal,{title:n?v("Delete events"):null,open:e,onCancel:()=>t(!1),onOk:()=>p(),confirmLoading:h,children:n?A.jsx(Ae.Radio.Group,{value:f,onChange:O=>d(O.target.value),children:A.jsxs(Ae.Space,{direction:"vertical",children:[A.jsx(Ae.Radio,{value:o,children:v("This event")}),A.jsx(Ae.Radio,{value:`${o}_after`,children:v("This and following events")}),A.jsx(Ae.Radio,{value:"all",children:v("All events")})]})}):A.jsx(g_,{strong:!0,style:{fontSize:"18px"},children:v("Delete this event?")})}),document.body)},{displayName:"DeleteEvent"}),y_=ee.observer(e=>A.jsx(A.Fragment,{children:e.children}),{displayName:"Event"}),w_=ee.observer(()=>{const{DesignableBar:e}=$.useDesignable(),{onNavigate:t}=g.useContext(Er);return A.jsxs(Ae.Button.Group,{children:[A.jsx(Ae.Button,{icon:A.jsx(ht.LeftOutlined,{}),onClick:()=>t(Oe.PREVIOUS)}),A.jsx(Ae.Button,{icon:A.jsx(ht.RightOutlined,{}),onClick:()=>t(Oe.NEXT)}),A.jsx(e,{})]})},{displayName:"Nav"}),S_=ee.observer(()=>{const{DesignableBar:e}=$.useDesignable(),{date:t,view:r,label:n,showLunar:a}=g.useContext(Er),i=g.useMemo(()=>{if(!(!a||r!=="day"))return A.jsx("span",{children:Cf(t)})},[r,t,a]);return A.jsxs(Ae.Button.Group,{style:{fontSize:"1.75em",fontWeight:300},children:[A.jsx("span",{children:n}),A.jsx("span",{style:{marginLeft:"4px"},children:i}),A.jsx(e,{})]})},{displayName:"Title"}),O_=ee.observer(e=>{const{DesignableBar:t}=$.useDesignable(),{onNavigate:r}=g.useContext(Er),{t:n}=et();return A.jsxs(Ae.Button,{onClick:()=>{r(Oe.TODAY)},children:[n("Today"),A.jsx(t,{})]})},{displayName:"Today"}),D_=ee.observer(e=>{const{DesignableBar:t}=$.useDesignable(),{views:r,view:n,onView:a,localizer:{messages:i}}=g.useContext(Er);return A.jsxs("div",{className:"ant-btn-group",children:[A.jsx(Ae.Select,{popupMatchSelectWidth:!1,value:n,onChange:a,children:r.map(o=>A.jsx(Ae.Select.Option,{value:o,children:i[o]},o))}),A.jsx(t,{})]})},{displayName:"ViewSelect"});dt.ActionBar=$.ActionBar,dt.Event=y_,dt.DeleteEvent=b_,dt.Title=S_,dt.Today=O_,dt.Nav=w_,dt.ViewSelect=D_,dt.Designer=v_;const T_=dt;function kf(e){const t=g.useMemo(()=>{var i,o;const r=[],n=(i=e.fieldNames)==null?void 0:i.start,a=(o=e.fieldNames)==null?void 0:o.end;return Array.isArray(n)&&n.length>=2&&r.push(n[0]),Array.isArray(a)&&a.length>=2&&r.push(a[0]),r},[e.fieldNames]);return g.useMemo(()=>ve(z({},e.params),{appends:[...t,...e.params.appends||[]],paginate:!1}),[t,e.params])}const yo=g.createContext({});yo.displayName="CalendarBlockContext";const x_=e=>{var s,l,c;const{fieldNames:t,showLunar:r}=e,n=ee.useField(),{resource:a,service:i}=$.useBlockRequestContext(),{filter:o}=$.useParsedFilter({filterOption:(l=(s=i==null?void 0:i.params)==null?void 0:s[0])==null?void 0:l.filter});return g.useEffect(()=>{var u;Cr.isEmpty(o)||i==null||i.run(ve(z({},(u=i==null?void 0:i.params)==null?void 0:u[0]),{filter:o}))},[JSON.stringify(o)]),A.jsx($.FixedBlockWrapper,{children:A.jsx(yo.Provider,{value:{field:n,service:i,resource:a,fieldNames:t,showLunar:r,fixedBlock:(c=n==null?void 0:n.decoratorProps)==null?void 0:c.fixedBlock},children:e.children})})},E_=e=>ee.useFieldSchema()["x-use-decorator-props"]?e.params:kf(e),$_=$.withDynamicSchemaProps(e=>{const t=E_(e);return A.jsx($.BlockProvider,ve(z({name:"calendar"},e),{params:t,children:A.jsx(x_,z({},e))}))}),bn=()=>g.useContext(yo),C_=()=>{var r;const e=bn(),t=ee.useField();return g.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}},__=()=>{const e=ee.useField(),{t}=et(),r=ee.useFieldSchema(),{dn:n}=$.useDesignable();return A.jsx($.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()}})},M_=new $.SchemaSettings({name:"blockSettings:calendar",items:[{name:"title",Component:$.SchemaSettingsBlockTitleItem},{name:"titleField",Component:$.SchemaSettingsSelectItem,useComponentProps(){var c;const{t:e}=et(),t=ee.useFieldSchema(),r=((c=t==null?void 0:t["x-decorator-props"])==null?void 0:c.fieldNames)||{},{service:n}=bn(),{getCollectionFieldsOptions:a}=$.useCollectionManager_deprecated(),{name:i,title:o}=$.useCollection(),s=ee.useField(),{dn:l}=$.useDesignable();return{title:e("Title field"),value:r.title,options:a(i,"string"),onChange:u=>{const f=s.decoratorProps.fieldNames||{};f.title=u,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:__},{name:"fixBlock",Component:$.FixedBlockDesignerItem},{name:"startDateField",Component:$.SchemaSettingsCascaderItem,useComponentProps(){var l;const{getCollectionFieldsOptions:e}=$.useCollectionManager_deprecated(),{t}=et(),r=ee.useFieldSchema(),n=((l=r==null?void 0:r["x-decorator-props"])==null?void 0:l.fieldNames)||{},a=ee.useField(),{dn:i}=$.useDesignable(),{service:o}=bn(),{name:s}=$.useCollection();return{title:t("Start date field"),value:n.start,options:e(s,"date",{association:["o2o","obo","oho","m2o"]}),onChange:c=>{const u=a.decoratorProps.fieldNames||{};u.start=c,a.decoratorProps.fieldNames=u,r["x-decorator-props"].fieldNames=u,o.refresh(),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"endDateField",Component:$.SchemaSettingsCascaderItem,useComponentProps(){var l;const{t:e}=et(),t=ee.useFieldSchema(),r=ee.useField(),{service:n}=bn(),{getCollectionFieldsOptions:a}=$.useCollectionManager_deprecated(),{dn:i}=$.useDesignable(),{name:o}=$.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:c=>{const u=r.decoratorProps.fieldNames||{};u.end=c,r.decoratorProps.fieldNames=u,t["x-decorator-props"].fieldNames=u,n.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),i.refresh()}}}},{name:"dataScope",Component:$.SchemaSettingsDataScope,useComponentProps(){var o,s;const{name:e}=$.useCollection(),t=ee.useFieldSchema(),{form:r}=$.useFormBlockContext(),n=ee.useField(),{service:a}=bn(),{dn:i}=$.useDesignable();return{collectionName:e,defaultFilter:((s=(o=t==null?void 0:t["x-decorator-props"])==null?void 0:o.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:l})=>{var u;l=$.removeNullCondition(l);const c=n.decoratorProps.params||{};c.filter=l,n.decoratorProps.params=c,t["x-decorator-props"].params=c,a.run(ve(z({},(u=a==null?void 0:a.params)==null?void 0:u[0]),{filter:l})),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}})}}}},{name:"divider",type:"divider"},{name:"template",Component:$.SchemaSettingsTemplate,useComponentProps(){var n,a;const{name:e}=$.useCollection(),t=ee.useFieldSchema(),r=((n=t==null?void 0:t["x-decorator-props"])==null?void 0:n.resource)||((a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.association);return{componentName:"Calendar",collectionName:e,resourceName:r}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});q("Calendar collection"),q("Repeats"),q("Daily"),q("Weekly"),q("Monthly"),q("Yearly"),$.getConfigurableProperties("title","name","inherits","category","description","presetFields");class k_ extends $.CollectionTemplate{constructor(){super(...arguments);$t(this,"name","calendar");$t(this,"title",q("Calendar collection"));$t(this,"order",2);$t(this,"color","orange");$t(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,sortable:!0,fields:[{name:"cron",type:"string",uiSchema:{type:"string",title:q("Repeats"),"x-component":"CronSet","x-component-props":"allowClear",enum:[{label:q("Daily"),value:"0 0 0 * * ?"},{label:q("Weekly"),value:"every_week"},{label:q("Monthly"),value:"every_month"},{label:q("Yearly"),value:"every_year"}]},interface:"select"},{name:"exclude",type:"json"}]});$t(this,"availableFieldInterfaces",{include:[]});$t(this,"configurableProperties",$.getConfigurableProperties("title","name","inherits","category","description","presetFields"))}}function A_(e){const t=kf(e);let r;return e.association&&(r=$.useParentRecordCommon(e.association)),{params:t,parentRecord:r}}const N_=new $.SchemaInitializer({title:q("Configure actions"),icon:"SettingOutlined",name:"calendar:configureActions",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:q("Enable actions"),children:[{name:"today",title:q("Today"),Component:"ActionInitializer",schema:{title:q("Today"),"x-component":"CalendarV2.Today","x-action":"calendar:today","x-align":"left"}},{name:"turnPages",title:q("Turn pages"),Component:"ActionInitializer",schema:{title:q("Turn pages"),"x-component":"CalendarV2.Nav","x-action":"calendar:nav","x-align":"left"}},{name:"title",title:q("Title"),Component:"ActionInitializer",schema:{title:q("Title"),"x-component":"CalendarV2.Title","x-action":"calendar:title","x-align":"left"}},{name:"selectView",title:q("Select view"),Component:"ActionInitializer",schema:{title:q("Select view"),"x-component":"CalendarV2.ViewSelect","x-action":"calendar:viewSelect","x-align":"right","x-designer":"Action.Designer"}},{name:"filter",title:q("Filter"),Component:"FilterActionInitializer",schema:{"x-align":"right"}},{name:"addNew",title:q("Add new"),Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){const e=$.useCollection();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}}]}]}),Af={name:"deleteEvent",title:q("Delete Event"),Component:"DeleteEventActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible(){return $.useCollection_deprecated().template==="calendar"}},I_=new $.SchemaInitializer({title:q("Configure actions"),name:"CalendarFormActionInitializers",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:q("Enable actions"),children:[{name:"edit",title:q("Edit"),Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}},useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}},{name:"delete",title:q("Delete"),Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},visible:function(){const t=$.useCollection_deprecated();return(t.template!=="view"||(t==null?void 0:t.writableView))&&t.template!=="sql"}},Af]},{name:"divider",type:"divider"},{type:"subMenu",name:"customize",title:q("Customize"),children:[{name:"popup",title:q("Popup"),Component:"CustomizeActionInitializer",schema:{type:"void",title:q("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:q("Popup"),"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",properties:{tab1:{type:"void",title:q("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:q("Update record"),Component:"CustomizeActionInitializer",schema:{title:q("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:q("Updated successfully")},triggerWorkflows:[]}},useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}},{name:"customRequest",title:q("Custom request"),Component:"CustomRequestInitializer",useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}}]}]}),wo=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:z({id:"id"},n),params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:calendar","x-component":"CardItem",properties:{[ee.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.Drawer","x-component-props":{className:"tb-action-popup"},title:q("View record"),properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers","x-initializer-props":{gridInitializer:"popup:common:addBlock"},properties:{tab1:{type:"void",title:q("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"}}}}}}}}}}}}}},P_=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:n,showAssociationFields:a})=>{const i=$.useSchemaInitializerItem(),{createCalendarBlock:o}=Nf();return A.jsx($.DataBlockInitializer,ve(z({},i),{componentType:"Calendar",icon:A.jsx(ht.CalendarOutlined,{}),onCreateBlockSchema:s=>Zt(this,null,function*(){if(n)return n(s);o(s)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:a}))},Nf=()=>{const{insert:e}=$.useSchemaInitializer(),{t}=et(),{getCollectionField:r,getCollectionFieldsOptions:n}=$.useCollectionManager_deprecated(),a=g.useContext(ee.SchemaOptionsContext),{theme:i}=$.useGlobalTheme();return{createCalendarBlock:l=>Zt(this,[l],function*({item:s}){const c=n(s.name,"string",{dataSource:s.dataSource}),u=n(s.name,"date",{association:["o2o","obo","oho","m2o"],dataSource:s.dataSource}),f=yield $.FormDialog(t("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:a.scope,components:z({},a.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:c,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:u,required:!0,default:r(`${s.name}.createdAt`)?"createdAt":null,"x-component":"Cascader","x-decorator":"FormItem"},end:{title:t("End date field"),enum:u,"x-component":"Cascader","x-decorator":"FormItem"}}}})})}),i).open({initialValues:{}});e(wo({collectionName:s.name,dataSource:s.dataSource,fieldNames:z({},f)}))})}},F_=()=>{const e=$.useSchemaInitializerItem(),m=e,{onCreateBlockSchema:t,componentType:r,createBlockSchema:n}=m,a=wn(m,["onCreateBlockSchema","componentType","createBlockSchema"]),{insert:i}=$.useSchemaInitializer(),{getTemplateSchemaByMode:o}=$.useSchemaTemplateManager(),{t:s}=et(),l=g.useContext(ee.SchemaOptionsContext),{getCollection:c}=$.useCollectionManager_deprecated(),u=e.field,f=c(u.target),d=`${u.collectionName}.${u.name}`,{theme:h}=$.useGlobalTheme();return A.jsx($.SchemaInitializerItem,ve(z({icon:A.jsx(ht.TableOutlined,{})},a),{onClick:v=>Zt(this,[v],function*({item:p}){var b,y,O,S;if(p.template){const w=yield o(p);i(w)}else{const w=(y=(b=f==null?void 0:f.fields)==null?void 0:b.filter(x=>x.type==="string"))==null?void 0:y.map(x=>{var E;return{label:(E=x==null?void 0:x.uiSchema)==null?void 0:E.title,value:x.name}}),D=(S=(O=f==null?void 0:f.fields)==null?void 0:O.filter(x=>x.type==="date"))==null?void 0:S.map(x=>{var E;return{label:(E=x==null?void 0:x.uiSchema)==null?void 0:E.title,value:x.name}}),T=yield $.FormDialog(s("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:l.scope,components:z({},l.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.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:D,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:s("End date field"),enum:D,"x-component":"Select","x-decorator":"FormItem"}}}})})}),h).open({initialValues:{}});i(wo({association:d,dataSource:p.dataSource,fieldNames:z({},T)}))}}),items:$.useRecordCollectionDataSourceItems("Calendar",e,u.target,d)}))};function L_(){const{insert:e}=$.useSchemaInitializer(),{getCollection:t}=$.useCollectionManager_deprecated(),{t:r}=et(),n=g.useContext(ee.SchemaOptionsContext),{theme:a}=$.useGlobalTheme();return{createAssociationCalendarBlock:s=>Zt(this,[s],function*({item:o}){var h,m,p,v;const l=o.associationField,c=t(l.target),u=(m=(h=c==null?void 0:c.fields)==null?void 0:h.filter(b=>b.type==="string"))==null?void 0:m.map(b=>{var y;return{label:(y=b==null?void 0:b.uiSchema)==null?void 0:y.title,value:b.name}}),f=(v=(p=c==null?void 0:c.fields)==null?void 0:p.filter(b=>b.type==="date"))==null?void 0:v.map(b=>{var y;return{label:(y=b==null?void 0:b.uiSchema)==null?void 0:y.title,value:b.name}}),d=yield $.FormDialog(r("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:n.scope,components:z({},n.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.SchemaComponent,{schema:{properties:{title:{title:r("Title field"),enum:u,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(wo({association:`${l.collectionName}.${l.name}`,dataSource:o.dataSource,fieldNames:z({},d)}))})}}class If extends $.Plugin{load(){return Zt(this,null,function*(){this.app.dataSourceManager.addCollectionTemplates([k_]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.calendar",{title:q("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.calendar",{title:q("Calendar"),Component:"CalendarBlockInitializer",useComponentProps(){const{createAssociationCalendarBlock:t}=L_(),{createCalendarBlock:r}=Nf();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:$_,CalendarBlockInitializer:P_,RecordAssociationCalendarBlockInitializer:F_,CalendarV2:T_}),this.app.addScopes({useCalendarBlockProps:C_,useCalendarBlockDecoratorProps:A_}),this.schemaSettingsManager.add(M_),this.app.schemaInitializerManager.add(N_),this.app.schemaInitializerManager.add(I_),this.app.schemaInitializerManager.get("details:configureActions").add("enableActions.deleteEvent",Af)})}}Z.PluginCalendarClient=If,Z.default=If,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
93
+ `;_f.displayName="GlobalStyle";const u_=$.genStyleHook("tb-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"}}}}}),f_=["month","week","day"],d_=r_(ke),Mf=g.createContext({close:()=>{}});function h_(e){const t=ee.useFieldSchema(),r=g.useMemo(()=>t.reduceProperties((n,a)=>a["x-component"].endsWith(".ActionBar")?a:n,null),[]);return A.jsx(Er.Provider,{value:e,children:A.jsx(ee.RecursionField,{name:r.name,schema:r})})}const p_=(e,t,r,n)=>{const{t:a}=et();return g.useMemo(()=>{if(!Array.isArray(e))return[];const i=[];return e.forEach(o=>{const{cron:s,exclude:l=[]}=o,c=ke(jn(o,t.start)||ke()),f=ke(jn(o,t.end)||c).diff(c,"millisecond",!0),d=ke(r);let h=d.clone().startOf("month"),m=h.clone().endOf("month");n==="month"&&(h=h.startOf("week"),m=m.endOf("week"));const p=(v=c.clone())=>{if(v.isBefore(c)||!v.isBetween(h,m))return;let b=!1;if(l==null?void 0:l.some(S=>S.endsWith("_after")?(S=S.replace(/_after$/,""),b=!0,v.isSameOrAfter(S)):v.isSame(S)))return b;const O={id:jn(o,t.id||"id"),title:jn(o,t.title)||a("Untitle"),start:v.toDate(),end:v.add(f,"millisecond").toDate()};i.push(O)};if(s==="every_week"){const v=c.clone().year(h.year()).month(h.month()).date(h.date()).day(c.day());for(;v.isBefore(m)&&!p(v.clone());)v.add(1,"week")}else if(s==="every_month")p(c.clone().year(d.year()).month(d.month()));else if(s==="every_year")p(c.clone().year(d.year()));else{if(p(),!s)return;try{const v=tp.parseExpression(s,{startDate:h.toDate(),endDate:m.toDate(),iterator:!0,currentDate:c.toDate(),utc:!0});for(;v.hasNext();){const{value:b}=v.next();if(p(ke(b.toDate())))break}}catch(v){console.error(v)}}}),i},[e,t,r,n])},m_=e=>{const{visible:t,setVisible:r,record:n}=e,a=$.useCollectionParentRecordData(),i=ee.useFieldSchema(),o=g.useMemo(()=>i.reduceProperties((l,c)=>c["x-component"].endsWith(".Event")?c:l,null),[]),s=g.useCallback(()=>{r(!1)},[]);return o&&A.jsx(Mf.Provider,{value:{close:s},children:A.jsx($.ActionContextProvider,{value:{visible:t,setVisible:r},children:A.jsx($.RecordProvider,{record:n,parent:a,children:A.jsx(ee.RecursionField,{schema:o,name:o.name})})})})},dt=$.withDynamicSchemaProps(ee.observer(e=>{const{dataSource:t,fieldNames:r,showLunar:n,fixedBlock:a}=$.useProps(e),[i,o]=g.useState(new Date),[s,l]=g.useState("month"),c=p_(t,r,i,s),[u,f]=g.useState(!1),[d,h]=g.useState({}),{wrapSSR:m,hashId:p,componentCls:v}=u_(),b=g.useMemo(()=>({toolbar:O=>A.jsx(h_,ve(z({},O),{showLunar:n})),month:{dateHeader:O=>A.jsx(s_,ve(z({},O),{showLunar:n}))}}),[n]),y={allDay:"",previous:A.jsx("div",{children:A.jsx(ht.LeftOutlined,{})}),next:A.jsx("div",{children:A.jsx(ht.RightOutlined,{})}),today:qe("Today"),month:qe("Month"),week:qe("Week"),work_week:qe("Work week"),day:qe("Day"),agenda:qe("Agenda"),date:qe("Date"),time:qe("Time"),event:qe("Event"),noEventsInRange:qe("None"),showMore:O=>qe("{{count}} more items",{count:O})};return m(A.jsxs("div",{className:`${p} ${v}`,style:{height:a?"100%":700},children:[A.jsx(_f,{}),A.jsx(m_,{visible:u,setVisible:f,record:d}),A.jsx(KC,{popup:!0,selectable:!0,events:c,view:s,views:f_,date:i,step:60,showMultiDayTimes:!0,messages:y,onNavigate:o,onView:l,onSelectSlot:O=>{console.log("onSelectSlot",O)},onDoubleClickEvent:()=>{console.log("onDoubleClickEvent")},onSelectEvent:O=>{const S=t==null?void 0:t.find(w=>w[r.id]===O.id);S&&(S.__event=ve(z({},O),{start:bo(ke(O.start)),end:bo(ke(O.end))}),h(S),f(!0))},formats:{monthHeaderFormat:"YYYY-M",agendaDateFormat:"M-DD",dayHeaderFormat:"YYYY-M-DD",dayRangeHeaderFormat:({start:O,end:S},w,D)=>xf.eq(O,S,"month")?D.format(O,"YYYY-M",w):`${D.format(O,"YYYY-M",w)} - ${D.format(S,"YYYY-M",w)}`},components:b,localizer:d_})]}))},{displayName:"Calendar"})),v_=()=>{const{name:e,title:t}=$.useCollection(),r=$.useSchemaTemplate();return A.jsx($.GeneralSchemaDesigner,{schemaSettings:"blockSettings:calendar",template:r,title:t||e})},{Text:g_}=Ae.Typography,b_=ee.observer(()=>{var y;const{visible:e,setVisible:t}=$.useActionContext(),b=$.useRecord(),{exclude:r=[],cron:n}=b,a=wn(b,["exclude","cron"]),{close:i}=g.useContext(Mf),o=bo(ke((y=a.__parent)==null?void 0:y.__event.start)),s=$.useFilterByTk(),{resource:l,service:c,__parent:u}=$.useBlockRequestContext(),[f,d]=g.useState(o),[h,m]=g.useState(!1),p=()=>Zt(this,null,function*(){var O,S,w;m(!0),f==="all"||!n?yield l.destroy({filterByTk:s}):yield l.update({filterByTk:s,values:{exclude:(r||[]).concat(f)}}),m(!1),(S=(O=u==null?void 0:u.service)==null?void 0:O.refresh)==null||S.call(O),(w=c==null?void 0:c.refresh)==null||w.call(c),t==null||t(!1,!0),i()}),{t:v}=et();return Ye.createPortal(A.jsx(Ae.Modal,{title:n?v("Delete events"):null,open:e,onCancel:()=>t(!1),onOk:()=>p(),confirmLoading:h,children:n?A.jsx(Ae.Radio.Group,{value:f,onChange:O=>d(O.target.value),children:A.jsxs(Ae.Space,{direction:"vertical",children:[A.jsx(Ae.Radio,{value:o,children:v("This event")}),A.jsx(Ae.Radio,{value:`${o}_after`,children:v("This and following events")}),A.jsx(Ae.Radio,{value:"all",children:v("All events")})]})}):A.jsx(g_,{strong:!0,style:{fontSize:"18px"},children:v("Delete this event?")})}),document.body)},{displayName:"DeleteEvent"}),y_=ee.observer(e=>A.jsx(A.Fragment,{children:e.children}),{displayName:"Event"}),w_=ee.observer(()=>{const{DesignableBar:e}=$.useDesignable(),{onNavigate:t}=g.useContext(Er);return A.jsxs(Ae.Button.Group,{children:[A.jsx(Ae.Button,{icon:A.jsx(ht.LeftOutlined,{}),onClick:()=>t(Oe.PREVIOUS)}),A.jsx(Ae.Button,{icon:A.jsx(ht.RightOutlined,{}),onClick:()=>t(Oe.NEXT)}),A.jsx(e,{})]})},{displayName:"Nav"}),S_=ee.observer(()=>{const{DesignableBar:e}=$.useDesignable(),{date:t,view:r,label:n,showLunar:a}=g.useContext(Er),i=g.useMemo(()=>{if(!(!a||r!=="day"))return A.jsx("span",{children:Cf(t)})},[r,t,a]);return A.jsxs(Ae.Button.Group,{style:{fontSize:"1.75em",fontWeight:300},children:[A.jsx("span",{children:n}),A.jsx("span",{style:{marginLeft:"4px"},children:i}),A.jsx(e,{})]})},{displayName:"Title"}),O_=ee.observer(e=>{const{DesignableBar:t}=$.useDesignable(),{onNavigate:r}=g.useContext(Er),{t:n}=et();return A.jsxs(Ae.Button,{onClick:()=>{r(Oe.TODAY)},children:[n("Today"),A.jsx(t,{})]})},{displayName:"Today"}),D_=ee.observer(e=>{const{DesignableBar:t}=$.useDesignable(),{views:r,view:n,onView:a,localizer:{messages:i}}=g.useContext(Er);return A.jsxs("div",{className:"ant-btn-group",children:[A.jsx(Ae.Select,{popupMatchSelectWidth:!1,value:n,onChange:a,children:r.map(o=>A.jsx(Ae.Select.Option,{value:o,children:i[o]},o))}),A.jsx(t,{})]})},{displayName:"ViewSelect"});dt.ActionBar=$.ActionBar,dt.Event=y_,dt.DeleteEvent=b_,dt.Title=S_,dt.Today=O_,dt.Nav=w_,dt.ViewSelect=D_,dt.Designer=v_;const T_=dt;function kf(e){const t=g.useMemo(()=>{var i,o;const r=[],n=(i=e.fieldNames)==null?void 0:i.start,a=(o=e.fieldNames)==null?void 0:o.end;return Array.isArray(n)&&n.length>=2&&r.push(n[0]),Array.isArray(a)&&a.length>=2&&r.push(a[0]),r},[e.fieldNames]);return g.useMemo(()=>ve(z({},e.params),{appends:[...t,...e.params.appends||[]],paginate:!1}),[t,e.params])}const yo=g.createContext({});yo.displayName="CalendarBlockContext";const x_=e=>{var s,l,c;const{fieldNames:t,showLunar:r}=e,n=ee.useField(),{resource:a,service:i}=$.useBlockRequestContext(),{filter:o}=$.useParsedFilter({filterOption:(l=(s=i==null?void 0:i.params)==null?void 0:s[0])==null?void 0:l.filter});return g.useEffect(()=>{var u;Cr.isEmpty(o)||i==null||i.run(ve(z({},(u=i==null?void 0:i.params)==null?void 0:u[0]),{filter:o}))},[JSON.stringify(o)]),A.jsx($.FixedBlockWrapper,{children:A.jsx(yo.Provider,{value:{field:n,service:i,resource:a,fieldNames:t,showLunar:r,fixedBlock:(c=n==null?void 0:n.decoratorProps)==null?void 0:c.fixedBlock},children:e.children})})},E_=e=>ee.useFieldSchema()["x-use-decorator-props"]?e.params:kf(e),$_=$.withDynamicSchemaProps(e=>{const t=E_(e);return A.jsx($.BlockProvider,ve(z({name:"calendar"},e),{params:t,children:A.jsx(x_,z({},e))}))}),bn=()=>g.useContext(yo),C_=()=>{var r;const e=bn(),t=ee.useField();return g.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}},__=()=>{const e=ee.useField(),{t}=et(),r=ee.useFieldSchema(),{dn:n}=$.useDesignable();return A.jsx($.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()}})},M_=new $.SchemaSettings({name:"blockSettings:calendar",items:[{name:"title",Component:$.SchemaSettingsBlockTitleItem},{name:"titleField",Component:$.SchemaSettingsSelectItem,useComponentProps(){var c;const{t:e}=et(),t=ee.useFieldSchema(),r=((c=t==null?void 0:t["x-decorator-props"])==null?void 0:c.fieldNames)||{},{service:n}=bn(),{getCollectionFieldsOptions:a}=$.useCollectionManager_deprecated(),{name:i,title:o}=$.useCollection(),s=ee.useField(),{dn:l}=$.useDesignable();return{title:e("Title field"),value:r.title,options:a(i,"string"),onChange:u=>{const f=s.decoratorProps.fieldNames||{};f.title=u,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:__},{name:"fixBlock",Component:$.FixedBlockDesignerItem},{name:"startDateField",Component:$.SchemaSettingsCascaderItem,useComponentProps(){var l;const{getCollectionFieldsOptions:e}=$.useCollectionManager_deprecated(),{t}=et(),r=ee.useFieldSchema(),n=((l=r==null?void 0:r["x-decorator-props"])==null?void 0:l.fieldNames)||{},a=ee.useField(),{dn:i}=$.useDesignable(),{service:o}=bn(),{name:s}=$.useCollection();return{title:t("Start date field"),value:n.start,options:e(s,"date",{association:["o2o","obo","oho","m2o"]}),onChange:c=>{const u=a.decoratorProps.fieldNames||{};u.start=c,a.decoratorProps.fieldNames=u,r["x-decorator-props"].fieldNames=u,o.refresh(),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":a.decoratorProps}}),i.refresh()}}}},{name:"endDateField",Component:$.SchemaSettingsCascaderItem,useComponentProps(){var l;const{t:e}=et(),t=ee.useFieldSchema(),r=ee.useField(),{service:n}=bn(),{getCollectionFieldsOptions:a}=$.useCollectionManager_deprecated(),{dn:i}=$.useDesignable(),{name:o}=$.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:c=>{const u=r.decoratorProps.fieldNames||{};u.end=c,r.decoratorProps.fieldNames=u,t["x-decorator-props"].fieldNames=u,n.refresh(),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),i.refresh()}}}},{name:"dataScope",Component:$.SchemaSettingsDataScope,useComponentProps(){var o,s;const{name:e}=$.useCollection(),t=ee.useFieldSchema(),{form:r}=$.useFormBlockContext(),n=ee.useField(),{service:a}=bn(),{dn:i}=$.useDesignable();return{collectionName:e,defaultFilter:((s=(o=t==null?void 0:t["x-decorator-props"])==null?void 0:o.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:l})=>{var u;l=$.removeNullCondition(l);const c=n.decoratorProps.params||{};c.filter=l,n.decoratorProps.params=c,t["x-decorator-props"].params=c,a.run(ve(z({},(u=a==null?void 0:a.params)==null?void 0:u[0]),{filter:l})),i.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}})}}}},{name:"divider",type:"divider"},{name:"template",Component:$.SchemaSettingsTemplate,useComponentProps(){var n,a;const{name:e}=$.useCollection(),t=ee.useFieldSchema(),r=((n=t==null?void 0:t["x-decorator-props"])==null?void 0:n.resource)||((a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.association);return{componentName:"Calendar",collectionName:e,resourceName:r}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]});q("Calendar collection"),q("Repeats"),q("Daily"),q("Weekly"),q("Monthly"),q("Yearly"),$.getConfigurableProperties("title","name","inherits","category","description","presetFields");class k_ extends $.CollectionTemplate{constructor(){super(...arguments);$t(this,"name","calendar");$t(this,"title",q("Calendar collection"));$t(this,"order",2);$t(this,"color","orange");$t(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,sortable:!0,fields:[{name:"cron",type:"string",uiSchema:{type:"string",title:q("Repeats"),"x-component":"CronSet","x-component-props":"allowClear",enum:[{label:q("Daily"),value:"0 0 0 * * ?"},{label:q("Weekly"),value:"every_week"},{label:q("Monthly"),value:"every_month"},{label:q("Yearly"),value:"every_year"}]},interface:"select"},{name:"exclude",type:"json"}]});$t(this,"availableFieldInterfaces",{include:[]});$t(this,"configurableProperties",$.getConfigurableProperties("title","name","inherits","category","description","presetFields"))}}function A_(e){const t=kf(e);let r;return e.association&&(r=$.useParentRecordCommon(e.association)),{params:t,parentRecord:r}}const N_=new $.SchemaInitializer({title:q("Configure actions"),icon:"SettingOutlined",name:"calendar:configureActions",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:q("Enable actions"),children:[{name:"today",title:q("Today"),Component:"ActionInitializer",schema:{title:q("Today"),"x-component":"CalendarV2.Today","x-action":"calendar:today","x-align":"left"}},{name:"turnPages",title:q("Turn pages"),Component:"ActionInitializer",schema:{title:q("Turn pages"),"x-component":"CalendarV2.Nav","x-action":"calendar:nav","x-align":"left"}},{name:"title",title:q("Title"),Component:"ActionInitializer",schema:{title:q("Title"),"x-component":"CalendarV2.Title","x-action":"calendar:title","x-align":"left"}},{name:"selectView",title:q("Select view"),Component:"ActionInitializer",schema:{title:q("Select view"),"x-component":"CalendarV2.ViewSelect","x-action":"calendar:viewSelect","x-align":"right","x-designer":"Action.Designer"}},{name:"filter",title:q("Filter"),Component:"FilterActionInitializer",schema:{"x-align":"right"}},{name:"addNew",title:q("Add new"),Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){const e=$.useCollection();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}}]}]}),Af={name:"deleteEvent",title:q("Delete Event"),Component:"DeleteEventActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},useVisible(){return $.useCollection_deprecated().template==="calendar"}},I_=new $.SchemaInitializer({title:q("Configure actions"),name:"CalendarFormActionInitializers",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:q("Enable actions"),children:[{name:"edit",title:q("Edit"),Component:"UpdateActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{type:"primary"}},useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}},{name:"delete",title:q("Delete"),Component:"DestroyActionInitializer",schema:{"x-component":"Action","x-decorator":"ACLActionProvider"},visible:function(){const t=$.useCollection_deprecated();return(t.template!=="view"||(t==null?void 0:t.writableView))&&t.template!=="sql"}},Af]},{name:"divider",type:"divider"},{type:"subMenu",name:"customize",title:q("Customize"),children:[{name:"popup",title:q("Popup"),Component:"CustomizeActionInitializer",schema:{type:"void",title:q("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:q("Popup"),"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:q("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:q("Update record"),Component:"CustomizeActionInitializer",schema:{title:q("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:q("Updated successfully")},triggerWorkflows:[]}},useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}},{name:"customRequest",title:q("Custom request"),Component:"CustomRequestInitializer",useVisible(){const e=$.useCollection_deprecated();return(e.template!=="view"||(e==null?void 0:e.writableView))&&e.template!=="sql"}}]}]}),wo=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:z({id:"id"},n),params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:calendar","x-component":"CardItem",properties:{[ee.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.Drawer","x-component-props":{className:"tb-action-popup"},title:q("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:q("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"}}}}}}}}}}}}}},P_=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:n,showAssociationFields:a})=>{const i=$.useSchemaInitializerItem(),{createCalendarBlock:o}=Nf();return A.jsx($.DataBlockInitializer,ve(z({},i),{componentType:"Calendar",icon:A.jsx(ht.CalendarOutlined,{}),onCreateBlockSchema:s=>Zt(this,null,function*(){if(n)return n(s);o(s)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:a}))},Nf=()=>{const{insert:e}=$.useSchemaInitializer(),{t}=et(),{getCollectionField:r,getCollectionFieldsOptions:n}=$.useCollectionManager_deprecated(),a=g.useContext(ee.SchemaOptionsContext),{theme:i}=$.useGlobalTheme();return{createCalendarBlock:l=>Zt(this,[l],function*({item:s}){const c=n(s.name,"string",{dataSource:s.dataSource}),u=n(s.name,"date",{association:["o2o","obo","oho","m2o"],dataSource:s.dataSource}),f=yield $.FormDialog(t("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:a.scope,components:z({},a.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:c,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:u,required:!0,default:r(`${s.name}.createdAt`)?"createdAt":null,"x-component":"Cascader","x-decorator":"FormItem"},end:{title:t("End date field"),enum:u,"x-component":"Cascader","x-decorator":"FormItem"}}}})})}),i).open({initialValues:{}});e(wo({collectionName:s.name,dataSource:s.dataSource,fieldNames:z({},f)}))})}},F_=()=>{const e=$.useSchemaInitializerItem(),m=e,{onCreateBlockSchema:t,componentType:r,createBlockSchema:n}=m,a=wn(m,["onCreateBlockSchema","componentType","createBlockSchema"]),{insert:i}=$.useSchemaInitializer(),{getTemplateSchemaByMode:o}=$.useSchemaTemplateManager(),{t:s}=et(),l=g.useContext(ee.SchemaOptionsContext),{getCollection:c}=$.useCollectionManager_deprecated(),u=e.field,f=c(u.target),d=`${u.collectionName}.${u.name}`,{theme:h}=$.useGlobalTheme();return A.jsx($.SchemaInitializerItem,ve(z({icon:A.jsx(ht.TableOutlined,{})},a),{onClick:v=>Zt(this,[v],function*({item:p}){var b,y,O,S;if(p.template){const w=yield o(p);i(w)}else{const w=(y=(b=f==null?void 0:f.fields)==null?void 0:b.filter(x=>x.type==="string"))==null?void 0:y.map(x=>{var E;return{label:(E=x==null?void 0:x.uiSchema)==null?void 0:E.title,value:x.name}}),D=(S=(O=f==null?void 0:f.fields)==null?void 0:O.filter(x=>x.type==="date"))==null?void 0:S.map(x=>{var E;return{label:(E=x==null?void 0:x.uiSchema)==null?void 0:E.title,value:x.name}}),T=yield $.FormDialog(s("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:l.scope,components:z({},l.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.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:D,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:s("End date field"),enum:D,"x-component":"Select","x-decorator":"FormItem"}}}})})}),h).open({initialValues:{}});i(wo({association:d,dataSource:p.dataSource,fieldNames:z({},T)}))}}),items:$.useRecordCollectionDataSourceItems("Calendar",e,u.target,d)}))};function L_(){const{insert:e}=$.useSchemaInitializer(),{getCollection:t}=$.useCollectionManager_deprecated(),{t:r}=et(),n=g.useContext(ee.SchemaOptionsContext),{theme:a}=$.useGlobalTheme();return{createAssociationCalendarBlock:s=>Zt(this,[s],function*({item:o}){var h,m,p,v;const l=o.associationField,c=t(l.target),u=(m=(h=c==null?void 0:c.fields)==null?void 0:h.filter(b=>b.type==="string"))==null?void 0:m.map(b=>{var y;return{label:(y=b==null?void 0:b.uiSchema)==null?void 0:y.title,value:b.name}}),f=(v=(p=c==null?void 0:c.fields)==null?void 0:p.filter(b=>b.type==="date"))==null?void 0:v.map(b=>{var y;return{label:(y=b==null?void 0:b.uiSchema)==null?void 0:y.title,value:b.name}}),d=yield $.FormDialog(r("Create calendar block"),()=>A.jsx($.SchemaComponentOptions,{scope:n.scope,components:z({},n.components),children:A.jsx(ka.FormLayout,{layout:"vertical",children:A.jsx($.SchemaComponent,{schema:{properties:{title:{title:r("Title field"),enum:u,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(wo({association:`${l.collectionName}.${l.name}`,dataSource:o.dataSource,fieldNames:z({},d)}))})}}class If extends $.Plugin{load(){return Zt(this,null,function*(){this.app.dataSourceManager.addCollectionTemplates([k_]),this.app.schemaInitializerManager.addItem("page:addBlock","dataBlocks.calendar",{title:q("Calendar"),Component:"CalendarBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.calendar",{title:q("Calendar"),Component:"CalendarBlockInitializer",useComponentProps(){const{createAssociationCalendarBlock:t}=L_(),{createCalendarBlock:r}=Nf();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:$_,CalendarBlockInitializer:P_,RecordAssociationCalendarBlockInitializer:F_,CalendarV2:T_}),this.app.addScopes({useCalendarBlockProps:C_,useCalendarBlockDecoratorProps:A_}),this.schemaSettingsManager.add(M_),this.app.schemaInitializerManager.add(N_),this.app.schemaInitializerManager.add(I_),this.app.schemaInitializerManager.get("details:configureActions").add("enableActions.deleteEvent",Af)})}}Z.PluginCalendarClient=If,Z.default=If,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,14 +1,14 @@
1
1
  module.exports = {
2
- "@tachybase/client": "0.23.35",
2
+ "@tachybase/client": "0.23.41",
3
3
  "react-i18next": "15.2.0",
4
- "@tachybase/server": "0.23.35",
5
- "@tachybase/test": "0.23.35",
4
+ "@tachybase/server": "0.23.41",
5
+ "@tachybase/test": "0.23.41",
6
6
  "react": "18.3.1",
7
- "@tachybase/schema": "0.23.35",
7
+ "@tachybase/schema": "0.23.41",
8
8
  "@ant-design/icons": "5.3.7",
9
9
  "dayjs": "1.11.13",
10
10
  "lodash": "4.17.21",
11
11
  "antd": "5.22.5",
12
12
  "react-dom": "18.3.1",
13
- "@tachybase/components": "0.23.35"
13
+ "@tachybase/components": "0.23.41"
14
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-block-calendar",
3
3
  "displayName": "Calendar",
4
- "version": "0.23.35",
4
+ "version": "0.23.41",
5
5
  "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.",
6
6
  "keywords": [
7
7
  "Collections",
@@ -22,14 +22,14 @@
22
22
  "react-i18next": "^15.2.0",
23
23
  "react-js-cron": "^3.2.0",
24
24
  "solarlunar-es": "^1.0.9",
25
- "@tachybase/components": "0.23.35",
26
- "@tachybase/schema": "0.23.35"
25
+ "@tachybase/components": "0.23.41",
26
+ "@tachybase/schema": "0.23.41"
27
27
  },
28
28
  "peerDependencies": {
29
- "@tachybase/client": "0.23.35",
30
- "@tachybase/database": "0.23.35",
31
- "@tachybase/server": "0.23.35",
32
- "@tachybase/test": "0.23.35"
29
+ "@tachybase/client": "0.23.41",
30
+ "@tachybase/test": "0.23.41",
31
+ "@tachybase/database": "0.23.41",
32
+ "@tachybase/server": "0.23.41"
33
33
  },
34
34
  "description.zh-CN": "提供日历数据表模板和卡片,用于管理日期数据,通常用于事件、约会、任务等与日期/时间相关的信息。",
35
35
  "displayName.zh-CN": "日历",