@nocobase/plugin-kanban 1.3.53 → 1.3.55
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 +1 -1
- package/dist/externalVersion.js +4 -4
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -312,4 +312,4 @@ Error generating stack: `+i.message+`
|
|
|
312
312
|
// color: #8c8c8c;
|
|
313
313
|
// fontweight: normal;
|
|
314
314
|
// }
|
|
315
|
-
`,Ks=D.memo(J.RecursionField);Ks.displayName="MemorizedRecursionField";const lI=J.observer(()=>{const e=I.useCollection(),{setDisableCardDrag:r}=D.useContext(Ws)||{},n=J.useFieldSchema(),{openPopup:t,getPopupSchemaFromSchema:o}=I.usePopupUtils(),i=I.useCollectionRecordData(),a=o(n)||uI(n),[l,u]=D.useState(!1),{isPopupVisibleControlledByURL:s}=I.usePopupSettings(),f=D.useCallback(w=>{const g=w.target;w.currentTarget.contains(g)&&(s()?t({popupUidUsedInURL:a==null?void 0:a["x-uid"]}):u(!0)),w.stopPropagation()},[t,a]),c=D.useMemo(()=>({cursor:"pointer",overflow:"hidden"}),[]),d=D.useMemo(()=>sm.createForm({values:i}),[i]),p=D.useCallback(()=>{r==null||r(!0)},[r]),h=D.useCallback(()=>{r==null||r(!1)},[r]),y=D.useMemo(()=>({type:"void",properties:{drawer:a}}),[a]);return b.jsxs(b.Fragment,{children:[b.jsx(Re.Card,{onClick:f,bordered:!1,hoverable:!0,style:c,className:aI,children:b.jsx(I.DndContext,{onDragStart:p,onDragEnd:h,children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.FormProvider,{form:d,children:b.jsx(Ks,{schema:n,onlyRenderProperties:!0})})})})}),b.jsx(I.PopupContextProvider,{visible:l,setVisible:u,children:b.jsx(I.VariablePopupRecordProvider,{recordData:i,collection:e,children:b.jsx(Ks,{schema:y})})})]})},{displayName:"KanbanCard"});function uI(e){var n,t,o,i;return(i=(o=(t=(n=e.parent)==null?void 0:n.properties)==null?void 0:t.cardViewer)==null?void 0:o.properties)!=null&&i.drawer?e.parent.properties.cardViewer.properties.drawer:Qg(e["x-uid"],e.root).parent.properties.cardViewer.properties.drawer}function Qg(e,r,n={value:null}){return n=n||{value:null},r.mapProperties(t=>{t["x-uid"]===e?n.value=t:Qg(e,t,n)}),n.value}const sI=e=>(e["x-read-pretty"]=!0,{type:"void","x-component":"Grid.Row",properties:{[Oo.uid()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||Oo.uid()]:e}}}}),cI=()=>{const{designable:e}=I.useDesignable(),{render:r}=I.useSchemaInitializerRender("kanban:configureItemFields");return e?b.jsx("div",{className:"general-schema-designer",children:b.jsx("div",{className:"general-schema-designer-icons",children:b.jsx(Re.Space,{size:2,align:"center",children:r()})})}):null},Yg={wrap:sI,useInsert(){const e=J.useFieldSchema(),{t:r}=pt.useTranslation(),n=I.useAPIClient(),{refresh:t}=I.useDesignable();return o=>{const i=e.reduceProperties((l,u)=>u["x-component"]==="Grid"?u:l,null);if(!i)return;const a=I.createDesignable({t:r,api:n,refresh:t,current:i});a.loadAPIClientEvents(),a.insertBeforeEnd(o)}},Component:e=>{const{getAriaLabel:r}=I.useGetAriaLabelOfDesigner();return b.jsx(ec.MenuOutlined,$(F({},e),{role:"button","aria-label":r("schema-initializer"),style:{cursor:"pointer",fontSize:12}}))},items:[{type:"itemGroup",title:'{{t("Display fields")}}',name:"displayFields",useChildren:I.useFormItemInitializerFields},{type:"itemGroup",divider:!0,title:'{{t("Display association fields")}}',name:"displayAssociationFields",hideIfNoChildren:!0,useChildren(){return I.useAssociatedFormItemInitializerFields({readPretty:!0,block:"Kanban"})}},{name:"divider",type:"divider"},{name:"openMode",Component:I.SchemaInitializerOpenModeSchemaItems,useComponentProps(){const{hideOpenMode:e}=I.useOpenModeContext();return{openMode:!e,openSize:!e}}}]},Xg=new I.CompatibleSchemaInitializer(F({name:"KanbanCardInitializers"},Yg)),dI=new I.CompatibleSchemaInitializer(F({name:"kanban:configureItemFields"},Yg),Xg),fI=J.observer(e=>e.children,{displayName:"KanbanCardViewer"}),pI=()=>{const{name:e,title:r}=I.useCollection_deprecated(),n=I.useSchemaTemplate();return b.jsx(I.GeneralSchemaDesigner,{schemaSettings:"blockSettings:kanban",template:n,title:r||e})},vI=new I.SchemaSettings({name:"blockSettings:kanban",items:[{name:"title",Component:I.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:I.SchemaSettingsBlockHeightItem},{name:"dataScope",Component:I.SchemaSettingsDataScope,useComponentProps(){var a,l;const{name:e}=I.useCollection_deprecated(),r=J.useFieldSchema(),{form:n}=I.useFormBlockContext(),t=J.useField(),{service:o}=ka(),{dn:i}=I.useDesignable();return{collectionName:e,defaultFilter:((l=(a=r==null?void 0:r["x-decorator-props"])==null?void 0:a.params)==null?void 0:l.filter)||{},form:n,onSubmit:({filter:u})=>{var f;u=I.removeNullCondition(u);const s=t.decoratorProps.params||{};s.filter=u,t.decoratorProps.params=s,r["x-decorator-props"].params=s,o.run($(F({},(f=o.params)==null?void 0:f[0]),{filter:u})),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":r["x-decorator-props"]}})}}}},{name:"template",Component:I.SchemaSettingsTemplate,useComponentProps(){const{name:e}=I.useCollection(),{componentNamePrefix:r}=I.useBlockTemplateContext();return{componentName:`${r}Kanban`,collectionName:e}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),Jg={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>I.useActionAvailable("create")}]},Zg=new I.CompatibleSchemaInitializer(F({name:"KanbanActionInitializers"},Jg)),gI=new I.CompatibleSchemaInitializer(F({name:"kanban:configureActions"},Jg),Zg),Po="kanban",mI=e=>{const g=e,{sortFields:r,collectionFields:n,groupField:t,collectionName:o,dataSource:i}=g,a=Fa(g,["sortFields","collectionFields","groupField","collectionName","dataSource"]),l=J.useField(),u=I.useCompile(),s=I.useAPIClient(),{t:f}=pt.useTranslation(),{theme:c}=I.useGlobalTheme(),d=D.useContext(J.SchemaOptionsContext),p=n==null?void 0:n.filter(v=>v.interface==="integer"),h=({scopeKey:v})=>{var C;const m=v&&n.find(x=>x.name===v),S=v&&u((C=m==null?void 0:m.uiSchema)==null?void 0:C.title);return b.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.25)"},children:["(",S?f("Grouped sorting based on",{ns:Po})+`「${S}」`:f("Global sorting",{ns:Po}),")"]})},y=()=>hr(this,null,function*(){var S;const v=yield I.FormDialog(f("Create sort field"),()=>b.jsx(I.SchemaComponentOptions,{scope:d.scope,components:F({},d.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),c).open({initialValues:{name:`f_${Oo.uid()}`}}),{data:m}=yield s.resource("collections.fields",o).create({values:F({type:"sort",interface:"sort"},v)});l.dataSource=l.dataSource.concat([$(F({},m.data),{value:m.data.name,label:u((S=m.data.uiSchema)==null?void 0:S.title)})]),l.value=m.data.name}),w=()=>hr(this,null,function*(){var C;const v=yield I.FormDialog(f("Create sort field"),()=>b.jsx(I.SchemaComponentOptions,{scope:d.scope,components:F({},d.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{field:{type:"string",title:f("Convert the following integer fields to sorting fields",{ns:Po}),required:!0,"x-decorator":"FormItem","x-component":"Select",enum:p.map(x=>{var E;return{value:x.name,label:u(((E=x.uiSchema)==null?void 0:E.title)||x.name)}})},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),c).open({initialValues:{}}),{data:m}=yield s.request({url:`dataSourcesCollections/${i}.${o}/fields:update?filterByTk=${v.field}`,method:"post",data:F({type:"sort",interface:"sort"},v)}),S=m.data;l.dataSource=l.dataSource.concat([$(F({},S),{value:S.name,label:u((C=S.uiSchema)==null?void 0:C.title)})]),l.value=S.name});return b.jsxs(Re.Space.Compact,{style:{width:"100%"},children:[b.jsx(I.Select,$(F({options:r},a),{disabled:!t,optionRender:({label:v,data:m})=>b.jsxs(Re.Space,{children:[b.jsx("span",{children:v}),b.jsx(h,{scopeKey:m.scopeKey})]})})),b.jsx(Re.Button,{disabled:!t,onClick:i==="main"?y:w,children:f("Add new")})]})},em=e=>{const{collectionName:r,groupField:n,sortField:t,dataSource:o,params:i,association:a}=e,l={type:"void","x-acl-action":`${a||r}:list`,"x-decorator":"KanbanBlockProvider","x-decorator-props":{collection:r,dataSource:o,action:"list",groupField:n,sortField:t,params:F({paginate:!1},i)},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:kanban","x-component":"CardItem",properties:{actions:{type:"void","x-initializer":"kanban:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{}},[Oo.uid()]:{type:"array","x-component":"Kanban","x-use-component-props":"useKanbanBlockProps",properties:{card:{type:"void","x-read-pretty":!0,"x-label-disabled":!0,"x-decorator":"BlockItem","x-component":"Kanban.Card","x-component-props":{openMode:"drawer"},"x-designer":"Kanban.Card.Designer",properties:{grid:{type:"void","x-component":"Grid","x-component-props":{dndContext:!1}}}},cardViewer:{type:"void",title:'{{ t("View") }}',"x-designer":"Action.Designer","x-component":"Kanban.CardViewer","x-action":"view","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("View record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{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",properties:{}}}}}}}}}}}}}};return a&&(l["x-decorator-props"].association=a),l},rm=({item:e,sortFields:r,collectionFields:n,fields:t,options:o,api:i})=>{const a=J.useForm(),{t:l}=pt.useTranslation();return b.jsx(I.APIClientProvider,{apiClient:i,children:b.jsx(I.SchemaComponentOptions,{scope:F({},o==null?void 0:o.scope),components:F({},o==null?void 0:o.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{groupField:{title:l("Grouping field"),enum:t,required:!0,description:l("Single select and radio fields can be used as the grouping field"),"x-component":"Select","x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},onChange:()=>{a.setValuesIn("dragSortBy",null)}},"x-decorator":"FormItem"},dragSortBy:{title:l("Sorting field",{ns:Po}),required:!0,description:l("Used for sorting kanban cards, only sorting fields corresponding to grouping fields can be selected",{ns:Po}),"x-component":mI,"x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},sortFields:r},"x-decorator":"FormItem","x-reactions":[u=>{var s;u.dataSource=r.map(f=>{var c,d;return $(F({},f),{disabled:f.scopeKey!==((d=(c=u.form.values)==null?void 0:c.groupField)==null?void 0:d.value)})}),u.groupField=(s=u.form.values)==null?void 0:s.groupField,u.setComponentProps({dataSource:e.dataSource,collectionName:e.collectionName||e.name,collectionFields:n,sortFields:r})},{dependencies:[".groupField"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}]}}}})})})})},hI=({filterCollections:e,onlyCurrentDataSource:r,hideSearch:n,createBlockSchema:t,showAssociationFields:o})=>{const i=I.useSchemaInitializerItem(),{createKanbanBlock:a}=nm();return b.jsx(I.DataBlockInitializer,$(F({},i),{componentType:"Kanban",icon:b.jsx(ec.FormOutlined,{}),onCreateBlockSchema:l=>hr(this,null,function*(){if(t)return t(l);a(l)}),onlyCurrentDataSource:r,hideSearch:n,filter:e,showAssociationFields:o}))},nm=()=>{const{insert:e}=I.useSchemaInitializer(),{t:r}=pt.useTranslation(),{getCollectionFields:n}=I.useCollectionManager_deprecated(),t=D.useContext(J.SchemaOptionsContext),{theme:o}=I.useGlobalTheme(),i=I.useAPIClient();return{createKanbanBlock:u=>hr(this,[u],function*({item:l}){var p,h;const s=n(l.name,l.dataSource),f=(p=s==null?void 0:s.filter(y=>["select","radioGroup"].includes(y.interface)))==null?void 0:p.map(y=>{var w;return{label:(w=y==null?void 0:y.uiSchema)==null?void 0:w.title,value:y.name,uiSchema:$(F({},y.uiSchema),{name:y.name})}}),c=(h=s==null?void 0:s.filter(y=>["sort"].includes(y.interface)))==null?void 0:h.map(y=>{var w;return{label:(w=y==null?void 0:y.uiSchema)==null?void 0:w.title,value:y.name,scopeKey:y.scopeKey,uiSchema:$(F({},y.uiSchema),{name:y.name})}}),d=yield I.FormDialog(r("Create kanban block"),b.jsx(rm,{item:l,sortFields:c,collectionFields:s,fields:f,options:t,api:i}),o).open({initialValues:{}});e(em({sortField:d.dragSortBy,groupField:d.groupField.value,collectionName:l.name,dataSource:l.dataSource,params:{sort:[d.dragSortBy]}}))})}};function yI(){const{insert:e}=I.useSchemaInitializer(),{t:r}=pt.useTranslation(),n=D.useContext(J.SchemaOptionsContext),{theme:t}=I.useGlobalTheme(),{getCollectionFields:o}=I.useCollectionManager_deprecated(),i=I.useAPIClient();return{createAssociationKanbanBlock:u=>hr(this,[u],function*({item:l}){var h,y;console.log(l);const s=l.associationField,f=o(l.name,l.dataSource),c=(h=f==null?void 0:f.filter(w=>["select","radioGroup"].includes(w.interface)))==null?void 0:h.map(w=>{var g;return{label:(g=w==null?void 0:w.uiSchema)==null?void 0:g.title,value:w.name,uiSchema:$(F({},w.uiSchema),{name:w.name})}}),d=(y=f==null?void 0:f.filter(w=>["sort"].includes(w.interface)))==null?void 0:y.map(w=>{var g;return{label:(g=w==null?void 0:w.uiSchema)==null?void 0:g.title,value:w.name,scopeKey:w.scopeKey,uiSchema:$(F({},w.uiSchema),{name:w.name})}}),p=yield I.FormDialog(r("Create kanban block"),b.jsx(rm,{item:l,sortFields:d,collectionFields:f,fields:c,options:n,api:i}),t).open({initialValues:{}});e(em({sortField:p.dragSortBy,groupField:p.groupField.value,association:`${s.collectionName}.${s.name}`,dataSource:l.dataSource,params:{sort:[p.dragSortBy]}}))})}}En.Card=lI,En.CardAdder=I.Action,En.CardViewer=fI,En.Card.Designer=cI,En.Designer=pI;const SI=En,tm=D.memo(e=>b.jsx(I.SchemaComponentOptions,{components:{Kanban:En,KanbanBlockProvider:TE,KanbanV2:SI,KanbanBlockInitializer:hI},scope:{useKanbanBlockProps:ME},children:e.children}));tm.displayName="KanbanPluginProvider";class wI extends I.Plugin{load(){return hr(this,null,function*(){this.app.use(tm),this.app.schemaInitializerManager.add(Xg),this.app.schemaInitializerManager.add(dI),this.app.schemaInitializerManager.add(Zg),this.app.schemaInitializerManager.add(gI),this.app.schemaSettingsManager.add(vI);const r=this.app.schemaInitializerManager.get("page:addBlock");r==null||r.add("dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer",useComponentProps(){const{createAssociationKanbanBlock:n}=yI(),{createKanbanBlock:t}=nm();return{onlyCurrentDataSource:!0,filterCollections({associationField:o}){return o?["hasMany","belongsToMany"].includes(o.type):!1},createBlockSchema:({item:o,fromOthersInPopup:i})=>{if(i)return t({item:o});n({item:o})},showAssociationFields:!0,hideSearch:!0}}})})}}j.default=wI,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
315
|
+
`,Ks=D.memo(J.RecursionField);Ks.displayName="MemorizedRecursionField";const lI=J.observer(()=>{const e=I.useCollection(),{setDisableCardDrag:r}=D.useContext(Ws)||{},n=J.useFieldSchema(),{openPopup:t,getPopupSchemaFromSchema:o}=I.usePopupUtils(),i=I.useCollectionRecordData(),a=o(n)||uI(n),[l,u]=D.useState(!1),{isPopupVisibleControlledByURL:s}=I.usePopupSettings(),f=D.useCallback(w=>{const g=w.target;w.currentTarget.contains(g)&&(s()?t({popupUidUsedInURL:a==null?void 0:a["x-uid"]}):u(!0)),w.stopPropagation()},[t,a]),c=D.useMemo(()=>({cursor:"pointer",overflow:"hidden"}),[]),d=D.useMemo(()=>sm.createForm({values:i}),[i]),p=D.useCallback(()=>{r==null||r(!0)},[r]),h=D.useCallback(()=>{r==null||r(!1)},[r]),y=D.useMemo(()=>({type:"void",properties:{drawer:a}}),[a]);return b.jsxs(b.Fragment,{children:[b.jsx(Re.Card,{onClick:f,bordered:!1,hoverable:!0,style:c,className:aI,children:b.jsx(I.DndContext,{onDragStart:p,onDragEnd:h,children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.FormProvider,{form:d,children:b.jsx(Ks,{schema:n,onlyRenderProperties:!0})})})})}),b.jsx(I.PopupContextProvider,{visible:l,setVisible:u,children:b.jsx(I.VariablePopupRecordProvider,{recordData:i,collection:e,children:b.jsx(Ks,{schema:y})})})]})},{displayName:"KanbanCard"});function uI(e){var n,t,o,i;return(i=(o=(t=(n=e.parent)==null?void 0:n.properties)==null?void 0:t.cardViewer)==null?void 0:o.properties)!=null&&i.drawer?e.parent.properties.cardViewer.properties.drawer:Qg(e["x-uid"],e.root).parent.properties.cardViewer.properties.drawer}function Qg(e,r,n={value:null}){return n=n||{value:null},r.mapProperties(t=>{t["x-uid"]===e?n.value=t:Qg(e,t,n)}),n.value}const sI=e=>(e["x-read-pretty"]=!0,{type:"void","x-component":"Grid.Row",properties:{[Oo.uid()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||Oo.uid()]:e}}}}),cI=()=>{const{designable:e}=I.useDesignable(),{render:r}=I.useSchemaInitializerRender("kanban:configureItemFields");return e?b.jsx("div",{className:"general-schema-designer",children:b.jsx("div",{className:"general-schema-designer-icons",children:b.jsx(Re.Space,{size:2,align:"center",children:r()})})}):null},Yg={wrap:sI,useInsert(){const e=J.useFieldSchema(),{t:r}=pt.useTranslation(),n=I.useAPIClient(),{refresh:t}=I.useDesignable();return o=>{const i=e.reduceProperties((l,u)=>u["x-component"]==="Grid"?u:l,null);if(!i)return;const a=I.createDesignable({t:r,api:n,refresh:t,current:i});a.loadAPIClientEvents(),a.insertBeforeEnd(o)}},Component:e=>{const{getAriaLabel:r}=I.useGetAriaLabelOfDesigner();return b.jsx(ec.MenuOutlined,$(F({},e),{role:"button","aria-label":r("schema-initializer"),style:{cursor:"pointer",fontSize:12}}))},items:[{type:"itemGroup",title:'{{t("Display fields")}}',name:"displayFields",useChildren:I.useFormItemInitializerFields},{type:"itemGroup",divider:!0,title:'{{t("Display association fields")}}',name:"displayAssociationFields",hideIfNoChildren:!0,useChildren(){return I.useAssociatedFormItemInitializerFields({readPretty:!0,block:"Kanban"})}},{name:"divider",type:"divider"},{name:"openMode",Component:I.SchemaInitializerOpenModeSchemaItems,useComponentProps(){const{hideOpenMode:e}=I.useOpenModeContext();return{openMode:!e,openSize:!e}}}]},Xg=new I.CompatibleSchemaInitializer(F({name:"KanbanCardInitializers"},Yg)),dI=new I.CompatibleSchemaInitializer(F({name:"kanban:configureItemFields"},Yg),Xg),fI=J.observer(e=>e.children,{displayName:"KanbanCardViewer"}),pI=()=>{const{name:e,title:r}=I.useCollection_deprecated(),n=I.useSchemaTemplate();return b.jsx(I.GeneralSchemaDesigner,{schemaSettings:"blockSettings:kanban",template:n,title:r||e})},vI=new I.SchemaSettings({name:"blockSettings:kanban",items:[{name:"title",Component:I.SchemaSettingsBlockTitleItem},{name:"setTheBlockHeight",Component:I.SchemaSettingsBlockHeightItem},{name:"dataScope",Component:I.SchemaSettingsDataScope,useComponentProps(){var a,l;const{name:e}=I.useCollection_deprecated(),r=J.useFieldSchema(),{form:n}=I.useFormBlockContext(),t=J.useField(),{service:o}=ka(),{dn:i}=I.useDesignable();return{collectionName:e,defaultFilter:((l=(a=r==null?void 0:r["x-decorator-props"])==null?void 0:a.params)==null?void 0:l.filter)||{},form:n,onSubmit:({filter:u})=>{var f;u=I.removeNullCondition(u);const s=t.decoratorProps.params||{};s.filter=u,t.decoratorProps.params=s,r["x-decorator-props"].params=s,o.run($(F({},(f=o.params)==null?void 0:f[0]),{filter:u})),i.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":r["x-decorator-props"]}})}}}},{name:"template",Component:I.SchemaSettingsTemplate,useComponentProps(){const{name:e}=I.useCollection(),{componentNamePrefix:r}=I.useBlockTemplateContext();return{componentName:`${r}Kanban`,collectionName:e}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),Jg={title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{name:"filter",title:"{{t('Filter')}}",Component:"FilterActionInitializer",schema:{"x-align":"left"}},{name:"addNew",title:"{{t('Add new')}}",Component:"CreateActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:()=>I.useActionAvailable("create")}]},Zg=new I.CompatibleSchemaInitializer(F({name:"KanbanActionInitializers"},Jg)),gI=new I.CompatibleSchemaInitializer(F({name:"kanban:configureActions"},Jg),Zg),Po="kanban",mI=e=>{const g=e,{sortFields:r,collectionFields:n,groupField:t,collectionName:o,dataSource:i}=g,a=Fa(g,["sortFields","collectionFields","groupField","collectionName","dataSource"]),l=J.useField(),u=I.useCompile(),s=I.useAPIClient(),{t:f}=pt.useTranslation(),{theme:c}=I.useGlobalTheme(),d=D.useContext(J.SchemaOptionsContext),p=n==null?void 0:n.filter(v=>v.interface==="integer"),h=({scopeKey:v})=>{var C;const m=v&&n.find(x=>x.name===v),S=v&&u((C=m==null?void 0:m.uiSchema)==null?void 0:C.title);return b.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.25)"},children:["(",S?f("Grouped sorting based on",{ns:Po})+`「${S}」`:f("Global sorting",{ns:Po}),")"]})},y=()=>hr(this,null,function*(){var S;const v=yield I.FormDialog(f("Create sort field"),()=>b.jsx(I.SchemaComponentOptions,{scope:d.scope,components:F({},d.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{"uiSchema.title":{type:"string",title:'{{t("Field display name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:'{{t("Field name")}}',required:!0,"x-decorator":"FormItem","x-component":"Input","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),c).open({initialValues:{name:`f_${Oo.uid()}`}}),{data:m}=yield s.resource("collections.fields",o).create({values:F({type:"sort",interface:"sort"},v)});l.dataSource=l.dataSource.concat([$(F({},m.data),{value:m.data.name,label:u((S=m.data.uiSchema)==null?void 0:S.title)})]),l.value=m.data.name}),w=()=>hr(this,null,function*(){var C;const v=yield I.FormDialog(f("Create sort field"),()=>b.jsx(I.SchemaComponentOptions,{scope:d.scope,components:F({},d.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{field:{type:"string",title:f("Convert the following integer fields to sorting fields",{ns:Po}),required:!0,"x-decorator":"FormItem","x-component":"Select",enum:p.map(x=>{var E;return{value:x.name,label:u(((E=x.uiSchema)==null?void 0:E.title)||x.name)}})},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),c).open({initialValues:{}}),{data:m}=yield s.request({url:`dataSourcesCollections/${i}.${o}/fields:update?filterByTk=${v.field}`,method:"post",data:F({type:"sort",interface:"sort"},v)}),S=m.data;l.dataSource=l.dataSource.concat([$(F({},S),{value:S.name,label:u((C=S.uiSchema)==null?void 0:C.title)})]),l.value=S.name});return b.jsxs(Re.Space.Compact,{style:{width:"100%"},children:[b.jsx(I.Select,$(F({options:r},a),{disabled:!t,optionRender:({label:v,data:m})=>b.jsxs(Re.Space,{children:[b.jsx("span",{children:v}),b.jsx(h,{scopeKey:m.scopeKey})]})})),b.jsx(Re.Button,{disabled:!t,onClick:i==="main"?y:w,children:f("Add new")})]})},em=e=>{const{collectionName:r,groupField:n,sortField:t,dataSource:o,params:i,association:a}=e,l={type:"void","x-acl-action":`${a||r}:list`,"x-decorator":"KanbanBlockProvider","x-decorator-props":{collection:r,dataSource:o,action:"list",groupField:n,sortField:t,params:F({paginate:!1},i)},"x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:kanban","x-component":"CardItem",properties:{actions:{type:"void","x-initializer":"kanban:configureActions","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{}},[Oo.uid()]:{type:"array","x-component":"Kanban","x-use-component-props":"useKanbanBlockProps",properties:{card:{type:"void","x-read-pretty":!0,"x-label-disabled":!0,"x-decorator":"BlockItem","x-component":"Kanban.Card","x-component-props":{openMode:"drawer"},"x-designer":"Kanban.Card.Designer",properties:{grid:{type:"void","x-component":"Grid","x-component-props":{dndContext:!1}}}},cardViewer:{type:"void",title:'{{ t("View") }}',"x-designer":"Action.Designer","x-component":"Kanban.CardViewer","x-action":"view","x-component-props":{openMode:"drawer"},properties:{drawer:{type:"void",title:'{{ t("View record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{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",properties:{}}}}}}}}}}}}}};return a&&(l["x-decorator-props"].association=a),l},rm=({item:e,sortFields:r,collectionFields:n,fields:t,options:o,api:i})=>{const a=J.useForm(),{t:l}=pt.useTranslation();return b.jsx(I.APIClientProvider,{apiClient:i,children:b.jsx(I.SchemaComponentOptions,{scope:F({},o==null?void 0:o.scope),components:F({},o==null?void 0:o.components),children:b.jsx(Fr.FormLayout,{layout:"vertical",children:b.jsx(I.SchemaComponent,{schema:{properties:{groupField:{title:l("Grouping field"),enum:t,required:!0,description:l("Single select and radio fields can be used as the grouping field"),"x-component":"Select","x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},onChange:()=>{a.setValuesIn("dragSortBy",null)}},"x-decorator":"FormItem"},dragSortBy:{title:l("Sorting field",{ns:Po}),required:!0,description:l("Used for sorting kanban cards, only sorting fields corresponding to grouping fields can be selected",{ns:Po}),"x-component":mI,"x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},sortFields:r},"x-decorator":"FormItem","x-reactions":[u=>{var s;u.dataSource=r.map(f=>{var c,d;return $(F({},f),{disabled:f.scopeKey!==((d=(c=u.form.values)==null?void 0:c.groupField)==null?void 0:d.value)})}),u.groupField=(s=u.form.values)==null?void 0:s.groupField,u.setComponentProps({dataSource:e.dataSource,collectionName:e.collectionName||e.name,collectionFields:n,sortFields:r})},{dependencies:[".groupField"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}]}}}})})})})},hI=({filterCollections:e,onlyCurrentDataSource:r,hideSearch:n,createBlockSchema:t,showAssociationFields:o})=>{const i=I.useSchemaInitializerItem(),{createKanbanBlock:a}=nm();return b.jsx(I.DataBlockInitializer,$(F({},i),{componentType:"Kanban",icon:b.jsx(ec.ProjectOutlined,{}),onCreateBlockSchema:l=>hr(this,null,function*(){if(t)return t(l);a(l)}),onlyCurrentDataSource:r,hideSearch:n,filter:e,showAssociationFields:o}))},nm=()=>{const{insert:e}=I.useSchemaInitializer(),{t:r}=pt.useTranslation(),{getCollectionFields:n}=I.useCollectionManager_deprecated(),t=D.useContext(J.SchemaOptionsContext),{theme:o}=I.useGlobalTheme(),i=I.useAPIClient();return{createKanbanBlock:u=>hr(this,[u],function*({item:l}){var p,h;const s=n(l.name,l.dataSource),f=(p=s==null?void 0:s.filter(y=>["select","radioGroup"].includes(y.interface)))==null?void 0:p.map(y=>{var w;return{label:(w=y==null?void 0:y.uiSchema)==null?void 0:w.title,value:y.name,uiSchema:$(F({},y.uiSchema),{name:y.name})}}),c=(h=s==null?void 0:s.filter(y=>["sort"].includes(y.interface)))==null?void 0:h.map(y=>{var w;return{label:(w=y==null?void 0:y.uiSchema)==null?void 0:w.title,value:y.name,scopeKey:y.scopeKey,uiSchema:$(F({},y.uiSchema),{name:y.name})}}),d=yield I.FormDialog(r("Create kanban block"),b.jsx(rm,{item:l,sortFields:c,collectionFields:s,fields:f,options:t,api:i}),o).open({initialValues:{}});e(em({sortField:d.dragSortBy,groupField:d.groupField.value,collectionName:l.name,dataSource:l.dataSource,params:{sort:[d.dragSortBy]}}))})}};function yI(){const{insert:e}=I.useSchemaInitializer(),{t:r}=pt.useTranslation(),n=D.useContext(J.SchemaOptionsContext),{theme:t}=I.useGlobalTheme(),{getCollectionFields:o}=I.useCollectionManager_deprecated(),i=I.useAPIClient();return{createAssociationKanbanBlock:u=>hr(this,[u],function*({item:l}){var h,y;console.log(l);const s=l.associationField,f=o(l.name,l.dataSource),c=(h=f==null?void 0:f.filter(w=>["select","radioGroup"].includes(w.interface)))==null?void 0:h.map(w=>{var g;return{label:(g=w==null?void 0:w.uiSchema)==null?void 0:g.title,value:w.name,uiSchema:$(F({},w.uiSchema),{name:w.name})}}),d=(y=f==null?void 0:f.filter(w=>["sort"].includes(w.interface)))==null?void 0:y.map(w=>{var g;return{label:(g=w==null?void 0:w.uiSchema)==null?void 0:g.title,value:w.name,scopeKey:w.scopeKey,uiSchema:$(F({},w.uiSchema),{name:w.name})}}),p=yield I.FormDialog(r("Create kanban block"),b.jsx(rm,{item:l,sortFields:d,collectionFields:f,fields:c,options:n,api:i}),t).open({initialValues:{}});e(em({sortField:p.dragSortBy,groupField:p.groupField.value,association:`${s.collectionName}.${s.name}`,dataSource:l.dataSource,params:{sort:[p.dragSortBy]}}))})}}En.Card=lI,En.CardAdder=I.Action,En.CardViewer=fI,En.Card.Designer=cI,En.Designer=pI;const SI=En,tm=D.memo(e=>b.jsx(I.SchemaComponentOptions,{components:{Kanban:En,KanbanBlockProvider:TE,KanbanV2:SI,KanbanBlockInitializer:hI},scope:{useKanbanBlockProps:ME},children:e.children}));tm.displayName="KanbanPluginProvider";class wI extends I.Plugin{load(){return hr(this,null,function*(){this.app.use(tm),this.app.schemaInitializerManager.add(Xg),this.app.schemaInitializerManager.add(dI),this.app.schemaInitializerManager.add(Zg),this.app.schemaInitializerManager.add(gI),this.app.schemaSettingsManager.add(vI);const r=this.app.schemaInitializerManager.get("page:addBlock");r==null||r.add("dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer"}),this.app.schemaInitializerManager.addItem("popup:common:addBlock","dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer",useComponentProps(){const{createAssociationKanbanBlock:n}=yI(),{createKanbanBlock:t}=nm();return{onlyCurrentDataSource:!0,filterCollections({associationField:o}){return o?["hasMany","belongsToMany"].includes(o.type):!1},createBlockSchema:({item:o,fromOthersInPopup:i})=>{if(i)return t({item:o});n({item:o})},showAssociationFields:!0,hideSearch:!0}}})})}}j.default=wI,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,16 +11,16 @@ module.exports = {
|
|
|
11
11
|
"@ant-design/icons": "5.2.6",
|
|
12
12
|
"@formily/react": "2.3.0",
|
|
13
13
|
"@formily/shared": "2.3.2",
|
|
14
|
-
"@nocobase/client": "1.3.
|
|
14
|
+
"@nocobase/client": "1.3.55",
|
|
15
15
|
"antd": "5.12.8",
|
|
16
16
|
"react": "18.2.0",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
18
|
"@emotion/css": "11.13.0",
|
|
19
19
|
"@formily/antd-v5": "1.1.9",
|
|
20
20
|
"@formily/core": "2.3.0",
|
|
21
|
-
"@nocobase/utils": "1.3.
|
|
21
|
+
"@nocobase/utils": "1.3.55",
|
|
22
22
|
"lodash": "4.17.21",
|
|
23
|
-
"@nocobase/server": "1.3.
|
|
24
|
-
"@nocobase/test": "1.3.
|
|
23
|
+
"@nocobase/server": "1.3.55",
|
|
24
|
+
"@nocobase/test": "1.3.55",
|
|
25
25
|
"antd-style": "3.7.1"
|
|
26
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-kanban",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/block-kanban",
|
|
6
6
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-kanban",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"react-intersection-observer": "^9.8.1"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "29126bb873bd07a9f40a7f2fee5ca1c396f09794",
|
|
21
21
|
"keywords": [
|
|
22
22
|
"Blocks"
|
|
23
23
|
]
|