@tachybase/plugin-block-kanban 0.23.40 → 0.23.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -299,4 +299,4 @@ Error generating stack: `+o.message+`
299
299
  color: #8c8c8c;
300
300
  fontweight: normal;
301
301
  }
302
- `),children:x.jsx(O.DndContext,{onDragStart:()=>{r(!0)},onDragEnd:()=>{r(!1)},children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(K.RecursionField,{basePath:i.address.concat(`${o}.cards.${a}`),schema:u,onlyRenderProperties:!0})})})}),n&&x.jsx(O.ActionContextProvider,{value:{openMode:((s=u["x-component-props"])==null?void 0:s.openMode)||"drawer",openSize:(d=u["x-component-props"])==null?void 0:d.openSize,visible:c,setVisible:f},children:x.jsx(O.RecordProvider,{record:t,parent:l,children:x.jsx(K.RecursionField,{basePath:i.address.concat(`${o}.cardViewer.${a}`),schema:n,onlyRenderProperties:!0})})})]})},{displayName:"KanbanCard"}),BE=e=>(e["x-read-pretty"]=!0,{type:"void","x-component":"Grid.Row",properties:{[K.uid()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||K.uid()]:e}}}}),ME=()=>{const{designable:e}=O.useDesignable(),{render:r}=O.useSchemaInitializerRender("kanban:configureItemFields");return e?x.jsx("div",{className:"general-schema-designer",children:x.jsx("div",{className:"general-schema-designer-icons",children:x.jsx(hr.Space,{size:2,align:"center",children:r()})})}):null},FE=new O.SchemaInitializer({name:"kanban:configureItemFields",wrap:BE,useInsert(){const e=K.useFieldSchema(),{t:r}=qe.useTranslation(),n=O.useAPIClient(),{refresh:t}=O.useDesignable();return i=>{const o=e.reduceProperties((l,u)=>u["x-component"]==="Grid"?u:l,null);if(!o)return;const a=O.createDesignable({t:r,api:n,refresh:t,current:o});a.loadAPIClientEvents(),a.insertBeforeEnd(i)}},Component:e=>{const{getAriaLabel:r}=O.useGetAriaLabelOfDesigner();return x.jsx(Pn.MenuOutlined,G(L({},e),{role:"button","aria-label":r("schema-initializer"),style:{cursor:"pointer",fontSize:12}}))},items:[{type:"itemGroup",title:'{{t("Display fields")}}',name:"displayFields",useChildren:O.useFormItemInitializerFields},{type:"itemGroup",divider:!0,title:'{{t("Display association fields")}}',name:"displayAssociationFields",hideIfNoChildren:!0,useChildren(){return O.useAssociatedFormItemInitializerFields({readPretty:!0,block:"Kanban"})}},{name:"divider",type:"divider"},{name:"openMode",Component:O.SchemaInitializerOpenModeSchemaItems}]}),LE=K.observer(e=>e.children,{displayName:"KanbanCardViewer"}),RE=()=>{const{name:e,title:r}=O.useCollection_deprecated(),n=O.useSchemaTemplate();return x.jsx(O.GeneralSchemaDesigner,{schemaSettings:"blockSettings:kanban",template:n,title:r||e})},zE=new O.SchemaSettings({name:"blockSettings:kanban",items:[{name:"title",Component:O.SchemaSettingsBlockTitleItem},{name:"dataScope",Component:O.SchemaSettingsDataScope,useComponentProps(){var a,l;const{name:e}=O.useCollection_deprecated(),r=K.useFieldSchema(),{form:n}=O.useFormBlockContext(),t=K.useField(),{service:i}=Da(),{dn:o}=O.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=O.removeNullCondition(u);const c=t.decoratorProps.params||{};c.filter=u,t.decoratorProps.params=c,r["x-decorator-props"].params=c,i.run(G(L({},(f=i.params)==null?void 0:f[0]),{filter:u})),o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":r["x-decorator-props"]}})}}}},{name:"fixedBlock",Component:O.FixedBlockDesignerItem},{name:"template",Component:O.SchemaSettingsTemplate,useComponentProps(){const{name:e}=O.useCollection_deprecated();return{componentName:"Kanban",collectionName:e}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),_E=new O.SchemaInitializer({name:"kanban:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{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(){const e=O.useCollection_deprecated();return e.template!=="view"||(e==null?void 0:e.writableView)}}]}]}),Ei="block-kanban",$E=e=>{const g=e,{sortFields:r,collectionFields:n,groupField:t,collectionName:i,dataSource:o}=g,a=Aa(g,["sortFields","collectionFields","groupField","collectionName","dataSource"]),l=K.useField(),u=O.useCompile(),c=O.useAPIClient(),{t:f}=qe.useTranslation(),{theme:s}=O.useGlobalTheme(),d=D.useContext(K.SchemaOptionsContext),p=n==null?void 0:n.filter(v=>v.interface==="integer"),h=({scopeKey:v})=>{var C;const m=v&&n.find(b=>b.name===v),S=v&&u((C=m.uiSchema)==null?void 0:C.title);return x.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.25)"},children:["(",S?f("Grouped sorting based on",{ns:Ei})+`「${S}」`:f("Global sorting",{ns:Ei}),")"]})},y=()=>Mr(this,null,function*(){var S;const v=yield O.FormDialog(f("Create sort field"),()=>x.jsx(O.SchemaComponentOptions,{scope:d.scope,components:L({},d.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.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]}}}})})}),s).open({initialValues:{name:`f_${K.uid()}`}}),{data:m}=yield c.resource("collections.fields",i).create({values:L({type:"sort",interface:"sort"},v)});l.dataSource=l.dataSource.concat([G(L({},m.data),{value:m.data.name,label:u((S=m.data.uiSchema)==null?void 0:S.title)})]),l.value=m.data.name}),w=()=>Mr(this,null,function*(){var C;const v=yield O.FormDialog(f("Create sort field"),()=>x.jsx(O.SchemaComponentOptions,{scope:d.scope,components:L({},d.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.SchemaComponent,{schema:{properties:{field:{type:"string",title:f("Convert the following integer fields to sorting fields",{ns:Ei}),required:!0,"x-decorator":"FormItem","x-component":"Select",enum:p.map(b=>{var E;return{value:b.name,label:u(((E=b.uiSchema)==null?void 0:E.title)||b.name)}})},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),s).open({initialValues:{}}),{data:m}=yield c.request({url:`dataSourcesCollections/${o}.${i}/fields:update?filterByTk=${v.field}`,method:"post",data:L({type:"sort",interface:"sort"},v)}),S=m.data;l.dataSource=l.dataSource.concat([G(L({},S),{value:S.name,label:u((C=S.uiSchema)==null?void 0:C.title)})]),l.value=S.name});return x.jsxs(hr.Space.Compact,{style:{width:"100%"},children:[x.jsx(O.Select,G(L({options:r},a),{disabled:!t,optionRender:({label:v,data:m})=>x.jsxs(hr.Space,{children:[x.jsx("span",{children:v}),x.jsx(h,{scopeKey:m.scopeKey})]})})),x.jsx(hr.Button,{disabled:!t,onClick:o==="main"?y:w,children:f("Add new")})]})},GE=e=>{const{collectionName:r,groupField:n,sortField:t,dataSource:i,params:o}=e;return{type:"void","x-acl-action":`${r}:list`,"x-decorator":"KanbanBlockProvider","x-decorator-props":{collection:r,action:"list",groupField:n,sortField:t,params:L({paginate:!1},o),dataSource: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(--tb-spacing)"}},properties:{}},[K.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:"tb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"TabPaneInitializers",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:{}}}}}}}}}}}}}}},jE=({item:e,sortFields:r,collectionFields:n,fields:t,options:i,api:o})=>{const a=K.useForm(),{t:l}=qe.useTranslation();return x.jsx(O.APIClientProvider,{apiClient:o,children:x.jsx(O.SchemaComponentOptions,{scope:L({},i==null?void 0:i.scope),components:L({},i==null?void 0:i.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.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:Ei}),required:!0,description:l("Used for sorting kanban cards, only sorting fields corresponding to grouping fields can be selected",{ns:Ei}),"x-component":$E,"x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},sortFields:r},"x-decorator":"FormItem","x-reactions":[u=>{var c;u.dataSource=r.map(f=>{var s,d;return G(L({},f),{disabled:f.scopeKey!==((d=(s=u.form.values)==null?void 0:s.groupField)==null?void 0:d.value)})}),u.groupField=(c=u.form.values)==null?void 0:c.groupField,u.setComponentProps({dataSource:e.dataSource,collectionName:e.name,collectionFields:n,sortFields:r})},{dependencies:[".groupField"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}]}}}})})})})},UE=()=>{const{insert:e}=O.useSchemaInitializer(),{t:r}=qe.useTranslation(),{getCollectionFields:n}=O.useCollectionManager_deprecated(),{theme:t}=O.useGlobalTheme(),i=O.useSchemaInitializerItem(),o=D.useContext(K.SchemaOptionsContext),a=O.useAPIClient();return x.jsx(O.DataBlockInitializer,G(L({},i),{componentType:"Kanban",icon:x.jsx(Pn.FormOutlined,{}),onCreateBlockSchema:u=>Mr(this,[u],function*({item:l}){var y,w;const{data:c}=yield a.resource("collections.fields",l.name).list({paginate:!1}),f=n(l.name,l.dataSource),s=l.dataSource==="main"?c.data:f,d=(y=s==null?void 0:s.filter(g=>["select","radioGroup"].includes(g.interface)))==null?void 0:y.map(g=>{var v;return{label:(v=g==null?void 0:g.uiSchema)==null?void 0:v.title,value:g.name,uiSchema:G(L({},g.uiSchema),{name:g.name})}}),p=(w=s==null?void 0:s.filter(g=>["sort"].includes(g.interface)))==null?void 0:w.map(g=>{var v;return{label:(v=g==null?void 0:g.uiSchema)==null?void 0:v.title,value:g.name,scopeKey:g.scopeKey,uiSchema:G(L({},g.uiSchema),{name:g.name})}}),h=yield O.FormDialog(r("Create kanban block"),x.jsx(jE,{item:l,sortFields:p,collectionFields:s,fields:d,options:o,api:a}),t).open({initialValues:{}});e(GE({sortField:h.dragSortBy,groupField:h.groupField.value,collectionName:l.name,dataSource:l.dataSource,params:{sort:[h.dragSortBy]}}))})}))};En.Card=TE,En.CardAdder=O.Action,En.CardViewer=LE,En.Card.Designer=ME,En.Designer=RE;const WE=En,_g=D.memo(e=>x.jsx(O.SchemaComponentOptions,{components:{Kanban:En,KanbanBlockProvider:lE,KanbanV2:WE,KanbanBlockInitializer:UE},scope:{useKanbanBlockProps:sE},children:e.children}));_g.displayName="KanbanPluginProvider";class HE extends O.Plugin{load(){return Mr(this,null,function*(){this.app.use(_g),this.app.schemaInitializerManager.add(FE),this.app.schemaInitializerManager.add(_E),this.app.schemaSettingsManager.add(zE);const r=this.app.schemaInitializerManager.get("page:addBlock");r==null||r.add("dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer"})})}}U.default=HE,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
302
+ `),children:x.jsx(O.DndContext,{onDragStart:()=>{r(!0)},onDragEnd:()=>{r(!1)},children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(K.RecursionField,{basePath:i.address.concat(`${o}.cards.${a}`),schema:u,onlyRenderProperties:!0})})})}),n&&x.jsx(O.ActionContextProvider,{value:{openMode:((s=u["x-component-props"])==null?void 0:s.openMode)||"drawer",openSize:(d=u["x-component-props"])==null?void 0:d.openSize,visible:c,setVisible:f},children:x.jsx(O.RecordProvider,{record:t,parent:l,children:x.jsx(K.RecursionField,{basePath:i.address.concat(`${o}.cardViewer.${a}`),schema:n,onlyRenderProperties:!0})})})]})},{displayName:"KanbanCard"}),BE=e=>(e["x-read-pretty"]=!0,{type:"void","x-component":"Grid.Row",properties:{[K.uid()]:{type:"void","x-component":"Grid.Col",properties:{[e.name||K.uid()]:e}}}}),ME=()=>{const{designable:e}=O.useDesignable(),{render:r}=O.useSchemaInitializerRender("kanban:configureItemFields");return e?x.jsx("div",{className:"general-schema-designer",children:x.jsx("div",{className:"general-schema-designer-icons",children:x.jsx(hr.Space,{size:2,align:"center",children:r()})})}):null},FE=new O.SchemaInitializer({name:"kanban:configureItemFields",wrap:BE,useInsert(){const e=K.useFieldSchema(),{t:r}=qe.useTranslation(),n=O.useAPIClient(),{refresh:t}=O.useDesignable();return i=>{const o=e.reduceProperties((l,u)=>u["x-component"]==="Grid"?u:l,null);if(!o)return;const a=O.createDesignable({t:r,api:n,refresh:t,current:o});a.loadAPIClientEvents(),a.insertBeforeEnd(i)}},Component:e=>{const{getAriaLabel:r}=O.useGetAriaLabelOfDesigner();return x.jsx(Pn.MenuOutlined,G(L({},e),{role:"button","aria-label":r("schema-initializer"),style:{cursor:"pointer",fontSize:12}}))},items:[{type:"itemGroup",title:'{{t("Display fields")}}',name:"displayFields",useChildren:O.useFormItemInitializerFields},{type:"itemGroup",divider:!0,title:'{{t("Display association fields")}}',name:"displayAssociationFields",hideIfNoChildren:!0,useChildren(){return O.useAssociatedFormItemInitializerFields({readPretty:!0,block:"Kanban"})}},{name:"divider",type:"divider"},{name:"openMode",Component:O.SchemaInitializerOpenModeSchemaItems}]}),LE=K.observer(e=>e.children,{displayName:"KanbanCardViewer"}),RE=()=>{const{name:e,title:r}=O.useCollection_deprecated(),n=O.useSchemaTemplate();return x.jsx(O.GeneralSchemaDesigner,{schemaSettings:"blockSettings:kanban",template:n,title:r||e})},zE=new O.SchemaSettings({name:"blockSettings:kanban",items:[{name:"title",Component:O.SchemaSettingsBlockTitleItem},{name:"dataScope",Component:O.SchemaSettingsDataScope,useComponentProps(){var a,l;const{name:e}=O.useCollection_deprecated(),r=K.useFieldSchema(),{form:n}=O.useFormBlockContext(),t=K.useField(),{service:i}=Da(),{dn:o}=O.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=O.removeNullCondition(u);const c=t.decoratorProps.params||{};c.filter=u,t.decoratorProps.params=c,r["x-decorator-props"].params=c,i.run(G(L({},(f=i.params)==null?void 0:f[0]),{filter:u})),o.emit("patch",{schema:{"x-uid":r["x-uid"],"x-decorator-props":r["x-decorator-props"]}})}}}},{name:"fixedBlock",Component:O.FixedBlockDesignerItem},{name:"template",Component:O.SchemaSettingsTemplate,useComponentProps(){const{name:e}=O.useCollection_deprecated();return{componentName:"Kanban",collectionName:e}}},{name:"divider",type:"divider"},{name:"remove",type:"remove",componentProps:{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}]}),_E=new O.SchemaInitializer({name:"kanban:configureActions",title:"{{t('Configure actions')}}",icon:"SettingOutlined",style:{marginLeft:8},items:[{type:"itemGroup",title:"{{t('Enable actions')}}",name:"enableActions",children:[{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(){const e=O.useCollection_deprecated();return e.template!=="view"||(e==null?void 0:e.writableView)}}]}]}),Ei="block-kanban",$E=e=>{const g=e,{sortFields:r,collectionFields:n,groupField:t,collectionName:i,dataSource:o}=g,a=Aa(g,["sortFields","collectionFields","groupField","collectionName","dataSource"]),l=K.useField(),u=O.useCompile(),c=O.useAPIClient(),{t:f}=qe.useTranslation(),{theme:s}=O.useGlobalTheme(),d=D.useContext(K.SchemaOptionsContext),p=n==null?void 0:n.filter(v=>v.interface==="integer"),h=({scopeKey:v})=>{var C;const m=v&&n.find(b=>b.name===v),S=v&&u((C=m.uiSchema)==null?void 0:C.title);return x.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.25)"},children:["(",S?f("Grouped sorting based on",{ns:Ei})+`「${S}」`:f("Global sorting",{ns:Ei}),")"]})},y=()=>Mr(this,null,function*(){var S;const v=yield O.FormDialog(f("Create sort field"),()=>x.jsx(O.SchemaComponentOptions,{scope:d.scope,components:L({},d.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.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]}}}})})}),s).open({initialValues:{name:`f_${K.uid()}`}}),{data:m}=yield c.resource("collections.fields",i).create({values:L({type:"sort",interface:"sort"},v)});l.dataSource=l.dataSource.concat([G(L({},m.data),{value:m.data.name,label:u((S=m.data.uiSchema)==null?void 0:S.title)})]),l.value=m.data.name}),w=()=>Mr(this,null,function*(){var C;const v=yield O.FormDialog(f("Create sort field"),()=>x.jsx(O.SchemaComponentOptions,{scope:d.scope,components:L({},d.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.SchemaComponent,{schema:{properties:{field:{type:"string",title:f("Convert the following integer fields to sorting fields",{ns:Ei}),required:!0,"x-decorator":"FormItem","x-component":"Select",enum:p.map(b=>{var E;return{value:b.name,label:u(((E=b.uiSchema)==null?void 0:E.title)||b.name)}})},scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',default:t.value,"x-disabled":!0,"x-decorator":"FormItem","x-component":"Select",enum:[t]}}}})})}),s).open({initialValues:{}}),{data:m}=yield c.request({url:`dataSourcesCollections/${o}.${i}/fields:update?filterByTk=${v.field}`,method:"post",data:L({type:"sort",interface:"sort"},v)}),S=m.data;l.dataSource=l.dataSource.concat([G(L({},S),{value:S.name,label:u((C=S.uiSchema)==null?void 0:C.title)})]),l.value=S.name});return x.jsxs(hr.Space.Compact,{style:{width:"100%"},children:[x.jsx(O.Select,G(L({options:r},a),{disabled:!t,optionRender:({label:v,data:m})=>x.jsxs(hr.Space,{children:[x.jsx("span",{children:v}),x.jsx(h,{scopeKey:m.scopeKey})]})})),x.jsx(hr.Button,{disabled:!t,onClick:o==="main"?y:w,children:f("Add new")})]})},GE=e=>{const{collectionName:r,groupField:n,sortField:t,dataSource:i,params:o}=e;return{type:"void","x-acl-action":`${r}:list`,"x-decorator":"KanbanBlockProvider","x-decorator-props":{collection:r,action:"list",groupField:n,sortField:t,params:L({paginate:!1},o),dataSource: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(--tb-spacing)"}},properties:{}},[K.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:"tb-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:{}}}}}}}}}}}}}}},jE=({item:e,sortFields:r,collectionFields:n,fields:t,options:i,api:o})=>{const a=K.useForm(),{t:l}=qe.useTranslation();return x.jsx(O.APIClientProvider,{apiClient:o,children:x.jsx(O.SchemaComponentOptions,{scope:L({},i==null?void 0:i.scope),components:L({},i==null?void 0:i.components),children:x.jsx(In.FormLayout,{layout:"vertical",children:x.jsx(O.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:Ei}),required:!0,description:l("Used for sorting kanban cards, only sorting fields corresponding to grouping fields can be selected",{ns:Ei}),"x-component":$E,"x-component-props":{objectValue:!0,fieldNames:{label:"label",value:"value"},sortFields:r},"x-decorator":"FormItem","x-reactions":[u=>{var c;u.dataSource=r.map(f=>{var s,d;return G(L({},f),{disabled:f.scopeKey!==((d=(s=u.form.values)==null?void 0:s.groupField)==null?void 0:d.value)})}),u.groupField=(c=u.form.values)==null?void 0:c.groupField,u.setComponentProps({dataSource:e.dataSource,collectionName:e.name,collectionFields:n,sortFields:r})},{dependencies:[".groupField"],fulfill:{schema:{"x-component-props":"{{$form.values}}"}}}]}}}})})})})},UE=()=>{const{insert:e}=O.useSchemaInitializer(),{t:r}=qe.useTranslation(),{getCollectionFields:n}=O.useCollectionManager_deprecated(),{theme:t}=O.useGlobalTheme(),i=O.useSchemaInitializerItem(),o=D.useContext(K.SchemaOptionsContext),a=O.useAPIClient();return x.jsx(O.DataBlockInitializer,G(L({},i),{componentType:"Kanban",icon:x.jsx(Pn.FormOutlined,{}),onCreateBlockSchema:u=>Mr(this,[u],function*({item:l}){var y,w;const{data:c}=yield a.resource("collections.fields",l.name).list({paginate:!1}),f=n(l.name,l.dataSource),s=l.dataSource==="main"?c.data:f,d=(y=s==null?void 0:s.filter(g=>["select","radioGroup"].includes(g.interface)))==null?void 0:y.map(g=>{var v;return{label:(v=g==null?void 0:g.uiSchema)==null?void 0:v.title,value:g.name,uiSchema:G(L({},g.uiSchema),{name:g.name})}}),p=(w=s==null?void 0:s.filter(g=>["sort"].includes(g.interface)))==null?void 0:w.map(g=>{var v;return{label:(v=g==null?void 0:g.uiSchema)==null?void 0:v.title,value:g.name,scopeKey:g.scopeKey,uiSchema:G(L({},g.uiSchema),{name:g.name})}}),h=yield O.FormDialog(r("Create kanban block"),x.jsx(jE,{item:l,sortFields:p,collectionFields:s,fields:d,options:o,api:a}),t).open({initialValues:{}});e(GE({sortField:h.dragSortBy,groupField:h.groupField.value,collectionName:l.name,dataSource:l.dataSource,params:{sort:[h.dragSortBy]}}))})}))};En.Card=TE,En.CardAdder=O.Action,En.CardViewer=LE,En.Card.Designer=ME,En.Designer=RE;const WE=En,_g=D.memo(e=>x.jsx(O.SchemaComponentOptions,{components:{Kanban:En,KanbanBlockProvider:lE,KanbanV2:WE,KanbanBlockInitializer:UE},scope:{useKanbanBlockProps:sE},children:e.children}));_g.displayName="KanbanPluginProvider";class HE extends O.Plugin{load(){return Mr(this,null,function*(){this.app.use(_g),this.app.schemaInitializerManager.add(FE),this.app.schemaInitializerManager.add(_E),this.app.schemaSettingsManager.add(zE);const r=this.app.schemaInitializerManager.get("page:addBlock");r==null||r.add("dataBlocks.kanban",{title:'{{t("Kanban")}}',Component:"KanbanBlockInitializer"})})}}U.default=HE,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,12 +1,12 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "0.23.40",
4
- "@tachybase/schema": "0.23.40",
3
+ "@tachybase/client": "0.23.41",
4
+ "@tachybase/schema": "0.23.41",
5
5
  "@ant-design/icons": "5.5.2",
6
6
  "antd": "5.22.5",
7
7
  "react-i18next": "15.2.0",
8
- "@tachybase/components": "0.23.40",
8
+ "@tachybase/components": "0.23.41",
9
9
  "lodash": "4.17.21",
10
- "@tachybase/server": "0.23.40",
11
- "@tachybase/test": "0.23.40"
10
+ "@tachybase/server": "0.23.41",
11
+ "@tachybase/test": "0.23.41"
12
12
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-block-kanban",
3
3
  "displayName": "Block: Kanban",
4
- "version": "0.23.40",
4
+ "version": "0.23.41",
5
5
  "description": "Provides kanban block.",
6
6
  "keywords": [
7
7
  "Blocks"
@@ -15,13 +15,13 @@
15
15
  "lodash": "4.17.21",
16
16
  "react-beautiful-dnd": "^13.1.1",
17
17
  "react-i18next": "^15.2.0",
18
- "@tachybase/components": "0.23.40",
19
- "@tachybase/schema": "0.23.40"
18
+ "@tachybase/components": "0.23.41",
19
+ "@tachybase/schema": "0.23.41"
20
20
  },
21
21
  "peerDependencies": {
22
- "@tachybase/client": "0.23.40",
23
- "@tachybase/test": "0.23.40",
24
- "@tachybase/server": "0.23.40"
22
+ "@tachybase/client": "0.23.41",
23
+ "@tachybase/test": "0.23.41",
24
+ "@tachybase/server": "0.23.41"
25
25
  },
26
26
  "description.zh-CN": "提供看板卡片。",
27
27
  "displayName.zh-CN": "卡片:看板",