@nocobase/plugin-gantt 1.3.50-beta → 1.3.52

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.
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(I,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("@formily/react"),require("react-i18next"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@emotion/css"),require("antd"),require("lodash"),require("antd-style"),require("@nocobase/utils/client")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","@formily/react","react-i18next","@ant-design/icons","@formily/antd-v5","@formily/shared","@emotion/css","antd","lodash","antd-style","@nocobase/utils/client"],c):(I=typeof globalThis!="undefined"?globalThis:I||self,c(I["@nocobase/plugin-gantt"]={},I.jsxRuntime,I["@nocobase/client"],I.react,I["@formily/react"],I["react-i18next"],I["@ant-design/icons"],I["@formily/antd-v5"],I["@formily/shared"],I["@emotion/css"],I.antd,I.lodash,I["antd-style"],I["@nocobase/utils"]))})(this,function(I,c,d,b,A,Ce,Ke,we,ie,M,Ve,ht,Ee,Je){"use strict";var jo=Object.defineProperty,qo=Object.defineProperties;var Uo=Object.getOwnPropertyDescriptors;var or=Object.getOwnPropertySymbols;var Wo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;var nr=(I,c,d)=>c in I?jo(I,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[c]=d,H=(I,c)=>{for(var d in c||(c={}))Wo.call(c,d)&&nr(I,d,c[d]);if(or)for(var d of or(c))Qo.call(c,d)&&nr(I,d,c[d]);return I},Se=(I,c)=>qo(I,Uo(c));var R=(I,c,d)=>new Promise((b,A)=>{var Ce=ie=>{try{we(d.next(ie))}catch(M){A(M)}},Ke=ie=>{try{we(d.throw(ie))}catch(M){A(M)}},we=ie=>ie.done?b(ie.value):Promise.resolve(ie.value).then(Ce,Ke);we((d=d.apply(I,c)).next())});const ar=()=>{const{name:e,title:t}=d.useCollection_deprecated(),r=d.useSchemaTemplate();return c.jsx(d.GeneralSchemaDesigner,{schemaSettings:"blockSettings:gantt",template:r,title:t||e})},Ze=b.createContext({});Ze.displayName="GanttBlockContext";const Re=(e=[],t,r=[],o=void 0,n=!1,a,s,i)=>(e.forEach(l=>{var D,w;const u=a(l),g=parseFloat((l[t.progress]*100).toFixed(2)),y=d.getLabelFormatValue(i,l[t.title]);l.children&&l.children.length?(r.push({start:new Date((D=l[t.start])!=null?D:void 0),end:new Date((w=l[t.end])!=null?w:void 0),name:y,id:l[s]+"",type:"project",progress:g>100?100:g||0,hideChildren:n,project:o,color:l.color,isDisabled:u}),Re(l.children,t,r,l.id+"",n,a,s,i)):r.push({start:l[t.start]?new Date(l[t.start]):void 0,end:new Date(l[t.end]||l[t.start]),name:y,id:l[s]+"",type:t.end?"task":"milestone",progress:g>100?100:g||0,project:o,color:l.color,isDisabled:u})}),r),sr=e=>{const{fieldNames:t,timeRange:r,resource:o}=e,n=A.useField(),{service:a}=d.useBlockRequestContext();return c.jsx(Ze.Provider,{value:{field:n,service:a,resource:o,fieldNames:t,timeRange:r},children:e.children})},ir=e=>{var n;const r=d.useCollectionManager_deprecated(e.dataSource).getCollection(e.collection,e.dataSource),o={filter:(n=e.params)==null?void 0:n.filter,paginate:!1,sort:[(r==null?void 0:r.primaryKey)||"id"]};return r!=null&&r.tree&&(o.tree=!0),c.jsx("div",{"aria-label":"block-item-gantt",role:"button",children:c.jsx(d.TableBlockProvider,Se(H({},e),{params:o,children:c.jsx(sr,H({},e))}))})},J=()=>b.useContext(Ze),gt=()=>{var v,N;const e=J(),{fieldNames:t}=e,[r,o]=b.useState([]),{getPrimaryKey:n,name:a,template:s,writableView:i}=d.useCollection_deprecated(),{parseAction:l}=d.useACLRoleContext(),u=d.useTableBlockContext(),[g,y]=b.useState(!1),D=n(),{fields:w}=d.useCollection(),C=(v=w.find(x=>x.name===(t==null?void 0:t.title)))==null?void 0:v.uiSchema,k=x=>{const h=`${a}:update`,p={},S=x==null?void 0:x[D],P=l(h,{schema:p,recordPkValue:S});return s==="view"&&!i||!P},m=x=>{const p=e.field.data.map(S=>S.id===x.id?x:S);o(p),e.field.data=p},f=x=>{var p;const h=Re((p=e.service.data)==null?void 0:p.data,e.fieldNames,[],void 0,x,k,D,C);o(h),e.field.data=h};return b.useEffect(()=>{var x,h;if(y(!0),!((x=e==null?void 0:e.service)!=null&&x.loading)){const p=Re((h=e.service.data)==null?void 0:h.data,e.fieldNames,[],void 0,!1,k,D,C);o(p),y(!1),e.field.data=p,r.length>0&&u.setExpandFlag(!0)}},[(N=e==null?void 0:e.service)==null?void 0:N.loading]),{fieldNames:e.fieldNames,timeRange:e.timeRange,onExpanderClick:m,expandAndCollapseAll:f,tasks:r,loading:g}},re=()=>Ce.useTranslation("gantt"),fe=(e="string")=>{var n;const t=d.useCompile(),{fields:r}=d.useCollection_deprecated();return(n=r==null?void 0:r.filter(a=>a.type===e))==null?void 0:n.map(a=>{var s;return{value:a.name,label:t((s=a==null?void 0:a.uiSchema)==null?void 0:s.title)}})},lr=new d.SchemaSettings({name:"GanttBlockSettings",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),n=A.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:fe("string"),onChange:i=>{const l=n.decoratorProps.fieldNames||{};l.title=i,n.decoratorProps.params=l,t["x-decorator-props"].params=l,t["x-decorator-props"].fieldNames=l,o.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}}),a.refresh()}}}},{name:"timeScale",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=re(),t=A.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=A.useField(),{service:n}=J(),{dn:a}=d.useDesignable(),s=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:s('{{t("Hour")}}'),value:"hour",color:"orange"},{label:s('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:s('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:s('{{t("Day")}}'),value:"day",color:"yellow"},{label:s('{{t("Week")}}'),value:"week",color:"pule"},{label:s('{{t("Month")}}'),value:"month",color:"green"},{label:s('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:s('{{t("Year")}}'),value:"year",color:"green"}],onChange:l=>{const u=o.decoratorProps.fieldNames||{};u.range=l,o.decoratorProps.params=u,t["x-decorator-props"].params=u,t["x-decorator-props"].fieldNames=u,n.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),a.refresh()}}}},{name:"startDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=A.useField(),{dn:n}=d.useDesignable(),{service:a}=J();return{title:e("Start date field"),value:r.start,options:fe("date"),onChange:i=>{const l=o.decoratorProps.fieldNames||{};l.start=i,o.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,a.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),n.refresh()}}}},{name:"endDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=A.useField(),{service:o}=J(),{dn:n}=d.useDesignable(),a=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{};return{title:e("End date field"),value:a.end,options:fe("date"),onChange:i=>{const l=r.decoratorProps.fieldNames||{};l.end=i,r.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),n.refresh()}}}},{name:"processField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),{dn:n}=d.useDesignable(),a=A.useField();return{title:e("Progress field"),value:r.progress,options:fe("float"),onChange:i=>{const l=a.decoratorProps.fieldNames||{};l.progress=i,a.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),n.refresh()}}}},{name:"dataScope",Component:d.SchemaSettingsDataScope,useComponentProps(){var a,s;const{name:e}=d.useCollection_deprecated(),t=A.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=A.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((s=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:i})=>{i=d.removeNullCondition(i);const l=o.decoratorProps.params||{};l.filter=i,o.decoratorProps.params=l,t["x-decorator-props"].params=l,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":t["x-decorator-props"]}})}}}},{name:"divider",type:"divider"},{name:"template",Component:d.SchemaSettingsTemplate,useComponentProps(){const{name:e}=d.useCollection_deprecated(),{componentNamePrefix:t}=d.useBlockTemplateContext();return{componentName:`${t}Gantt`,collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),cr=new d.SchemaSettings({name:"blockSettings:gantt",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),n=A.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:fe("string"),onChange:i=>{const l=n.decoratorProps.fieldNames||{};l.title=i,n.decoratorProps.params=l,t["x-decorator-props"].params=l,t["x-decorator-props"].fieldNames=l,o.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}}),a.refresh()}}}},{name:"timeScale",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=re(),t=A.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=A.useField(),{service:n}=J(),{dn:a}=d.useDesignable(),s=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:s('{{t("Hour")}}'),value:"hour",color:"orange"},{label:s('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:s('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:s('{{t("Day")}}'),value:"day",color:"yellow"},{label:s('{{t("Week")}}'),value:"week",color:"pule"},{label:s('{{t("Month")}}'),value:"month",color:"green"},{label:s('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:s('{{t("Year")}}'),value:"year",color:"green"}],onChange:l=>{const u=o.decoratorProps.fieldNames||{};u.range=l,o.decoratorProps.params=u,t["x-decorator-props"].params=u,t["x-decorator-props"].fieldNames=u,n.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),a.refresh()}}}},{name:"startDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=A.useField(),{dn:n}=d.useDesignable(),{service:a}=J();return{title:e("Start date field"),value:r.start,options:fe("date"),onChange:i=>{const l=o.decoratorProps.fieldNames||{};l.start=i,o.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,a.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),n.refresh()}}}},d.setDataLoadingModeSettingsItem,{name:"endDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=A.useField(),{service:o}=J(),{dn:n}=d.useDesignable(),a=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{};return{title:e("End date field"),value:a.end,options:fe("date"),onChange:i=>{const l=r.decoratorProps.fieldNames||{};l.end=i,r.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),n.refresh()}}}},{name:"processField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),{dn:n}=d.useDesignable(),a=A.useField();return{title:e("Progress field"),value:r.progress,options:fe("float"),onChange:i=>{const l=a.decoratorProps.fieldNames||{};l.progress=i,a.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),n.refresh()}}}},{name:"dataScope",Component:d.SchemaSettingsDataScope,useComponentProps(){var a,s;const{name:e}=d.useCollection(),t=A.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=A.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((s=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:i})=>{i=d.removeNullCondition(i);const l=o.decoratorProps.params||{};l.filter=i,o.decoratorProps.params=l,t["x-decorator-props"].params=l,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":t["x-decorator-props"]}})}}}},{name:"divider",type:"divider"},{name:"template",Component:d.SchemaSettingsTemplate,useComponentProps(){const{name:e}=d.useCollection(),{componentNamePrefix:t}=d.useBlockTemplateContext();return{componentName:`${t}Gantt`,collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),mt={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"item",name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{type:"item",title:"{{t('Add new')}}",name:"addNew",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>d.useActionAvailable("create")},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible:()=>d.useActionAvailable("destroyMany")},{type:"item",title:"{{t('Refresh')}}",name:"refresh",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"toggle",title:"{{t('Expand/Collapse')}}",Component:"ExpandableActionInitializer",schema:{"x-align":"right"},useVisible(){var o;const e=A.useFieldSchema(),t=d.useCollection(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},bt=new d.CompatibleSchemaInitializer(H({name:"GanttActionInitializers"},mt)),dr=new d.CompatibleSchemaInitializer(H({name:"gantt:configureActions"},mt),bt),xt=e=>{const{collectionName:t,fieldNames:r,dataSource:o,association:n}=e,a={type:"void","x-acl-action":`${n||t}:list`,"x-decorator":"GanttBlockProvider","x-decorator-props":{collection:t,dataSource:o,action:"list",fieldNames:r,params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:gantt","x-component":"CardItem",properties:{[ie.uid()]:{type:"void","x-component":"Gantt","x-use-component-props":"useGanttBlockProps",properties:{toolBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},"x-initializer":"gantt:configureActions",properties:{}},table:{type:"array","x-decorator":"div","x-decorator-props":{style:{float:"left",maxWidth:"35%"}},"x-initializer":"table:configureColumns","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},pagination:!1},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-toolbar":"TableColumnSchemaToolbar","x-initializer":"table:configureItemActions","x-settings":"fieldSettings:TableColumn","x-toolbar-props":{initializer:"table:configureItemActions"},properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"}}}}}},detail:{type:"void","x-component":"Gantt.Event",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"nb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock"}}}}}}}}}}}}};return n&&(a["x-decorator-props"].association=n),a},ur=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:o,showAssociationFields:n})=>{const a=d.useSchemaInitializerItem(),{createGanttBlock:s}=yt();return c.jsx(d.DataBlockInitializer,Se(H({},a),{componentType:"Calendar",icon:c.jsx(Ke.FormOutlined,{}),onCreateBlockSchema:i=>R(this,null,function*(){if(o)return o(i);s(i)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:n}))},yt=()=>{const{insert:e}=d.useSchemaInitializer(),{t}=Ce.useTranslation(),{getCollectionFields:r}=d.useCollectionManager_deprecated(),o=b.useContext(A.SchemaOptionsContext),{theme:n}=d.useGlobalTheme();return{createGanttBlock:i=>R(this,[i],function*({item:s}){var w,C,k;const l=r(s.name,s.dataSource),u=(w=l==null?void 0:l.filter(m=>m.type==="string"))==null?void 0:w.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),g=(C=l==null?void 0:l.filter(m=>m.type==="date"))==null?void 0:C.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),y=(k=l==null?void 0:l.filter(m=>m.type==="float"))==null?void 0:k.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),D=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:o.scope,components:H({},o.components),children:c.jsx(we.FormLayout,{layout:"vertical",children:c.jsx(d.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:g,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:g,required:!0,"x-component":"Select","x-decorator":"FormItem"},progress:{title:t("Progress field"),enum:y,"x-component":"Select","x-decorator":"FormItem"},range:{title:t("Time scale"),enum:[{label:'{{t("Hour")}}',value:"hour",color:"orange"},{label:'{{t("Quarter of day")}}',value:"quarterDay",color:"default"},{label:'{{t("Half of day")}}',value:"halfDay",color:"blue"},{label:'{{t("Day")}}',value:"day",color:"yellow"},{label:'{{t("Week")}}',value:"week",color:"pule"},{label:'{{t("Month")}}',value:"month",color:"green"},{label:'{{t("Year")}}',value:"year",color:"green"},{label:'{{t("QuarterYear")}}',value:"quarterYear",color:"red"}],default:"day","x-component":"Select","x-decorator":"FormItem"}}}})})}),n).open({initialValues:{}});e(xt({collectionName:s.name,dataSource:s.dataSource,fieldNames:H({},D)}))})}};function pr(){const{insert:e}=d.useSchemaInitializer(),{t}=Ce.useTranslation(),r=b.useContext(A.SchemaOptionsContext),{theme:o}=d.useGlobalTheme(),{getCollectionFields:n}=d.useCollectionManager_deprecated();return{createAssociationGanttBlock:i=>R(this,[i],function*({item:s}){var C,k,m;const l=s.associationField,u=n(s.name,s.dataSource),g=(C=u==null?void 0:u.filter(f=>f.type==="string"))==null?void 0:C.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),y=(k=u==null?void 0:u.filter(f=>f.type==="date"))==null?void 0:k.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),D=(m=u==null?void 0:u.filter(f=>f.type==="float"))==null?void 0:m.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),w=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:r.scope,components:H({},r.components),children:c.jsx(we.FormLayout,{layout:"vertical",children:c.jsx(d.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:g,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:y,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:y,required:!0,"x-component":"Select","x-decorator":"FormItem"},progress:{title:t("Progress field"),enum:D,"x-component":"Select","x-decorator":"FormItem"},range:{title:t("Time scale"),enum:[{label:'{{t("Hour")}}',value:"hour",color:"orange"},{label:'{{t("Quarter of day")}}',value:"quarterDay",color:"default"},{label:'{{t("Half of day")}}',value:"halfDay",color:"blue"},{label:'{{t("Day")}}',value:"day",color:"yellow"},{label:'{{t("Week")}}',value:"week",color:"pule"},{label:'{{t("Month")}}',value:"month",color:"green"},{label:'{{t("Year")}}',value:"year",color:"green"},{label:'{{t("QuarterYear")}}',value:"quarterYear",color:"red"}],default:"day","x-component":"Select","x-decorator":"FormItem"}}}})})}),o).open({initialValues:{}});e(xt({association:`${l.collectionName}.${l.name}`,dataSource:s.dataSource,fieldNames:H({},w)}))})}}const fr=A.observer(e=>{const t=d.useCollectionRecordData(),r=d.useCollection();return c.jsx(d.PopupContextProvider,{children:c.jsx(d.VariablePopupRecordProvider,{recordData:t,collection:r,children:e.children})})},{displayName:"Event"}),hr=(e,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f)=>{let v=e.map((N,x)=>gr(N,x,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f));return v=v.map(N=>{const x=N.dependencies||[];for(let h=0;h<x.length;h++){const p=v.findIndex(S=>S.id===x[h]);p!==-1&&v[p].barChildren.push(N)}return N}),v},gr=(e,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f,v)=>{let N;switch(e.type){case"milestone":N=mr(e,t,r,o,n,a,s,i,f,v);break;case"project":N=vt(e,t,r,o,n,a*.5,s,i,l,w,C,k,m);break;default:N=vt(e,t,r,o,n,a,s,i,l,u,g,y,D);break}return N},vt=(e,t,r,o,n,a,s,i,l,u,g,y,D)=>{let w,C;l?(C=St(e.start,r,o),w=St(e.end,r,o)):(w=He(e.start,r,o),C=He(e.end,r,o));let k=e.type;k==="task"&&C-w<i*2&&(k="smalltask",C=w>0?w+i*2:w);const[m,f]=Pe(w,C,e.progress,l),v=e.type==="project"?et(t,n,a)+8:et(t,n,a),N=e.type==="project"?e.hideChildren:void 0,x=H({backgroundColor:y,backgroundSelectedColor:D,progressColor:u,progressSelectedColor:g},e.styles);return Se(H({},e),{typeInternal:k,x1:w,x2:C,y:v,index:t,progressX:f,progressWidth:m,barCornerRadius:s,handleWidth:i,hideChildren:N,height:a,barChildren:[],styles:x})},mr=(e,t,r,o,n,a,s,i,l,u)=>{const g=He(e.start,r,o),y=et(t,n,a),D=g-a*.5,w=g+a*.5,C=a/1.414,k=H({backgroundColor:l,backgroundSelectedColor:u,progressColor:"",progressSelectedColor:""},e.styles);return Se(H({},e),{end:e.start,x1:D,x2:w,y,index:t,progressX:0,progressWidth:0,barCornerRadius:s,handleWidth:i,typeInternal:e.type,progress:0,height:C,hideChildren:void 0,barChildren:[],styles:k})},He=(e,t,r)=>{var i,l,u;const o=t.findIndex(g=>(g==null?void 0:g.getTime())>=(e==null?void 0:e.getTime()))-1,a=((e==null?void 0:e.getTime())-((i=t[o])==null?void 0:i.getTime()))/(((l=t[o+1])==null?void 0:l.getTime())-((u=t[o])==null?void 0:u.getTime())),s=o*r+a*r;return isNaN(s)?0:s},St=(e,t,r)=>{let o=He(e,t,r);return o+=r,isNaN(o)?0:o},et=(e,t,r)=>{const o=e*t+(t-r)/2;return isNaN(o)?0:o},Pe=(e,t,r,o)=>{const n=(t-e)*r*.01;let a;return o?a=t-n:a=e,[n,a]},br=(e,t)=>{if(e>=t.x2)return 100;if(e<=t.x1)return 0;{const r=t.x2-t.x1;return Math.round((e-t.x1)*100/r)}},xr=(e,t)=>{if(e>=t.x2)return 0;if(e<=t.x1)return 100;{const r=t.x2-t.x1;return Math.round((t.x2-e)*100/r)}},Ct=(e,t,r)=>[e-5,t+r,e+5,t+r,e,t+r-8.66].join(","),yr=(e,t,r)=>{e>=r.x2-r.handleWidth*2&&(e=r.x2-r.handleWidth*2);const n=Math.round((e-r.x1)/t)*t;return r.x1+n},vr=(e,t,r)=>{e<=r.x1+r.handleWidth*2&&(e=r.x1+r.handleWidth*2);const n=Math.round((e-r.x2)/t)*t;return r.x2+n},wt=(e,t,r)=>{const n=Math.round((e-r.x1)/t)*t,a=r.x1+n,s=a+r.x2-r.x1;return[a,s]},me=(e,t,r,o,n)=>{var s,i;let a=new Date((e-t)/o*n+((s=r==null?void 0:r.getTime)==null?void 0:s.call(r)));return a=new Date(((i=a==null?void 0:a.getTime)==null?void 0:i.call(a))+((a==null?void 0:a.getTimezoneOffset())-(r==null?void 0:r.getTimezoneOffset()))*6e4),a},Tt=(e,t,r,o,n,a,s)=>{let i;switch(r.type){case"milestone":i=Cr(e,t,r,o,n,a);break;default:i=Sr(e,t,r,o,n,a,s);break}return i},Sr=(e,t,r,o,n,a,s)=>{const i=H({},r);let l=!1;switch(t){case"progress":if(s?i.progress=xr(e,r):i.progress=br(e,r),l=i.progress!==r.progress,l){const[u,g]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=u,i.progressX=g}break;case"start":{const u=yr(e,o,r);if(i.x1=u,l=i.x1!==r.x1,l){s?i.end=me(u,r.x1,r.end,o,n):i.start=me(u,r.x1,r.start,o,n);const[g,y]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=g,i.progressX=y}break}case"end":{const u=vr(e,o,r);if(i.x2=u,l=i.x2!==r.x2,l){s?i.start=me(u,r.x2,r.start,o,n):i.end=me(u,r.x2,r.end,o,n);const[g,y]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=g,i.progressX=y}break}case"move":{const[u,g]=wt(e-a,o,r);if(l=u!==r.x1,l){i.start=me(u,r.x1,r.start,o,n),i.end=me(g,r.x2,r.end,o,n),i.x1=u,i.x2=g;const[y,D]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=y,i.progressX=D}break}}return{isChanged:l,changedTask:i}},Cr=(e,t,r,o,n,a)=>{const s=H({},r);let i=!1;switch(t){case"move":{const[l,u]=wt(e-a,o,r);i=l!==r.x1,i&&(s.start=me(l,r.x1,r.start,o,n),s.end=s.start,s.x1=l,s.x2=u);break}}return{isChanged:i,changedTask:s}};var E=(e=>(e.Hour="hour",e.QuarterDay="quarterDay",e.HalfDay="halfDay",e.Day="day",e.Week="week",e.Month="month",e.QuarterYear="quarterYear",e.Year="year",e))(E||{});const Nt={},Oe=(e,t={})=>{const r=JSON.stringify([e,t]);let o=Nt[r];return o||(o=new Intl.DateTimeFormat(e,t),Nt[r]=o),o},O=(e,t,r)=>new Date(e.getFullYear()+(r==="year"?t:0),e.getMonth()+(r==="month"?t:0),e.getDate()+(r==="day"?t:0),e.getHours()+(r==="hour"?t:0),e.getMinutes()+(r==="minute"?t:0),e.getSeconds()+(r==="second"?t:0),e.getMilliseconds()+(r==="millisecond"?t:0)),j=(e,t)=>{const r=["millisecond","second","minute","hour","day","month","year"],o=a=>{const s=r.indexOf(t);return r.indexOf(a)<=s};return new Date(e==null?void 0:e.getFullYear(),o("year")?0:e.getMonth(),o("month")?1:e.getDate(),o("day")?0:e.getHours(),o("hour")?0:e.getMinutes(),o("minute")?0:e.getSeconds(),o("second")?0:e.getMilliseconds())},Mt=(e,t,r)=>{var a,s;let o=((a=e[0])==null?void 0:a.start)||new Date,n=((s=e[0])==null?void 0:s.start)||new Date;for(const i of e)i.start<o&&(o=i.start),i.end>n&&(n=i.end);switch(t){case E.Year:o=O(o,-1,"year"),o=j(o,"year"),n=O(n,1,"year"),n=j(n,"year");break;case E.QuarterYear:o=O(o,-3,"month"),o=j(o,"month"),n=O(n,3,"year"),n=j(n,"year");break;case E.Month:o=O(o,-1*r,"month"),o=j(o,"month"),n=O(n,1,"year"),n=j(n,"year");break;case E.Week:o=j(o,"day"),o=O(wr(o),-7*r,"day"),n=j(n,"day"),n=O(n,1.5,"month");break;case E.Day:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,19,"day");break;case E.QuarterDay:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,66,"hour");break;case E.HalfDay:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,108,"hour");break;case E.Hour:o=j(o,"hour"),o=O(o,-1*r,"hour"),n=j(n,"day"),n=O(n,1,"day");break}return[o,n]},Dt=(e,t,r)=>{let o=new Date(e);const n=[o];for(;o<t;){switch(r){case E.Year:o=O(o,1,"year");break;case E.QuarterYear:o=O(o,3,"month");break;case E.Month:o=O(o,1,"month");break;case E.Week:o=O(o,7,"day");break;case E.Day:o=O(o,1,"day");break;case E.HalfDay:o=O(o,12,"hour");break;case E.QuarterDay:o=O(o,6,"hour");break;case E.Hour:o=O(o,1,"hour");break}n.push(o)}return n},Fe=(e,t)=>{let r=Oe(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase()),r},Bt=(e,t,r)=>{let o=Oe(t,{weekday:r}).format(e);return o=o.replace(o[0],o[0].toLocaleUpperCase()),o},wr=e=>{const t=e.getDay(),r=e.getDate()-t+(t===0?-6:1);return new Date(e.setDate(r))},Tr=e=>{const t=new Date(e.valueOf()),r=(t.getDay()+6)%7;t.setDate(t.getDate()-r+3);const o=t.valueOf();t.setMonth(0,1),t.getDay()!==4&&t.setMonth(0,1+(4-t.getDay()+7)%7);const n=(1+Math.ceil((o-t.valueOf())/6048e5)).toString();return n.length===1?`0${n}`:n},Nr=(e,t)=>new Date(t,e+1,0).getDate();function Mr(e){return e.key!==void 0}function Dr(e){const t=e.filter(r=>r.hideChildren&&r.type==="project");if(t.length>0)for(let r=0;t.length>r;r++){const o=t[r],n=Pt(e,o);e=e.filter(a=>n.indexOf(a)===-1)}return e}function Pt(e,t){let r=[];t.type!=="project"?r=e.filter(n=>n.dependencies&&n.dependencies.indexOf(t.id)!==-1):r=e.filter(n=>n.project&&n.project===t.id);const o=[];return r.forEach(n=>{o.push(...Pt(e,n))}),r=r.concat(r,o),r}const Br=(e,t)=>{const r=e.displayOrder||Number.MAX_VALUE,o=t.displayOrder||Number.MAX_VALUE;return r>o?1:r<o?-1:0},Te=e=>{var t;return isNaN((t=e==null?void 0:e.getTime)==null?void 0:t.call(e))?0:e.getFullYear()+`/${e.getMonth()+1}/`+e.getDate()},ze=Ee.createStyles(({token:e,css:t})=>({scrollWrapper:t`
10
+ (function(I,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("@formily/react"),require("react-i18next"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@emotion/css"),require("antd"),require("lodash"),require("antd-style"),require("@nocobase/utils/client")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","@formily/react","react-i18next","@ant-design/icons","@formily/antd-v5","@formily/shared","@emotion/css","antd","lodash","antd-style","@nocobase/utils/client"],c):(I=typeof globalThis!="undefined"?globalThis:I||self,c(I["@nocobase/plugin-gantt"]={},I.jsxRuntime,I["@nocobase/client"],I.react,I["@formily/react"],I["react-i18next"],I["@ant-design/icons"],I["@formily/antd-v5"],I["@formily/shared"],I["@emotion/css"],I.antd,I.lodash,I["antd-style"],I["@nocobase/utils"]))})(this,function(I,c,d,b,A,Ce,Ke,we,ie,M,Ve,ht,Ee,Je){"use strict";var jo=Object.defineProperty,qo=Object.defineProperties;var Uo=Object.getOwnPropertyDescriptors;var or=Object.getOwnPropertySymbols;var Wo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;var nr=(I,c,d)=>c in I?jo(I,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[c]=d,H=(I,c)=>{for(var d in c||(c={}))Wo.call(c,d)&&nr(I,d,c[d]);if(or)for(var d of or(c))Qo.call(c,d)&&nr(I,d,c[d]);return I},Se=(I,c)=>qo(I,Uo(c));var R=(I,c,d)=>new Promise((b,A)=>{var Ce=ie=>{try{we(d.next(ie))}catch(M){A(M)}},Ke=ie=>{try{we(d.throw(ie))}catch(M){A(M)}},we=ie=>ie.done?b(ie.value):Promise.resolve(ie.value).then(Ce,Ke);we((d=d.apply(I,c)).next())});const ar=()=>{const{name:e,title:t}=d.useCollection_deprecated(),r=d.useSchemaTemplate();return c.jsx(d.GeneralSchemaDesigner,{schemaSettings:"blockSettings:gantt",template:r,title:t||e})},Ze=b.createContext({});Ze.displayName="GanttBlockContext";const Re=(e=[],t,r=[],o=void 0,n=!1,a,s,i)=>(e.forEach(l=>{var D,w;const u=a(l),g=parseFloat((l[t.progress]*100).toFixed(2)),y=d.getLabelFormatValue(i,l[t.title]);l.children&&l.children.length?(r.push({start:new Date((D=l[t.start])!=null?D:void 0),end:new Date((w=l[t.end])!=null?w:void 0),name:y,id:l[s]+"",type:"project",progress:g>100?100:g||0,hideChildren:n,project:o,color:l.color,isDisabled:u}),Re(l.children,t,r,l.id+"",n,a,s,i)):r.push({start:l[t.start]?new Date(l[t.start]):void 0,end:new Date(l[t.end]||l[t.start]),name:y,id:l[s]+"",type:t.end?"task":"milestone",progress:g>100?100:g||0,project:o,color:l.color,isDisabled:u})}),r),sr=e=>{const{fieldNames:t,timeRange:r,resource:o}=e,n=A.useField(),{service:a}=d.useBlockRequestContext();return c.jsx(Ze.Provider,{value:{field:n,service:a,resource:o,fieldNames:t,timeRange:r},children:e.children})},ir=e=>{var n;const r=d.useCollectionManager_deprecated(e.dataSource).getCollection(e.collection,e.dataSource),o={filter:(n=e.params)==null?void 0:n.filter,paginate:!1,sort:[(r==null?void 0:r.primaryKey)||"id"]};return r!=null&&r.tree&&(o.tree=!0),c.jsx("div",{"aria-label":"block-item-gantt",role:"button",children:c.jsx(d.TableBlockProvider,Se(H({},e),{params:o,children:c.jsx(sr,H({},e))}))})},J=()=>b.useContext(Ze),gt=()=>{var v,N;const e=J(),{fieldNames:t}=e,[r,o]=b.useState([]),{getPrimaryKey:n,name:a,template:s,writableView:i}=d.useCollection_deprecated(),{parseAction:l}=d.useACLRoleContext(),u=d.useTableBlockContext(),[g,y]=b.useState(!1),D=n(),{fields:w}=d.useCollection(),C=(v=w.find(x=>x.name===(t==null?void 0:t.title)))==null?void 0:v.uiSchema,k=x=>{const h=`${a}:update`,p={},S=x==null?void 0:x[D],P=l(h,{schema:p,recordPkValue:S});return s==="view"&&!i||!P},m=x=>{const p=e.field.data.map(S=>S.id===x.id?x:S);o(p),e.field.data=p},f=x=>{var p;const h=Re((p=e.service.data)==null?void 0:p.data,e.fieldNames,[],void 0,x,k,D,C);o(h),e.field.data=h};return b.useEffect(()=>{var x,h;if(y(!0),!((x=e==null?void 0:e.service)!=null&&x.loading)){const p=Re((h=e.service.data)==null?void 0:h.data,e.fieldNames,[],void 0,!1,k,D,C);o(p),y(!1),e.field.data=p,r.length>0&&u.setExpandFlag(!0)}},[(N=e==null?void 0:e.service)==null?void 0:N.loading]),{fieldNames:e.fieldNames,timeRange:e.timeRange,onExpanderClick:m,expandAndCollapseAll:f,tasks:r,loading:g}},re=()=>Ce.useTranslation("gantt"),fe=(e="string")=>{var n;const t=d.useCompile(),{fields:r}=d.useCollection_deprecated();return(n=r==null?void 0:r.filter(a=>a.type===e))==null?void 0:n.map(a=>{var s;return{value:a.name,label:t((s=a==null?void 0:a.uiSchema)==null?void 0:s.title)}})},lr=new d.SchemaSettings({name:"GanttBlockSettings",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),n=A.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:fe("string"),onChange:i=>{const l=n.decoratorProps.fieldNames||{};l.title=i,n.decoratorProps.params=l,t["x-decorator-props"].params=l,t["x-decorator-props"].fieldNames=l,o.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}}),a.refresh()}}}},{name:"timeScale",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=re(),t=A.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=A.useField(),{service:n}=J(),{dn:a}=d.useDesignable(),s=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:s('{{t("Hour")}}'),value:"hour",color:"orange"},{label:s('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:s('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:s('{{t("Day")}}'),value:"day",color:"yellow"},{label:s('{{t("Week")}}'),value:"week",color:"pule"},{label:s('{{t("Month")}}'),value:"month",color:"green"},{label:s('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:s('{{t("Year")}}'),value:"year",color:"green"}],onChange:l=>{const u=o.decoratorProps.fieldNames||{};u.range=l,o.decoratorProps.params=u,t["x-decorator-props"].params=u,t["x-decorator-props"].fieldNames=u,n.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),a.refresh()}}}},{name:"startDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=A.useField(),{dn:n}=d.useDesignable(),{service:a}=J();return{title:e("Start date field"),value:r.start,options:fe("date"),onChange:i=>{const l=o.decoratorProps.fieldNames||{};l.start=i,o.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,a.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),n.refresh()}}}},{name:"endDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=A.useField(),{service:o}=J(),{dn:n}=d.useDesignable(),a=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{};return{title:e("End date field"),value:a.end,options:fe("date"),onChange:i=>{const l=r.decoratorProps.fieldNames||{};l.end=i,r.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),n.refresh()}}}},{name:"processField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),{dn:n}=d.useDesignable(),a=A.useField();return{title:e("Progress field"),value:r.progress,options:fe("float"),onChange:i=>{const l=a.decoratorProps.fieldNames||{};l.progress=i,a.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),n.refresh()}}}},{name:"dataScope",Component:d.SchemaSettingsDataScope,useComponentProps(){var a,s;const{name:e}=d.useCollection_deprecated(),t=A.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=A.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((s=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:i})=>{i=d.removeNullCondition(i);const l=o.decoratorProps.params||{};l.filter=i,o.decoratorProps.params=l,t["x-decorator-props"].params=l,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":t["x-decorator-props"]}})}}}},{name:"divider",type:"divider"},{name:"template",Component:d.SchemaSettingsTemplate,useComponentProps(){const{name:e}=d.useCollection_deprecated(),{componentNamePrefix:t}=d.useBlockTemplateContext();return{componentName:`${t}Gantt`,collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),cr=new d.SchemaSettings({name:"blockSettings:gantt",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),n=A.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:fe("string"),onChange:i=>{const l=n.decoratorProps.fieldNames||{};l.title=i,n.decoratorProps.params=l,t["x-decorator-props"].params=l,t["x-decorator-props"].fieldNames=l,o.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":n.decoratorProps}}),a.refresh()}}}},{name:"timeScale",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=re(),t=A.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=A.useField(),{service:n}=J(),{dn:a}=d.useDesignable(),s=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:s('{{t("Hour")}}'),value:"hour",color:"orange"},{label:s('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:s('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:s('{{t("Day")}}'),value:"day",color:"yellow"},{label:s('{{t("Week")}}'),value:"week",color:"pule"},{label:s('{{t("Month")}}'),value:"month",color:"green"},{label:s('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:s('{{t("Year")}}'),value:"year",color:"green"}],onChange:l=>{const u=o.decoratorProps.fieldNames||{};u.range=l,o.decoratorProps.params=u,t["x-decorator-props"].params=u,t["x-decorator-props"].fieldNames=u,n.refresh(),a.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),a.refresh()}}}},{name:"startDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=A.useField(),{dn:n}=d.useDesignable(),{service:a}=J();return{title:e("Start date field"),value:r.start,options:fe("date"),onChange:i=>{const l=o.decoratorProps.fieldNames||{};l.start=i,o.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,a.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":o.decoratorProps}}),n.refresh()}}}},d.setDataLoadingModeSettingsItem,{name:"endDateField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=A.useField(),{service:o}=J(),{dn:n}=d.useDesignable(),a=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{};return{title:e("End date field"),value:a.end,options:fe("date"),onChange:i=>{const l=r.decoratorProps.fieldNames||{};l.end=i,r.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":r.decoratorProps}}),n.refresh()}}}},{name:"processField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var s;const{t:e}=re(),t=A.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},{service:o}=J(),{dn:n}=d.useDesignable(),a=A.useField();return{title:e("Progress field"),value:r.progress,options:fe("float"),onChange:i=>{const l=a.decoratorProps.fieldNames||{};l.progress=i,a.decoratorProps.fieldNames=l,t["x-decorator-props"].fieldNames=l,o.refresh(),n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":a.decoratorProps}}),n.refresh()}}}},{name:"dataScope",Component:d.SchemaSettingsDataScope,useComponentProps(){var a,s;const{name:e}=d.useCollection(),t=A.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=A.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((s=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:s.filter)||{},form:r,onSubmit:({filter:i})=>{i=d.removeNullCondition(i);const l=o.decoratorProps.params||{};l.filter=i,o.decoratorProps.params=l,t["x-decorator-props"].params=l,n.emit("patch",{schema:{"x-uid":t["x-uid"],"x-decorator-props":t["x-decorator-props"]}})}}}},{name:"divider",type:"divider"},{name:"template",Component:d.SchemaSettingsTemplate,useComponentProps(){const{name:e}=d.useCollection(),{componentNamePrefix:t}=d.useBlockTemplateContext();return{componentName:`${t}Gantt`,collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),mt={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"item",name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{type:"item",title:"{{t('Add new')}}",name:"addNew",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>d.useActionAvailable("create")},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible:()=>d.useActionAvailable("destroyMany")},{type:"item",title:"{{t('Refresh')}}",name:"refresh",Component:"RefreshActionInitializer",schema:{"x-align":"right"}},{name:"toggle",title:"{{t('Expand/Collapse')}}",Component:"ExpandableActionInitializer",schema:{"x-align":"right"},useVisible(){var o;const e=A.useFieldSchema(),t=d.useCollection(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},bt=new d.CompatibleSchemaInitializer(H({name:"GanttActionInitializers"},mt)),dr=new d.CompatibleSchemaInitializer(H({name:"gantt:configureActions"},mt),bt),xt=e=>{const{collectionName:t,fieldNames:r,dataSource:o,association:n}=e,a={type:"void","x-acl-action":`${n||t}:list`,"x-decorator":"GanttBlockProvider","x-decorator-props":{collection:t,dataSource:o,action:"list",fieldNames:r,params:{paginate:!1}},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:gantt","x-component":"CardItem",properties:{[ie.uid()]:{type:"void","x-component":"Gantt","x-use-component-props":"useGanttBlockProps",properties:{toolBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},"x-initializer":"gantt:configureActions",properties:{}},table:{type:"array","x-decorator":"div","x-decorator-props":{style:{float:"left",maxWidth:"35%"}},"x-initializer":"table:configureColumns","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},pagination:!1},properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-toolbar":"TableColumnSchemaToolbar","x-initializer":"table:configureItemActions","x-settings":"fieldSettings:TableColumn","x-toolbar-props":{initializer:"table:configureItemActions"},properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"}}}}}},detail:{type:"void","x-component":"Gantt.Event",properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{className:"nb-action-popup"},title:'{{ t("View record") }}',properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:common:addBlock"}}}}}}}}}}}}};return n&&(a["x-decorator-props"].association=n),a},ur=({filterCollections:e,onlyCurrentDataSource:t,hideSearch:r,createBlockSchema:o,showAssociationFields:n})=>{const a=d.useSchemaInitializerItem(),{createGanttBlock:s}=yt();return c.jsx(d.DataBlockInitializer,Se(H({},a),{componentType:"Gantt",icon:c.jsx(Ke.FormOutlined,{}),onCreateBlockSchema:i=>R(this,null,function*(){if(o)return o(i);s(i)}),onlyCurrentDataSource:t,hideSearch:r,filter:e,showAssociationFields:n}))},yt=()=>{const{insert:e}=d.useSchemaInitializer(),{t}=Ce.useTranslation(),{getCollectionFields:r}=d.useCollectionManager_deprecated(),o=b.useContext(A.SchemaOptionsContext),{theme:n}=d.useGlobalTheme();return{createGanttBlock:i=>R(this,[i],function*({item:s}){var w,C,k;const l=r(s.name,s.dataSource),u=(w=l==null?void 0:l.filter(m=>m.type==="string"))==null?void 0:w.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),g=(C=l==null?void 0:l.filter(m=>m.type==="date"))==null?void 0:C.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),y=(k=l==null?void 0:l.filter(m=>m.type==="float"))==null?void 0:k.map(m=>{var f;return{label:(f=m==null?void 0:m.uiSchema)==null?void 0:f.title,value:m.name}}),D=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:o.scope,components:H({},o.components),children:c.jsx(we.FormLayout,{layout:"vertical",children:c.jsx(d.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:g,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:g,required:!0,"x-component":"Select","x-decorator":"FormItem"},progress:{title:t("Progress field"),enum:y,"x-component":"Select","x-decorator":"FormItem"},range:{title:t("Time scale"),enum:[{label:'{{t("Hour")}}',value:"hour",color:"orange"},{label:'{{t("Quarter of day")}}',value:"quarterDay",color:"default"},{label:'{{t("Half of day")}}',value:"halfDay",color:"blue"},{label:'{{t("Day")}}',value:"day",color:"yellow"},{label:'{{t("Week")}}',value:"week",color:"pule"},{label:'{{t("Month")}}',value:"month",color:"green"},{label:'{{t("Year")}}',value:"year",color:"green"},{label:'{{t("QuarterYear")}}',value:"quarterYear",color:"red"}],default:"day","x-component":"Select","x-decorator":"FormItem"}}}})})}),n).open({initialValues:{}});e(xt({collectionName:s.name,dataSource:s.dataSource,fieldNames:H({},D)}))})}};function pr(){const{insert:e}=d.useSchemaInitializer(),{t}=Ce.useTranslation(),r=b.useContext(A.SchemaOptionsContext),{theme:o}=d.useGlobalTheme(),{getCollectionFields:n}=d.useCollectionManager_deprecated();return{createAssociationGanttBlock:i=>R(this,[i],function*({item:s}){var C,k,m;const l=s.associationField,u=n(s.name,s.dataSource),g=(C=u==null?void 0:u.filter(f=>f.type==="string"))==null?void 0:C.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),y=(k=u==null?void 0:u.filter(f=>f.type==="date"))==null?void 0:k.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),D=(m=u==null?void 0:u.filter(f=>f.type==="float"))==null?void 0:m.map(f=>{var v;return{label:(v=f==null?void 0:f.uiSchema)==null?void 0:v.title,value:f.name}}),w=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:r.scope,components:H({},r.components),children:c.jsx(we.FormLayout,{layout:"vertical",children:c.jsx(d.SchemaComponent,{schema:{properties:{title:{title:t("Title field"),enum:g,required:!0,"x-component":"Select","x-decorator":"FormItem"},start:{title:t("Start date field"),enum:y,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:y,required:!0,"x-component":"Select","x-decorator":"FormItem"},progress:{title:t("Progress field"),enum:D,"x-component":"Select","x-decorator":"FormItem"},range:{title:t("Time scale"),enum:[{label:'{{t("Hour")}}',value:"hour",color:"orange"},{label:'{{t("Quarter of day")}}',value:"quarterDay",color:"default"},{label:'{{t("Half of day")}}',value:"halfDay",color:"blue"},{label:'{{t("Day")}}',value:"day",color:"yellow"},{label:'{{t("Week")}}',value:"week",color:"pule"},{label:'{{t("Month")}}',value:"month",color:"green"},{label:'{{t("Year")}}',value:"year",color:"green"},{label:'{{t("QuarterYear")}}',value:"quarterYear",color:"red"}],default:"day","x-component":"Select","x-decorator":"FormItem"}}}})})}),o).open({initialValues:{}});e(xt({association:`${l.collectionName}.${l.name}`,dataSource:s.dataSource,fieldNames:H({},w)}))})}}const fr=A.observer(e=>{const t=d.useCollectionRecordData(),r=d.useCollection();return c.jsx(d.PopupContextProvider,{children:c.jsx(d.VariablePopupRecordProvider,{recordData:t,collection:r,children:e.children})})},{displayName:"Event"}),hr=(e,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f)=>{let v=e.map((N,x)=>gr(N,x,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f));return v=v.map(N=>{const x=N.dependencies||[];for(let h=0;h<x.length;h++){const p=v.findIndex(S=>S.id===x[h]);p!==-1&&v[p].barChildren.push(N)}return N}),v},gr=(e,t,r,o,n,a,s,i,l,u,g,y,D,w,C,k,m,f,v)=>{let N;switch(e.type){case"milestone":N=mr(e,t,r,o,n,a,s,i,f,v);break;case"project":N=vt(e,t,r,o,n,a*.5,s,i,l,w,C,k,m);break;default:N=vt(e,t,r,o,n,a,s,i,l,u,g,y,D);break}return N},vt=(e,t,r,o,n,a,s,i,l,u,g,y,D)=>{let w,C;l?(C=St(e.start,r,o),w=St(e.end,r,o)):(w=He(e.start,r,o),C=He(e.end,r,o));let k=e.type;k==="task"&&C-w<i*2&&(k="smalltask",C=w>0?w+i*2:w);const[m,f]=Pe(w,C,e.progress,l),v=e.type==="project"?et(t,n,a)+8:et(t,n,a),N=e.type==="project"?e.hideChildren:void 0,x=H({backgroundColor:y,backgroundSelectedColor:D,progressColor:u,progressSelectedColor:g},e.styles);return Se(H({},e),{typeInternal:k,x1:w,x2:C,y:v,index:t,progressX:f,progressWidth:m,barCornerRadius:s,handleWidth:i,hideChildren:N,height:a,barChildren:[],styles:x})},mr=(e,t,r,o,n,a,s,i,l,u)=>{const g=He(e.start,r,o),y=et(t,n,a),D=g-a*.5,w=g+a*.5,C=a/1.414,k=H({backgroundColor:l,backgroundSelectedColor:u,progressColor:"",progressSelectedColor:""},e.styles);return Se(H({},e),{end:e.start,x1:D,x2:w,y,index:t,progressX:0,progressWidth:0,barCornerRadius:s,handleWidth:i,typeInternal:e.type,progress:0,height:C,hideChildren:void 0,barChildren:[],styles:k})},He=(e,t,r)=>{var i,l,u;const o=t.findIndex(g=>(g==null?void 0:g.getTime())>=(e==null?void 0:e.getTime()))-1,a=((e==null?void 0:e.getTime())-((i=t[o])==null?void 0:i.getTime()))/(((l=t[o+1])==null?void 0:l.getTime())-((u=t[o])==null?void 0:u.getTime())),s=o*r+a*r;return isNaN(s)?0:s},St=(e,t,r)=>{let o=He(e,t,r);return o+=r,isNaN(o)?0:o},et=(e,t,r)=>{const o=e*t+(t-r)/2;return isNaN(o)?0:o},Pe=(e,t,r,o)=>{const n=(t-e)*r*.01;let a;return o?a=t-n:a=e,[n,a]},br=(e,t)=>{if(e>=t.x2)return 100;if(e<=t.x1)return 0;{const r=t.x2-t.x1;return Math.round((e-t.x1)*100/r)}},xr=(e,t)=>{if(e>=t.x2)return 0;if(e<=t.x1)return 100;{const r=t.x2-t.x1;return Math.round((t.x2-e)*100/r)}},Ct=(e,t,r)=>[e-5,t+r,e+5,t+r,e,t+r-8.66].join(","),yr=(e,t,r)=>{e>=r.x2-r.handleWidth*2&&(e=r.x2-r.handleWidth*2);const n=Math.round((e-r.x1)/t)*t;return r.x1+n},vr=(e,t,r)=>{e<=r.x1+r.handleWidth*2&&(e=r.x1+r.handleWidth*2);const n=Math.round((e-r.x2)/t)*t;return r.x2+n},wt=(e,t,r)=>{const n=Math.round((e-r.x1)/t)*t,a=r.x1+n,s=a+r.x2-r.x1;return[a,s]},me=(e,t,r,o,n)=>{var s,i;let a=new Date((e-t)/o*n+((s=r==null?void 0:r.getTime)==null?void 0:s.call(r)));return a=new Date(((i=a==null?void 0:a.getTime)==null?void 0:i.call(a))+((a==null?void 0:a.getTimezoneOffset())-(r==null?void 0:r.getTimezoneOffset()))*6e4),a},Tt=(e,t,r,o,n,a,s)=>{let i;switch(r.type){case"milestone":i=Cr(e,t,r,o,n,a);break;default:i=Sr(e,t,r,o,n,a,s);break}return i},Sr=(e,t,r,o,n,a,s)=>{const i=H({},r);let l=!1;switch(t){case"progress":if(s?i.progress=xr(e,r):i.progress=br(e,r),l=i.progress!==r.progress,l){const[u,g]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=u,i.progressX=g}break;case"start":{const u=yr(e,o,r);if(i.x1=u,l=i.x1!==r.x1,l){s?i.end=me(u,r.x1,r.end,o,n):i.start=me(u,r.x1,r.start,o,n);const[g,y]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=g,i.progressX=y}break}case"end":{const u=vr(e,o,r);if(i.x2=u,l=i.x2!==r.x2,l){s?i.start=me(u,r.x2,r.start,o,n):i.end=me(u,r.x2,r.end,o,n);const[g,y]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=g,i.progressX=y}break}case"move":{const[u,g]=wt(e-a,o,r);if(l=u!==r.x1,l){i.start=me(u,r.x1,r.start,o,n),i.end=me(g,r.x2,r.end,o,n),i.x1=u,i.x2=g;const[y,D]=Pe(i.x1,i.x2,i.progress,s);i.progressWidth=y,i.progressX=D}break}}return{isChanged:l,changedTask:i}},Cr=(e,t,r,o,n,a)=>{const s=H({},r);let i=!1;switch(t){case"move":{const[l,u]=wt(e-a,o,r);i=l!==r.x1,i&&(s.start=me(l,r.x1,r.start,o,n),s.end=s.start,s.x1=l,s.x2=u);break}}return{isChanged:i,changedTask:s}};var E=(e=>(e.Hour="hour",e.QuarterDay="quarterDay",e.HalfDay="halfDay",e.Day="day",e.Week="week",e.Month="month",e.QuarterYear="quarterYear",e.Year="year",e))(E||{});const Nt={},Oe=(e,t={})=>{const r=JSON.stringify([e,t]);let o=Nt[r];return o||(o=new Intl.DateTimeFormat(e,t),Nt[r]=o),o},O=(e,t,r)=>new Date(e.getFullYear()+(r==="year"?t:0),e.getMonth()+(r==="month"?t:0),e.getDate()+(r==="day"?t:0),e.getHours()+(r==="hour"?t:0),e.getMinutes()+(r==="minute"?t:0),e.getSeconds()+(r==="second"?t:0),e.getMilliseconds()+(r==="millisecond"?t:0)),j=(e,t)=>{const r=["millisecond","second","minute","hour","day","month","year"],o=a=>{const s=r.indexOf(t);return r.indexOf(a)<=s};return new Date(e==null?void 0:e.getFullYear(),o("year")?0:e.getMonth(),o("month")?1:e.getDate(),o("day")?0:e.getHours(),o("hour")?0:e.getMinutes(),o("minute")?0:e.getSeconds(),o("second")?0:e.getMilliseconds())},Mt=(e,t,r)=>{var a,s;let o=((a=e[0])==null?void 0:a.start)||new Date,n=((s=e[0])==null?void 0:s.start)||new Date;for(const i of e)i.start<o&&(o=i.start),i.end>n&&(n=i.end);switch(t){case E.Year:o=O(o,-1,"year"),o=j(o,"year"),n=O(n,1,"year"),n=j(n,"year");break;case E.QuarterYear:o=O(o,-3,"month"),o=j(o,"month"),n=O(n,3,"year"),n=j(n,"year");break;case E.Month:o=O(o,-1*r,"month"),o=j(o,"month"),n=O(n,1,"year"),n=j(n,"year");break;case E.Week:o=j(o,"day"),o=O(wr(o),-7*r,"day"),n=j(n,"day"),n=O(n,1.5,"month");break;case E.Day:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,19,"day");break;case E.QuarterDay:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,66,"hour");break;case E.HalfDay:o=j(o,"day"),o=O(o,-1*r,"day"),n=j(n,"day"),n=O(n,108,"hour");break;case E.Hour:o=j(o,"hour"),o=O(o,-1*r,"hour"),n=j(n,"day"),n=O(n,1,"day");break}return[o,n]},Dt=(e,t,r)=>{let o=new Date(e);const n=[o];for(;o<t;){switch(r){case E.Year:o=O(o,1,"year");break;case E.QuarterYear:o=O(o,3,"month");break;case E.Month:o=O(o,1,"month");break;case E.Week:o=O(o,7,"day");break;case E.Day:o=O(o,1,"day");break;case E.HalfDay:o=O(o,12,"hour");break;case E.QuarterDay:o=O(o,6,"hour");break;case E.Hour:o=O(o,1,"hour");break}n.push(o)}return n},Fe=(e,t)=>{let r=Oe(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase()),r},Bt=(e,t,r)=>{let o=Oe(t,{weekday:r}).format(e);return o=o.replace(o[0],o[0].toLocaleUpperCase()),o},wr=e=>{const t=e.getDay(),r=e.getDate()-t+(t===0?-6:1);return new Date(e.setDate(r))},Tr=e=>{const t=new Date(e.valueOf()),r=(t.getDay()+6)%7;t.setDate(t.getDate()-r+3);const o=t.valueOf();t.setMonth(0,1),t.getDay()!==4&&t.setMonth(0,1+(4-t.getDay()+7)%7);const n=(1+Math.ceil((o-t.valueOf())/6048e5)).toString();return n.length===1?`0${n}`:n},Nr=(e,t)=>new Date(t,e+1,0).getDate();function Mr(e){return e.key!==void 0}function Dr(e){const t=e.filter(r=>r.hideChildren&&r.type==="project");if(t.length>0)for(let r=0;t.length>r;r++){const o=t[r],n=Pt(e,o);e=e.filter(a=>n.indexOf(a)===-1)}return e}function Pt(e,t){let r=[];t.type!=="project"?r=e.filter(n=>n.dependencies&&n.dependencies.indexOf(t.id)!==-1):r=e.filter(n=>n.project&&n.project===t.id);const o=[];return r.forEach(n=>{o.push(...Pt(e,n))}),r=r.concat(r,o),r}const Br=(e,t)=>{const r=e.displayOrder||Number.MAX_VALUE,o=t.displayOrder||Number.MAX_VALUE;return r>o?1:r<o?-1:0},Te=e=>{var t;return isNaN((t=e==null?void 0:e.getTime)==null?void 0:t.call(e))?0:e.getFullYear()+`/${e.getMonth()+1}/`+e.getDate()},ze=Ee.createStyles(({token:e,css:t})=>({scrollWrapper:t`
11
11
  overflow: auto;
12
12
  position: absolute;
13
13
  bottom: -8px;
@@ -82,7 +82,7 @@
82
82
  },
83
83
  }
84
84
  }
