@nocobase/plugin-block-workbench 1.4.0-beta.9 → 1.4.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.
@@ -60,4 +60,4 @@
60
60
  margin-top: ${g.marginSM}px;
61
61
  text-overflow: ellipsis;
62
62
  overflow: hidden;
63
- `}));function zi(){var y,M;const g=Ye.useFieldSchema(),d=(y=g["x-component-props"])==null?void 0:y.icon,h=(M=g["x-component-props"])==null?void 0:M.iconColor,{layout:m}=Me.useContext(Lr),{styles:p,cx:x}=Fr();return m===en.Grid?G.jsxs("div",{title:g.title,style:{width:"70px",overflow:"hidden"},children:[G.jsx($e.Avatar,{style:{backgroundColor:h},size:54,icon:G.jsx(W.Icon,{type:d})}),G.jsx("div",{className:x(p.title),children:g.title})]}):G.jsx("span",{children:g.title})}const Yi=W.withDynamicSchemaProps(g=>{const M=g,{className:d}=M,h=Zn(M,["className"]),{styles:m,cx:p}=Fr(),x=Ye.useFieldSchema(),y=W.useComponent(g==null?void 0:g.targetComponent)||W.Action;return G.jsx(y,_n(st({className:p(d,m.action,"nb-action-panel")},h),{icon:null,title:G.jsx(zi,{}),confirmTitle:x.title}))}),Zi={type:"void","x-decorator":"CardItem","x-decorator-props":{title:""},"x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},vt={type:"item",name:"workbenchBlock",icon:"FileImageOutlined",useComponentProps(){const{t:g}=xt.useTranslation("@nocobase/plugin-block-workbench"),{insert:d}=W.useSchemaInitializer();return{title:g("Action panel"),onClick:()=>{d(Zi)}}}};function Mn(g){const A=g,{modalSchema:d={}}=A,h=Zn(A,["modalSchema"]),_=d,{properties:m}=_,p=Zn(_,["properties"]),[x,y]=Me.useState(!1),{setVisible:M}=W.useSchemaInitializer(),B=Me.useMemo(()=>_n(st({name:hi.uid(),"x-component":"Action.Modal","x-component-props":{width:"520px"},type:"void","x-decorator":"FormV2","x-decorator-props":{}},p),{properties:_n(st({},m),{footer1:{"x-component":"Action.Modal.Footer",type:"void",properties:{close:{title:"Cancel","x-component":"Action","x-component-props":{type:"default"},"x-use-component-props":()=>({onClick(){var R;y(!1),(R=g==null?void 0:g.onCancel)==null||R.call(g)}})},submit:{title:"OK","x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":()=>{const R=Ye.useForm();return{onClick(){return Jt(this,null,function*(){var ee;yield R.submit(),y(!1),(ee=g==null?void 0:g.onSubmit)==null||ee.call(g,R.values)})}}}}}}})}),[x]);return G.jsxs(G.Fragment,{children:[G.jsx(W.SchemaInitializerItem,_n(st({},h),{onClick:R=>{var $;M(!1),y(!0),($=g==null?void 0:g.onClick)==null||$.call(g,R)}})),G.jsx(W.ActionContextProvider,{value:{visible:x,setVisible:y},children:G.jsx(W.SchemaComponent,{components:{Action:W.Action},schema:B})})]})}const Ki=new W.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:W.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ji(g){const d=W.useSchemaInitializerItem(),{insert:h}=W.useSchemaInitializer(),{t:m}=xt.useTranslation();return G.jsx(Mn,{title:d.title,modalSchema:{title:m("Add link"),properties:{title:{title:m("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:m("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:m("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:p=>{h({type:"void",title:p.title,"x-action":"customize:link","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:link","x-component":"WorkbenchAction","x-use-component-props":"useLinkActionProps","x-component-props":{icon:p.icon,iconColor:p.iconColor}})}})}const qi=new W.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:ji}]}),Qi=new W.SchemaSettings({name:"workbench:actionSettings:popup",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"openMode",Component:W.SchemaSettingOpenModeSchemaItems,useComponentProps(){const{t:g}=xt.useTranslation(),{hideOpenMode:d}=W.useOpenModeContext();return{openSize:!d,modeOptions:d&&[{label:g("Drawer"),value:"drawer"},{label:g("Page"),value:"page"}]}}},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function Ji(g){const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation(),{isMobile:m}=W.useOpenModeContext();return G.jsx(Mn,{title:h("Popup"),modalSchema:{title:h("Add popup",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:p=>{d({type:"void",title:p.title,"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:popup","x-component":"WorkbenchAction","x-component-props":{icon:p.icon,iconColor:p.iconColor,refreshDataBlockRequest:!1},properties:{drawer:{type:"void",title:p.title,"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":m?"mobile:addBlock":"page:addBlock",properties:{}}}}}}}}}})}})}const $i=new W.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function es(g){W.useSchemaInitializerItem();const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation();return G.jsx(Mn,{title:h("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:h("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:m=>{d({type:"void",title:m.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:m.icon,iconColor:m.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"QRCodeScanner",title:h("Scan QR code",{ns:"block-workbench"})}}})}})}const ts=new W.SchemaSettings({name:"workbench:actionSettings:customRequest",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:W.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ns(g){const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation();return G.jsx(Mn,{title:h("Custom request"),modalSchema:{title:h("Add custom request",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:m=>{d({type:"void",title:m.title,"x-component":"WorkbenchAction","x-component-props":{icon:m.icon,iconColor:m.iconColor,targetComponent:"CustomRequestAction"},"x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}})}})}class Ur extends W.Plugin{load(){return Jt(this,null,function*(){this.app.addComponents({WorkbenchBlock:kr,QRCodeScanner:Ui,WorkbenchAction:Yi}),this.app.schemaSettingsManager.add(Wi),this.app.schemaInitializerManager.add(qi),this.app.schemaInitializerManager.addItem("page:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("popup:common:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("mobilePage:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("mobile:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaSettingsManager.add(Ki),this.app.schemaSettingsManager.add($i),this.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:es}),this.app.schemaSettingsManager.add(Qi),this.app.schemaInitializerManager.addItem("workbench:configureActions","popup",{Component:Ji}),this.app.schemaSettingsManager.add(ts),this.app.schemaInitializerManager.addItem("workbench:configureActions","customRequest",{Component:ns})})}}oe.PluginBlockWorkbenchClient=Ur,oe.default=Ur,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
63
+ `}));function zi(){var y,M;const g=Ye.useFieldSchema(),d=(y=g["x-component-props"])==null?void 0:y.icon,h=(M=g["x-component-props"])==null?void 0:M.iconColor,{layout:m}=Me.useContext(Lr),{styles:p,cx:x}=Fr();return m===en.Grid?G.jsxs("div",{title:g.title,style:{width:"70px",overflow:"hidden"},children:[G.jsx($e.Avatar,{style:{backgroundColor:h},size:54,icon:G.jsx(W.Icon,{type:d})}),G.jsx("div",{className:x(p.title),children:g.title})]}):G.jsx("span",{children:g.title})}const Yi=W.withDynamicSchemaProps(g=>{const M=g,{className:d}=M,h=Zn(M,["className"]),{styles:m,cx:p}=Fr(),x=Ye.useFieldSchema(),y=W.useComponent(g==null?void 0:g.targetComponent)||W.Action;return G.jsx(y,_n(st({className:p(d,m.action,"nb-action-panel")},h),{icon:null,title:G.jsx(zi,{}),confirmTitle:x.title}))}),Zi={type:"void","x-decorator":"CardItem","x-decorator-props":{title:""},"x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},vt={type:"item",name:"workbenchBlock",icon:"AppstoreAddOutlined",useComponentProps(){const{t:g}=xt.useTranslation("@nocobase/plugin-block-workbench"),{insert:d}=W.useSchemaInitializer();return{title:g("Action panel"),onClick:()=>{d(Zi)}}}};function Mn(g){const A=g,{modalSchema:d={}}=A,h=Zn(A,["modalSchema"]),_=d,{properties:m}=_,p=Zn(_,["properties"]),[x,y]=Me.useState(!1),{setVisible:M}=W.useSchemaInitializer(),B=Me.useMemo(()=>_n(st({name:hi.uid(),"x-component":"Action.Modal","x-component-props":{width:"520px"},type:"void","x-decorator":"FormV2","x-decorator-props":{}},p),{properties:_n(st({},m),{footer1:{"x-component":"Action.Modal.Footer",type:"void",properties:{close:{title:"Cancel","x-component":"Action","x-component-props":{type:"default"},"x-use-component-props":()=>({onClick(){var R;y(!1),(R=g==null?void 0:g.onCancel)==null||R.call(g)}})},submit:{title:"OK","x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":()=>{const R=Ye.useForm();return{onClick(){return Jt(this,null,function*(){var ee;yield R.submit(),y(!1),(ee=g==null?void 0:g.onSubmit)==null||ee.call(g,R.values)})}}}}}}})}),[x]);return G.jsxs(G.Fragment,{children:[G.jsx(W.SchemaInitializerItem,_n(st({},h),{onClick:R=>{var $;M(!1),y(!0),($=g==null?void 0:g.onClick)==null||$.call(g,R)}})),G.jsx(W.ActionContextProvider,{value:{visible:x,setVisible:y},children:G.jsx(W.SchemaComponent,{components:{Action:W.Action},schema:B})})]})}const Ki=new W.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:W.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ji(g){const d=W.useSchemaInitializerItem(),{insert:h}=W.useSchemaInitializer(),{t:m}=xt.useTranslation();return G.jsx(Mn,{title:d.title,modalSchema:{title:m("Add link"),properties:{title:{title:m("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:m("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:m("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:p=>{h({type:"void",title:p.title,"x-action":"customize:link","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:link","x-component":"WorkbenchAction","x-use-component-props":"useLinkActionProps","x-component-props":{icon:p.icon,iconColor:p.iconColor}})}})}const qi=new W.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:ji}]}),Qi=new W.SchemaSettings({name:"workbench:actionSettings:popup",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"openMode",Component:W.SchemaSettingOpenModeSchemaItems,useComponentProps(){const{t:g}=xt.useTranslation(),{hideOpenMode:d}=W.useOpenModeContext();return{openSize:!d,modeOptions:d&&[{label:g("Drawer"),value:"drawer"},{label:g("Page"),value:"page"}]}}},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function Ji(g){const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation(),{isMobile:m}=W.useOpenModeContext();return G.jsx(Mn,{title:h("Popup"),modalSchema:{title:h("Add popup",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:p=>{d({type:"void",title:p.title,"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:popup","x-component":"WorkbenchAction","x-component-props":{icon:p.icon,iconColor:p.iconColor,refreshDataBlockRequest:!1},properties:{drawer:{type:"void",title:p.title,"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":m?"mobile:addBlock":"page:addBlock",properties:{}}}}}}}}}})}})}const $i=new W.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function es(g){W.useSchemaInitializerItem();const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation();return G.jsx(Mn,{title:h("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:h("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:m=>{d({type:"void",title:m.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:m.icon,iconColor:m.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"QRCodeScanner",title:h("Scan QR code",{ns:"block-workbench"})}}})}})}const ts=new W.SchemaSettings({name:"workbench:actionSettings:customRequest",items:[{name:"editButton",Component:W.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:W.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ns(g){const{insert:d}=W.useSchemaInitializer(),{t:h}=xt.useTranslation();return G.jsx(Mn,{title:h("Custom request"),modalSchema:{title:h("Add custom request",{ns:"block-workbench"}),properties:{title:{title:h("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:h("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:h("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:m=>{d({type:"void",title:m.title,"x-component":"WorkbenchAction","x-component-props":{icon:m.icon,iconColor:m.iconColor,targetComponent:"CustomRequestAction"},"x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}})}})}class Ur extends W.Plugin{load(){return Jt(this,null,function*(){this.app.addComponents({WorkbenchBlock:kr,QRCodeScanner:Ui,WorkbenchAction:Yi}),this.app.schemaSettingsManager.add(Wi),this.app.schemaInitializerManager.add(qi),this.app.schemaInitializerManager.addItem("page:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("popup:common:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("mobilePage:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaInitializerManager.addItem("mobile:addBlock",`otherBlocks.${vt.name}`,vt),this.app.schemaSettingsManager.add(Ki),this.app.schemaSettingsManager.add($i),this.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:es}),this.app.schemaSettingsManager.add(Qi),this.app.schemaInitializerManager.addItem("workbench:configureActions","popup",{Component:Ji}),this.app.schemaSettingsManager.add(ts),this.app.schemaInitializerManager.addItem("workbench:configureActions","customRequest",{Component:ns})})}}oe.PluginBlockWorkbenchClient=Ur,oe.default=Ur,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -9,14 +9,14 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
- "@nocobase/client": "1.4.0-beta.9",
13
- "@nocobase/utils": "1.4.0-beta.9",
12
+ "@nocobase/client": "1.4.1",
13
+ "@nocobase/utils": "1.4.1",
14
14
  "react": "18.2.0",
15
15
  "react-i18next": "11.18.6",
16
16
  "antd": "5.12.8",
17
17
  "antd-style": "3.7.1",
18
18
  "@emotion/css": "11.13.0",
19
- "@nocobase/server": "1.4.0-beta.9",
19
+ "@nocobase/server": "1.4.1",
20
20
  "@ant-design/icons": "5.3.7",
21
21
  "react-router-dom": "6.21.0"
22
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-block-workbench",
3
- "version": "1.4.0-beta.9",
3
+ "version": "1.4.1",
4
4
  "displayName": "Block: Action panel",
5
5
  "displayName.zh-CN": "区块:操作面板",
6
6
  "description": "Centrally manages and displays various actions, allowing users to efficiently perform tasks. It supports extensibility, with current action types including pop-ups, links, scanning, and custom requests.",
@@ -20,5 +20,5 @@
20
20
  "keywords": [
21
21
  "Blocks"
22
22
  ],
23
- "gitHead": "202544bfa8ad5ed3a443ec4be9ee3f121af04937"
23
+ "gitHead": "db321e5213768ee9e357fbb55fc7120e2e308d6e"
24
24
  }