@nocobase/plugin-gantt 0.21.0-alpha.9 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +23 -20
- package/dist/externalVersion.js +4 -4
- package/package.json +5 -5
package/dist/client/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(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,g,P,Ce,Qe,Fe,ae,N,pt,ft,ze,Ke){"use strict";var Ho=Object.defineProperty,zo=Object.defineProperties;var Go=Object.getOwnPropertyDescriptors;var er=Object.getOwnPropertySymbols;var Oo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var tr=(I,c,d)=>c in I?Ho(I,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[c]=d,G=(I,c)=>{for(var d in c||(c={}))Oo.call(c,d)&&tr(I,d,c[d]);if(er)for(var d of er(c))Xo.call(c,d)&&tr(I,d,c[d]);return I},be=(I,c)=>zo(I,Go(c));var ne=(I,c,d)=>new Promise((g,P)=>{var Ce=ae=>{try{Fe(d.next(ae))}catch(N){P(N)}},Qe=ae=>{try{Fe(d.throw(ae))}catch(N){P(N)}},Fe=ae=>ae.done?g(ae.value):Promise.resolve(ae.value).then(Ce,Qe);Fe((d=d.apply(I,c)).next())});const rr=()=>{const{name:e,title:t}=d.useCollection_deprecated(),r=d.useSchemaTemplate();return c.jsx(d.GeneralSchemaDesigner,{schemaSettings:"blockSettings:gantt",template:r,title:t||e})},Je=g.createContext({});Je.displayName="GanttBlockContext";const Ze=(e=[],t,r=[],o=void 0,n=!1,a,i)=>(e.forEach(s=>{var h,v;const l=a(s),u=parseFloat((s[t.progress]*100).toFixed(2));s.children&&s.children.length?(r.push({start:new Date((h=s[t.start])!=null?h:void 0),end:new Date((v=s[t.end])!=null?v:void 0),name:s[t.title],id:s[i]+"",type:"project",progress:u>100?100:u||0,hideChildren:n,project:o,color:s.color,isDisabled:l}),Ze(s.children,t,r,s.id+"",n,a,i)):r.push({start:s[t.start]?new Date(s[t.start]):void 0,end:new Date(s[t.end]||s[t.start]),name:s[t.title],id:s[i]+"",type:t.end?"task":"milestone",progress:u>100?100:u||0,project:o,color:s.color,isDisabled:l})}),r),or=e=>{const{fieldNames:t,timeRange:r,resource:o}=e,n=P.useField(),{service:a}=d.useBlockRequestContext();return c.jsx(Je.Provider,{value:{field:n,service:a,resource:o,fieldNames:t,timeRange:r},children:e.children})},nr=e=>{const t={filter:e.params.filter,paginate:!1,sort:e.fieldNames.start},r=d.useCollection_deprecated();return r!=null&&r.tree&&(t.tree=!0),c.jsx("div",{"aria-label":"block-item-gantt",role:"button",children:c.jsx(d.BlockProvider,be(G({name:"gantt"},e),{params:t,children:c.jsx(d.TableBlockProvider,be(G({},e),{params:t,children:c.jsx(or,G({},e))}))}))})},K=()=>g.useContext(Je),ht=()=>{var C;const e=K(),[t,r]=g.useState([]),{getPrimaryKey:o,name:n,template:a,writableView:i}=d.useCollection_deprecated(),{parseAction:s}=d.useACLRoleContext(),l=d.useTableBlockContext(),u=o(),h=x=>{const F=`${n}:update`,p={},y=x==null?void 0:x[u],S=s(F,{schema:p,recordPkValue:y});return a==="view"&&!i||!S},v=x=>{const p=e.field.data.map(y=>y.id===x.id?x:y);r(p),e.field.data=p},V=x=>{var p;const F=Ze((p=e.service.data)==null?void 0:p.data,e.fieldNames,[],void 0,x,h,u);r(F),e.field.data=F};return g.useEffect(()=>{var x,F;if(!((x=e==null?void 0:e.service)!=null&&x.loading)){const p=Ze((F=e.service.data)==null?void 0:F.data,e.fieldNames,[],void 0,!1,h,u);r(p),e.field.data=p,t.length>0&&l.setExpandFlag(!0)}},[(C=e==null?void 0:e.service)==null?void 0:C.loading]),console.log(t),{fieldNames:e.fieldNames,timeRange:e.timeRange,onExpanderClick:v,expandAndCollapseAll:V,tasks:t}},ee=()=>Ce.useTranslation("gantt"),pe=(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 i;return{value:a.name,label:t((i=a==null?void 0:a.uiSchema)==null?void 0:i.title)}})},ar=new d.SchemaSettings({name:"GanttBlockSettings",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),n=P.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:pe("string"),onChange:s=>{const l=n.decoratorProps.fieldNames||{};l.title=s,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 s;const{t:e}=ee(),t=P.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=P.useField(),{service:n}=K(),{dn:a}=d.useDesignable(),i=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:i('{{t("Hour")}}'),value:"hour",color:"orange"},{label:i('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:i('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:i('{{t("Day")}}'),value:"day",color:"yellow"},{label:i('{{t("Week")}}'),value:"week",color:"pule"},{label:i('{{t("Month")}}'),value:"month",color:"green"},{label:i('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:i('{{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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=P.useField(),{dn:n}=d.useDesignable(),{service:a}=K();return{title:e("Start date field"),value:r.start,options:pe("date"),onChange:s=>{const l=o.decoratorProps.fieldNames||{};l.start=s,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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=P.useField(),{service:o}=K(),{dn:n}=d.useDesignable(),a=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{};return{title:e("End date field"),value:a.end,options:pe("date"),onChange:s=>{const l=r.decoratorProps.fieldNames||{};l.end=s,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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),{dn:n}=d.useDesignable(),a=P.useField();return{title:e("Progress field"),value:r.progress,options:pe("float"),onChange:s=>{const l=a.decoratorProps.fieldNames||{};l.progress=s,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,i;const{name:e}=d.useCollection_deprecated(),t=P.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=P.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((i=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:i.filter)||{},form:r,onSubmit:({filter:s})=>{s=d.removeNullCondition(s);const l=o.decoratorProps.params||{};l.filter=s,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();return{componentName:"Gantt",collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),sr=new d.SchemaSettings({name:"blockSettings:gantt",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),n=P.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:pe("string"),onChange:s=>{const l=n.decoratorProps.fieldNames||{};l.title=s,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 s;const{t:e}=ee(),t=P.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=P.useField(),{service:n}=K(),{dn:a}=d.useDesignable(),i=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:i('{{t("Hour")}}'),value:"hour",color:"orange"},{label:i('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:i('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:i('{{t("Day")}}'),value:"day",color:"yellow"},{label:i('{{t("Week")}}'),value:"week",color:"pule"},{label:i('{{t("Month")}}'),value:"month",color:"green"},{label:i('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:i('{{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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=P.useField(),{dn:n}=d.useDesignable(),{service:a}=K();return{title:e("Start date field"),value:r.start,options:pe("date"),onChange:s=>{const l=o.decoratorProps.fieldNames||{};l.start=s,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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=P.useField(),{service:o}=K(),{dn:n}=d.useDesignable(),a=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{};return{title:e("End date field"),value:a.end,options:pe("date"),onChange:s=>{const l=r.decoratorProps.fieldNames||{};l.end=s,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 i;const{t:e}=ee(),t=P.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),{dn:n}=d.useDesignable(),a=P.useField();return{title:e("Progress field"),value:r.progress,options:pe("float"),onChange:s=>{const l=a.decoratorProps.fieldNames||{};l.progress=s,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,i;const{name:e}=d.useCollection(),t=P.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=P.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((i=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:i.filter)||{},form:r,onSubmit:({filter:s})=>{s=d.removeNullCondition(s);const l=o.decoratorProps.params||{};l.filter=s,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();return{componentName:"Gantt",collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),gt=new d.CompatibleSchemaInitializer({name:"GanttActionInitializers",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{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(){const e=d.useCollection_deprecated();return!["view","file","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{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=P.useFieldSchema(),t=d.useCollection_deprecated(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},{name:"divider",type:"divider",useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{type:"item",title:'{{t("Add record")}}',name:"addRecord",Component:"CustomizeAddRecordActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"create","x-acl-action-props":{skipScopeCheck:!0}}}],useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}}]}),ir=new d.CompatibleSchemaInitializer({name:"gantt:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{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(){const e=d.useCollection_deprecated();return!["view","file","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{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=P.useFieldSchema(),t=d.useCollection_deprecated(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},{name:"divider",type:"divider",useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{type:"item",title:'{{t("Add record")}}',name:"addRecord",Component:"CustomizeAddRecordActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"create","x-acl-action-props":{skipScopeCheck:!0}}}],useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}}]},gt),lr=e=>{const{collectionName:t,fieldNames:r,dataSource:o}=e;return{type:"void","x-acl-action":`${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:{[ae.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-designer":"TableV2.ActionColumnDesigner","x-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"}}}}}}}}}}}}}},cr=()=>{const{insert:e}=d.useSchemaInitializer(),{t}=Ce.useTranslation(),{getCollectionFields:r}=d.useCollectionManager_deprecated(),o=g.useContext(P.SchemaOptionsContext),{theme:n}=d.useGlobalTheme(),a=d.useSchemaInitializerItem();return c.jsx(d.DataBlockInitializer,be(G({},a),{componentType:"Gantt",icon:c.jsx(Qe.FormOutlined,{}),onCreateBlockSchema:s=>ne(this,[s],function*({item:i}){var C,x,F;const l=r(i.name,i.dataSource),u=(C=l==null?void 0:l.filter(p=>p.type==="string"))==null?void 0:C.map(p=>{var y;return{label:(y=p==null?void 0:p.uiSchema)==null?void 0:y.title,value:p.name}}),h=(x=l==null?void 0:l.filter(p=>p.type==="date"))==null?void 0:x.map(p=>{var y;return{label:(y=p==null?void 0:p.uiSchema)==null?void 0:y.title,value:p.name}}),v=(F=l==null?void 0:l.filter(p=>p.type==="float"))==null?void 0:F.map(p=>{var y;return{label:(y=p==null?void 0:p.uiSchema)==null?void 0:y.title,value:p.name}}),V=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:o.scope,components:G({},o.components),children:c.jsx(Fe.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:h,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:h,required:!0,"x-component":"Select","x-decorator":"FormItem"},progress:{title:t("Progress field"),enum:v,"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(lr({collectionName:i.name,dataSource:i.dataSource,fieldNames:G({},V)}))})}))},dr=P.observer(e=>c.jsx(c.Fragment,{children:e.children}),{displayName:"Event"}),ur=(e,t,r,o,n,a,i,s,l,u,h,v,V,C,x,F,p,y)=>{let S=e.map((T,M)=>pr(T,M,t,r,o,n,a,i,s,l,u,h,v,V,C,x,F,p,y));return S=S.map(T=>{const M=T.dependencies||[];for(let m=0;m<M.length;m++){const f=S.findIndex(b=>b.id===M[m]);f!==-1&&S[f].barChildren.push(T)}return T}),S},pr=(e,t,r,o,n,a,i,s,l,u,h,v,V,C,x,F,p,y,S)=>{let T;switch(e.type){case"milestone":T=fr(e,t,r,o,n,a,i,s,y,S);break;case"project":T=mt(e,t,r,o,n,a*.5,i,s,l,C,x,F,p);break;default:T=mt(e,t,r,o,n,a,i,s,l,u,h,v,V);break}return T},mt=(e,t,r,o,n,a,i,s,l,u,h,v,V)=>{let C,x;l?(x=bt(e.start,r,o),C=bt(e.end,r,o)):(C=Ge(e.start,r,o),x=Ge(e.end,r,o));let F=e.type;F==="task"&&x-C<s*2&&(F="smalltask",x=C>0?C+s*2:C);const[p,y]=Ae(C,x,e.progress,l),S=e.type==="project"?Re(t,n,a)+8:Re(t,n,a),T=e.type==="project"?e.hideChildren:void 0,M=G({backgroundColor:v,backgroundSelectedColor:V,progressColor:u,progressSelectedColor:h},e.styles);return be(G({},e),{typeInternal:F,x1:C,x2:x,y:S,index:t,progressX:y,progressWidth:p,barCornerRadius:i,handleWidth:s,hideChildren:T,height:a,barChildren:[],styles:M})},fr=(e,t,r,o,n,a,i,s,l,u)=>{const h=Ge(e.start,r,o),v=Re(t,n,a),V=h-a*.5,C=h+a*.5,x=a/1.414,F=G({backgroundColor:l,backgroundSelectedColor:u,progressColor:"",progressSelectedColor:""},e.styles);return be(G({},e),{end:e.start,x1:V,x2:C,y:v,index:t,progressX:0,progressWidth:0,barCornerRadius:i,handleWidth:s,typeInternal:e.type,progress:0,height:x,hideChildren:void 0,barChildren:[],styles:F})},Ge=(e,t,r)=>{var s,l,u;const o=t.findIndex(h=>(h==null?void 0:h.getTime())>=(e==null?void 0:e.getTime()))-1,a=((e==null?void 0:e.getTime())-((s=t[o])==null?void 0:s.getTime()))/(((l=t[o+1])==null?void 0:l.getTime())-((u=t[o])==null?void 0:u.getTime())),i=o*r+a*r;return isNaN(i)?0:i},bt=(e,t,r)=>{let o=Ge(e,t,r);return o+=r,isNaN(o)?0:o},Re=(e,t,r)=>{const o=e*t+(t-r)/2;return isNaN(o)?0:o},Ae=(e,t,r,o)=>{const n=(t-e)*r*.01;let a;return o?a=t-n:a=e,[n,a]},hr=(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)}},gr=(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)}},xt=(e,t,r)=>[e-5,t+r,e+5,t+r,e,t+r-8.66].join(","),mr=(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},br=(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},yt=(e,t,r)=>{const n=Math.round((e-r.x1)/t)*t,a=r.x1+n,i=a+r.x2-r.x1;return[a,i]},xe=(e,t,r,o,n)=>{var i,s;let a=new Date((e-t)/o*n+((i=r==null?void 0:r.getTime)==null?void 0:i.call(r)));return a=new Date(((s=a==null?void 0:a.getTime)==null?void 0:s.call(a))+((a==null?void 0:a.getTimezoneOffset())-(r==null?void 0:r.getTimezoneOffset()))*6e4),a},vt=(e,t,r,o,n,a,i)=>{let s;switch(r.type){case"milestone":s=yr(e,t,r,o,n,a);break;default:s=xr(e,t,r,o,n,a,i);break}return s},xr=(e,t,r,o,n,a,i)=>{const s=G({},r);let l=!1;switch(t){case"progress":if(i?s.progress=gr(e,r):s.progress=hr(e,r),l=s.progress!==r.progress,l){const[u,h]=Ae(s.x1,s.x2,s.progress,i);s.progressWidth=u,s.progressX=h}break;case"start":{const u=mr(e,o,r);if(s.x1=u,l=s.x1!==r.x1,l){i?s.end=xe(u,r.x1,r.end,o,n):s.start=xe(u,r.x1,r.start,o,n);const[h,v]=Ae(s.x1,s.x2,s.progress,i);s.progressWidth=h,s.progressX=v}break}case"end":{const u=br(e,o,r);if(s.x2=u,l=s.x2!==r.x2,l){i?s.start=xe(u,r.x2,r.start,o,n):s.end=xe(u,r.x2,r.end,o,n);const[h,v]=Ae(s.x1,s.x2,s.progress,i);s.progressWidth=h,s.progressX=v}break}case"move":{const[u,h]=yt(e-a,o,r);if(l=u!==r.x1,l){s.start=xe(u,r.x1,r.start,o,n),s.end=xe(h,r.x2,r.end,o,n),s.x1=u,s.x2=h;const[v,V]=Ae(s.x1,s.x2,s.progress,i);s.progressWidth=v,s.progressX=V}break}}return{isChanged:l,changedTask:s}},yr=(e,t,r,o,n,a)=>{const i=G({},r);let s=!1;switch(t){case"move":{const[l,u]=yt(e-a,o,r);s=l!==r.x1,s&&(i.start=xe(l,r.x1,r.start,o,n),i.end=i.start,i.x1=l,i.x2=u);break}}return{isChanged:s,changedTask:i}};var H=(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))(H||{});const St={},Oe=(e,t={})=>{const r=JSON.stringify([e,t]);let o=St[r];return o||(o=new Intl.DateTimeFormat(e,t),St[r]=o),o},z=(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 i=r.indexOf(t);return r.indexOf(a)<=i};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())},wt=(e,t,r)=>{var a,i;let o=((a=e[0])==null?void 0:a.start)||new Date,n=((i=e[0])==null?void 0:i.start)||new Date;for(const s of e)s.start<o&&(o=s.start),s.end>n&&(n=s.end);switch(t){case H.Year:o=z(o,-1,"year"),o=j(o,"year"),n=z(n,1,"year"),n=j(n,"year");break;case H.QuarterYear:o=z(o,-3,"month"),o=j(o,"month"),n=z(n,3,"year"),n=j(n,"year");break;case H.Month:o=z(o,-1*r,"month"),o=j(o,"month"),n=z(n,1,"year"),n=j(n,"year");break;case H.Week:o=j(o,"day"),o=z(vr(o),-7*r,"day"),n=j(n,"day"),n=z(n,1.5,"month");break;case H.Day:o=j(o,"day"),o=z(o,-1*r,"day"),n=j(n,"day"),n=z(n,19,"day");break;case H.QuarterDay:o=j(o,"day"),o=z(o,-1*r,"day"),n=j(n,"day"),n=z(n,66,"hour");break;case H.HalfDay:o=j(o,"day"),o=z(o,-1*r,"day"),n=j(n,"day"),n=z(n,108,"hour");break;case H.Hour:o=j(o,"hour"),o=z(o,-1*r,"hour"),n=j(n,"day"),n=z(n,1,"day");break}return[o,n]},Ct=(e,t,r)=>{let o=new Date(e);const n=[o];for(;o<t;){switch(r){case H.Year:o=z(o,1,"year");break;case H.QuarterYear:o=z(o,3,"month");break;case H.Month:o=z(o,1,"month");break;case H.Week:o=z(o,7,"day");break;case H.Day:o=z(o,1,"day");break;case H.HalfDay:o=z(o,12,"hour");break;case H.QuarterDay:o=z(o,6,"hour");break;case H.Hour:o=z(o,1,"hour");break}n.push(o)}return n},$e=(e,t)=>{let r=Oe(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase()),r},Tt=(e,t,r)=>{let o=Oe(t,{weekday:r}).format(e);return o=o.replace(o[0],o[0].toLocaleUpperCase()),o},vr=e=>{const t=e.getDay(),r=e.getDate()-t+(t===0?-6:1);return new Date(e.setDate(r))},Sr=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},wr=(e,t)=>new Date(t,e+1,0).getDate();function Cr(e){return e.key!==void 0}function Tr(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=Nt(e,o);e=e.filter(a=>n.indexOf(a)===-1)}return e}function Nt(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(...Nt(e,n))}),r=r.concat(r,o),r}const Nr=(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()},Xe=ze.createStyles(({token:e,css:t})=>({scrollWrapper:t`
|
|
1
|
+
(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,g,F,we,Qe,Pe,ae,M,pt,ft,ze,Ke){"use strict";var zo=Object.defineProperty,Ho=Object.defineProperties;var Go=Object.getOwnPropertyDescriptors;var er=Object.getOwnPropertySymbols;var Oo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var tr=(I,c,d)=>c in I?zo(I,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[c]=d,O=(I,c)=>{for(var d in c||(c={}))Oo.call(c,d)&&tr(I,d,c[d]);if(er)for(var d of er(c))Xo.call(c,d)&&tr(I,d,c[d]);return I},ge=(I,c)=>Ho(I,Go(c));var ne=(I,c,d)=>new Promise((g,F)=>{var we=ae=>{try{Pe(d.next(ae))}catch(M){F(M)}},Qe=ae=>{try{Pe(d.throw(ae))}catch(M){F(M)}},Pe=ae=>ae.done?g(ae.value):Promise.resolve(ae.value).then(we,Qe);Pe((d=d.apply(I,c)).next())});const rr=()=>{const{name:e,title:t}=d.useCollection_deprecated(),r=d.useSchemaTemplate();return c.jsx(d.GeneralSchemaDesigner,{schemaSettings:"blockSettings:gantt",template:r,title:t||e})},Je=g.createContext({});Je.displayName="GanttBlockContext";const Ze=(e=[],t,r=[],o=void 0,n=!1,a,i)=>(e.forEach(s=>{var h,y;const l=a(s),u=parseFloat((s[t.progress]*100).toFixed(2));s.children&&s.children.length?(r.push({start:new Date((h=s[t.start])!=null?h:void 0),end:new Date((y=s[t.end])!=null?y:void 0),name:s[t.title],id:s[i]+"",type:"project",progress:u>100?100:u||0,hideChildren:n,project:o,color:s.color,isDisabled:l}),Ze(s.children,t,r,s.id+"",n,a,i)):r.push({start:s[t.start]?new Date(s[t.start]):void 0,end:new Date(s[t.end]||s[t.start]),name:s[t.title],id:s[i]+"",type:t.end?"task":"milestone",progress:u>100?100:u||0,project:o,color:s.color,isDisabled:l})}),r),or=e=>{const{fieldNames:t,timeRange:r,resource:o}=e,n=F.useField(),{service:a}=d.useBlockRequestContext();return c.jsx(Je.Provider,{value:{field:n,service:a,resource:o,fieldNames:t,timeRange:r},children:e.children})},nr=e=>{const t={filter:e.params.filter,paginate:!1,sort:["id"]},r=d.useCollection_deprecated();return r!=null&&r.tree&&(t.tree=!0),c.jsx("div",{"aria-label":"block-item-gantt",role:"button",children:c.jsx(d.BlockProvider,ge(O({name:"gantt"},e),{params:t,children:c.jsx(d.TableBlockProvider,ge(O({},e),{params:t,children:c.jsx(or,O({},e))}))}))})},K=()=>g.useContext(Je),ht=()=>{var T;const e=K(),[t,r]=g.useState([]),{getPrimaryKey:o,name:n,template:a,writableView:i}=d.useCollection_deprecated(),{parseAction:s}=d.useACLRoleContext(),l=d.useTableBlockContext(),u=o(),h=b=>{const A=`${n}:update`,p={},x=b==null?void 0:b[u],S=s(A,{schema:p,recordPkValue:x});return a==="view"&&!i||!S},y=b=>{const p=e.field.data.map(x=>x.id===b.id?b:x);r(p),e.field.data=p},V=b=>{var p;const A=Ze((p=e.service.data)==null?void 0:p.data,e.fieldNames,[],void 0,b,h,u);r(A),e.field.data=A};return g.useEffect(()=>{var b,A;if(!((b=e==null?void 0:e.service)!=null&&b.loading)){const p=Ze((A=e.service.data)==null?void 0:A.data,e.fieldNames,[],void 0,!1,h,u);r(p),e.field.data=p,t.length>0&&l.setExpandFlag(!0)}},[(T=e==null?void 0:e.service)==null?void 0:T.loading]),{fieldNames:e.fieldNames,timeRange:e.timeRange,onExpanderClick:y,expandAndCollapseAll:V,tasks:t}},te=()=>we.useTranslation("gantt"),pe=(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 i;return{value:a.name,label:t((i=a==null?void 0:a.uiSchema)==null?void 0:i.title)}})},ar=new d.SchemaSettings({name:"GanttBlockSettings",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),n=F.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:pe("string"),onChange:s=>{const l=n.decoratorProps.fieldNames||{};l.title=s,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 s;const{t:e}=te(),t=F.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=F.useField(),{service:n}=K(),{dn:a}=d.useDesignable(),i=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:i('{{t("Hour")}}'),value:"hour",color:"orange"},{label:i('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:i('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:i('{{t("Day")}}'),value:"day",color:"yellow"},{label:i('{{t("Week")}}'),value:"week",color:"pule"},{label:i('{{t("Month")}}'),value:"month",color:"green"},{label:i('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:i('{{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 i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=F.useField(),{dn:n}=d.useDesignable(),{service:a}=K();return{title:e("Start date field"),value:r.start,options:pe("date"),onChange:s=>{const l=o.decoratorProps.fieldNames||{};l.start=s,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 i;const{t:e}=te(),t=F.useFieldSchema(),r=F.useField(),{service:o}=K(),{dn:n}=d.useDesignable(),a=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{};return{title:e("End date field"),value:a.end,options:pe("date"),onChange:s=>{const l=r.decoratorProps.fieldNames||{};l.end=s,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 i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),{dn:n}=d.useDesignable(),a=F.useField();return{title:e("Progress field"),value:r.progress,options:pe("float"),onChange:s=>{const l=a.decoratorProps.fieldNames||{};l.progress=s,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,i;const{name:e}=d.useCollection_deprecated(),t=F.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=F.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((i=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:i.filter)||{},form:r,onSubmit:({filter:s})=>{s=d.removeNullCondition(s);const l=o.decoratorProps.params||{};l.filter=s,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();return{componentName:"Gantt",collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),sr=new d.SchemaSettings({name:"blockSettings:gantt",items:[{name:"title",Component:d.SchemaSettingsBlockTitleItem},{name:"titleField",Component:d.SchemaSettingsSelectItem,useComponentProps(){var i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),n=F.useField(),{dn:a}=d.useDesignable();return{title:e("Title field"),value:r.title,options:pe("string"),onChange:s=>{const l=n.decoratorProps.fieldNames||{};l.title=s,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 s;const{t:e}=te(),t=F.useFieldSchema(),r=((s=t==null?void 0:t["x-decorator-props"])==null?void 0:s.fieldNames)||{},o=F.useField(),{service:n}=K(),{dn:a}=d.useDesignable(),i=d.useCompile();return{title:e("Time scale"),value:r.range||"day",options:[{label:i('{{t("Hour")}}'),value:"hour",color:"orange"},{label:i('{{t("Quarter of day")}}'),value:"quarterDay",color:"default"},{label:i('{{t("Half of day")}}'),value:"halfDay",color:"blue"},{label:i('{{t("Day")}}'),value:"day",color:"yellow"},{label:i('{{t("Week")}}'),value:"week",color:"pule"},{label:i('{{t("Month")}}'),value:"month",color:"green"},{label:i('{{t("QuarterYear")}}'),value:"quarterYear",color:"red"},{label:i('{{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 i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},o=F.useField(),{dn:n}=d.useDesignable(),{service:a}=K();return{title:e("Start date field"),value:r.start,options:pe("date"),onChange:s=>{const l=o.decoratorProps.fieldNames||{};l.start=s,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 i;const{t:e}=te(),t=F.useFieldSchema(),r=F.useField(),{service:o}=K(),{dn:n}=d.useDesignable(),a=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{};return{title:e("End date field"),value:a.end,options:pe("date"),onChange:s=>{const l=r.decoratorProps.fieldNames||{};l.end=s,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 i;const{t:e}=te(),t=F.useFieldSchema(),r=((i=t==null?void 0:t["x-decorator-props"])==null?void 0:i.fieldNames)||{},{service:o}=K(),{dn:n}=d.useDesignable(),a=F.useField();return{title:e("Progress field"),value:r.progress,options:pe("float"),onChange:s=>{const l=a.decoratorProps.fieldNames||{};l.progress=s,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,i;const{name:e}=d.useCollection(),t=F.useFieldSchema(),{form:r}=d.useFormBlockContext(),o=F.useField(),{dn:n}=d.useDesignable();return{collectionName:e,defaultFilter:((i=(a=t==null?void 0:t["x-decorator-props"])==null?void 0:a.params)==null?void 0:i.filter)||{},form:r,onSubmit:({filter:s})=>{s=d.removeNullCondition(s);const l=o.decoratorProps.params||{};l.filter=s,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();return{componentName:"Gantt",collectionName:e}}},{name:"divider2",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),gt=new d.CompatibleSchemaInitializer({name:"GanttActionInitializers",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{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(){const e=d.useCollection_deprecated();return!["view","file","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{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=F.useFieldSchema(),t=d.useCollection_deprecated(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},{name:"divider",type:"divider",useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{type:"item",title:'{{t("Add record")}}',name:"addRecord",Component:"CustomizeAddRecordActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"create","x-acl-action-props":{skipScopeCheck:!0}}}],useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}}]}),ir=new d.CompatibleSchemaInitializer({name:"gantt:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",name:"enableActions",title:"{{t('Enable actions')}}",children:[{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(){const e=d.useCollection_deprecated();return!["view","file","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"item",title:"{{t('Delete')}}",name:"delete",Component:"BulkDestroyActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider"},useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{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=F.useFieldSchema(),t=d.useCollection_deprecated(),{treeTable:r}=((o=e==null?void 0:e.parent)==null?void 0:o["x-decorator-props"])||{};return t.tree&&r}}]},{name:"divider",type:"divider",useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}},{type:"subMenu",name:"customize",title:'{{t("Customize")}}',children:[{type:"item",title:'{{t("Add record")}}',name:"addRecord",Component:"CustomizeAddRecordActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"create","x-acl-action-props":{skipScopeCheck:!0}}}],useVisible(){const e=d.useCollection_deprecated();return!["view","sql"].includes(e.template)||(e==null?void 0:e.writableView)}}]},gt),lr=e=>{const{collectionName:t,fieldNames:r,dataSource:o}=e;return{type:"void","x-acl-action":`${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:{[ae.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-designer":"TableV2.ActionColumnDesigner","x-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"}}}}}}}}}}}}}},cr=()=>{const{insert:e}=d.useSchemaInitializer(),{t}=we.useTranslation(),{getCollectionFields:r}=d.useCollectionManager_deprecated(),o=g.useContext(F.SchemaOptionsContext),{theme:n}=d.useGlobalTheme(),a=d.useSchemaInitializerItem();return c.jsx(d.DataBlockInitializer,ge(O({},a),{componentType:"Gantt",icon:c.jsx(Qe.FormOutlined,{}),onCreateBlockSchema:s=>ne(this,[s],function*({item:i}){var T,b,A;const l=r(i.name,i.dataSource),u=(T=l==null?void 0:l.filter(p=>p.type==="string"))==null?void 0:T.map(p=>{var x;return{label:(x=p==null?void 0:p.uiSchema)==null?void 0:x.title,value:p.name}}),h=(b=l==null?void 0:l.filter(p=>p.type==="date"))==null?void 0:b.map(p=>{var x;return{label:(x=p==null?void 0:p.uiSchema)==null?void 0:x.title,value:p.name}}),y=(A=l==null?void 0:l.filter(p=>p.type==="float"))==null?void 0:A.map(p=>{var x;return{label:(x=p==null?void 0:p.uiSchema)==null?void 0:x.title,value:p.name}}),V=yield d.FormDialog(t("Create gantt block"),()=>c.jsx(d.SchemaComponentOptions,{scope:o.scope,components:O({},o.components),children:c.jsx(Pe.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:h,required:!0,default:"createdAt","x-component":"Select","x-decorator":"FormItem"},end:{title:t("End date field"),enum:h,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(lr({collectionName:i.name,dataSource:i.dataSource,fieldNames:O({},V)}))})}))},dr=F.observer(e=>c.jsx(c.Fragment,{children:e.children}),{displayName:"Event"}),ur=(e,t,r,o,n,a,i,s,l,u,h,y,V,T,b,A,p,x)=>{let S=e.map((N,w)=>pr(N,w,t,r,o,n,a,i,s,l,u,h,y,V,T,b,A,p,x));return S=S.map(N=>{const w=N.dependencies||[];for(let m=0;m<w.length;m++){const f=S.findIndex(v=>v.id===w[m]);f!==-1&&S[f].barChildren.push(N)}return N}),S},pr=(e,t,r,o,n,a,i,s,l,u,h,y,V,T,b,A,p,x,S)=>{let N;switch(e.type){case"milestone":N=fr(e,t,r,o,n,a,i,s,x,S);break;case"project":N=mt(e,t,r,o,n,a*.5,i,s,l,T,b,A,p);break;default:N=mt(e,t,r,o,n,a,i,s,l,u,h,y,V);break}return N},mt=(e,t,r,o,n,a,i,s,l,u,h,y,V)=>{let T,b;l?(b=bt(e.start,r,o),T=bt(e.end,r,o)):(T=He(e.start,r,o),b=He(e.end,r,o));let A=e.type;A==="task"&&b-T<s*2&&(A="smalltask",b=T>0?T+s*2:T);const[p,x]=Be(T,b,e.progress,l),S=e.type==="project"?Re(t,n,a)+8:Re(t,n,a),N=e.type==="project"?e.hideChildren:void 0,w=O({backgroundColor:y,backgroundSelectedColor:V,progressColor:u,progressSelectedColor:h},e.styles);return ge(O({},e),{typeInternal:A,x1:T,x2:b,y:S,index:t,progressX:x,progressWidth:p,barCornerRadius:i,handleWidth:s,hideChildren:N,height:a,barChildren:[],styles:w})},fr=(e,t,r,o,n,a,i,s,l,u)=>{const h=He(e.start,r,o),y=Re(t,n,a),V=h-a*.5,T=h+a*.5,b=a/1.414,A=O({backgroundColor:l,backgroundSelectedColor:u,progressColor:"",progressSelectedColor:""},e.styles);return ge(O({},e),{end:e.start,x1:V,x2:T,y,index:t,progressX:0,progressWidth:0,barCornerRadius:i,handleWidth:s,typeInternal:e.type,progress:0,height:b,hideChildren:void 0,barChildren:[],styles:A})},He=(e,t,r)=>{var s,l,u;const o=t.findIndex(h=>(h==null?void 0:h.getTime())>=(e==null?void 0:e.getTime()))-1,a=((e==null?void 0:e.getTime())-((s=t[o])==null?void 0:s.getTime()))/(((l=t[o+1])==null?void 0:l.getTime())-((u=t[o])==null?void 0:u.getTime())),i=o*r+a*r;return isNaN(i)?0:i},bt=(e,t,r)=>{let o=He(e,t,r);return o+=r,isNaN(o)?0:o},Re=(e,t,r)=>{const o=e*t+(t-r)/2;return isNaN(o)?0:o},Be=(e,t,r,o)=>{const n=(t-e)*r*.01;let a;return o?a=t-n:a=e,[n,a]},hr=(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)}},gr=(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)}},xt=(e,t,r)=>[e-5,t+r,e+5,t+r,e,t+r-8.66].join(","),mr=(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},br=(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},yt=(e,t,r)=>{const n=Math.round((e-r.x1)/t)*t,a=r.x1+n,i=a+r.x2-r.x1;return[a,i]},me=(e,t,r,o,n)=>{var i,s;let a=new Date((e-t)/o*n+((i=r==null?void 0:r.getTime)==null?void 0:i.call(r)));return a=new Date(((s=a==null?void 0:a.getTime)==null?void 0:s.call(a))+((a==null?void 0:a.getTimezoneOffset())-(r==null?void 0:r.getTimezoneOffset()))*6e4),a},vt=(e,t,r,o,n,a,i)=>{let s;switch(r.type){case"milestone":s=yr(e,t,r,o,n,a);break;default:s=xr(e,t,r,o,n,a,i);break}return s},xr=(e,t,r,o,n,a,i)=>{const s=O({},r);let l=!1;switch(t){case"progress":if(i?s.progress=gr(e,r):s.progress=hr(e,r),l=s.progress!==r.progress,l){const[u,h]=Be(s.x1,s.x2,s.progress,i);s.progressWidth=u,s.progressX=h}break;case"start":{const u=mr(e,o,r);if(s.x1=u,l=s.x1!==r.x1,l){i?s.end=me(u,r.x1,r.end,o,n):s.start=me(u,r.x1,r.start,o,n);const[h,y]=Be(s.x1,s.x2,s.progress,i);s.progressWidth=h,s.progressX=y}break}case"end":{const u=br(e,o,r);if(s.x2=u,l=s.x2!==r.x2,l){i?s.start=me(u,r.x2,r.start,o,n):s.end=me(u,r.x2,r.end,o,n);const[h,y]=Be(s.x1,s.x2,s.progress,i);s.progressWidth=h,s.progressX=y}break}case"move":{const[u,h]=yt(e-a,o,r);if(l=u!==r.x1,l){s.start=me(u,r.x1,r.start,o,n),s.end=me(h,r.x2,r.end,o,n),s.x1=u,s.x2=h;const[y,V]=Be(s.x1,s.x2,s.progress,i);s.progressWidth=y,s.progressX=V}break}}return{isChanged:l,changedTask:s}},yr=(e,t,r,o,n,a)=>{const i=O({},r);let s=!1;switch(t){case"move":{const[l,u]=yt(e-a,o,r);s=l!==r.x1,s&&(i.start=me(l,r.x1,r.start,o,n),i.end=i.start,i.x1=l,i.x2=u);break}}return{isChanged:s,changedTask:i}};var z=(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))(z||{});const St={},Ge=(e,t={})=>{const r=JSON.stringify([e,t]);let o=St[r];return o||(o=new Intl.DateTimeFormat(e,t),St[r]=o),o},H=(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)),q=(e,t)=>{const r=["millisecond","second","minute","hour","day","month","year"],o=a=>{const i=r.indexOf(t);return r.indexOf(a)<=i};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())},wt=(e,t,r)=>{var a,i;let o=((a=e[0])==null?void 0:a.start)||new Date,n=((i=e[0])==null?void 0:i.start)||new Date;for(const s of e)s.start<o&&(o=s.start),s.end>n&&(n=s.end);switch(t){case z.Year:o=H(o,-1,"year"),o=q(o,"year"),n=H(n,1,"year"),n=q(n,"year");break;case z.QuarterYear:o=H(o,-3,"month"),o=q(o,"month"),n=H(n,3,"year"),n=q(n,"year");break;case z.Month:o=H(o,-1*r,"month"),o=q(o,"month"),n=H(n,1,"year"),n=q(n,"year");break;case z.Week:o=q(o,"day"),o=H(vr(o),-7*r,"day"),n=q(n,"day"),n=H(n,1.5,"month");break;case z.Day:o=q(o,"day"),o=H(o,-1*r,"day"),n=q(n,"day"),n=H(n,19,"day");break;case z.QuarterDay:o=q(o,"day"),o=H(o,-1*r,"day"),n=q(n,"day"),n=H(n,66,"hour");break;case z.HalfDay:o=q(o,"day"),o=H(o,-1*r,"day"),n=q(n,"day"),n=H(n,108,"hour");break;case z.Hour:o=q(o,"hour"),o=H(o,-1*r,"hour"),n=q(n,"day"),n=H(n,1,"day");break}return[o,n]},Ct=(e,t,r)=>{let o=new Date(e);const n=[o];for(;o<t;){switch(r){case z.Year:o=H(o,1,"year");break;case z.QuarterYear:o=H(o,3,"month");break;case z.Month:o=H(o,1,"month");break;case z.Week:o=H(o,7,"day");break;case z.Day:o=H(o,1,"day");break;case z.HalfDay:o=H(o,12,"hour");break;case z.QuarterDay:o=H(o,6,"hour");break;case z.Hour:o=H(o,1,"hour");break}n.push(o)}return n},Fe=(e,t)=>{let r=Ge(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase()),r},Tt=(e,t,r)=>{let o=Ge(t,{weekday:r}).format(e);return o=o.replace(o[0],o[0].toLocaleUpperCase()),o},vr=e=>{const t=e.getDay(),r=e.getDate()-t+(t===0?-6:1);return new Date(e.setDate(r))},Sr=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},wr=(e,t)=>new Date(t,e+1,0).getDate();function Cr(e){return e.key!==void 0}function Tr(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=Nt(e,o);e=e.filter(a=>n.indexOf(a)===-1)}return e}function Nt(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(...Nt(e,n))}),r=r.concat(r,o),r}const Nr=(e,t)=>{const r=e.displayOrder||Number.MAX_VALUE,o=t.displayOrder||Number.MAX_VALUE;return r>o?1:r<o?-1:0},Ce=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()},Oe=ze.createStyles(({token:e,css:t})=>({scrollWrapper:t`
|
|
2
2
|
overflow: auto;
|
|
3
3
|
position: absolute;
|
|
4
|
-
bottom: -
|
|
4
|
+
bottom: -8px;
|
|
5
5
|
max-width: 100%;
|
|
6
6
|
scrollbarWidth: thin;
|
|
7
7
|
height: 1.2rem;
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
`})),Mr=({scroll:e,svgWidth:t,taskListWidth:r,rtl:o,onScroll:n})=>{const{styles:a}=
|
|
76
|
+
`})),Mr=({scroll:e,svgWidth:t,taskListWidth:r,rtl:o,onScroll:n})=>{const{styles:a}=Oe(),i=g.useRef(null);return g.useEffect(()=>{i.current&&(i.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:i,children:c.jsx("div",{style:{width:t,height:1},className:"horizontalScroll"})})},Dr=({task:e,rowHeight:t,rtl:r,svgContainerHeight:o,svgContainerWidth:n,scrollX:a,scrollY:i,arrowIndent:s,fontSize:l,fontFamily:u,headerHeight:h,taskListWidth:y,TooltipContent:V})=>{const{styles:T}=Oe(),b=g.useRef(null),[A,p]=g.useState(0),[x,S]=g.useState(0);return g.useEffect(()=>{if(b.current){const N=b.current.offsetHeight*1.1,w=b.current.offsetWidth*1.1;let m=e.index*t-i+h,f;if(r)f=e.x1-s*1.5-w-a,f<0&&(f=e.x2+s*1.5-a),w+f>n&&(f=n-w,m+=t);else{f=e.x2+s*1.5+y-a;const P=w+f,L=y+n;P>L&&(f=e.x1+y-s*1.5-a-w),f<y&&(f=n+y-w,m+=t)}N+m-i>o-i&&(m=o-N),p(m),S(f)}},[b,e,s,a,i,h,y,t,o,n,r]),c.jsx("div",{ref:b,className:M.cx(x?T.tooltipDetailsContainer:T.tooltipDetailsContainerHidden,T.nbGridOther),style:{left:x,top:A},children:c.jsx(V,{task:e,fontSize:l,fontFamily:u})})},Pr=({task:e,fontSize:t,fontFamily:r})=>{var a,i,s,l,u,h,y,V;const{styles:o}=Oe(),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,": ",Ce(e.start)," ~ ",Ce(e.end)]}),((i=(a=e.end)==null?void 0:a.getTime)==null?void 0:i.call(a))-((l=(s=e.start)==null?void 0:s.getTime)==null?void 0:l.call(s))!==0&&c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:`Duration: ${Math.round((((h=(u=e.end)==null?void 0:u.getTime)==null?void 0:h.call(u))-((V=(y=e.start)==null?void 0:y.getTime)==null?void 0:V.call(y)))/(1e3*60*60*24)*10)/10||""} day(s)`}),c.jsx("p",{className:"tooltipDefaultContainerParagraph",children:!!e.progress&&`Progress: ${e.progress}%`})]})},Br=({scroll:e,ganttHeight:t,ganttFullHeight:r,headerHeight:o,rtl:n,onScroll:a})=>{const{styles:i}=Oe(),s=g.useRef(null);return g.useEffect(()=>{s.current&&(s.current.scrollTop=e)},[e]),c.jsx("div",{style:{maxHeight:t,marginTop:o,marginLeft:n?"":"-1rem"},className:M.cx(i.nbGridOther,"verticalScroll"),onScroll:a,ref:s,children:c.jsx("div",{style:{height:r,width:1}})})},Mt=d.createStyles(({token:e,css:t})=>({ganttverticalcontainer:t`
|
|
77
77
|
overflow: hidden;
|
|
78
78
|
font-size: 0;
|
|
79
79
|
margin: 0;
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
display: block;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
`}));function Y(e,t){Fr(e)&&(e="100%");var r=Ar(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 Ye(e){return Math.min(1,Math.max(0,e))}function Fr(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function Ar(e){return typeof e=="string"&&e.indexOf("%")!==-1}function Dt(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function je(e){return e<=1?"".concat(Number(e)*100,"%"):e}function ye(e){return e.length===1?"0"+e:String(e)}function $r(e,t,r){return{r:Y(e,255)*255,g:Y(t,255)*255,b:Y(r,255)*255}}function Pt(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,i=0,s=(o+n)/2;if(o===n)i=0,a=0;else{var l=o-n;switch(i=s>.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:i,l:s}}function et(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 i=r<.5?r*(1+t):r+t-r*t,s=2*r-i;o=et(s,i,e+1/3),n=et(s,i,e),a=et(s,i,e-1/3)}return{r:o*255,g:n*255,b:a*255}}function Bt(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,i=o,s=o-n,l=o===0?0:s/o;if(o===n)a=0;else{switch(o){case e:a=(t-r)/s+(t<r?6:0);break;case t:a=(r-e)/s+2;break;case r:a=(e-t)/s+4;break}a/=6}return{h:a,s:l,v:i}}function Ir(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),i=r*(1-n*t),s=r*(1-(1-n)*t),l=o%6,u=[r,i,a,a,s,r][l],h=[s,r,r,i,a,a][l],v=[a,a,s,r,r,i][l];return{r:u*255,g:h*255,b:v*255}}function Ft(e,t,r,o){var n=[ye(Math.round(e).toString(16)),ye(Math.round(t).toString(16)),ye(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 Lr(e,t,r,o,n){var a=[ye(Math.round(e).toString(16)),ye(Math.round(t).toString(16)),ye(Math.round(r).toString(16)),ye(Er(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 Er(e){return Math.round(parseFloat(e)*255).toString(16)}function At(e){return U(e)/255}function U(e){return parseInt(e,16)}function kr(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var tt={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 Hr(e){var t={r:0,g:0,b:0},r=1,o=null,n=null,a=null,i=!1,s=!1;return typeof e=="string"&&(e=Or(e)),typeof e=="object"&&(se(e.r)&&se(e.g)&&se(e.b)?(t=$r(e.r,e.g,e.b),i=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):se(e.h)&&se(e.s)&&se(e.v)?(o=je(e.s),n=je(e.v),t=Ir(e.h,o,n),i=!0,s="hsv"):se(e.h)&&se(e.s)&&se(e.l)&&(o=je(e.s),a=je(e.l),t=Vr(e.h,o,a),i=!0,s="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=Dt(r),{ok:i,format:e.format||s,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 zr="[-\\+]?\\d+%?",Gr="[-\\+]?\\d*\\.\\d+%?",fe="(?:".concat(Gr,")|(?:").concat(zr,")"),rt="[\\s|\\(]+(".concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")\\s*\\)?"),ot="[\\s|\\(]+(".concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")\\s*\\)?"),Z={CSS_UNIT:new RegExp(fe),rgb:new RegExp("rgb"+rt),rgba:new RegExp("rgba"+ot),hsl:new RegExp("hsl"+rt),hsla:new RegExp("hsla"+ot),hsv:new RegExp("hsv"+rt),hsva:new RegExp("hsva"+ot),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 Or(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(tt[e])e=tt[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r=Z.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=Z.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Z.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=Z.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Z.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=Z.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Z.hex8.exec(e),r?{r:U(r[1]),g:U(r[2]),b:U(r[3]),a:At(r[4]),format:t?"name":"hex8"}:(r=Z.hex6.exec(e),r?{r:U(r[1]),g:U(r[2]),b:U(r[3]),format:t?"name":"hex"}:(r=Z.hex4.exec(e),r?{r:U(r[1]+r[1]),g:U(r[2]+r[2]),b:U(r[3]+r[3]),a:At(r[4]+r[4]),format:t?"name":"hex8"}:(r=Z.hex3.exec(e),r?{r:U(r[1]+r[1]),g:U(r[2]+r[2]),b:U(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function se(e){return!!Z.CSS_UNIT.exec(String(e))}var Xr=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=kr(t)),this.originalInput=t;var n=Hr(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,i=t.g/255,s=t.b/255;return a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),s<=.03928?n=s/12.92:n=Math.pow((s+.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=Dt(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=Bt(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=Bt(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=Pt(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=Pt(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),Ft(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),Lr(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="#"+Ft(this.r,this.g,this.b,!1),r=0,o=Object.entries(tt);r<o.length;r++){var n=o[r],a=n[0],i=n[1];if(t===i)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=Ye(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=Ye(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=Ye(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=Ye(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,i={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(i)},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,i=[],s=1/t;t--;)i.push(new e({h:o,s:n,v:a})),a=(a+s)%1;return i},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,i=1;i<t;i++)n.push(new e({h:(o+i*a)%360,s:r.s,l:r.l}));return n},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Yr=ze.createStyles(({token:e,css:t})=>{const r=new Xr(e.colorFillAlter).onBackground(e.colorBgContainer).toHexShortString();return{calendarheader:t`
|
|
109
|
+
`}));function j(e,t){Fr(e)&&(e="100%");var r=Ar(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 Fr(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function Ar(e){return typeof e=="string"&&e.indexOf("%")!==-1}function Dt(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 $r(e,t,r){return{r:j(e,255)*255,g:j(t,255)*255,b:j(r,255)*255}}function Pt(e,t,r){e=j(e,255),t=j(t,255),r=j(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,i=0,s=(o+n)/2;if(o===n)i=0,a=0;else{var l=o-n;switch(i=s>.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:i,l:s}}function et(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=j(e,360),t=j(t,100),r=j(r,100),t===0)n=r,a=r,o=r;else{var i=r<.5?r*(1+t):r+t-r*t,s=2*r-i;o=et(s,i,e+1/3),n=et(s,i,e),a=et(s,i,e-1/3)}return{r:o*255,g:n*255,b:a*255}}function Bt(e,t,r){e=j(e,255),t=j(t,255),r=j(r,255);var o=Math.max(e,t,r),n=Math.min(e,t,r),a=0,i=o,s=o-n,l=o===0?0:s/o;if(o===n)a=0;else{switch(o){case e:a=(t-r)/s+(t<r?6:0);break;case t:a=(r-e)/s+2;break;case r:a=(e-t)/s+4;break}a/=6}return{h:a,s:l,v:i}}function Ir(e,t,r){e=j(e,360)*6,t=j(t,100),r=j(r,100);var o=Math.floor(e),n=e-o,a=r*(1-t),i=r*(1-n*t),s=r*(1-(1-n)*t),l=o%6,u=[r,i,a,a,s,r][l],h=[s,r,r,i,a,a][l],y=[a,a,s,r,r,i][l];return{r:u*255,g:h*255,b:y*255}}function Ft(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 Lr(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(Er(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 Er(e){return Math.round(parseFloat(e)*255).toString(16)}function At(e){return W(e)/255}function W(e){return parseInt(e,16)}function kr(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var tt={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 zr(e){var t={r:0,g:0,b:0},r=1,o=null,n=null,a=null,i=!1,s=!1;return typeof e=="string"&&(e=Or(e)),typeof e=="object"&&(se(e.r)&&se(e.g)&&se(e.b)?(t=$r(e.r,e.g,e.b),i=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):se(e.h)&&se(e.s)&&se(e.v)?(o=Ye(e.s),n=Ye(e.v),t=Ir(e.h,o,n),i=!0,s="hsv"):se(e.h)&&se(e.s)&&se(e.l)&&(o=Ye(e.s),a=Ye(e.l),t=Vr(e.h,o,a),i=!0,s="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=Dt(r),{ok:i,format:e.format||s,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 Hr="[-\\+]?\\d+%?",Gr="[-\\+]?\\d*\\.\\d+%?",fe="(?:".concat(Gr,")|(?:").concat(Hr,")"),rt="[\\s|\\(]+(".concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")\\s*\\)?"),ot="[\\s|\\(]+(".concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")[,|\\s]+(").concat(fe,")\\s*\\)?"),R={CSS_UNIT:new RegExp(fe),rgb:new RegExp("rgb"+rt),rgba:new RegExp("rgba"+ot),hsl:new RegExp("hsl"+rt),hsla:new RegExp("hsla"+ot),hsv:new RegExp("hsv"+rt),hsva:new RegExp("hsva"+ot),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 Or(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(tt[e])e=tt[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r=R.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=R.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=R.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=R.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=R.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=R.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=R.hex8.exec(e),r?{r:W(r[1]),g:W(r[2]),b:W(r[3]),a:At(r[4]),format:t?"name":"hex8"}:(r=R.hex6.exec(e),r?{r:W(r[1]),g:W(r[2]),b:W(r[3]),format:t?"name":"hex"}:(r=R.hex4.exec(e),r?{r:W(r[1]+r[1]),g:W(r[2]+r[2]),b:W(r[3]+r[3]),a:At(r[4]+r[4]),format:t?"name":"hex8"}:(r=R.hex3.exec(e),r?{r:W(r[1]+r[1]),g:W(r[2]+r[2]),b:W(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function se(e){return!!R.CSS_UNIT.exec(String(e))}var Xr=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=kr(t)),this.originalInput=t;var n=zr(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,i=t.g/255,s=t.b/255;return a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),s<=.03928?n=s/12.92:n=Math.pow((s+.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=Dt(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=Bt(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=Bt(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=Pt(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=Pt(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),Ft(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),Lr(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(j(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(j(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="#"+Ft(this.r,this.g,this.b,!1),r=0,o=Object.entries(tt);r<o.length;r++){var n=o[r],a=n[0],i=n[1];if(t===i)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,i={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(i)},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,i=[],s=1/t;t--;)i.push(new e({h:o,s:n,v:a})),a=(a+s)%1;return i},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,i=1;i<t;i++)n.push(new e({h:(o+i*a)%360,s:r.s,l:r.l}));return n},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Yr=ze.createStyles(({token:e,css:t})=>{const r=new Xr(e.colorFillAlter).onBackground(e.colorBgContainer).toHexShortString();return{calendarheader:t`
|
|
110
110
|
color: ${e.colorText};
|
|
111
111
|
fill: ${r};
|
|
112
112
|
stroke-width: 1.4;
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
font-weight: 500;
|
|
140
140
|
fill: ${e.colorText};
|
|
141
141
|
}
|
|
142
|
-
`}}),
|
|
142
|
+
`}}),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")]}),jr=({dateSetup:e,locale:t,viewMode:r,rtl:o,headerHeight:n,columnWidth:a,fontFamily:i,fontSize:s})=>{const{styles:l}=Yr(),u=()=>{const S=[],N=[],w=n*.5;for(let m=0;m<e.dates.length;m++){const f=e.dates[m],v=f.getFullYear();if(N.push(c.jsx("text",{y:n*.8,x:a*m+a*.5,className:M.cx("calendarBottomText"),children:v},f.getTime())),m===0||f.getFullYear()!==e.dates[m-1].getFullYear()){const P=f.getFullYear().toString();let L;o?L=(6+m+f.getFullYear()+1)*a:L=(6+m-f.getFullYear())*a,S.push(c.jsx(xe,{value:P,x1Line:a*m,y1Line:0,y2Line:n,xText:L,yText:w*.9},P))}}return[S,N]},h=()=>{const S=[],N=[],w=n*.5;for(let m=0;m<e.dates.length;m++){const f=e.dates[m],v="Q"+Math.floor((f.getMonth()+3)/3);if(N.push(c.jsx("text",{y:n*.8,x:a*m+a*.5,className:M.cx("calendarBottomText"),children:v},f.getTime())),m===0||f.getFullYear()!==e.dates[m-1].getFullYear()){const P=f.getFullYear().toString();let L;o?L=(6+m+f.getMonth()+1)*a:L=(6+m-f.getMonth())*a,S.push(c.jsx(xe,{value:P,x1Line:a*m,y1Line:0,y2Line:w,xText:Math.abs(L),yText:w*.9},P))}}return[S,N]},y=()=>{const S=[],N=[],w=n*.5;for(let m=0;m<e.dates.length;m++){const f=e.dates[m],v=Fe(f,t);if(N.push(c.jsx("text",{y:n*.8,x:a*m+a*.5,className:M.cx("calendarBottomText"),children:v},v+f.getFullYear())),m===0||f.getFullYear()!==e.dates[m-1].getFullYear()){const P=f.getFullYear().toString();let L;o?L=(6+m+f.getMonth()+1)*a:L=(6+m-f.getMonth())*a,S.push(c.jsx(xe,{value:P,x1Line:a*m,y1Line:0,y2Line:w,xText:L,yText:w*.9},P))}}return[S,N]},V=()=>{const S=[],N=[];let w=1;const m=n*.5,f=e.dates;for(let v=f.length-1;v>=0;v--){const P=f[v];let L="";(v===0||P.getMonth()!==f[v-1].getMonth())&&(L=`${Fe(P,t)}, ${P.getFullYear()}`);const U=`W${Sr(P)}`;N.push(c.jsx("text",{y:n*.8,x:a*(v+ +o),className:M.cx("calendarBottomText"),children:U},P.getTime())),L&&(v!==f.length-1&&S.push(c.jsx(xe,{value:L,x1Line:a*v+w*a,y1Line:0,y2Line:m,xText:a*v+a*w*.5,yText:m*.9},L)),w=0),w++}return[S,N]},T=()=>{const S=[],N=[],w=n*.5,m=e.dates;for(let f=0;f<m.length;f++){const v=m[f],P=`${v.getDate().toString()}`;if(N.push(c.jsx("text",{y:n*.8,x:a*f+a*.5,className:M.cx("calendarBottomText"),children:P},v.getTime())),f+1!==m.length&&v.getMonth()!==m[f+1].getMonth()){const L=Fe(v,t);S.push(c.jsx(xe,{value:L,x1Line:a*(f+1),y1Line:0,y2Line:w,xText:a*(f+1)-wr(v.getMonth(),v.getFullYear())*a*.5,yText:w*.9},L+v.getFullYear()))}}return[S,N]},b=()=>{const S=[],N=[],w=r===z.HalfDay?2:4,m=n*.5,f=e.dates;for(let v=0;v<f.length;v++){const P=f[v],L=Ge(t,{hour:"numeric"}).format(P).replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(v+ +o),className:M.cx("calendarBottomText"),fontFamily:i,children:L},P.getTime())),v===0||P.getDate()!==f[v-1].getDate()){const U=`${Tt(P,t,"short")}, ${P.getDate()} ${Fe(P,t)}`;S.push(c.jsx(xe,{value:U,x1Line:a*v+w*a,y1Line:0,y2Line:m,xText:a*v+w*a*.5,yText:m*.9},U+P.getFullYear()))}}return[S,N]},A=()=>{var f;const S=[],N=[],w=n*.5,m=e.dates;for(let v=0;v<m.length;v++){const P=m[v],L=(f=Ge(t,{hour:"numeric"}).format(P))==null?void 0:f.replace("时","");if(N.push(c.jsx("text",{y:n*.8,x:a*(v+ +o),className:M.cx("calendarBottomText"),fontFamily:i,children:L},P.getTime())),v!==0&&P.getDate()!==m[v-1].getDate()){const U=m[v-1],ye=`${Tt(U,t,"long")}, ${U.getDate()} ${Fe(U,t)}`,J=(P.getHours()-24)/2;S.push(c.jsx(xe,{value:ye,x1Line:a*v,y1Line:0,y2Line:w,xText:a*(v+J),yText:w*.9},ye+U.getFullYear()))}}return[S,N]};let p=[],x=[];switch(e.viewMode){case z.Year:[p,x]=u();break;case z.QuarterYear:[p,x]=h();break;case z.Month:[p,x]=y();break;case z.Week:[p,x]=V();break;case z.Day:[p,x]=T();break;case z.QuarterDay:case z.HalfDay:[p,x]=b();break;case z.Hour:[p,x]=A()}return c.jsxs("g",{className:l.nbGanttCalendar,fontSize:s,fontFamily:i,children:[c.jsx("rect",{x:0,y:0,width:a*e.dates.length,height:n,className:l.calendarheader}),x," ",p]})},qr=ze.createStyles(({token:e,css:t})=>({gridRow:t`
|
|
143
143
|
fill: ${e.colorBgContainer};
|
|
144
144
|
`,gridHeightRow:t`
|
|
145
145
|
fill: #e6f7ff;
|
|
@@ -153,21 +153,21 @@
|
|
|
153
153
|
.gridtick: {
|
|
154
154
|
stroke: ${e.colorBorderSecondary};
|
|
155
155
|
}
|
|
156
|
-
`})),_r=[{id:Ke.uid()},{id:Ke.uid()},{id:Ke.uid()}],Ur=({tasks:e,dates:t,rowHeight:r,svgWidth:o,columnWidth:n,todayColor:a,rtl:i,selectedRowKeys:s})=>{const{styles:l}=qr(),u=e.length?e:_r;let h=0;const
|
|
156
|
+
`})),_r=[{id:Ke.uid()},{id:Ke.uid()},{id:Ke.uid()}],Ur=({tasks:e,dates:t,rowHeight:r,svgWidth:o,columnWidth:n,todayColor:a,rtl:i,selectedRowKeys:s})=>{const{styles:l}=qr(),u=e.length?e:_r;let h=0;const y=[],V=[c.jsx("line",{x:"0",y1:0,x2:o,y2:0,className:M.cx("gridRowLine")},"RowLineFirst")];for(const x of u)y.push(c.jsx("rect",{x:"0",y:h,width:o,height:r,className:s!=null&&s.includes(+x.id)?l.gridHeightRow:l.gridRow},"Row"+x.id)),V.push(c.jsx("line",{x:"0",y1:h+r,x2:o,y2:h+r,className:M.cx("gridRowLine")},"RowLine"+x.id)),h+=r;const T=new Date;let b=0;const A=[];let p=c.jsx("rect",{});for(let x=0;x<t.length;x++){const S=t[x];A.push(c.jsx("line",{x1:b,y1:0,x2:b,y2:h,className:M.cx("gridTick")},S.getTime())),(x+1!==t.length&&S.getTime()<T.getTime()&&t[x+1].getTime()>=T.getTime()||x!==0&&x+1===t.length&&S.getTime()<T.getTime()&&H(S,S.getTime()-t[x-1].getTime(),"millisecond").getTime()>=T.getTime())&&(p=c.jsx("rect",{x:b,y:0,width:n,height:h,fill:a})),i&&x+1!==t.length&&S.getTime()>=T.getTime()&&t[x+1].getTime()<T.getTime()&&(p=c.jsx("rect",{x:b+n,y:0,width:n,height:h,fill:a})),b+=n}return c.jsxs("g",{className:M.cx("gridBody",l.nbGridbody),children:[c.jsx("g",{className:"rows",children:y}),c.jsx("g",{className:"rowLines",children:V}),c.jsx("g",{className:"ticks",children:A}),c.jsx("g",{className:"today",children:p})]})},Wr=e=>c.jsx("g",{className:"grid",children:c.jsx(Ur,O({},e))}),Qr=({taskFrom:e,taskTo:t,rowHeight:r,taskHeight:o,arrowIndent:n,rtl:a})=>{let i,s;return a?[i,s]=Jr(e,t,r,o,n):[i,s]=Kr(e,t,r,o,n),c.jsxs("g",{className:"arrow",children:[c.jsx("path",{strokeWidth:"1.5",d:i,fill:"none"}),c.jsx("polygon",{points:s})]})},Kr=(e,t,r,o,n)=>{const a=e.index>t.index?-1:1,i=t.y+o/2,s=e.x2+n*2,l=s<t.x1?"":`H ${t.x1-n}`,u=s>t.x1?n:t.x1-e.x2-n,h=`M ${e.x2} ${e.y+o/2}
|
|
157
157
|
h ${n}
|
|
158
158
|
v ${a*r/2}
|
|
159
159
|
${l}
|
|
160
160
|
V ${i}
|
|
161
|
-
h ${u}`,
|
|
161
|
+
h ${u}`,y=`${t.x1},${i}
|
|
162
162
|
${t.x1-5},${i-5}
|
|
163
|
-
${t.x1-5},${i+5}`;return[h,
|
|
163
|
+
${t.x1-5},${i+5}`;return[h,y]},Jr=(e,t,r,o,n)=>{const a=e.index>t.index?-1:1,i=t.y+o/2,s=e.x1-n*2,l=s>t.x2?"":`H ${t.x2+n}`,u=s<t.x2?-n:t.x2-e.x1+n,h=`M ${e.x1} ${e.y+o/2}
|
|
164
164
|
h ${-n}
|
|
165
165
|
v ${a*r/2}
|
|
166
166
|
${l}
|
|
167
167
|
V ${i}
|
|
168
|
-
h ${u}`,
|
|
168
|
+
h ${u}`,y=`${t.x2},${i}
|
|
169
169
|
${t.x2+5},${i+5}
|
|
170
|
-
${t.x2+5},${i-5}`;return[h,
|
|
170
|
+
${t.x2+5},${i-5}`;return[h,y]},$t=({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`
|
|
171
171
|
cursor: pointer;
|
|
172
172
|
outline: none;
|
|
173
173
|
.barHandle {
|
|
@@ -180,25 +180,25 @@
|
|
|
180
180
|
visibility: visible;
|
|
181
181
|
opacity: 1;
|
|
182
182
|
}
|
|
183
|
-
`,Zr=
|
|
183
|
+
`,Zr=M.css`
|
|
184
184
|
user-select: none;
|
|
185
185
|
stroke-width: 0;
|
|
186
186
|
opacity: 0.6;
|
|
187
|
-
`,It=({x:e,y:t,color:r,width:o,height:n,isSelected:a,progressX:i,progressWidth:s,barCornerRadius:l,styles:u,onMouseDown:h})=>{const
|
|
187
|
+
`,It=({x:e,y:t,color:r,width:o,height:n,isSelected:a,progressX:i,progressWidth:s,barCornerRadius:l,styles:u,onMouseDown:h})=>{const y=()=>r||(a?u.progressSelectedColor:u.progressColor),V=()=>r||(a?u.backgroundSelectedColor:u.backgroundColor);return c.jsxs("g",{onMouseDown:h,children:[c.jsx("rect",{x:e,width:o,y:t,height:n,ry:l,rx:l,fill:V(),className:M.cx(Zr)}),c.jsx("rect",{x:i,width:s,y:t,height:n,ry:l,rx:l,fill:y()})]})},Lt=({progressPoint:e,onMouseDown:t})=>c.jsx("polygon",{className:"barHandle",points:e,onMouseDown:t}),Rr=({task:e,isProgressChangeable:t,isDateChangeable:r,rtl:o,onEventStart:n,isSelected:a})=>{const i=xt(+!o*e.progressWidth+e.progressX,e.y,e.height),s=e.height-2;return c.jsxs("g",{className:M.cx(Vt),"aria-label":"task-bar",tabIndex:0,children:[c.jsx(It,{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($t,{x:e.x1+1,y:e.y+1,width:e.handleWidth,height:s,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("start",e,l)}}),c.jsx($t,{x:e.x2-e.handleWidth-1,y:e.y+1,width:e.handleWidth,height:s,barCornerRadius:e.barCornerRadius,onMouseDown:l=>{n("end",e,l)}})]}),t&&c.jsx(Lt,{progressPoint:i,onMouseDown:l=>{n("progress",e,l)}})]})]})},eo=({task:e,isProgressChangeable:t,isDateChangeable:r,onEventStart:o,isSelected:n})=>{const a=xt(e.progressWidth+e.x1+10,e.y,e.height);return c.jsxs("g",{className:M.cx(Vt),tabIndex:0,children:[c.jsx(It,{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:i=>{r&&o("move",e,i)}}),c.jsx("g",{className:"handleGroup",children:t&&c.jsx(Lt,{progressPoint:a,onMouseDown:i=>{o("progress",e,i)}})})]})},to=M.css`
|
|
188
188
|
cursor: pointer;
|
|
189
189
|
outline: none;
|
|
190
|
-
`,ro=
|
|
190
|
+
`,ro=M.css`
|
|
191
191
|
user-select: none;
|
|
192
192
|
`,oo=({task:e,isDateChangeable:t,onEventStart:r,isSelected:o})=>{const n=`rotate(45 ${e.x1+e.height*.356}
|
|
193
|
-
${e.y+e.height*.85})`,a=()=>o?e.styles.backgroundSelectedColor:e.styles.backgroundColor;return c.jsx("g",{tabIndex:0,className:
|
|
193
|
+
${e.y+e.height*.85})`,a=()=>o?e.styles.backgroundSelectedColor:e.styles.backgroundColor;return c.jsx("g",{tabIndex:0,className:M.cx(to),children:c.jsx("rect",{fill:a(),x:e.x1,width:e.height,y:e.y,height:e.height,rx:e.barCornerRadius,ry:e.barCornerRadius,transform:n,className:M.cx(ro),onMouseDown:i=>{t&&r("move",e,i)}})})},no=M.css`
|
|
194
194
|
cursor: pointer;
|
|
195
195
|
outline: none;
|
|
196
|
-
`,ao=
|
|
196
|
+
`,ao=M.css`
|
|
197
197
|
user-select: none;
|
|
198
198
|
opacity: 0.6;
|
|
199
|
-
`;
|
|
199
|
+
`;M.css`
|
|
200
200
|
user-select: none;
|
|
201
|
-
`;const so=({task:e,isSelected:t})=>{const r=t?e.styles.backgroundSelectedColor:e.styles.backgroundColor,o=t?e.styles.progressSelectedColor:e.styles.progressColor,n=e.x2-e.x1;return c.jsxs("g",{tabIndex:0,className:
|
|
201
|
+
`;const so=({task:e,isSelected:t})=>{const r=t?e.styles.backgroundSelectedColor:e.styles.backgroundColor,o=t?e.styles.progressSelectedColor:e.styles.progressColor,n=e.x2-e.x1;return c.jsxs("g",{tabIndex:0,className:M.cx(no),children:[c.jsx("rect",{fill:e.color||r,x:e.x1,width:n,y:e.y,height:e.height,rx:e.barCornerRadius,ry:e.barCornerRadius,className:M.cx(ao)}),c.jsx("rect",{x:e.progressX,width:e.progressWidth,y:e.y,height:e.height,ry:e.barCornerRadius,rx:e.barCornerRadius,fill:e.color||o})]})},io=ze.createStyles(({token:e,css:t})=>({nbganttTaskitem:t`
|
|
202
202
|
.barLabel: {
|
|
203
203
|
fill: ${e.colorTextLightSolid},
|
|
204
204
|
textAnchor: middle,
|
|
@@ -234,11 +234,14 @@
|
|
|
234
234
|
pointerEvents: none,
|
|
235
235
|
},
|
|
236
236
|
}
|
|
237
|
-
}`})),lo=e=>{const{styles:t}=io(),{task:r,arrowIndent:o,isDelete:n,taskHeight:a,isSelected:i,rtl:s,onEventStart:l}=G({},e),u=g.useRef(null),[h,v]=g.useState(c.jsx("div",{})),[V,C]=g.useState(!0),x=r.typeInternal==="project";g.useEffect(()=>{switch(r.typeInternal){case"milestone":v(c.jsx(oo,G({},e)));break;case"project":v(c.jsx(so,G({},e)));break;case"smalltask":v(c.jsx(eo,G({},e)));break;default:v(c.jsx(Rr,G({},e)));break}},[r,i]),g.useEffect(()=>{u.current&&C(u.current.getBBox().width<r.x2-r.x1)},[u,r]);const F=()=>{const p=r.x2-r.x1,y=r.barChildren.length>0;return V?r.x1+p*.5:s&&u.current?r.x1-u.current.getBBox().width-o*+y-o*.2:r.x1+p+o*+y+o*.2};return c.jsxs("g",{className:N.cx(t.nbganttTaskitem),onKeyDown:p=>{switch(p.key){case"Delete":{n&&l("delete",r,p);break}}p.stopPropagation()},onMouseEnter:p=>{l("mouseenter",r,p)},onMouseLeave:p=>{l("mouseleave",r,p)},onDoubleClick:p=>{l("dblclick",r,p)},onClick:p=>{l("click",r,p)},onFocus:()=>{l("select",r)},children:[h,c.jsx("text",{x:x?r.x1:F(),y:x?r.y-8:V?r.y+a*.5:r.y+a*.65,className:x?N.cx("projectLabel"):V?N.cx("barLabel"):N.cx("barLabelOutside"),ref:u,children:x&&Te(r.start)&&Te(r.end)?`${r.name}: ${Te(r.start)} ~ ${Te(r.end)}`:r.name})]})};let nt=null,Ve=null;const co=({tasks:e,dates:t,ganttEvent:r,selectedTask:o,rowHeight:n,columnWidth:a,timeStep:i,svg:s,taskHeight:l,arrowColor:u,arrowIndent:h,fontFamily:v,fontSize:V,rtl:C,setGanttEvent:x,setFailedTask:F,setSelectedTask:p,onDateChange:y,onProgressChange:S,onDoubleClick:T,onClick:M,onDelete:m})=>{var te;const f=(te=s==null?void 0:s.current)==null?void 0:te.createSVGPoint(),[b,B]=g.useState(0),[E,W]=g.useState(0),[ie,he]=g.useState(!1);g.useEffect(()=>{var X,q,O,_;const A=((X=t[1])==null?void 0:X.getTime())-((q=t[0])==null?void 0:q.getTime())-((O=t[1])==null?void 0:O.getTimezoneOffset())*60*1e3+((_=t[0])==null?void 0:_.getTimezoneOffset())*60*1e3,k=i*a/A;B(k)},[a,t,i]),g.useEffect(()=>{const A=X=>ne(this,null,function*(){var ge;if(!r.changedTask||!f||!(s!=null&&s.current))return;X.preventDefault(),f.x=X.clientX;const q=f.matrixTransform((ge=s==null?void 0:s.current.getScreenCTM())==null?void 0:ge.inverse()),{isChanged:O,changedTask:_}=vt(q.x,r.action,r.changedTask,b,i,E,C);O&&x({action:r.action,changedTask:_})}),k=X=>ne(this,null,function*(){var Ie;const{action:q,originalSelectedTask:O,changedTask:_}=r;if(!_||!f||!(s!=null&&s.current)||!O)return;X.preventDefault(),f.x=X.clientX;const ge=f.matrixTransform((Ie=s==null?void 0:s.current.getScreenCTM())==null?void 0:Ie.inverse()),{changedTask:J}=vt(ge.x,q,_,b,i,E,C),De=O.start!==J.start||O.end!==J.end||O.progress!==J.progress;s.current.removeEventListener("mousemove",A),s.current.removeEventListener("mouseup",k),x({action:""}),he(!1);let Se=!0;if((q==="move"||q==="end"||q==="start")&&y&&De)try{const le=yield y(J,J.barChildren);le!==void 0&&(Se=le)}catch(le){Se=!1}else if(S&&De)try{const le=yield S(J,J.barChildren);le!==void 0&&(Se=le)}catch(le){Se=!1}Se||F(O)});!ie&&(r.action==="move"||r.action==="end"||r.action==="start"||r.action==="progress")&&(s!=null&&s.current)&&(s.current.addEventListener("mousemove",A),s.current.addEventListener("mouseup",k),he(!0))},[r,b,E,S,i,y,s,ie,f,C,F,x]);const Me=(A,k,X)=>ne(this,null,function*(){var q;if(!X)A==="select"&&p(k.id);else if(Cr(X)){if(A==="delete"&&m)try{const O=yield m(k);O!==void 0&&O&&x({action:A,changedTask:k})}catch(O){console.error("Error on Delete. "+O)}}else if(A==="mouseenter")r.action||x({action:A,changedTask:k,originalSelectedTask:k});else if(A==="mouseleave")r.action==="mouseenter"&&setTimeout(()=>{x({action:""})},300);else if(A==="dblclick")T&&T(k);else if(A==="click")M&&M(k);else if(A==="move"){if(!(s!=null&&s.current)||!f)return;f.x=X.clientX;const O=f.matrixTransform((q=s.current.getScreenCTM())==null?void 0:q.inverse());W(O.x-k.x1),x({action:A,changedTask:k,originalSelectedTask:k})}else x({action:A,changedTask:k,originalSelectedTask:k})}),at=(A,k,X)=>{["click"].includes(A)?(!["start","end","progress"].includes(nt)&&(!Ve||Ve===k.start)&&Me(A,k,X),nt=null,Ve=null):["move","select"].includes(A)?(Ve=k.start,Me(A,k,X)):(Ve=k.start,nt=A,Me(A,k,X))};return c.jsxs("g",{className:"content",children:[c.jsx("g",{className:"arrows",fill:u,stroke:u,children:e.map(A=>A.barChildren.map(k=>c.jsx(Qr,{taskFrom:A,taskTo:e[k.index],rowHeight:n,taskHeight:l,arrowIndent:h,rtl:C},`Arrow from ${A.id} to ${e[k.index].id}`)))}),c.jsx("g",{className:"bar",fontFamily:v,fontSize:V,children:e.map(A=>c.jsx(lo,{task:A,arrowIndent:h,taskHeight:l,isProgressChangeable:!!S&&!A.isDisabled,isDateChangeable:!!y&&!A.isDisabled,isDelete:!A.isDisabled,onEventStart:at,isSelected:!!o&&A.id===o.id,rtl:C},A.id))})]})},Et=g.forwardRef(({gridProps:e,calendarProps:t,barProps:r,ganttHeight:o,scrollY:n,scrollX:a},i)=>{const s=g.useRef(null),l=g.useRef(null),u=be(G({},r),{svg:s}),{styles:h}=Mt();return g.useEffect(()=>{l.current&&(l.current.scrollTop=n)},[n]),g.useEffect(()=>{i.current&&(i.current.scrollLeft=a)},[a]),c.jsxs("div",{className:h.ganttverticalcontainer,ref:i,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(jr,G({},t))}),c.jsx("div",{ref:l,className:h.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||3),fontFamily:r.fontFamily,ref:s,className:"ganttBody",children:[c.jsx(Wr,G({},e)),c.jsx(co,G({},u))]})})]})});Et.displayName="TaskGantt";const uo=(e,t)=>t/e>50?Math.floor(t/e)+20:50,po=g.createContext({close:()=>{}}),fo=e=>{const{visible:t,setVisible:r,record:o}=e,{t:n}=Ce.useTranslation(),a=d.useCollection(),i=d.useCollectionParentRecordData(),l=P.useFieldSchema().properties.detail,u=g.useCallback(()=>{r(!1)},[]);return l&&c.jsx(po.Provider,{value:{close:u},children:c.jsx(d.ActionContextProvider,{value:{visible:t,setVisible:r},children:c.jsx(d.RecordProvider,{record:o,parent:i,children:c.jsx(d.DeclareVariable,{name:"$nPopupRecord",title:n("Current popup record"),value:o,collection:a,children:c.jsx(P.RecursionField,{schema:l,name:l.name})})})})})},ho=ft.debounce((e,t,r,o,n)=>ne(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.start]:e.start,[r.end]:e.end}}),pt.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),go=ft.debounce((e,t,r,o,n)=>ne(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.progress]:e.progress/100}}),pt.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),Ne=d.withDynamicSchemaProps(e=>{var Kt,Jt,Zt;const{styles:t}=Mt(),{token:r}=d.useToken(),a=d.useAPIClient().auth.getOption("theme")==="compact"?45:55.56,{headerHeight:i=((Kt=document.querySelector(".ant-table-thead"))==null?void 0:Kt.clientHeight)||0,listCellWidth:s="155px",rowHeight:l=a,ganttHeight:u=0,preStepsCount:h=1,barFill:v=60,barCornerRadius:V=r.borderRadiusXS,barProgressColor:C=r.colorPrimary,barProgressSelectedColor:x=r.colorPrimary,barBackgroundColor:F=r.colorPrimary,barBackgroundSelectedColor:p=r.colorPrimary,projectProgressColor:y=r.colorPrimary,projectProgressSelectedColor:S=r.colorPrimary,projectBackgroundColor:T=r.colorPrimary,projectBackgroundSelectedColor:M=r.colorPrimary,milestoneBackgroundColor:m="#f1c453",milestoneBackgroundSelectedColor:f="#f29e4c",rtl:b=!1,handleWidth:B=8,timeStep:E=3e5,arrowColor:W="grey",fontFamily:ie="-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:he=r.fontSize,arrowIndent:Me=20,todayColor:at="rgba(252, 248, 227, 0.5)",viewDate:te,TooltipContent:A=Pr,onDoubleClick:k,onDelete:X,onSelect:q,onExpanderClick:O,tasks:_,expandAndCollapseAll:ge,fieldNames:J}=d.useProps(e),De=K(),Se=d.useCurrentAppInfo(),{t:Ie}=Ce.useTranslation(),le=(Jt=Se.data)==null?void 0:Jt.lang,st=d.useTableBlockContext(),{resource:zt,service:Le}=d.useBlockRequestContext(),Gt=P.useFieldSchema(),re=J.range||"day",we=g.useRef(null),it=g.useRef(null),Ot=g.useRef(null),[ce,mo]=g.useState(()=>{const[w,L]=wt(_,re,h);return{viewMode:re,dates:Ct(w,L,re)}}),[bo,Xt]=g.useState(!1),[xo,yo]=g.useState({}),[Ee,Yt]=g.useState(void 0),[qe,jt]=g.useState(0),[vo,So]=g.useState(0),[wo,qt]=g.useState(u),[oe,_e]=g.useState([]),[ke,_t]=g.useState({action:""}),lt=g.useMemo(()=>l*v/100,[l,v]),[ct,Co]=g.useState(),[Ue,Ut]=g.useState(null),[me,dt]=g.useState(0),[de,He]=g.useState(-1),[Wt,Pe]=g.useState(!1),R=uo(ce.dates.length,(Zt=Ot.current)==null?void 0:Zt.clientWidth),ue=ce.dates.length*R,Be=oe.length*l,{expandFlag:Qt}=st,[To,No]=g.useState([]);g.useEffect(()=>{st.field.onExpandClick=Fo,st.field.onRowSelect=Ao},[]),g.useEffect(()=>{ge==null||ge(!Qt)},[Qt]),g.useEffect(()=>{let w;O?w=Tr(_):w=_,w=w.sort(Nr);const[L,D]=wt(w,re,h);let $=Ct(L,D,re);b&&($=$.reverse(),de===-1&&He($.length*R)),mo({dates:$,viewMode:re}),_e(ur(w,$,R,l,lt,V,B,b,C,x,F,p,y,S,T,M,m,f))},[_,re,h,l,V,R,lt,B,C,x,F,p,y,S,T,M,m,f,b,de]),g.useEffect(()=>{if(re===ce.viewMode&&(te&&!Ee||te&&(Ee==null?void 0:Ee.valueOf())!==te.valueOf())){const w=ce.dates,L=w.findIndex((D,$)=>te.valueOf()>=D.valueOf()&&$+1!==w.length&&te.valueOf()<w[$+1].valueOf());if(L===-1)return;Yt(te),He(R*L)}},[te,R,ce.dates,ce.viewMode,re,Ee,Yt]),g.useEffect(()=>{const{changedTask:w,action:L}=ke;if(w){if(L==="delete")_t({action:""}),_e(oe.filter(D=>D.id!==w.id));else if(L==="move"||L==="end"||L==="start"||L==="progress"){const D=oe.find($=>$.id===w.id);if(D&&D.start&&D.end&&(D.start.getTime()!==w.start.getTime()||D.end.getTime()!==w.end.getTime()||D.progress!==w.progress)){const $=oe.map(Q=>Q.id===w.id?w:Q);_e($)}}}},[ke,oe]),g.useEffect(()=>{Ue&&(_e(oe.map(w=>w.id!==Ue.id?w:Ue)),Ut(null))},[Ue,oe]),g.useEffect(()=>{s||jt(0),it.current&&jt(it.current.offsetWidth)},[it,s]),g.useEffect(()=>{we.current&&So(we.current.offsetWidth-qe)},[we,qe]),g.useEffect(()=>{qt(u?u+i:_.length*l+i)},[u,_,i,l]),g.useEffect(()=>{var L;const w=D=>{if(D.shiftKey||D.deltaX){const $=D.deltaX?D.deltaX:D.deltaY;let Q=de+$;Q<0?Q=0:Q>ue&&(Q=ue),He(Q),D.preventDefault()}else if(u){let $=me+D.deltaY;$<0?$=0:$>Be-u&&($=Be-u),$!==me&&(dt($),D.preventDefault())}Pe(!0)};return(L=we.current)==null||L.addEventListener("wheel",w,{passive:!1}),()=>{var D;(D=we.current)==null||D.removeEventListener("wheel",w)}},[we,me,de,u,ue,b,Be]);const Mo=w=>{me!==w.currentTarget.scrollTop&&!Wt?(dt(w.currentTarget.scrollTop),Pe(!0)):Pe(!1)},Do=w=>{de!==w.currentTarget.scrollLeft&&!Wt?(He(w.currentTarget.scrollLeft),Pe(!0)):Pe(!1)},Po=w=>{w.preventDefault();let L=me,D=de,$=!0;switch(w.key){case"Down":case"ArrowDown":L+=l,$=!1;break;case"Up":case"ArrowUp":L-=l,$=!1;break;case"Left":case"ArrowLeft":D-=R;break;case"Right":case"ArrowRight":D+=R;break}$?(D<0?D=0:D>ue&&(D=ue),He(D)):(L<0?L=0:L>Be-u&&(L=Be-u),dt(L)),Pe(!0)},Bo=w=>{const L=oe.find($=>$.id===w),D=oe.find($=>!!ct&&$.id===ct.id);q&&(D&&q(D,!1),L&&q(L,!0)),Co(L)},Fo=(w,L)=>{var $;const D=($=De==null?void 0:De.field)==null?void 0:$.data.find(Q=>Q.id===L.id+"");O&&L.children.length&&O(be(G({},D),{hideChildren:!w}))},Ao=w=>{No(w)},$o=w=>ne(this,null,function*(){go(w,zt,J,Le,Ie)}),Vo=w=>ne(this,null,function*(){ho(w,zt,J,Le,Ie)}),Io=w=>{var Q;const L=ut=>ut.reduce((Rt,We)=>We.children?Rt.concat([We,...L(We.children)]):Rt.concat(We),[]),D=L((Q=Le==null?void 0:Le.data)==null?void 0:Q.data),$=D==null?void 0:D.find(ut=>ut.id===+w.id);$&&(yo($),Xt(!0))},Lo={columnWidth:R,svgWidth:ue,tasks:_,rowHeight:l,dates:ce.dates,todayColor:at,rtl:b,selectedRowKeys:To},Eo={dateSetup:ce,locale:le,viewMode:re,headerHeight:i,columnWidth:R,fontFamily:ie,fontSize:he,rtl:b},ko={tasks:oe,dates:ce.dates,ganttEvent:ke,selectedTask:ct,rowHeight:l,taskHeight:lt,columnWidth:R,arrowColor:W,timeStep:E,fontFamily:ie,fontSize:he,arrowIndent:Me,svgWidth:ue,rtl:b,setGanttEvent:_t,setFailedTask:Ut,setSelectedTask:Bo,onDateChange:Vo,onProgressChange:J.progress&&$o,onDoubleClick:k,onClick:Io,onDelete:X};return c.jsxs("div",{className:N.cx(N.css`
|
|
237
|
+
}`})),lo=e=>{const{styles:t}=io(),{task:r,arrowIndent:o,isDelete:n,taskHeight:a,isSelected:i,rtl:s,onEventStart:l}=O({},e),u=g.useRef(null),[h,y]=g.useState(c.jsx("div",{})),[V,T]=g.useState(!0),b=r.typeInternal==="project";g.useEffect(()=>{switch(r.typeInternal){case"milestone":y(c.jsx(oo,O({},e)));break;case"project":y(c.jsx(so,O({},e)));break;case"smalltask":y(c.jsx(eo,O({},e)));break;default:y(c.jsx(Rr,O({},e)));break}},[r,i]),g.useEffect(()=>{u.current&&T(u.current.getBBox().width<r.x2-r.x1)},[u,r]);const A=()=>{const p=r.x2-r.x1,x=r.barChildren.length>0;return V?r.x1+p*.5:s&&u.current?r.x1-u.current.getBBox().width-o*+x-o*.2:r.x1+p+o*+x+o*.2};return c.jsxs("g",{className:M.cx(t.nbganttTaskitem),onKeyDown:p=>{switch(p.key){case"Delete":{n&&l("delete",r,p);break}}p.stopPropagation()},onMouseEnter:p=>{l("mouseenter",r,p)},onMouseLeave:p=>{l("mouseleave",r,p)},onDoubleClick:p=>{l("dblclick",r,p)},onClick:p=>{l("click",r,p)},onFocus:()=>{l("select",r)},children:[h,c.jsx("text",{x:b?r.x1:A(),y:b?r.y-8:r.y+a*.65,className:b?M.cx("projectLabel"):V?M.cx("barLabel"):M.cx("barLabelOutside"),ref:u,children:b&&Ce(r.start)&&Ce(r.end)?`${r.name}: ${Ce(r.start)} ~ ${Ce(r.end)}`:r.name})]})};let nt=null,Ae=null;const co=({tasks:e,dates:t,ganttEvent:r,selectedTask:o,rowHeight:n,columnWidth:a,timeStep:i,svg:s,taskHeight:l,arrowColor:u,arrowIndent:h,fontFamily:y,fontSize:V,rtl:T,setGanttEvent:b,setFailedTask:A,setSelectedTask:p,onDateChange:x,onProgressChange:S,onDoubleClick:N,onClick:w,onDelete:m})=>{var je;const f=(je=s==null?void 0:s.current)==null?void 0:je.createSVGPoint(),[v,P]=g.useState(0),[L,U]=g.useState(0),[ye,J]=g.useState(!1);g.useEffect(()=>{var G,_,X,ie;const B=((G=t[1])==null?void 0:G.getTime())-((_=t[0])==null?void 0:_.getTime())-((X=t[1])==null?void 0:X.getTimezoneOffset())*60*1e3+((ie=t[0])==null?void 0:ie.getTimezoneOffset())*60*1e3,k=i*a/B;P(k)},[a,t,i]),g.useEffect(()=>{const B=G=>ne(this,null,function*(){var Z;if(!r.changedTask||!f||!(s!=null&&s.current))return;G.preventDefault(),f.x=G.clientX;const _=f.matrixTransform((Z=s==null?void 0:s.current.getScreenCTM())==null?void 0:Z.inverse()),{isChanged:X,changedTask:ie}=vt(_.x,r.action,r.changedTask,v,i,L,T);X&&b({action:r.action,changedTask:ie})}),k=G=>ne(this,null,function*(){var Ve;const{action:_,originalSelectedTask:X,changedTask:ie}=r;if(!ie||!f||!(s!=null&&s.current)||!X)return;G.preventDefault(),f.x=G.clientX;const Z=f.matrixTransform((Ve=s==null?void 0:s.current.getScreenCTM())==null?void 0:Ve.inverse()),{changedTask:Y}=vt(Z.x,_,ie,v,i,L,T),Ne=X.start!==Y.start||X.end!==Y.end||X.progress!==Y.progress;s.current.removeEventListener("mousemove",B),s.current.removeEventListener("mouseup",k),b({action:""}),J(!1);let ve=!0;if((_==="move"||_==="end"||_==="start")&&x&&Ne)try{const le=yield x(Y,Y.barChildren);le!==void 0&&(ve=le)}catch(le){ve=!1}else if(S&&Ne)try{const le=yield S(Y,Y.barChildren);le!==void 0&&(ve=le)}catch(le){ve=!1}ve||A(X)});!ye&&(r.action==="move"||r.action==="end"||r.action==="start"||r.action==="progress")&&(s!=null&&s.current)&&(s.current.addEventListener("mousemove",B),s.current.addEventListener("mouseup",k),J(!0))},[r,v,L,S,i,x,s,ye,f,T,A,b]);const $e=(B,k,G)=>ne(this,null,function*(){var _;if(!G)B==="select"&&p(k.id);else if(Cr(G)){if(B==="delete"&&m)try{const X=yield m(k);X!==void 0&&X&&b({action:B,changedTask:k})}catch(X){console.error("Error on Delete. "+X)}}else if(B==="mouseenter")r.action||b({action:B,changedTask:k,originalSelectedTask:k});else if(B==="mouseleave")r.action==="mouseenter"&&setTimeout(()=>{b({action:""})},300);else if(B==="dblclick")N&&N(k);else if(B==="click")G.target.tagName==="rect"&&w&&w(k);else if(B==="move"){if(!(s!=null&&s.current)||!f)return;f.x=G.clientX;const X=f.matrixTransform((_=s.current.getScreenCTM())==null?void 0:_.inverse());U(X.x-k.x1),b({action:B,changedTask:k,originalSelectedTask:k})}else b({action:B,changedTask:k,originalSelectedTask:k})}),at=(B,k,G)=>{["click"].includes(B)?(!["start","end","progress"].includes(nt)&&(!Ae||Ae===k.start)&&$e(B,k,G),nt=null,Ae=null):["move","select"].includes(B)?(Ae=k.start,$e(B,k,G)):(Ae=k.start,nt=B,$e(B,k,G))};return c.jsxs("g",{className:"content",children:[c.jsx("g",{className:"arrows",fill:u,stroke:u,children:e.map(B=>B.barChildren.map(k=>c.jsx(Qr,{taskFrom:B,taskTo:e[k.index],rowHeight:n,taskHeight:l,arrowIndent:h,rtl:T},`Arrow from ${B.id} to ${e[k.index].id}`)))}),c.jsx("g",{className:"bar",fontFamily:y,fontSize:V,children:e.map(B=>c.jsx(lo,{task:B,arrowIndent:h,taskHeight:l,isProgressChangeable:!!S&&!B.isDisabled,isDateChangeable:!!x&&!B.isDisabled,isDelete:!B.isDisabled,onEventStart:at,isSelected:!!o&&B.id===o.id,rtl:T},B.id))})]})},Et=g.forwardRef(({gridProps:e,calendarProps:t,barProps:r,ganttHeight:o,scrollY:n,scrollX:a},i)=>{const s=g.useRef(null),l=g.useRef(null),u=ge(O({},r),{svg:s}),{styles:h}=Mt();return g.useEffect(()=>{l.current&&(l.current.scrollTop=n)},[n]),g.useEffect(()=>{i.current&&(i.current.scrollLeft=a)},[a]),c.jsxs("div",{className:h.ganttverticalcontainer,ref:i,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(jr,O({},t))}),c.jsx("div",{ref:l,className:h.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||3),fontFamily:r.fontFamily,ref:s,className:"ganttBody",children:[c.jsx(Wr,O({},e)),c.jsx(co,O({},u))]})})]})});Et.displayName="TaskGantt";const uo=(e,t)=>t/e>50?Math.floor(t/e)+20:50,po=g.createContext({close:()=>{}}),fo=e=>{const{visible:t,setVisible:r,record:o}=e,{t:n}=we.useTranslation(),a=d.useCollection(),i=d.useCollectionParentRecordData(),l=F.useFieldSchema().properties.detail,u=g.useCallback(()=>{r(!1)},[]);return l&&c.jsx(po.Provider,{value:{close:u},children:c.jsx(d.ActionContextProvider,{value:{visible:t,setVisible:r},children:c.jsx(d.RecordProvider,{record:o,parent:i,children:c.jsx(d.DeclareVariable,{name:"$nPopupRecord",title:n("Current popup record"),value:o,collection:a,children:c.jsx(F.RecursionField,{schema:l,name:l.name})})})})})},ho=ft.debounce((e,t,r,o,n)=>ne(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.start]:e.start,[r.end]:e.end}}),pt.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),go=ft.debounce((e,t,r,o,n)=>ne(this,null,function*(){yield t.update({filterByTk:e.id,values:{[r.progress]:e.progress/100}}),pt.message.success(n("Saved successfully")),yield o==null?void 0:o.refresh()}),300),Te=d.withDynamicSchemaProps(e=>{var Kt,Jt,Zt;const{styles:t}=Mt(),{token:r}=d.useToken(),o=d.useAPIClient(),n=(Kt=JSON.parse(o.auth.getOption("theme")))==null?void 0:Kt.uid,{listCellWidth:a="155px",ganttHeight:i=0,preStepsCount:s=1,barFill:l=60,barCornerRadius:u=r.borderRadiusXS,barProgressColor:h=r.colorPrimary,barProgressSelectedColor:y=r.colorPrimary,barBackgroundColor:V=r.colorPrimary,barBackgroundSelectedColor:T=r.colorPrimary,projectProgressColor:b=r.colorPrimary,projectProgressSelectedColor:A=r.colorPrimary,projectBackgroundColor:p=r.colorPrimary,projectBackgroundSelectedColor:x=r.colorPrimary,milestoneBackgroundColor:S="#f1c453",milestoneBackgroundSelectedColor:N="#f29e4c",rtl:w=!1,handleWidth:m=8,timeStep:f=3e5,arrowColor:v="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:U=20,todayColor:ye="rgba(252, 248, 227, 0.5)",viewDate:J,TooltipContent:$e=Pr,onDoubleClick:at,onDelete:je,onSelect:B,onExpanderClick:k,tasks:G,expandAndCollapseAll:_,fieldNames:X}=d.useProps(e),{designable:ie}=d.useDesignable(),Z=n.includes("compact")?45:ie?65:55,Y=n.includes("compact")?45:65,Ne=K(),ve=d.useCurrentAppInfo(),{t:Ve}=we.useTranslation(),le=(Jt=ve.data)==null?void 0:Jt.lang,st=d.useTableBlockContext(),{resource:Ht,service:Ie}=d.useBlockRequestContext(),Gt=F.useFieldSchema(),re=X.range||"day",Se=g.useRef(null),it=g.useRef(null),Ot=g.useRef(null),[ce,mo]=g.useState(()=>{const[C,E]=wt(G,re,s);return{viewMode:re,dates:Ct(C,E,re)}}),[bo,Xt]=g.useState(!1),[xo,yo]=g.useState({}),[Le,Yt]=g.useState(void 0),[qe,jt]=g.useState(0),[vo,So]=g.useState(0),[wo,qt]=g.useState(i),[oe,_e]=g.useState([]),[Ee,_t]=g.useState({action:""}),lt=g.useMemo(()=>Y*l/100,[Y,l]),[ct,Co]=g.useState(),[Ue,Ut]=g.useState(null),[he,dt]=g.useState(0),[de,ke]=g.useState(-1),[Wt,Me]=g.useState(!1),ee=uo(ce.dates.length,(Zt=Ot.current)==null?void 0:Zt.clientWidth),ue=ce.dates.length*ee,De=oe.length*Y,{expandFlag:Qt}=st,[To,No]=g.useState([]);g.useEffect(()=>{st.field.onExpandClick=Fo,st.field.onRowSelect=Ao},[]),g.useEffect(()=>{_==null||_(!Qt)},[Qt]),g.useEffect(()=>{let C;k?C=Tr(G):C=G,C=C.sort(Nr);const[E,D]=wt(C,re,s);let $=Ct(E,D,re);w&&($=$.reverse(),de===-1&&ke($.length*ee)),mo({dates:$,viewMode:re}),_e(ur(C,$,ee,Y,lt,u,m,w,h,y,V,T,b,A,p,x,S,N))},[G,re,s,Y,u,ee,lt,m,h,y,V,T,b,A,p,x,S,N,w,de]),g.useEffect(()=>{if(re===ce.viewMode&&(J&&!Le||J&&(Le==null?void 0:Le.valueOf())!==J.valueOf())){const C=ce.dates,E=C.findIndex((D,$)=>J.valueOf()>=D.valueOf()&&$+1!==C.length&&J.valueOf()<C[$+1].valueOf());if(E===-1)return;Yt(J),ke(ee*E)}},[J,ee,ce.dates,ce.viewMode,re,Le,Yt]),g.useEffect(()=>{const{changedTask:C,action:E}=Ee;if(C){if(E==="delete")_t({action:""}),_e(oe.filter(D=>D.id!==C.id));else if(E==="move"||E==="end"||E==="start"||E==="progress"){const D=oe.find($=>$.id===C.id);if(D&&D.start&&D.end&&(D.start.getTime()!==C.start.getTime()||D.end.getTime()!==C.end.getTime()||D.progress!==C.progress)){const $=oe.map(Q=>Q.id===C.id?C:Q);_e($)}}}},[Ee,oe]),g.useEffect(()=>{Ue&&(_e(oe.map(C=>C.id!==Ue.id?C:Ue)),Ut(null))},[Ue,oe]),g.useEffect(()=>{a||jt(0),it.current&&jt(it.current.offsetWidth)},[it,a]),g.useEffect(()=>{Se.current&&So(Se.current.offsetWidth-qe)},[Se,qe]),g.useEffect(()=>{qt(i?i+Z:G.length*Y+Z)},[i,G,Z,Y]),g.useEffect(()=>{var E;const C=D=>{if(D.shiftKey||D.deltaX){const $=D.deltaX?D.deltaX:D.deltaY;let Q=de+$;Q<0?Q=0:Q>ue&&(Q=ue),ke(Q),D.preventDefault()}else if(i){let $=he+D.deltaY;$<0?$=0:$>De-i&&($=De-i),$!==he&&(dt($),D.preventDefault())}Me(!0)};return(E=Se.current)==null||E.addEventListener("wheel",C,{passive:!1}),()=>{var D;(D=Se.current)==null||D.removeEventListener("wheel",C)}},[Se,he,de,i,ue,w,De]);const Mo=C=>{he!==C.currentTarget.scrollTop&&!Wt?(dt(C.currentTarget.scrollTop),Me(!0)):Me(!1)},Do=C=>{de!==C.currentTarget.scrollLeft&&!Wt?(ke(C.currentTarget.scrollLeft),Me(!0)):Me(!1)},Po=C=>{C.preventDefault();let E=he,D=de,$=!0;switch(C.key){case"Down":case"ArrowDown":E+=Y,$=!1;break;case"Up":case"ArrowUp":E-=Y,$=!1;break;case"Left":case"ArrowLeft":D-=ee;break;case"Right":case"ArrowRight":D+=ee;break}$?(D<0?D=0:D>ue&&(D=ue),ke(D)):(E<0?E=0:E>De-i&&(E=De-i),dt(E)),Me(!0)},Bo=C=>{const E=oe.find($=>$.id===C),D=oe.find($=>!!ct&&$.id===ct.id);B&&(D&&B(D,!1),E&&B(E,!0)),Co(E)},Fo=(C,E)=>{var $;const D=($=Ne==null?void 0:Ne.field)==null?void 0:$.data.find(Q=>Q.id===E.id+"");k&&E.children.length&&k(ge(O({},D),{hideChildren:!C}))},Ao=C=>{No(C)},$o=C=>ne(this,null,function*(){go(C,Ht,X,Ie,Ve)}),Vo=C=>ne(this,null,function*(){ho(C,Ht,X,Ie,Ve)}),Io=C=>{var Q;const E=ut=>ut.reduce((Rt,We)=>We.children?Rt.concat([We,...E(We.children)]):Rt.concat(We),[]),D=E((Q=Ie==null?void 0:Ie.data)==null?void 0:Q.data),$=D==null?void 0:D.find(ut=>ut.id===+C.id);$&&(yo($),Xt(!0))},Lo={columnWidth:ee,svgWidth:ue,tasks:G,rowHeight:Y,dates:ce.dates,todayColor:ye,rtl:w,selectedRowKeys:To},Eo={dateSetup:ce,locale:le,viewMode:re,headerHeight:Z,columnWidth:ee,fontFamily:P,fontSize:L,rtl:w},ko={tasks:oe,dates:ce.dates,ganttEvent:Ee,selectedTask:ct,rowHeight:Y,taskHeight:lt,columnWidth:ee,arrowColor:v,timeStep:f,fontFamily:P,fontSize:L,arrowIndent:U,svgWidth:ue,rtl:w,setGanttEvent:_t,setFailedTask:Ut,setSelectedTask:Bo,onDateChange:Vo,onProgressChange:X.progress&&$o,onDoubleClick:at,onClick:Io,onDelete:je};return c.jsxs("div",{className:M.cx(M.css`
|
|
238
238
|
.ant-table-container::after {
|
|
239
239
|
box-shadow: none !important;
|
|
240
240
|
}
|
|
241
241
|
.ant-table-row {
|
|
242
|
-
height: ${
|
|
242
|
+
height: ${Y}px;
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
.ant-table-thead {
|
|
245
|
+
height: ${Z}px;
|
|
246
|
+
}
|
|
247
|
+
`),children:[c.jsx(fo,{visible:bo,setVisible:Xt,record:xo}),c.jsx(F.RecursionField,{name:"anctionBar",schema:Gt.properties.toolBar}),c.jsx(F.RecursionField,{name:"table",schema:Gt.properties.table}),c.jsxs("div",{className:t.wrapper,onKeyDown:Po,tabIndex:0,ref:Se,children:[c.jsx(Et,{gridProps:Lo,calendarProps:Eo,barProps:ko,ganttHeight:i,scrollY:he,scrollX:de,ref:Ot}),Ee.changedTask&&c.jsx(Dr,{arrowIndent:U,rowHeight:Y,svgContainerHeight:wo,svgContainerWidth:vo,fontFamily:P,fontSize:L,scrollX:de,scrollY:he,task:Ee.changedTask,headerHeight:Z,taskListWidth:qe,TooltipContent:$e,rtl:w,svgWidth:ue}),c.jsx(Br,{ganttFullHeight:De,ganttHeight:i,headerHeight:Z,scroll:he,onScroll:Mo,rtl:w}),c.jsx(Mr,{svgWidth:ue,taskListWidth:qe,scroll:de,rtl:w,onScroll:Do})]})]})});Te.ActionBar=d.ActionBar,Te.ViewMode=z,Te.Designer=rr,Te.Event=dr;const kt=g.memo(e=>c.jsx(d.SchemaComponentOptions,{components:{Gantt:Te,GanttBlockInitializer:cr,GanttBlockProvider:nr},scope:{useGanttBlockProps:ht},children:e.children}));kt.displayName="GanttProvider";class zt extends d.Plugin{load(){return ne(this,null,function*(){this.app.use(kt),this.app.schemaSettingsManager.add(ar),this.app.schemaSettingsManager.add(sr),this.app.schemaInitializerManager.add(gt),this.app.schemaInitializerManager.add(ir);const t=this.app.schemaInitializerManager.get("page:addBlock");t==null||t.add("dataBlocks.gantt",{title:"{{t('Gantt')}}",Component:"GanttBlockInitializer"}),this.app.addScopes({useGanttBlockProps:ht})})}}I.Gantt=Te,I.PluginGanttClient=zt,I.default=zt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
2
|
+
"@nocobase/client": "1.0.0-alpha.1",
|
|
3
3
|
"react": "18.2.0",
|
|
4
4
|
"@formily/react": "2.3.0",
|
|
5
5
|
"@ant-design/icons": "5.2.6",
|
|
@@ -7,10 +7,10 @@ module.exports = {
|
|
|
7
7
|
"react-i18next": "11.18.6",
|
|
8
8
|
"lodash": "4.17.21",
|
|
9
9
|
"@formily/shared": "2.3.0",
|
|
10
|
-
"@nocobase/server": "0.
|
|
11
|
-
"@nocobase/test": "0.
|
|
10
|
+
"@nocobase/server": "1.0.0-alpha.1",
|
|
11
|
+
"@nocobase/test": "1.0.0-alpha.1",
|
|
12
12
|
"@emotion/css": "11.11.2",
|
|
13
13
|
"antd-style": "3.4.5",
|
|
14
14
|
"antd": "5.12.8",
|
|
15
|
-
"@nocobase/utils": "0.
|
|
15
|
+
"@nocobase/utils": "1.0.0-alpha.1"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-gantt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"displayName": "Block: Gantt",
|
|
5
5
|
"displayName.zh-CN": "区块:甘特图",
|
|
6
6
|
"description": "Provides Gantt block.",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"antd-style": "3.4.5"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@nocobase/client": "
|
|
17
|
-
"@nocobase/server": "
|
|
18
|
-
"@nocobase/test": "
|
|
16
|
+
"@nocobase/client": "1.x",
|
|
17
|
+
"@nocobase/server": "1.x",
|
|
18
|
+
"@nocobase/test": "1.x"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "c73b6d2032a6151fdfeebeb0ec923d766578c53c",
|
|
21
21
|
"keywords": [
|
|
22
22
|
"Blocks"
|
|
23
23
|
]
|