85
- `})),Pr=({scroll:e,svgWidth:t,taskListWidth:r,rtl:o,onScroll:n})=>{const{styles:a}=ze(),s=b.useRef(null);return b.useEffect(()=>{s.current&&(s.current.scrollLeft=e)},[e]),c.jsx("div",{dir:"ltr",style:{margin:o?`0px ${r}px 0px 0px`:`0px 0px 0px ${r}px`},className:M.cx(a.nbGridOther,a.scrollWrapper,"gantt-horizontal-scoll"),onScroll:n,ref:s,children:c.jsx("div",{style:{width:t,height:1},className:"horizontalScroll"})})},Fr=({task:e,rowHeight:t,rtl:r,svgContainerHeight:o,svgContainerWidth:n,scrollX:a,scrollY:s,arrowIndent:i,fontSize:l,fontFamily:u,headerHeight:g,taskListWidth:y,TooltipContent:D})=>{const{styles:w}=ze(),C=b.useRef(null),[k,m]=b.useState(0),[f,v]=b.useState(0);return b.useEffect(()=>{if(C.current){const N=C.current.offsetHeight*1.1,x=C.current.offsetWidth*1.1;let h=e.index*t-s+g,p;if(r)p=e.x1-i*1.5-x-a,p<0&&(p=e.x2+i*1.5-a),x+p>n&&(p=n-x,h+=t);else{p=e.x2+i*1.5+y-a;const P=x+p,L=y+n;P>L&&(p=e.x1+y-i*1.5-a-x),p<y&&(p=n+y-x,h+=t)}N+h-s>o-s&&(h=o-N),m(h),v(p)}},[C,e,i,a,s,g,y,t,o,n,r]),c.jsx("div",{ref:C,className:M.cx(f?w.tooltipDetailsContainer:w.tooltipDetailsContainerHidden,w.nbGridOther),style:{left:f,top:k},children:c.jsx(D,{task:e,fontSize:l,fontFamily:u})})},Ar=({task:e,fontSize:t,fontFamily:r})=>{var a,s,i,l,u,g,y,D;const{styles:o}=ze(),n={fontSize:t,fontFamily:r};return c.jsxs("div",{className:M.cx(o.nbGridOther,o.tooltipDefaultContainer),"aria-label":"nb-gantt-tooltip",style:n,children:[c.jsxs("b",{style:{fontSize:t},children:[e.name,": ",Te(e.start)," ~ ",Te(e.end)]}),((s=(a=e.end)==null?void 0:a.getTime)==null?void 0:s.call(a))-((l=(i=e.start)==null?void 0:i.getTime)==null?void 0:l.call(i))!==0&&c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:`Duration: ${Math.round((((g=(u=e.end)==null?void 0:u.getTime)==null?void 0:g.call(u))-((D=(y=e.start)==null?void 0:y.getTime)==null?void 0:D.call(y)))/(1e3*60*60*24)*10)/10||""} day(s)`}),c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:!!e.progress&&`Progress: ${e.progress}%`})]})},$r=({scroll:e,ganttHeight:t,ganttFullHeight:r,headerHeight:o,rtl:n,onScroll:a})=>{const{styles:s}=ze(),i=b.useRef(null);return b.useEffect(()=>{i.current&&(i.current.scrollTop=e)},[e]),c.jsx("div",{style:{maxHeight:t,marginTop:o,marginLeft:n?"":"-1rem"},className:M.cx(s.nbGridOther,"verticalScroll"),onScroll:a,ref:i,children:c.jsx("div",{style:{height:r,width:1}})})},Ir=e=>{const r=A.useFieldSchema().properties.detail;return r?c.jsx(A.RecursionField,{schema:r,name:r.name}):null},Ft=d.createStyles(({token:e,css:t})=>({ganttverticalcontainer:t`
85
+ `})),Pr=({scroll:e,svgWidth:t,taskListWidth:r,rtl:o,onScroll:n})=>{const{styles:a}=ze(),s=b.useRef(null);return b.useEffect(()=>{s.current&&(s.current.scrollLeft=e)},[e]),c.jsx("div",{dir:"ltr",style:{margin:o?`0px ${r}px 0px 0px`:`0px 0px 0px ${r}px`},className:M.cx(a.nbGridOther,a.scrollWrapper,"gantt-horizontal-scoll"),onScroll:n,ref:s,children:c.jsx("div",{style:{width:t,height:1},className:"horizontalScroll"})})},Fr=({task:e,rowHeight:t,rtl:r,svgContainerHeight:o,svgContainerWidth:n,scrollX:a,scrollY:s,arrowIndent:i,fontSize:l,fontFamily:u,headerHeight:g,taskListWidth:y,TooltipContent:D})=>{const{styles:w}=ze(),C=b.useRef(null),[k,m]=b.useState(0),[f,v]=b.useState(0);return b.useEffect(()=>{if(C.current){const N=C.current.offsetHeight*1.1,x=C.current.offsetWidth*1.1;let h=e.index*t-s+g,p;if(r)p=e.x1-i*1.5-x-a,p<0&&(p=e.x2+i*1.5-a),x+p>n&&(p=n-x,h+=t);else{p=e.x2+i*1.5+y-a;const P=x+p,G=y+n;P>G&&(p=e.x1+y-i*1.5-a-x),p<y&&(p=n+y-x,h+=t)}N+h-s>o-s&&(h=o-N),m(h),v(p)}},[C,e,i,a,s,g,y,t,o,n,r]),c.jsx("div",{ref:C,className:M.cx(f?w.tooltipDetailsContainer:w.tooltipDetailsContainerHidden,w.nbGridOther),style:{left:f,top:k},children:c.jsx(D,{task:e,fontSize:l,fontFamily:u})})},Ar=({task:e,fontSize:t,fontFamily:r})=>{var a,s,i,l,u,g,y,D;const{styles:o}=ze(),n={fontSize:t,fontFamily:r};return c.jsxs("div",{className:M.cx(o.nbGridOther,o.tooltipDefaultContainer),"aria-label":"nb-gantt-tooltip",style:n,children:[c.jsxs("b",{style:{fontSize:t},children:[e.name,": ",Te(e.start)," ~ ",Te(e.end)]}),((s=(a=e.end)==null?void 0:a.getTime)==null?void 0:s.call(a))-((l=(i=e.start)==null?void 0:i.getTime)==null?void 0:l.call(i))!==0&&c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:`Duration: ${Math.round((((g=(u=e.end)==null?void 0:u.getTime)==null?void 0:g.call(u))-((D=(y=e.start)==null?void 0:y.getTime)==null?void 0:D.call(y)))/(1e3*60*60*24)*10)/10||""} day(s)`}),c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:!!e.progress&&`Progress: ${e.progress}%`})]})},$r=({scroll:e,ganttHeight:t,ganttFullHeight:r,headerHeight:o,rtl:n,onScroll:a})=>{const{styles:s}=ze(),i=b.useRef(null);return b.useEffect(()=>{i.current&&(i.current.scrollTop=e)},[e]),c.jsx("div",{style:{maxHeight:t,marginTop:o,marginLeft:n?"":"-1rem"},className:M.cx(s.nbGridOther,"verticalScroll"),onScroll:a,ref:i,children:c.jsx("div",{style:{height:r,width:1}})})},Ir=e=>{const r=A.useFieldSchema().properties.detail;return r?c.jsx(A.RecursionField,{schema:r,name:r.name}):null},Ft=d.createStyles(({token:e,css:t})=>({ganttverticalcontainer:t`
86
86
  overflow: hidden;
87
87
  font-size: 0;
88
88
  margin: 0;
@@ -115,7 +115,7 @@
115
115
  display: block;
116
116
  }
117
117
  }
118
- `}));function Y(e,t){kr(e)&&(e="100%");var r=Lr(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function Xe(e){return Math.min(1,Math.max(0,e))}function kr(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function Lr(e){return typeof e=="string"&&e.indexOf("%")!==-1}function At(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Ye(e){return e<=1?"".concat(Number(e)*100,"%"):e}function be(e){return e.length===1?"0"+e:String(e)}function Gr(e,t,r){return{r:Y(e,255)*255,g:Y(t,255)*255,b:Y(r,255)*255}}function $t(e,t,r){e=Y(e,255),t=Y(t,255),r=Y(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,s=0,i=(o+n)/2;if(o===n)s=0,a=0;else{var l=o-n;switch(s=i>.5?l/(2-o-n):l/(o+n),o){case e:a=(t-r)/l+(t<r?6:0);break;case t:a=(r-e)/l+2;break;case r:a=(e-t)/l+4;break}a/=6}return{h:a,s,l:i}}function tt(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*(6*r):r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function Vr(e,t,r){var o,n,a;if(e=Y(e,360),t=Y(t,100),r=Y(r,100),t===0)n=r,a=r,o=r;else{var s=r<.5?r*(1+t):r+t-r*t,i=2*r-s;o=tt(i,s,e+1/3),n=tt(i,s,e),a=tt(i,s,e-1/3)}return{r:o*255,g:n*255,b:a*255}}function It(e,t,r){e=Y(e,255),t=Y(t,255),r=Y(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,s=o,i=o-n,l=o===0?0:i/o;if(o===n)a=0;else{switch(o){case e:a=(t-r)/i+(t<r?6:0);break;case t:a=(r-e)/i+2;break;case r:a=(e-t)/i+4;break}a/=6}return{h:a,s:l,v:s}}function Er(e,t,r){e=Y(e,360)*6,t=Y(t,100),r=Y(r,100);var o=Math.floor(e),n=e-o,a=r*(1-t),s=r*(1-n*t),i=r*(1-(1-n)*t),l=o%6,u=[r,s,a,a,i,r][l],g=[i,r,r,s,a,a][l],y=[a,a,i,r,r,s][l];return{r:u*255,g:g*255,b:y*255}}function kt(e,t,r,o){var n=[be(Math.round(e).toString(16)),be(Math.round(t).toString(16)),be(Math.round(r).toString(16))];return o&&n[0].startsWith(n[0].charAt(1))&&n[1].startsWith(n[1].charAt(1))&&n[2].startsWith(n[2].charAt(1))?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function Hr(e,t,r,o,n){var a=[be(Math.round(e).toString(16)),be(Math.round(t).toString(16)),be(Math.round(r).toString(16)),be(Or(o))];return n&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function Or(e){return Math.round(parseFloat(e)*255).toString(16)}function Lt(e){return _(e)/255}function _(e){return parseInt(e,16)}function zr(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var rt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Xr(e){var t={r:0,g:0,b:0},r=1,o=null,n=null,a=null,s=!1,i=!1;return typeof e=="string"&&(e=qr(e)),typeof e=="object"&&(le(e.r)&&le(e.g)&&le(e.b)?(t=Gr(e.r,e.g,e.b),s=!0,i=String(e.r).substr(-1)==="%"?"prgb":"rgb"):le(e.h)&&le(e.s)&&le(e.v)?(o=Ye(e.s),n=Ye(e.v),t=Er(e.h,o,n),s=!0,i="hsv"):le(e.h)&&le(e.s)&&le(e.l)&&(o=Ye(e.s),a=Ye(e.l),t=Vr(e.h,o,a),s=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=At(r),{ok:s,format:e.format||i,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}var Yr="[-\\+]?\\d+%?",jr="[-\\+]?\\d*\\.\\d+%?",he="(?:".concat(jr,")|(?:").concat(Yr,")"),ot="[\\s|\\(]+(".concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")\\s*\\)?"),nt="[\\s|\\(]+(".concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")\\s*\\)?"),ee={CSS_UNIT:new RegExp(he),rgb:new RegExp("rgb"+ot),rgba:new RegExp("rgba"+nt),hsl:new RegExp("hsl"+ot),hsla:new RegExp("hsla"+nt),hsv:new RegExp("hsv"+ot),hsva:new RegExp("hsva"+nt),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function qr(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(rt[e])e=rt[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r=ee.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=ee.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ee.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=ee.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ee.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=ee.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ee.hex8.exec(e),r?{r:_(r[1]),g:_(r[2]),b:_(r[3]),a:Lt(r[4]),format:t?"name":"hex8"}:(r=ee.hex6.exec(e),r?{r:_(r[1]),g:_(r[2]),b:_(r[3]),format:t?"name":"hex"}:(r=ee.hex4.exec(e),r?{r:_(r[1]+r[1]),g:_(r[2]+r[2]),b:_(r[3]+r[3]),a:Lt(r[4]+r[4]),format:t?"name":"hex8"}:(r=ee.hex3.exec(e),r?{r:_(r[1]+r[1]),g:_(r[2]+r[2]),b:_(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function le(e){return!!ee.CSS_UNIT.exec(String(e))}var Ur=function(){function e(t,r){t===void 0&&(t=""),r===void 0&&(r={});var o;if(t instanceof e)return t;typeof t=="number"&&(t=zr(t)),this.originalInput=t;var n=Xr(t);this.originalInput=t,this.r=n.r,this.g=n.g,this.b=n.b,this.a=n.a,this.roundA=Math.round(100*this.a)/100,this.format=(o=r.format)!==null&&o!==void 0?o:n.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=n.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),r,o,n,a=t.r/255,s=t.g/255,i=t.b/255;return a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),s<=.03928?o=s/12.92:o=Math.pow((s+.055)/1.055,2.4),i<=.03928?n=i/12.92:n=Math.pow((i+.055)/1.055,2.4),.2126*r+.7152*o+.0722*n},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=At(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=It(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=It(this.r,this.g,this.b),r=Math.round(t.h*360),o=Math.round(t.s*100),n=Math.round(t.v*100);return this.a===1?"hsv(".concat(r,", ").concat(o,"%, ").concat(n,"%)"):"hsva(".concat(r,", ").concat(o,"%, ").concat(n,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=$t(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=$t(this.r,this.g,this.b),r=Math.round(t.h*360),o=Math.round(t.s*100),n=Math.round(t.l*100);return this.a===1?"hsl(".concat(r,", ").concat(o,"%, ").concat(n,"%)"):"hsla(".concat(r,", ").concat(o,"%, ").concat(n,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),kt(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),Hr(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toHexShortString=function(t){return t===void 0&&(t=!1),this.a===1?this.toHexString(t):this.toHex8String(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),r=Math.round(this.g),o=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(r,", ").concat(o,")"):"rgba(".concat(t,", ").concat(r,", ").concat(o,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(r){return"".concat(Math.round(Y(r,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(r){return Math.round(Y(r,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+kt(this.r,this.g,this.b,!1),r=0,o=Object.entries(rt);r<o.length;r++){var n=o[r],a=n[0],s=n[1];if(t===s)return a}return!1},e.prototype.toString=function(t){var r=!!t;t=t!=null?t:this.format;var o=!1,n=this.a<1&&this.a>=0,a=!r&&n&&(t.startsWith("hex")||t==="name");return a?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(o=this.toRgbString()),t==="prgb"&&(o=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(o=this.toHexString()),t==="hex3"&&(o=this.toHexString(!0)),t==="hex4"&&(o=this.toHex8String(!0)),t==="hex8"&&(o=this.toHex8String()),t==="name"&&(o=this.toName()),t==="hsl"&&(o=this.toHslString()),t==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l+=t/100,r.l=Xe(r.l),new e(r)},e.prototype.brighten=function(t){t===void 0&&(t=10);var r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),new e(r)},e.prototype.darken=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l-=t/100,r.l=Xe(r.l),new e(r)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s-=t/100,r.s=Xe(r.s),new e(r)},e.prototype.saturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s+=t/100,r.s=Xe(r.s),new e(r)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var r=this.toHsl(),o=(r.h+t)%360;return r.h=o<0?360+o:o,new e(r)},e.prototype.mix=function(t,r){r===void 0&&(r=50);var o=this.toRgb(),n=new e(t).toRgb(),a=r/100,s={r:(n.r-o.r)*a+o.r,g:(n.g-o.g)*a+o.g,b:(n.b-o.b)*a+o.b,a:(n.a-o.a)*a+o.a};return new e(s)},e.prototype.analogous=function(t,r){t===void 0&&(t=6),r===void 0&&(r=30);var o=this.toHsl(),n=360/r,a=[this];for(o.h=(o.h-(n*t>>1)+720)%360;--t;)o.h=(o.h+n)%360,a.push(new e(o));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var r=this.toHsv(),o=r.h,n=r.s,a=r.v,s=[],i=1/t;t--;)s.push(new e({h:o,s:n,v:a})),a=(a+i)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),r=t.h;return[this,new e({h:(r+72)%360,s:t.s,l:t.l}),new e({h:(r+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var r=this.toRgb(),o=new e(t).toRgb(),n=r.a+o.a*(1-r.a);return new e({r:(r.r*r.a+o.r*o.a*(1-r.a))/n,g:(r.g*r.a+o.g*o.a*(1-r.a))/n,b:(r.b*r.a+o.b*o.a*(1-r.a))/n,a:n})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var r=this.toHsl(),o=r.h,n=[this],a=360/t,s=1;s<t;s++)n.push(new e({h:(o+s*a)%360,s:r.s,l:r.l}));return n},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Wr=Ee.createStyles(({token:e,css:t})=>{const r=new Ur(e.colorFillAlter).onBackground(e.colorBgContainer).toHexShortString();return{calendarheader:t`
118
+ `}));function Y(e,t){kr(e)&&(e="100%");var r=Gr(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function Xe(e){return Math.min(1,Math.max(0,e))}function kr(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function Gr(e){return typeof e=="string"&&e.indexOf("%")!==-1}function At(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Ye(e){return e<=1?"".concat(Number(e)*100,"%"):e}function be(e){return e.length===1?"0"+e:String(e)}function Lr(e,t,r){return{r:Y(e,255)*255,g:Y(t,255)*255,b:Y(r,255)*255}}function $t(e,t,r){e=Y(e,255),t=Y(t,255),r=Y(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,s=0,i=(o+n)/2;if(o===n)s=0,a=0;else{var l=o-n;switch(s=i>.5?l/(2-o-n):l/(o+n),o){case e:a=(t-r)/l+(t<r?6:0);break;case t:a=(r-e)/l+2;break;case r:a=(e-t)/l+4;break}a/=6}return{h:a,s,l:i}}function tt(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*(6*r):r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function Vr(e,t,r){var o,n,a;if(e=Y(e,360),t=Y(t,100),r=Y(r,100),t===0)n=r,a=r,o=r;else{var s=r<.5?r*(1+t):r+t-r*t,i=2*r-s;o=tt(i,s,e+1/3),n=tt(i,s,e),a=tt(i,s,e-1/3)}return{r:o*255,g:n*255,b:a*255}}function It(e,t,r){e=Y(e,255),t=Y(t,255),r=Y(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,s=o,i=o-n,l=o===0?0:i/o;if(o===n)a=0;else{switch(o){case e:a=(t-r)/i+(t<r?6:0);break;case t:a=(r-e)/i+2;break;case r:a=(e-t)/i+4;break}a/=6}return{h:a,s:l,v:s}}function Er(e,t,r){e=Y(e,360)*6,t=Y(t,100),r=Y(r,100);var o=Math.floor(e),n=e-o,a=r*(1-t),s=r*(1-n*t),i=r*(1-(1-n)*t),l=o%6,u=[r,s,a,a,i,r][l],g=[i,r,r,s,a,a][l],y=[a,a,i,r,r,s][l];return{r:u*255,g:g*255,b:y*255}}function kt(e,t,r,o){var n=[be(Math.round(e).toString(16)),be(Math.round(t).toString(16)),be(Math.round(r).toString(16))];return o&&n[0].startsWith(n[0].charAt(1))&&n[1].startsWith(n[1].charAt(1))&&n[2].startsWith(n[2].charAt(1))?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function Hr(e,t,r,o,n){var a=[be(Math.round(e).toString(16)),be(Math.round(t).toString(16)),be(Math.round(r).toString(16)),be(Or(o))];return n&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function Or(e){return Math.round(parseFloat(e)*255).toString(16)}function Gt(e){return _(e)/255}function _(e){return parseInt(e,16)}function zr(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var rt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Xr(e){var t={r:0,g:0,b:0},r=1,o=null,n=null,a=null,s=!1,i=!1;return typeof e=="string"&&(e=qr(e)),typeof e=="object"&&(le(e.r)&&le(e.g)&&le(e.b)?(t=Lr(e.r,e.g,e.b),s=!0,i=String(e.r).substr(-1)==="%"?"prgb":"rgb"):le(e.h)&&le(e.s)&&le(e.v)?(o=Ye(e.s),n=Ye(e.v),t=Er(e.h,o,n),s=!0,i="hsv"):le(e.h)&&le(e.s)&&le(e.l)&&(o=Ye(e.s),a=Ye(e.l),t=Vr(e.h,o,a),s=!0,i="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=At(r),{ok:s,format:e.format||i,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}var Yr="[-\\+]?\\d+%?",jr="[-\\+]?\\d*\\.\\d+%?",he="(?:".concat(jr,")|(?:").concat(Yr,")"),ot="[\\s|\\(]+(".concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")\\s*\\)?"),nt="[\\s|\\(]+(".concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")[,|\\s]+(").concat(he,")\\s*\\)?"),ee={CSS_UNIT:new RegExp(he),rgb:new RegExp("rgb"+ot),rgba:new RegExp("rgba"+nt),hsl:new RegExp("hsl"+ot),hsla:new RegExp("hsla"+nt),hsv:new RegExp("hsv"+ot),hsva:new RegExp("hsva"+nt),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function qr(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(rt[e])e=rt[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r=ee.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=ee.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ee.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=ee.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ee.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=ee.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ee.hex8.exec(e),r?{r:_(r[1]),g:_(r[2]),b:_(r[3]),a:Gt(r[4]),format:t?"name":"hex8"}:(r=ee.hex6.exec(e),r?{r:_(r[1]),g:_(r[2]),b:_(r[3]),format:t?"name":"hex"}:(r=ee.hex4.exec(e),r?{r:_(r[1]+r[1]),g:_(r[2]+r[2]),b:_(r[3]+r[3]),a:Gt(r[4]+r[4]),format:t?"name":"hex8"}:(r=ee.hex3.exec(e),r?{r:_(r[1]+r[1]),g:_(r[2]+r[2]),b:_(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function le(e){return!!ee.CSS_UNIT.exec(String(e))}var Ur=function(){function e(t,r){t===void 0&&(t=""),r===void 0&&(r={});var o;if(t instanceof e)return t;typeof t=="number"&&(t=zr(t)),this.originalInput=t;var n=Xr(t);this.originalInput=t,this.r=n.r,this.g=n.g,this.b=n.b,this.a=n.a,this.roundA=Math.round(100*this.a)/100,this.format=(o=r.format)!==null&&o!==void 0?o:n.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=n.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),r,o,n,a=t.r/255,s=t.g/255,i=t.b/255;return a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),s<=.03928?o=s/12.92:o=Math.pow((s+.055)/1.055,2.4),i<=.03928?n=i/12.92:n=Math.pow((i+.055)/1.055,2.4),.2126*r+.7152*o+.0722*n},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=At(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=It(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=It(this.r,this.g,this.b),r=Math.round(t.h*360),o=Math.round(t.s*100),n=Math.round(t.v*100);return this.a===1?"hsv(".concat(r,", ").concat(o,"%, ").concat(n,"%)"):"hsva(".concat(r,", ").concat(o,"%, ").concat(n,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=$t(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=$t(this.r,this.g,this.b),r=Math.round(t.h*360),o=Math.round(t.s*100),n=Math.round(t.l*100);return this.a===1?"hsl(".concat(r,", ").concat(o,"%, ").concat(n,"%)"):"hsla(".concat(r,", ").concat(o,"%, ").concat(n,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),kt(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),Hr(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toHexShortString=function(t){return t===void 0&&(t=!1),this.a===1?this.toHexString(t):this.toHex8String(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),r=Math.round(this.g),o=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(r,", ").concat(o,")"):"rgba(".concat(t,", ").concat(r,", ").concat(o,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(r){return"".concat(Math.round(Y(r,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(r){return Math.round(Y(r,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+kt(this.r,this.g,this.b,!1),r=0,o=Object.entries(rt);r<o.length;r++){var n=o[r],a=n[0],s=n[1];if(t===s)return a}return!1},e.prototype.toString=function(t){var r=!!t;t=t!=null?t:this.format;var o=!1,n=this.a<1&&this.a>=0,a=!r&&n&&(t.startsWith("hex")||t==="name");return a?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(o=this.toRgbString()),t==="prgb"&&(o=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(o=this.toHexString()),t==="hex3"&&(o=this.toHexString(!0)),t==="hex4"&&(o=this.toHex8String(!0)),t==="hex8"&&(o=this.toHex8String()),t==="name"&&(o=this.toName()),t==="hsl"&&(o=this.toHslString()),t==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l+=t/100,r.l=Xe(r.l),new e(r)},e.prototype.brighten=function(t){t===void 0&&(t=10);var r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),new e(r)},e.prototype.darken=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l-=t/100,r.l=Xe(r.l),new e(r)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s-=t/100,r.s=Xe(r.s),new e(r)},e.prototype.saturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s+=t/100,r.s=Xe(r.s),new e(r)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var r=this.toHsl(),o=(r.h+t)%360;return r.h=o<0?360+o:o,new e(r)},e.prototype.mix=function(t,r){r===void 0&&(r=50);var o=this.toRgb(),n=new e(t).toRgb(),a=r/100,s={r:(n.r-o.r)*a+o.r,g:(n.g-o.g)*a+o.g,b:(n.b-o.b)*a+o.b,a:(n.a-o.a)*a+o.a};return new e(s)},e.prototype.analogous=function(t,r){t===void 0&&(t=6),r===void 0&&(r=30);var o=this.toHsl(),n=360/r,a=[this];for(o.h=(o.h-(n*t>>1)+720)%360;--t;)o.h=(o.h+n)%360,a.push(new e(o));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var r=this.toHsv(),o=r.h,n=r.s,a=r.v,s=[],i=1/t;t--;)s.push(new e({h:o,s:n,v:a})),a=(a+i)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),r=t.h;return[this,new e({h:(r+72)%360,s:t.s,l:t.l}),new e({h:(r+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var r=this.toRgb(),o=new e(t).toRgb(),n=r.a+o.a*(1-r.a);return new e({r:(r.r*r.a+o.r*o.a*(1-r.a))/n,g:(r.g*r.a+o.g*o.a*(1-r.a))/n,b:(r.b*r.a+o.b*o.a*(1-r.a))/n,a:n})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var r=this.toHsl(),o=r.h,n=[this],a=360/t,s=1;s<t;s++)n.push(new e({h:(o+s*a)%360,s:r.s,l:r.l}));return n},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Wr=Ee.createStyles(({token:e,css:t})=>{const r=new Ur(e.colorFillAlter).onBackground(e.colorBgContainer).toHexShortString();return{calendarheader:t`
119
119
  color: ${e.colorText};
120
120
  fill: ${r};
121
121
  stroke-width: 1.4;
@@ -148,7 +148,7 @@
148
148
  font-weight: 500;
149
149
  fill: ${e.colorText};
150
150
  }
151
- `}}),xe=({value:e,x1Line:t,y1Line:r,y2Line:o,xText:n,yText:a})=>c.jsxs("g",{className:"calendarTop",children:[c.jsx("line",{x1:t,y1:r,x2:t,y2:o,className:M.cx("calendarTopTick")},e+"line"),c.jsx("text",{y:a,x:n,className:M.cx("calendarTopText"),children:e},e+"text")]}),Qr=({dateSetup:e,locale:t,viewMode:r,rtl:o,headerHeight:n,columnWidth:a,fontFamily:s,fontSize:i})=>{const{styles:l}=Wr(),u=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S=p.getFullYear();if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},p.getTime())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let L;o?L=(6+h+p.getFullYear()+1)*a:L=(6+h-p.getFullYear())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:n,xText:L,yText:x*.9},P))}}return[v,N]},g=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S="Q"+Math.floor((p.getMonth()+3)/3);if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},p.getTime())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let L;o?L=(6+h+p.getMonth()+1)*a:L=(6+h-p.getMonth())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:x,xText:Math.abs(L),yText:x*.9},P))}}return[v,N]},y=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S=Fe(p,t);if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},S+p.getFullYear())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let L;o?L=(6+h+p.getMonth()+1)*a:L=(6+h-p.getMonth())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:x,xText:L,yText:x*.9},P))}}return[v,N]},D=()=>{const v=[],N=[];let x=1;const h=n*.5,p=e.dates;for(let S=p.length-1;S>=0;S--){const P=p[S];let L="";(S===0||P.getMonth()!==p[S-1].getMonth())&&(L=`${Fe(P,t)}, ${P.getFullYear()}`);const Q=`W${Tr(P)}`;N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),children:Q},P.getTime())),L&&(S!==p.length-1&&v.push(c.jsx(xe,{value:L,x1Line:a*S+x*a,y1Line:0,y2Line:h,xText:a*S+a*x*.5,yText:h*.9},L)),x=0),x++}return[v,N]},w=()=>{const v=[],N=[],x=n*.5,h=e.dates;for(let p=0;p<h.length;p++){const S=h[p],P=`${S.getDate().toString()}`;if(N.push(c.jsx("text",{y:n*.8,x:a*p+a*.5,className:M.cx("calendarBottomText"),children:P},S.getTime())),p+1!==h.length&&S.getMonth()!==h[p+1].getMonth()){const L=Fe(S,t);v.push(c.jsx(xe,{value:L,x1Line:a*(p+1),y1Line:0,y2Line:x,xText:a*(p+1)-Nr(S.getMonth(),S.getFullYear())*a*.5,yText:x*.9},L+S.getFullYear()))}}return[v,N]},C=()=>{const v=[],N=[],x=r===E.HalfDay?2:4,h=n*.5,p=e.dates;for(let S=0;S<p.length;S++){const P=p[S],L=Oe(t,{hour:"numeric"}).format(P).replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),fontFamily:s,children:L},P.getTime())),S===0||P.getDate()!==p[S-1].getDate()){const Q=`${Bt(P,t,"short")}, ${P.getDate()} ${Fe(P,t)}`;v.push(c.jsx(xe,{value:Q,x1Line:a*S+x*a,y1Line:0,y2Line:h,xText:a*S+x*a*.5,yText:h*.9},Q+P.getFullYear()))}}return[v,N]},k=()=>{var p;const v=[],N=[],x=n*.5,h=e.dates;for(let S=0;S<h.length;S++){const P=h[S],L=(p=Oe(t,{hour:"numeric"}).format(P))==null?void 0:p.replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),fontFamily:s,children:L},P.getTime())),S!==0&&P.getDate()!==h[S-1].getDate()){const Q=h[S-1],ye=`${Bt(Q,t,"long")}, ${Q.getDate()} ${Fe(Q,t)}`,Z=(P.getHours()-24)/2;v.push(c.jsx(xe,{value:ye,x1Line:a*S,y1Line:0,y2Line:x,xText:a*(S+Z),yText:x*.9},ye+Q.getFullYear()))}}return[v,N]};let m=[],f=[];switch(e.viewMode){case E.Year:[m,f]=u();break;case E.QuarterYear:[m,f]=g();break;case E.Month:[m,f]=y();break;case E.Week:[m,f]=D();break;case E.Day:[m,f]=w();break;case E.QuarterDay:case E.HalfDay:[m,f]=C();break;case E.Hour:[m,f]=k()}return c.jsxs("g",{className:l.nbGanttCalendar,fontSize:i,fontFamily:s,children:[c.jsx("rect",{x:0,y:0,width:a*e.dates.length,height:n,className:l.calendarheader}),f," ",m]})},_r=Ee.createStyles(({token:e,css:t})=>({gridRow:t`
151
+ `}}),xe=({value:e,x1Line:t,y1Line:r,y2Line:o,xText:n,yText:a})=>c.jsxs("g",{className:"calendarTop",children:[c.jsx("line",{x1:t,y1:r,x2:t,y2:o,className:M.cx("calendarTopTick")},e+"line"),c.jsx("text",{y:a,x:n,className:M.cx("calendarTopText"),children:e},e+"text")]}),Qr=({dateSetup:e,locale:t,viewMode:r,rtl:o,headerHeight:n,columnWidth:a,fontFamily:s,fontSize:i})=>{const{styles:l}=Wr(),u=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S=p.getFullYear();if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},p.getTime())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let G;o?G=(6+h+p.getFullYear()+1)*a:G=(6+h-p.getFullYear())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:n,xText:G,yText:x*.9},P))}}return[v,N]},g=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S="Q"+Math.floor((p.getMonth()+3)/3);if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},p.getTime())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let G;o?G=(6+h+p.getMonth()+1)*a:G=(6+h-p.getMonth())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:x,xText:Math.abs(G),yText:x*.9},P))}}return[v,N]},y=()=>{const v=[],N=[],x=n*.5;for(let h=0;h<e.dates.length;h++){const p=e.dates[h],S=Fe(p,t);if(N.push(c.jsx("text",{y:n*.8,x:a*h+a*.5,className:M.cx("calendarBottomText"),children:S},S+p.getFullYear())),h===0||p.getFullYear()!==e.dates[h-1].getFullYear()){const P=p.getFullYear().toString();let G;o?G=(6+h+p.getMonth()+1)*a:G=(6+h-p.getMonth())*a,v.push(c.jsx(xe,{value:P,x1Line:a*h,y1Line:0,y2Line:x,xText:G,yText:x*.9},P))}}return[v,N]},D=()=>{const v=[],N=[];let x=1;const h=n*.5,p=e.dates;for(let S=p.length-1;S>=0;S--){const P=p[S];let G="";(S===0||P.getMonth()!==p[S-1].getMonth())&&(G=`${Fe(P,t)}, ${P.getFullYear()}`);const Q=`W${Tr(P)}`;N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),children:Q},P.getTime())),G&&(S!==p.length-1&&v.push(c.jsx(xe,{value:G,x1Line:a*S+x*a,y1Line:0,y2Line:h,xText:a*S+a*x*.5,yText:h*.9},G)),x=0),x++}return[v,N]},w=()=>{const v=[],N=[],x=n*.5,h=e.dates;for(let p=0;p<h.length;p++){const S=h[p],P=`${S.getDate().toString()}`;if(N.push(c.jsx("text",{y:n*.8,x:a*p+a*.5,className:M.cx("calendarBottomText"),children:P},S.getTime())),p+1!==h.length&&S.getMonth()!==h[p+1].getMonth()){const G=Fe(S,t);v.push(c.jsx(xe,{value:G,x1Line:a*(p+1),y1Line:0,y2Line:x,xText:a*(p+1)-Nr(S.getMonth(),S.getFullYear())*a*.5,yText:x*.9},G+S.getFullYear()))}}return[v,N]},C=()=>{const v=[],N=[],x=r===E.HalfDay?2:4,h=n*.5,p=e.dates;for(let S=0;S<p.length;S++){const P=p[S],G=Oe(t,{hour:"numeric"}).format(P).replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),fontFamily:s,children:G},P.getTime())),S===0||P.getDate()!==p[S-1].getDate()){const Q=`${Bt(P,t,"short")}, ${P.getDate()} ${Fe(P,t)}`;v.push(c.jsx(xe,{value:Q,x1Line:a*S+x*a,y1Line:0,y2Line:h,xText:a*S+x*a*.5,yText:h*.9},Q+P.getFullYear()))}}return[v,N]},k=()=>{var p;const v=[],N=[],x=n*.5,h=e.dates;for(let S=0;S<h.length;S++){const P=h[S],G=(p=Oe(t,{hour:"numeric"}).format(P))==null?void 0:p.replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(S+ +o),className:M.cx("calendarBottomText"),fontFamily:s,children:G},P.getTime())),S!==0&&P.getDate()!==h[S-1].getDate()){const Q=h[S-1],ye=`${Bt(Q,t,"long")}, ${Q.getDate()} ${Fe(Q,t)}`,Z=(P.getHours()-24)/2;v.push(c.jsx(xe,{value:ye,x1Line:a*S,y1Line:0,y2Line:x,xText:a*(S+Z),yText:x*.9},ye+Q.getFullYear()))}}return[v,N]};let m=[],f=[];switch(e.viewMode){case E.Year:[m,f]=u();break;case E.QuarterYear:[m,f]=g();break;case E.Month:[m,f]=y();break;case E.Week:[m,f]=D();break;case E.Day:[m,f]=w();break;case E.QuarterDay:case E.HalfDay:[m,f]=C();break;case E.Hour:[m,f]=k()}return c.jsxs("g",{className:l.nbGanttCalendar,fontSize:i,fontFamily:s,children:[c.jsx("rect",{x:0,y:0,width:a*e.dates.length,height:n,className:l.calendarheader}),f," ",m]})},_r=Ee.createStyles(({token:e,css:t})=>({gridRow:t`
152
152
  fill: ${e.colorBgContainer};
153
153
  `,gridHeightRow:t`
154
154
  fill: #e6f7ff;
@@ -176,7 +176,7 @@
176
176
  V ${s}
177
177
  h ${u}`,y=`${t.x2},${s}
178
178
  ${t.x2+5},${s+5}
179
- ${t.x2+5},${s-5}`;return[g,y]},Gt=({x:e,y:t,width:r,height:o,barCornerRadius:n,onMouseDown:a})=>c.jsx("rect",{x:e,y:t,width:r,height:o,className:"barHandle",role:"button",ry:n,rx:n,onMouseDown:a}),Vt=M.css`
179
+ ${t.x2+5},${s-5}`;return[g,y]},Lt=({x:e,y:t,width:r,height:o,barCornerRadius:n,onMouseDown:a})=>c.jsx("rect",{x:e,y:t,width:r,height:o,className:"barHandle",role:"button",ry:n,rx:n,onMouseDown:a}),Vt=M.css`
180
180
  cursor: pointer;
181
181
  outline: none;
182
182
  .barHandle {
@@ -193,7 +193,7 @@
193
193
  user-select: none;
194
194
  stroke-width: 0;
195
195
  opacity: 0.6;
196
- `,Et=({x:e,y:t,color:r,width:o,height:n,isSelected:a,progressX:s,progressWidth:i,barCornerRadius:l,styles:u,onMouseDown:g})=>{const y=()=>r||(a?u.progressSelectedColor:u.progressColor),D=()=>r||(a?u.backgroundSelectedColor:u.backgroundColor);return c.jsxs("g",{onMouseDown:g,children:[c.jsx("rect",{x:e,width:o,y:t,height:n,ry:l,rx:l,fill:D(),className:M.cx(ro)}),c.jsx("rect",{x:s,width:i,y:t,height:n,ry:l,rx:l,fill:y()})]})},Ht=({progressPoint:e,onMouseDown:t})=>c.jsx("polygon",{className:"barHandle",points:e,onMouseDown:t}),oo=({task:e,isProgressChangeable:t,isDateChangeable:r,rtl:o,onEventStart:n,isSelected:a})=>{const s=Ct(+!o*e.progressWidth+e.progressX,e.y,e.height),i=e.height-2;return c.jsxs("g",{className:M.cx(Vt),"aria-label":"task-bar",tabIndex:0,children:[c.jsx(Et,{x:e.x1,y:e.y,color:e.color,width:e.x2-e.x1,height:e.height,progressX:e.progressX,progressWidth:e.progressWidth,barCornerRadius:e.barCornerRadius,styles:e.styles,isSelected:a,onMouseDown:l=>{r&&n("move",e,l)}}),c.jsxs("g",{className:"handleGroup",children:[r&&c.jsxs("g",{children:[c.jsx(Gt,{x:e.x1+1,y:e.y+1,width:e.handleWidth,height:i,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("start",e,l)}}),c.jsx(Gt,{x:e.x2-e.handleWidth-1,y:e.y+1,width:e.handleWidth,height:i,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("end",e,l)}})]}),t&&c.jsx(Ht,{progressPoint:s,onMouseDown:l=>{n("progress",e,l)}})]})]})},no=({task:e,isProgressChangeable:t,isDateChangeable:r,onEventStart:o,isSelected:n})=>{const a=Ct(e.progressWidth+e.x1+10,e.y,e.height);return c.jsxs("g",{className:M.cx(Vt),tabIndex:0,children:[c.jsx(Et,{x:e.x1,y:e.y,width:e.x2-e.x1,height:e.height,progressX:e.progressX,progressWidth:e.progressWidth,barCornerRadius:e.barCornerRadius,styles:e.styles,isSelected:n,onMouseDown:s=>{r&&o("move",e,s)}}),c.jsx("g",{className:"handleGroup",children:t&&c.jsx(Ht,{progressPoint:a,onMouseDown:s=>{o("progress",e,s)}})})]})},ao=M.css`
196
+ `,Et=({x:e,y:t,color:r,width:o,height:n,isSelected:a,progressX:s,progressWidth:i,barCornerRadius:l,styles:u,onMouseDown:g})=>{const y=()=>r||(a?u.progressSelectedColor:u.progressColor),D=()=>r||(a?u.backgroundSelectedColor:u.backgroundColor);return c.jsxs("g",{onMouseDown:g,children:[c.jsx("rect",{x:e,width:o,y:t,height:n,ry:l,rx:l,fill:D(),className:M.cx(ro)}),c.jsx("rect",{x:s,width:i,y:t,height:n,ry:l,rx:l,fill:y()})]})},Ht=({progressPoint:e,onMouseDown:t})=>c.jsx("polygon",{className:"barHandle",points:e,onMouseDown:t}),oo=({task:e,isProgressChangeable:t,isDateChangeable:r,rtl:o,onEventStart:n,isSelected:a})=>{const s=Ct(+!o*e.progressWidth+e.progressX,e.y,e.height),i=e.height-2;return c.jsxs("g",{className:M.cx(Vt),"aria-label":"task-bar",tabIndex:0,children:[c.jsx(Et,{x:e.x1,y:e.y,color:e.color,width:e.x2-e.x1,height:e.height,progressX:e.progressX,progressWidth:e.progressWidth,barCornerRadius:e.barCornerRadius,styles:e.styles,isSelected:a,onMouseDown:l=>{r&&n("move",e,l)}}),c.jsxs("g",{className:"handleGroup",children:[r&&c.jsxs("g",{children:[c.jsx(Lt,{x:e.x1+1,y:e.y+1,width:e.handleWidth,height:i,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("start",e,l)}}),c.jsx(Lt,{x:e.x2-e.handleWidth-1,y:e.y+1,width:e.handleWidth,height:i,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("end",e,l)}})]}),t&&c.jsx(Ht,{progressPoint:s,onMouseDown:l=>{n("progress",e,l)}})]})]})},no=({task:e,isProgressChangeable:t,isDateChangeable:r,onEventStart:o,isSelected:n})=>{const a=Ct(e.progressWidth+e.x1+10,e.y,e.height);return c.jsxs("g",{className:M.cx(Vt),tabIndex:0,children:[c.jsx(Et,{x:e.x1,y:e.y,width:e.x2-e.x1,height:e.height,progressX:e.progressX,progressWidth:e.progressWidth,barCornerRadius:e.barCornerRadius,styles:e.styles,isSelected:n,onMouseDown:s=>{r&&o("move",e,s)}}),c.jsx("g",{className:"handleGroup",children:t&&c.jsx(Ht,{progressPoint:a,onMouseDown:s=>{o("progress",e,s)}})})]})},ao=M.css`
197
197
  cursor: pointer;
198
198
  outline: none;
199
199
  `,so=M.css`
@@ -243,7 +243,7 @@
243
243
  pointerEvents: none,
244
244
  },
245
245
  }
246
- }`})),fo=e=>{const{styles:t}=po(),{task:r,arrowIndent:o,isDelete:n,taskHeight:a,isSelected:s,rtl:i,onEventStart:l}=H({},e),u=b.useRef(null),[g,y]=b.useState(c.jsx("div",{})),[D,w]=b.useState(!0),C=r.typeInternal==="project";b.useEffect(()=>{switch(r.typeInternal){case"milestone":y(c.jsx(io,H({},e)));break;case"project":y(c.jsx(uo,H({},e)));break;case"smalltask":y(c.jsx(no,H({},e)));break;default:y(c.jsx(oo,H({},e)));break}},[r,s]),b.useEffect(()=>{u.current&&w(u.current.getBBox().width<r.x2-r.x1)},[u,r]);const k=()=>{const m=r.x2-r.x1,f=r.barChildren.length>0;return D?r.x1+m*.5:i&&u.current?r.x1-u.current.getBBox().width-o*+f-o*.2:r.x1+m+o*+f+o*.2};return c.jsxs("g",{className:M.cx(t.nbganttTaskitem),onKeyDown:m=>{switch(m.key){case"Delete":{n&&l("delete",r,m);break}}m.stopPropagation()},onMouseEnter:m=>{l("mouseenter",r,m)},onMouseLeave:m=>{l("mouseleave",r,m)},onDoubleClick:m=>{l("dblclick",r,m)},onClick:m=>{l("click",r,m)},onFocus:()=>{l("select",r)},children:[g,c.jsx("text",{x:C?r.x1:k(),y:C?r.y-8:r.y+a*.65,className:C?M.cx("projectLabel"):D?M.cx("barLabel"):M.cx("barLabelOutside"),ref:u,children:C&&Te(r.start)&&Te(r.end)?`${r.name}: ${Te(r.start)} ~ ${Te(r.end)}`:r.name})]})};let at=null,Ae=null;const ho=({tasks:e,dates:t,ganttEvent:r,selectedTask:o,rowHeight:n,columnWidth:a,timeStep:s,svg:i,taskHeight:l,arrowColor:u,arrowIndent:g,fontFamily:y,fontSize:D,rtl:w,setGanttEvent:C,setFailedTask:k,setSelectedTask:m,onDateChange:f,onProgressChange:v,onDoubleClick:N,onClick:x,onDelete:h})=>{var je;const p=(je=i==null?void 0:i.current)==null?void 0:je.createSVGPoint(),[S,P]=b.useState(0),[L,Q]=b.useState(0),[ye,Z]=b.useState(!1);b.useEffect(()=>{var z,q,X,oe;const F=((z=t[1])==null?void 0:z.getTime())-((q=t[0])==null?void 0:q.getTime())-((X=t[1])==null?void 0:X.getTimezoneOffset())*60*1e3+((oe=t[0])==null?void 0:oe.getTimezoneOffset())*60*1e3,V=s*a/F;P(V)},[a,t,s]),b.useEffect(()=>{const F=z=>R(this,null,function*(){var Me;if(!r.changedTask||!p||!(i!=null&&i.current))return;z.preventDefault(),p.x=z.clientX;const q=p.matrixTransform((Me=i==null?void 0:i.current.getScreenCTM())==null?void 0:Me.inverse()),{isChanged:X,changedTask:oe}=Tt(q.x,r.action,r.changedTask,S,s,L,w);X&&C({action:r.action,changedTask:oe})}),V=z=>R(this,null,function*(){var qe;const{action:q,originalSelectedTask:X,changedTask:oe}=r;if(!oe||!p||!(i!=null&&i.current)||!X)return;z.preventDefault(),p.x=z.clientX;const Me=p.matrixTransform((qe=i==null?void 0:i.current.getScreenCTM())==null?void 0:qe.inverse()),{changedTask:W}=Tt(Me.x,q,oe,S,s,L,w),U=X.start!==W.start||X.end!==W.end||X.progress!==W.progress;i.current.removeEventListener("mousemove",F),i.current.removeEventListener("mouseup",V),C({action:""}),Z(!1);let ce=!0;if((q==="move"||q==="end"||q==="start")&&f&&U)try{const ne=yield f(W,W.barChildren);ne!==void 0&&(ce=ne)}catch(ne){ce=!1}else if(v&&U)try{const ne=yield v(W,W.barChildren);ne!==void 0&&(ce=ne)}catch(ne){ce=!1}ce||k(X)});!ye&&(r.action==="move"||r.action==="end"||r.action==="start"||r.action==="progress")&&(i!=null&&i.current)&&(i.current.addEventListener("mousemove",F),i.current.addEventListener("mouseup",V),Z(!0))},[r,S,L,v,s,f,i,ye,p,w,k,C]);const $e=(F,V,z)=>R(this,null,function*(){var q;if(!z)F==="select"&&m(V.id);else if(Mr(z)){if(F==="delete"&&h)try{const X=yield h(V);X!==void 0&&X&&C({action:F,changedTask:V})}catch(X){console.error("Error on Delete. "+X)}}else if(F==="mouseenter")r.action||C({action:F,changedTask:V,originalSelectedTask:V});else if(F==="mouseleave")r.action==="mouseenter"&&setTimeout(()=>{C({action:""})},300);else if(F==="dblclick")N&&N(V);else if(F==="click")z.target.tagName==="rect"&&x&&x(V);else if(F==="move"){if(!(i!=null&&i.current)||!p)return;p.x=z.clientX;const X=p.matrixTransform((q=i.current.getScreenCTM())==null?void 0:q.inverse());Q(X.x-V.x1),C({action:F,changedTask:V,originalSelectedTask:V})}else C({action:F,changedTask:V,originalSelectedTask:V})}),st=(F,V,z)=>{["click"].includes(F)?(!["start","end","progress"].includes(at)&&(!Ae||Ae===V.start)&&$e(F,V,z),at=null,Ae=null):["move","select"].includes(F)?(Ae=V.start,$e(F,V,z)):(Ae=V.start,at=F,$e(F,V,z))};return c.jsxs("g",{className:"content",children:[c.jsx("g",{className:"arrows",fill:u,stroke:u,children:e.map(F=>F.barChildren.map(V=>c.jsx(Rr,{taskFrom:F,taskTo:e[V.index],rowHeight:n,taskHeight:l,arrowIndent:g,rtl:w},`Arrow from ${F.id} to ${e[V.index].id}`)))}),c.jsx("g",{className:"bar",fontFamily:y,fontSize:D,children:e.map(F=>c.jsx(fo,{task:F,arrowIndent:g,taskHeight:l,isProgressChangeable:!!v&&!F.isDisabled,isDateChangeable:!!f&&!F.isDisabled,isDelete:!F.isDisabled,onEventStart:st,isSelected:!!o&&F.id===o.id,rtl:w},F.id))})]})},Ot=b.forwardRef(({gridProps:e,calendarProps:t,barProps:r,ganttHeight:o,scrollY:n,scrollX:a},s)=>{const i=b.useRef(null),l=b.useRef(null),u=Se(H({},r),{svg:i}),{styles:g}=Ft();return b.useEffect(()=>{l.current&&(l.current.scrollTop=n)},[n]),b.useEffect(()=>{s.current&&(s.current.scrollLeft=a)},[a]),c.jsxs("div",{className:g.ganttverticalcontainer,ref:s,dir:"ltr",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.svgWidth,height:t.headerHeight,fontFamily:r.fontFamily,className:"ganttHeader",children:c.jsx(Qr,H({},t))}),c.jsx(Ve.Spin,{spinning:r==null?void 0:r.loading,children:c.jsx("div",{ref:l,className:g.horizontalcontainer,style:o?{maxHeight:o,width:e.svgWidth}:{width:e.svgWidth},children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.svgWidth,height:r.rowHeight*r.tasks.length||166,fontFamily:r.fontFamily,ref:i,className:"ganttBody",children:[c.jsx(Zr,H({},e)),c.jsx(ho,H({},u))]})})})]})});Ot.displayName="TaskGantt";const go=(e,t)=>t/e>50?Math.floor(t/e)+20:50,mo=ht.debounce((e,t,r,o,n)=>R(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.start]:e.start,[r.end]:e.end}}),Ve.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),bo=ht.debounce((e,t,r,o,n)=>R(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.progress]:e.progress/100}}),Ve.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),Ne=d.withDynamicSchemaProps(e=>{var Rt,er,tr;const{styles:t}=Ft(),{token:r}=d.useToken(),o=d.useAPIClient(),n=(Rt=JSON.parse(o.auth.getOption("theme")))==null?void 0:Rt.uid,{listCellWidth:a="155px",ganttHeight:s=0,preStepsCount:i=1,barFill:l=60,barCornerRadius:u=r.borderRadiusXS,barProgressColor:g=r.colorPrimary,barProgressSelectedColor:y=r.colorPrimary,barBackgroundColor:D=r.colorPrimary,barBackgroundSelectedColor:w=r.colorPrimary,projectProgressColor:C=r.colorPrimary,projectProgressSelectedColor:k=r.colorPrimary,projectBackgroundColor:m=r.colorPrimary,projectBackgroundSelectedColor:f=r.colorPrimary,milestoneBackgroundColor:v="#f1c453",milestoneBackgroundSelectedColor:N="#f29e4c",rtl:x=!1,handleWidth:h=8,timeStep:p=3e5,arrowColor:S="grey",fontFamily:P="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontSize:L=r.fontSize,arrowIndent:Q=20,todayColor:ye="rgba(252, 248, 227, 0.5)",viewDate:Z,TooltipContent:$e=Ar,onDoubleClick:st,onDelete:je,onSelect:F,onExpanderClick:V,tasks:z,expandAndCollapseAll:q,fieldNames:X,loading:oe}=d.useProps(e),{designable:Me}=d.useDesignable(),W=n!=null&&n.includes("compact")?45:Me?65:55,U=n!=null&&n.includes("compact")?45:65,ce=J(),qe=d.useCurrentAppInfo(),{t:ne}=Ce.useTranslation(),xo=(er=qe.data)==null?void 0:er.lang,it=d.useTableBlockContext(),{resource:Yt,service:Ie}=d.useBlockRequestContext(),lt=A.useFieldSchema(),ae=X.range||"day",ve=b.useRef(null),ct=b.useRef(null),jt=b.useRef(null),yo=b.useRef(null),[de,vo]=b.useState(()=>{const[T,G]=Mt(z,ae,i);return{viewMode:ae,dates:Dt(T,G,ae)}}),[So,qt]=b.useState(!1),{openPopup:Co}=d.usePopupUtils({setVisible:qt}),[wo,To]=b.useState({}),No=d.useCollectionParentRecordData(),[ke,Ut]=b.useState(void 0),[Ue,Wt]=b.useState(0),[Mo,Do]=b.useState(0),[Bo,Qt]=b.useState(s),[se,We]=b.useState([]),[Le,_t]=b.useState({action:""}),dt=b.useMemo(()=>U*l/100,[U,l]),[ut,Po]=b.useState(),[Qe,Kt]=b.useState(null),[ge,pt]=b.useState(0),[ue,Ge]=b.useState(-1),[Jt,De]=b.useState(!1),te=go(de.dates.length,(tr=jt.current)==null?void 0:tr.clientWidth),pe=de.dates.length*te,Be=se.length*U,{expandFlag:Zt}=it,[Fo,Ao]=b.useState([]);b.useEffect(()=>{it.field.onExpandClick=Go,it.field.onRowSelect=Vo},[]),b.useEffect(()=>{q==null||q(!Zt)},[Zt]),b.useEffect(()=>{let T;V?T=Dr(z):T=z,T=T.sort(Br);const[G,B]=Mt(T,ae,i);let $=Dt(G,B,ae);x&&($=$.reverse(),ue===-1&&Ge($.length*te)),vo({dates:$,viewMode:ae}),We(hr(T,$,te,U,dt,u,h,x,g,y,D,w,C,k,m,f,v,N))},[z,ae,i,U,u,te,dt,h,g,y,D,w,C,k,m,f,v,N,x,ue]),b.useEffect(()=>{if(ae===de.viewMode&&(Z&&!ke||Z&&(ke==null?void 0:ke.valueOf())!==Z.valueOf())){const T=de.dates,G=T.findIndex((B,$)=>Z.valueOf()>=B.valueOf()&&$+1!==T.length&&Z.valueOf()<T[$+1].valueOf());if(G===-1)return;Ut(Z),Ge(te*G)}},[Z,te,de.dates,de.viewMode,ae,ke,Ut]),b.useEffect(()=>{const{changedTask:T,action:G}=Le;if(T){if(G==="delete")_t({action:""}),We(se.filter(B=>B.id!==T.id));else if(G==="move"||G==="end"||G==="start"||G==="progress"){const B=se.find($=>$.id===T.id);if(B&&B.start&&B.end&&(B.start.getTime()!==T.start.getTime()||B.end.getTime()!==T.end.getTime()||B.progress!==T.progress)){const $=se.map(K=>K.id===T.id?T:K);We($)}}}},[Le,se]),b.useEffect(()=>{Qe&&(We(se.map(T=>T.id!==Qe.id?T:Qe)),Kt(null))},[Qe,se]),b.useEffect(()=>{a||Wt(0),ct.current&&Wt(ct.current.offsetWidth)},[ct,a]),b.useEffect(()=>{ve.current&&Do(ve.current.offsetWidth-Ue)},[ve,Ue]),b.useEffect(()=>{Qt(s?s+W:z.length*U+W)},[s,z,W,U]),b.useEffect(()=>{var G;const T=B=>{if(B.shiftKey||B.deltaX){const $=B.deltaX?B.deltaX:B.deltaY;let K=ue+$;K<0?K=0:K>pe&&(K=pe),Ge(K),B.preventDefault()}else if(s){let $=ge+B.deltaY;$<0?$=0:$>Be-s&&($=Be-s),$!==ge&&(pt($),B.preventDefault())}De(!0)};return(G=ve.current)==null||G.addEventListener("wheel",T,{passive:!1}),()=>{var B;(B=ve.current)==null||B.removeEventListener("wheel",T)}},[ve,ge,ue,s,pe,x,Be]);const $o=T=>{ge!==T.currentTarget.scrollTop&&!Jt?(pt(T.currentTarget.scrollTop),De(!0)):De(!1)},Io=T=>{ue!==T.currentTarget.scrollLeft&&!Jt?(Ge(T.currentTarget.scrollLeft),De(!0)):De(!1)},ko=T=>{T.preventDefault();let G=ge,B=ue,$=!0;switch(T.key){case"Down":case"ArrowDown":G+=U,$=!1;break;case"Up":case"ArrowUp":G-=U,$=!1;break;case"Left":case"ArrowLeft":B-=te;break;case"Right":case"ArrowRight":B+=te;break}$?(B<0?B=0:B>pe&&(B=pe),Ge(B)):(G<0?G=0:G>Be-s&&(G=Be-s),pt(G)),De(!0)},Lo=T=>{const G=se.find($=>$.id===T),B=se.find($=>!!ut&&$.id===ut.id);F&&(B&&F(B,!1),G&&F(G,!0)),Po(G)},Go=(T,G)=>{var $;const B=($=ce==null?void 0:ce.field)==null?void 0:$.data.find(K=>K.id===G.id+"");V&&G.children.length&&V(Se(H({},B),{hideChildren:!T}))},Vo=T=>{Ao(T)},Eo=T=>R(this,null,function*(){bo(T,Yt,X,Ie,ne)}),Ho=T=>R(this,null,function*(){mo(T,Yt,X,Ie,ne)}),Oo=T=>{var K;const G=ft=>ft.reduce((rr,_e)=>_e.children?rr.concat([_e,...G(_e.children)]):rr.concat(_e),[]),B=G((K=Ie==null?void 0:Ie.data)==null?void 0:K.data),$=B==null?void 0:B.find(ft=>ft.id===+T.id);$&&(To($),Co({recordData:$,customActionSchema:lt.properties.detail}))},zo={columnWidth:te,svgWidth:pe,tasks:z,rowHeight:U,dates:de.dates,todayColor:ye,rtl:x,selectedRowKeys:Fo},Xo={dateSetup:de,locale:xo,viewMode:ae,headerHeight:W,columnWidth:te,fontFamily:P,fontSize:L,rtl:x},Yo={tasks:se,dates:de.dates,ganttEvent:Le,selectedTask:ut,rowHeight:U,taskHeight:dt,columnWidth:te,arrowColor:S,timeStep:p,fontFamily:P,fontSize:L,arrowIndent:Q,svgWidth:pe,rtl:x,setGanttEvent:_t,setFailedTask:Kt,setSelectedTask:Lo,onDateChange:Ho,onProgressChange:X.progress&&Eo,onDoubleClick:st,onClick:Oo,onDelete:je,loading:oe};return c.jsx("div",{className:M.cx(M.css`
246
+ }`})),fo=e=>{const{styles:t}=po(),{task:r,arrowIndent:o,isDelete:n,taskHeight:a,isSelected:s,rtl:i,onEventStart:l}=H({},e),u=b.useRef(null),[g,y]=b.useState(c.jsx("div",{})),[D,w]=b.useState(!0),C=r.typeInternal==="project";b.useEffect(()=>{switch(r.typeInternal){case"milestone":y(c.jsx(io,H({},e)));break;case"project":y(c.jsx(uo,H({},e)));break;case"smalltask":y(c.jsx(no,H({},e)));break;default:y(c.jsx(oo,H({},e)));break}},[r,s]),b.useEffect(()=>{u.current&&w(u.current.getBBox().width<r.x2-r.x1)},[u,r]);const k=()=>{const m=r.x2-r.x1,f=r.barChildren.length>0;return D?r.x1+m*.5:i&&u.current?r.x1-u.current.getBBox().width-o*+f-o*.2:r.x1+m+o*+f+o*.2};return c.jsxs("g",{className:M.cx(t.nbganttTaskitem),onKeyDown:m=>{switch(m.key){case"Delete":{n&&l("delete",r,m);break}}m.stopPropagation()},onMouseEnter:m=>{l("mouseenter",r,m)},onMouseLeave:m=>{l("mouseleave",r,m)},onDoubleClick:m=>{l("dblclick",r,m)},onClick:m=>{l("click",r,m)},onFocus:()=>{l("select",r)},children:[g,c.jsx("text",{x:C?r.x1:k(),y:C?r.y-8:r.y+a*.65,className:C?M.cx("projectLabel"):D?M.cx("barLabel"):M.cx("barLabelOutside"),ref:u,children:C&&Te(r.start)&&Te(r.end)?`${r.name}: ${Te(r.start)} ~ ${Te(r.end)}`:r.name})]})};let at=null,Ae=null;const ho=({tasks:e,dates:t,ganttEvent:r,selectedTask:o,rowHeight:n,columnWidth:a,timeStep:s,svg:i,taskHeight:l,arrowColor:u,arrowIndent:g,fontFamily:y,fontSize:D,rtl:w,setGanttEvent:C,setFailedTask:k,setSelectedTask:m,onDateChange:f,onProgressChange:v,onDoubleClick:N,onClick:x,onDelete:h})=>{var je;const p=(je=i==null?void 0:i.current)==null?void 0:je.createSVGPoint(),[S,P]=b.useState(0),[G,Q]=b.useState(0),[ye,Z]=b.useState(!1);b.useEffect(()=>{var z,q,X,oe;const F=((z=t[1])==null?void 0:z.getTime())-((q=t[0])==null?void 0:q.getTime())-((X=t[1])==null?void 0:X.getTimezoneOffset())*60*1e3+((oe=t[0])==null?void 0:oe.getTimezoneOffset())*60*1e3,V=s*a/F;P(V)},[a,t,s]),b.useEffect(()=>{const F=z=>R(this,null,function*(){var Me;if(!r.changedTask||!p||!(i!=null&&i.current))return;z.preventDefault(),p.x=z.clientX;const q=p.matrixTransform((Me=i==null?void 0:i.current.getScreenCTM())==null?void 0:Me.inverse()),{isChanged:X,changedTask:oe}=Tt(q.x,r.action,r.changedTask,S,s,G,w);X&&C({action:r.action,changedTask:oe})}),V=z=>R(this,null,function*(){var qe;const{action:q,originalSelectedTask:X,changedTask:oe}=r;if(!oe||!p||!(i!=null&&i.current)||!X)return;z.preventDefault(),p.x=z.clientX;const Me=p.matrixTransform((qe=i==null?void 0:i.current.getScreenCTM())==null?void 0:qe.inverse()),{changedTask:W}=Tt(Me.x,q,oe,S,s,G,w),U=X.start!==W.start||X.end!==W.end||X.progress!==W.progress;i.current.removeEventListener("mousemove",F),i.current.removeEventListener("mouseup",V),C({action:""}),Z(!1);let ce=!0;if((q==="move"||q==="end"||q==="start")&&f&&U)try{const ne=yield f(W,W.barChildren);ne!==void 0&&(ce=ne)}catch(ne){ce=!1}else if(v&&U)try{const ne=yield v(W,W.barChildren);ne!==void 0&&(ce=ne)}catch(ne){ce=!1}ce||k(X)});!ye&&(r.action==="move"||r.action==="end"||r.action==="start"||r.action==="progress")&&(i!=null&&i.current)&&(i.current.addEventListener("mousemove",F),i.current.addEventListener("mouseup",V),Z(!0))},[r,S,G,v,s,f,i,ye,p,w,k,C]);const $e=(F,V,z)=>R(this,null,function*(){var q;if(!z)F==="select"&&m(V.id);else if(Mr(z)){if(F==="delete"&&h)try{const X=yield h(V);X!==void 0&&X&&C({action:F,changedTask:V})}catch(X){console.error("Error on Delete. "+X)}}else if(F==="mouseenter")r.action||C({action:F,changedTask:V,originalSelectedTask:V});else if(F==="mouseleave")r.action==="mouseenter"&&setTimeout(()=>{C({action:""})},300);else if(F==="dblclick")N&&N(V);else if(F==="click")z.target.tagName==="rect"&&x&&x(V);else if(F==="move"){if(!(i!=null&&i.current)||!p)return;p.x=z.clientX;const X=p.matrixTransform((q=i.current.getScreenCTM())==null?void 0:q.inverse());Q(X.x-V.x1),C({action:F,changedTask:V,originalSelectedTask:V})}else C({action:F,changedTask:V,originalSelectedTask:V})}),st=(F,V,z)=>{["click"].includes(F)?(!["start","end","progress"].includes(at)&&(!Ae||Ae===V.start)&&$e(F,V,z),at=null,Ae=null):["move","select"].includes(F)?(Ae=V.start,$e(F,V,z)):(Ae=V.start,at=F,$e(F,V,z))};return c.jsxs("g",{className:"content",children:[c.jsx("g",{className:"arrows",fill:u,stroke:u,children:e.map(F=>F.barChildren.map(V=>c.jsx(Rr,{taskFrom:F,taskTo:e[V.index],rowHeight:n,taskHeight:l,arrowIndent:g,rtl:w},`Arrow from ${F.id} to ${e[V.index].id}`)))}),c.jsx("g",{className:"bar",fontFamily:y,fontSize:D,children:e.map(F=>c.jsx(fo,{task:F,arrowIndent:g,taskHeight:l,isProgressChangeable:!!v&&!F.isDisabled,isDateChangeable:!!f&&!F.isDisabled,isDelete:!F.isDisabled,onEventStart:st,isSelected:!!o&&F.id===o.id,rtl:w},F.id))})]})},Ot=b.forwardRef(({gridProps:e,calendarProps:t,barProps:r,ganttHeight:o,scrollY:n,scrollX:a},s)=>{const i=b.useRef(null),l=b.useRef(null),u=Se(H({},r),{svg:i}),{styles:g}=Ft();return b.useEffect(()=>{l.current&&(l.current.scrollTop=n)},[n]),b.useEffect(()=>{s.current&&(s.current.scrollLeft=a)},[a]),c.jsxs("div",{className:g.ganttverticalcontainer,ref:s,dir:"ltr",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.svgWidth,height:t.headerHeight,fontFamily:r.fontFamily,className:"ganttHeader",children:c.jsx(Qr,H({},t))}),c.jsx(Ve.Spin,{spinning:r==null?void 0:r.loading,children:c.jsx("div",{ref:l,className:g.horizontalcontainer,style:o?{maxHeight:o,width:e.svgWidth}:{width:e.svgWidth},children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.svgWidth,height:r.rowHeight*r.tasks.length||166,fontFamily:r.fontFamily,ref:i,className:"ganttBody",children:[c.jsx(Zr,H({},e)),c.jsx(ho,H({},u))]})})})]})});Ot.displayName="TaskGantt";const go=(e,t)=>t/e>50?Math.floor(t/e)+20:50,mo=ht.debounce((e,t,r,o,n)=>R(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.start]:e.start,[r.end]:e.end}}),Ve.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),bo=ht.debounce((e,t,r,o,n)=>R(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.progress]:e.progress/100}}),Ve.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),Ne=d.withDynamicSchemaProps(e=>{var Rt,er,tr;const{styles:t}=Ft(),{token:r}=d.useToken(),o=d.useAPIClient(),n=(Rt=JSON.parse(o.auth.getOption("theme")))==null?void 0:Rt.uid,{listCellWidth:a="155px",ganttHeight:s=0,preStepsCount:i=1,barFill:l=60,barCornerRadius:u=r.borderRadiusXS,barProgressColor:g=r.colorPrimary,barProgressSelectedColor:y=r.colorPrimary,barBackgroundColor:D=r.colorPrimary,barBackgroundSelectedColor:w=r.colorPrimary,projectProgressColor:C=r.colorPrimary,projectProgressSelectedColor:k=r.colorPrimary,projectBackgroundColor:m=r.colorPrimary,projectBackgroundSelectedColor:f=r.colorPrimary,milestoneBackgroundColor:v="#f1c453",milestoneBackgroundSelectedColor:N="#f29e4c",rtl:x=!1,handleWidth:h=8,timeStep:p=3e5,arrowColor:S="grey",fontFamily:P="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontSize:G=r.fontSize,arrowIndent:Q=20,todayColor:ye="rgba(252, 248, 227, 0.5)",viewDate:Z,TooltipContent:$e=Ar,onDoubleClick:st,onDelete:je,onSelect:F,onExpanderClick:V,tasks:z,expandAndCollapseAll:q,fieldNames:X,loading:oe}=d.useProps(e),{designable:Me}=d.useDesignable(),W=n!=null&&n.includes("compact")?45:Me?65:55,U=n!=null&&n.includes("compact")?45:65,ce=J(),qe=d.useCurrentAppInfo(),{t:ne}=Ce.useTranslation(),xo=(er=qe.data)==null?void 0:er.lang,it=d.useTableBlockContext(),{resource:Yt,service:Ie}=d.useBlockRequestContext(),lt=A.useFieldSchema(),ae=X.range||"day",ve=b.useRef(null),ct=b.useRef(null),jt=b.useRef(null),yo=b.useRef(null),[de,vo]=b.useState(()=>{const[T,L]=Mt(z,ae,i);return{viewMode:ae,dates:Dt(T,L,ae)}}),[So,qt]=b.useState(!1),{openPopup:Co}=d.usePopupUtils({setVisible:qt}),[wo,To]=b.useState({}),No=d.useCollectionParentRecordData(),[ke,Ut]=b.useState(void 0),[Ue,Wt]=b.useState(0),[Mo,Do]=b.useState(0),[Bo,Qt]=b.useState(s),[se,We]=b.useState([]),[Ge,_t]=b.useState({action:""}),dt=b.useMemo(()=>U*l/100,[U,l]),[ut,Po]=b.useState(),[Qe,Kt]=b.useState(null),[ge,pt]=b.useState(0),[ue,Le]=b.useState(-1),[Jt,De]=b.useState(!1),te=go(de.dates.length,(tr=jt.current)==null?void 0:tr.clientWidth),pe=de.dates.length*te,Be=se.length*U,{expandFlag:Zt}=it,[Fo,Ao]=b.useState([]);b.useEffect(()=>{it.field.onExpandClick=Lo,it.field.onRowSelect=Vo},[]),b.useEffect(()=>{q==null||q(!Zt)},[Zt]),b.useEffect(()=>{let T;V?T=Dr(z):T=z,T=T.sort(Br);const[L,B]=Mt(T,ae,i);let $=Dt(L,B,ae);x&&($=$.reverse(),ue===-1&&Le($.length*te)),vo({dates:$,viewMode:ae}),We(hr(T,$,te,U,dt,u,h,x,g,y,D,w,C,k,m,f,v,N))},[z,ae,i,U,u,te,dt,h,g,y,D,w,C,k,m,f,v,N,x,ue]),b.useEffect(()=>{if(ae===de.viewMode&&(Z&&!ke||Z&&(ke==null?void 0:ke.valueOf())!==Z.valueOf())){const T=de.dates,L=T.findIndex((B,$)=>Z.valueOf()>=B.valueOf()&&$+1!==T.length&&Z.valueOf()<T[$+1].valueOf());if(L===-1)return;Ut(Z),Le(te*L)}},[Z,te,de.dates,de.viewMode,ae,ke,Ut]),b.useEffect(()=>{const{changedTask:T,action:L}=Ge;if(T){if(L==="delete")_t({action:""}),We(se.filter(B=>B.id!==T.id));else if(L==="move"||L==="end"||L==="start"||L==="progress"){const B=se.find($=>$.id===T.id);if(B&&B.start&&B.end&&(B.start.getTime()!==T.start.getTime()||B.end.getTime()!==T.end.getTime()||B.progress!==T.progress)){const $=se.map(K=>K.id===T.id?T:K);We($)}}}},[Ge,se]),b.useEffect(()=>{Qe&&(We(se.map(T=>T.id!==Qe.id?T:Qe)),Kt(null))},[Qe,se]),b.useEffect(()=>{a||Wt(0),ct.current&&Wt(ct.current.offsetWidth)},[ct,a]),b.useEffect(()=>{ve.current&&Do(ve.current.offsetWidth-Ue)},[ve,Ue]),b.useEffect(()=>{Qt(s?s+W:z.length*U+W)},[s,z,W,U]),b.useEffect(()=>{var L;const T=B=>{if(B.shiftKey||B.deltaX){const $=B.deltaX?B.deltaX:B.deltaY;let K=ue+$;K<0?K=0:K>pe&&(K=pe),Le(K),B.preventDefault()}else if(s){let $=ge+B.deltaY;$<0?$=0:$>Be-s&&($=Be-s),$!==ge&&(pt($),B.preventDefault())}De(!0)};return(L=ve.current)==null||L.addEventListener("wheel",T,{passive:!1}),()=>{var B;(B=ve.current)==null||B.removeEventListener("wheel",T)}},[ve,ge,ue,s,pe,x,Be]);const $o=T=>{ge!==T.currentTarget.scrollTop&&!Jt?(pt(T.currentTarget.scrollTop),De(!0)):De(!1)},Io=T=>{ue!==T.currentTarget.scrollLeft&&!Jt?(Le(T.currentTarget.scrollLeft),De(!0)):De(!1)},ko=T=>{T.preventDefault();let L=ge,B=ue,$=!0;switch(T.key){case"Down":case"ArrowDown":L+=U,$=!1;break;case"Up":case"ArrowUp":L-=U,$=!1;break;case"Left":case"ArrowLeft":B-=te;break;case"Right":case"ArrowRight":B+=te;break}$?(B<0?B=0:B>pe&&(B=pe),Le(B)):(L<0?L=0:L>Be-s&&(L=Be-s),pt(L)),De(!0)},Go=T=>{const L=se.find($=>$.id===T),B=se.find($=>!!ut&&$.id===ut.id);F&&(B&&F(B,!1),L&&F(L,!0)),Po(L)},Lo=(T,L)=>{var $;const B=($=ce==null?void 0:ce.field)==null?void 0:$.data.find(K=>K.id===L.id+"");V&&L.children.length&&V(Se(H({},B),{hideChildren:!T}))},Vo=T=>{Ao(T)},Eo=T=>R(this,null,function*(){bo(T,Yt,X,Ie,ne)}),Ho=T=>R(this,null,function*(){mo(T,Yt,X,Ie,ne)}),Oo=T=>{var K;const L=ft=>ft.reduce((rr,_e)=>_e.children?rr.concat([_e,...L(_e.children)]):rr.concat(_e),[]),B=L((K=Ie==null?void 0:Ie.data)==null?void 0:K.data),$=B==null?void 0:B.find(ft=>ft.id===+T.id);$&&(To($),Co({recordData:$,customActionSchema:lt.properties.detail}))},zo={columnWidth:te,svgWidth:pe,tasks:z,rowHeight:U,dates:de.dates,todayColor:ye,rtl:x,selectedRowKeys:Fo},Xo={dateSetup:de,locale:xo,viewMode:ae,headerHeight:W,columnWidth:te,fontFamily:P,fontSize:G,rtl:x},Yo={tasks:se,dates:de.dates,ganttEvent:Ge,selectedTask:ut,rowHeight:U,taskHeight:dt,columnWidth:te,arrowColor:S,timeStep:p,fontFamily:P,fontSize:G,arrowIndent:Q,svgWidth:pe,rtl:x,setGanttEvent:_t,setFailedTask:Kt,setSelectedTask:Go,onDateChange:Ho,onProgressChange:X.progress&&Eo,onDoubleClick:st,onClick:Oo,onDelete:je,loading:oe};return c.jsx("div",{className:M.cx(M.css`
247
247
  .ant-table-container::after {
248
248
  box-shadow: none !important;
249
249
  }
@@ -253,4 +253,4 @@
253
253
  .ant-table-thead {
254
254
  height: ${W}px;
255
255
  }
256
- `),ref:yo,children:c.jsxs(d.PopupContextProvider,{visible:So,setVisible:qt,children:[c.jsx(d.RecordProvider,{record:wo,parent:No,children:c.jsx(Ir,{})}),c.jsx(A.RecursionField,{name:"anctionBar",schema:lt.properties.toolBar}),c.jsx(A.RecursionField,{name:"table",schema:lt.properties.table}),c.jsxs("div",{className:t.wrapper,onKeyDown:ko,tabIndex:0,ref:ve,children:[c.jsx(Ot,{gridProps:zo,calendarProps:Xo,barProps:Yo,ganttHeight:s,scrollY:ge,scrollX:ue,ref:jt}),Le.changedTask&&c.jsx(Fr,{arrowIndent:Q,rowHeight:U,svgContainerHeight:Bo,svgContainerWidth:Mo,fontFamily:P,fontSize:L,scrollX:ue,scrollY:ge,task:Le.changedTask,headerHeight:W,taskListWidth:Ue,TooltipContent:$e,rtl:x,svgWidth:pe}),c.jsx($r,{ganttFullHeight:Be,ganttHeight:s,headerHeight:W,scroll:ge,onScroll:$o,rtl:x}),c.jsx(Ve.Spin,{spinning:oe,style:{visibility:"hidden"},children:c.jsx(Pr,{svgWidth:pe,taskListWidth:Ue,scroll:ue,rtl:x,onScroll:Io})})]})]})})});Ne.ActionBar=d.ActionBar,Ne.ViewMode=E,Ne.Designer=ar,Ne.Event=fr;const zt=b.memo(e=>c.jsx(d.SchemaComponentOptions,{components:{Gantt:Ne,GanttBlockInitializer:ur,GanttBlockProvider:ir},scope:{useGanttBlockProps:gt},children:e.children}));zt.displayName="GanttProvider";class Xt extends d.Plugin{load(){return R(this,null,function*(){this.app.use(zt),this.app.schemaSettingsManager.add(lr),this.app.schemaSettingsManager.add(cr),this.app.schemaInitializerManager.add(bt),this.app.schemaInitializerManager.add(dr);const t=this.app.schemaInitializerManager.get("page:addBlock");t==null||t.add("dataBlocks.gantt",{title:"{{t('Gantt')}}",Component:"GanttBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.gantt",{title:"{{t('Gantt')}}",Component:"GanttBlockInitializer",useComponentProps(){const{createAssociationGanttBlock:r}=pr(),{createGanttBlock:o}=yt();return{onlyCurrentDataSource:!0,filterCollections({associationField:n}){return n?["hasMany","belongsToMany"].includes(n.type):!1},createBlockSchema:({item:n,fromOthersInPopup:a})=>{if(a)return o({item:n});r({item:n})},showAssociationFields:!0,hideSearch:!0}}}),this.app.addScopes({useGanttBlockProps:gt})})}}I.Gantt=Ne,I.PluginGanttClient=Xt,I.default=Xt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
256
+ `),ref:yo,children:c.jsxs(d.PopupContextProvider,{visible:So,setVisible:qt,children:[c.jsx(d.RecordProvider,{record:wo,parent:No,children:c.jsx(Ir,{})}),c.jsx(A.RecursionField,{name:"anctionBar",schema:lt.properties.toolBar}),c.jsx(A.RecursionField,{name:"table",schema:lt.properties.table}),c.jsxs("div",{className:t.wrapper,onKeyDown:ko,tabIndex:0,ref:ve,children:[c.jsx(Ot,{gridProps:zo,calendarProps:Xo,barProps:Yo,ganttHeight:s,scrollY:ge,scrollX:ue,ref:jt}),Ge.changedTask&&c.jsx(Fr,{arrowIndent:Q,rowHeight:U,svgContainerHeight:Bo,svgContainerWidth:Mo,fontFamily:P,fontSize:G,scrollX:ue,scrollY:ge,task:Ge.changedTask,headerHeight:W,taskListWidth:Ue,TooltipContent:$e,rtl:x,svgWidth:pe}),c.jsx($r,{ganttFullHeight:Be,ganttHeight:s,headerHeight:W,scroll:ge,onScroll:$o,rtl:x}),c.jsx(Ve.Spin,{spinning:oe,style:{visibility:"hidden"},children:c.jsx(Pr,{svgWidth:pe,taskListWidth:Ue,scroll:ue,rtl:x,onScroll:Io})})]})]})})});Ne.ActionBar=d.ActionBar,Ne.ViewMode=E,Ne.Designer=ar,Ne.Event=fr;const zt=b.memo(e=>c.jsx(d.SchemaComponentOptions,{components:{Gantt:Ne,GanttBlockInitializer:ur,GanttBlockProvider:ir},scope:{useGanttBlockProps:gt},children:e.children}));zt.displayName="GanttProvider";class Xt extends d.Plugin{load(){return R(this,null,function*(){this.app.use(zt),this.app.schemaSettingsManager.add(lr),this.app.schemaSettingsManager.add(cr),this.app.schemaInitializerManager.add(bt),this.app.schemaInitializerManager.add(dr);const t=this.app.schemaInitializerManager.get("page:addBlock");t==null||t.add("dataBlocks.gantt",{title:"{{t('Gantt')}}",Component:"GanttBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.gantt",{title:"{{t('Gantt')}}",Component:"GanttBlockInitializer",useComponentProps(){const{createAssociationGanttBlock:r}=pr(),{createGanttBlock:o}=yt();return{onlyCurrentDataSource:!0,filterCollections({associationField:n}){return n?["hasMany","belongsToMany"].includes(n.type):!1},createBlockSchema:({item:n,fromOthersInPopup:a})=>{if(a)return o({item:n});r({item:n})},showAssociationFields:!0,hideSearch:!0}}}),this.app.addScopes({useGanttBlockProps:gt})})}}I.Gantt=Ne,I.PluginGanttClient=Xt,I.default=Xt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.3.50-beta",
11
+ "@nocobase/client": "1.3.52",
12
12
  "react": "18.2.0",
13
13
  "@formily/react": "2.3.0",
14
14
  "@ant-design/icons": "5.2.6",
@@ -16,10 +16,10 @@ module.exports = {
16
16
  "react-i18next": "11.18.6",
17
17
  "lodash": "4.17.21",
18
18
  "@formily/shared": "2.3.2",
19
- "@nocobase/server": "1.3.50-beta",
20
- "@nocobase/test": "1.3.50-beta",
19
+ "@nocobase/server": "1.3.52",
20
+ "@nocobase/test": "1.3.52",
21
21
  "@emotion/css": "11.13.0",
22
22
  "antd-style": "3.7.1",
23
- "@nocobase/utils": "1.3.50-beta",
23
+ "@nocobase/utils": "1.3.52",
24
24
  "antd": "5.12.8"
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-gantt",
3
- "version": "1.3.50-beta",
3
+ "version": "1.3.52",
4
4
  "displayName": "Block: Gantt",
5
5
  "displayName.zh-CN": "区块:甘特图",
6
6
  "description": "Provides Gantt block.",
@@ -17,7 +17,7 @@
17
17
  "@nocobase/server": "1.x",
18
18
  "@nocobase/test": "1.x"
19
19
  },
20
- "gitHead": "ae3ceb799109d3a088d13f999e52b02af6df2457",
20
+ "gitHead": "90afbd90f915cf5df0ee6766ddbdf7803b3ab7ea",
21
21
  "keywords": [
22
22
  "Blocks"
23
23
  ]