@nocobase/plugin-action-bulk-update 0.19.0-alpha.6 → 0.19.0-alpha.8
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/shared"),require("react-i18next"),require("@formily/react"),require("@nocobase/utils/client"),require("react-router-dom"),require("antd"),require("react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/shared","react-i18next","@formily/react","@nocobase/utils/client","react-router-dom","antd","react"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i["@nocobase/plugin-action-bulk-update"]={},i["@nocobase/client"],i.jsxRuntime,i["@formily/shared"],i["react-i18next"],i["@formily/react"],i["@nocobase/utils"],i["react-router-dom"],i.antd,i.react))})(this,function(i,e,r,z,p,l,C,g,c,x){"use strict";var ne=Object.defineProperty,re=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var _=(i,e,r)=>e in i?ne(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,S=(i,e)=>{for(var r in e||(e={}))le.call(e,r)&&_(i,r,e[r]);if(O)for(var r of O(e))ue.call(e,r)&&_(i,r,e[r]);return i},N=(i,e)=>re(i,ce(e));var m=(i,e,r)=>new Promise((z,p)=>{var l=c=>{try{g(r.next(c))}catch(x){p(x)}},C=c=>{try{g(r.throw(c))}catch(x){p(x)}},g=c=>c.done?z(c.value):Promise.resolve(c.value).then(l,C);g((r=r.apply(i,e)).next())});const K=a=>{const t=l.useFieldSchema(),{t:o}=p.useTranslation(),n=e.useCompile(),d=t.title?n(t.title):"";return r.jsx(e.SchemaSettingsItemGroup,{title:`${o("Customize")} > ${d}`,children:a.children})};function H(){var n;const{dn:a}=e.useDesignable(),{t}=p.useTranslation(),o=l.useFieldSchema();return r.jsx(e.SchemaSettingsSelectItem,{title:t("Data will be updated"),options:[{label:t("Selected"),value:"selected"},{label:t("All"),value:"all"}],value:(n=o==null?void 0:o["x-action-settings"])==null?void 0:n.updateMode,onChange:d=>{o["x-action-settings"].updateMode=d,a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}}),a.refresh()}})}function J(){var n;const{dn:a}=e.useDesignable(),{t}=p.useTranslation(),o=l.useFieldSchema();return r.jsx(e.SchemaSettingsModalItem,{title:t("After successful submission"),initialValues:(n=o==null?void 0:o["x-action-settings"])==null?void 0:n.onSuccess,schema:{type:"object",title:t("After successful submission"),properties:{successMessage:{title:t("Popup message"),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}},manualClose:{title:t("Popup close method"),enum:[{label:t("Automatic close"),value:!1},{label:t("Manually close"),value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{}},redirecting:{title:t("Then"),enum:[{label:t("Stay on current page"),value:!1},{label:t("Redirect to"),value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{},"x-reactions":{target:"redirectTo",fulfill:{state:{visible:"{{!!$self.value}}"}}}},redirectTo:{title:t("Link"),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:d=>{o["x-action-settings"].onSuccess=d,a.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}})}})}const Q=new e.SchemaSettings({name:"ActionSettings:customize:bulkUpdate",items:[{name:"Customize",Component:K,children:[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps(){const{buttonEditorProps:a}=e.useSchemaToolbar();return a}},{name:"updateMode",Component:H,useVisible(){const a=l.useFieldSchema();return["customize:bulkUpdate","customize:bulkEdit"].includes(a["x-action"])}},{name:"assignFieldValues",Component:e.AssignedFieldValues},{name:"afterSuccess",Component:J,useVisible(){var t;const a=l.useFieldSchema();return z.isValid((t=a==null?void 0:a["x-action-settings"])==null?void 0:t.onSuccess)}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps(){const{removeButtonProps:a}=e.useSchemaToolbar();return a}}]}]}),W=()=>{const a=e.useCollection(),t=e.useSchemaInitializerItem(),o={};return a&&o["x-acl-action"]&&(o["x-acl-action"]=`${a.name}:${o["x-acl-action"]}`,o["x-decorator"]="ACLActionProvider"),r.jsx(e.BlockInitializer,N(S({},t),{schema:o,item:t}))},X="bulk-update";function Y(){return p.useTranslation(X,{nsMode:"fallback"})}const Z=()=>{var w,q,R,j;const{field:a,resource:t,__parent:o,service:n}=e.useBlockRequestContext(),d=x.useContext(l.SchemaExpressionScopeContext),U=l.useFieldSchema(),V=e.useTableBlockContext(),{rowKey:ee}=V,A=(j=(R=(q=(w=V.field)==null?void 0:w.data)==null?void 0:q.selectedRowKeys)!=null?R:d==null?void 0:d.selectedRecordKeys)!=null?j:{},F=g.useNavigate(),I=e.useCompile(),{t:k}=Y(),h=l.useField(),{modal:B}=c.App.useApp(),y=e.useVariables(),te=e.useRecord(),{name:se,getField:oe}=e.useCollection(),ie=e.useLocalVariables({currentRecord:{__parent:te,__collectionName:se}});return{onClick(){return m(this,null,function*(){var L;const{assignedValues:D={},onSuccess:s,updateMode:E}=(L=U==null?void 0:U["x-action-settings"])!=null?L:{};h.data=a.data||{},h.data.loading=!0;const P={},ae=Object.keys(D).map(f=>m(this,null,function*(){const u=D[f],T=oe(f);if(e.isVariable(u)){const b=yield y==null?void 0:y.parseVariable(u,ie);b&&(P[f]=e.transformVariableValue(b,{targetCollectionField:T}))}else u!=null&&u!==""&&(P[f]=u)}));yield Promise.all(ae),B.confirm({title:k("Bulk update",{ns:"client"}),content:E==="selected"?k("Update selected data?",{ns:"client"}):k("Update all data?",{ns:"client"}),onOk(){return m(this,null,function*(){var T,b,$,M,G;const{filter:f}=(b=(T=n.params)==null?void 0:T[0])!=null?b:{},u={values:S({},P),filter:f,forceUpdate:!1};if(E==="selected"){if(!(A!=null&&A.length)){c.message.error(k("Please select the records to be updated")),h.data.loading=!1;return}u.filter={$and:[{[ee||"id"]:{$in:A}}]}}u.filter||(u.forceUpdate=!0);try{yield t.update(u)}catch(de){}finally{h.data.loading=!1}($=n==null?void 0:n.refresh)==null||$.call(n),t instanceof e.TableFieldResource||(G=(M=o==null?void 0:o.service)==null?void 0:M.refresh)==null||G.call(M),s!=null&&s.successMessage&&(s!=null&&s.manualClose?B.success({title:I(s==null?void 0:s.successMessage),onOk:()=>m(this,null,function*(){s!=null&&s.redirecting&&(s!=null&&s.redirectTo)&&(C.isURL(s.redirectTo)?window.location.href=s.redirectTo:F(s.redirectTo))})}):(c.message.success(I(s==null?void 0:s.successMessage)),s!=null&&s.redirecting&&(s!=null&&s.redirectTo)&&(C.isURL(s.redirectTo)?window.location.href=s.redirectTo:F(s.redirectTo))))})},onCancel(){return m(this,null,function*(){h.data.loading=!1})}})})}}};class v extends e.Plugin{load(){return m(this,null,function*(){this.app.addComponents({CustomizeActionInitializer:W}),this.app.addScopes({useCustomizeBulkUpdateActionProps:Z}),this.app.schemaSettingsManager.add(Q);const t={title:'{{t("Bulk update")}}',Component:"CustomizeActionInitializer",name:"bulkUpdate",schema:{type:"void",title:'{{ t("Bulk update") }}',"x-component":"Action","x-align":"right","x-acl-action":"update","x-decorator":"ACLActionProvider","x-designer":"Action.Designer","x-acl-action-props":{skipScopeCheck:!0},"x-action":"customize:bulkUpdate","x-settings":"ActionSettings:customize:bulkUpdate","x-action-settings":{assignedValues:{},updateMode:"selected",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-component-props":{icon:"EditOutlined",useProps:"{{ useCustomizeBulkUpdateActionProps }}"}},useVisible(){const n=e.useCollection();return(n.template!=="view"||(n==null?void 0:n.writableView))&&n.template!=="file"&&n.template!=="sql"}},o=this.app.schemaInitializerManager.get("TableActionInitializers");o==null||o.add("customize.bulkUpdate",t),this.app.schemaInitializerManager.addItem("GanttActionInitializers","customize.bulkUpdate",t),this.app.schemaInitializerManager.addItem("MapActionInitializers","customize.bulkUpdate",t)})}}i.BulkUpdatePlugin=v,i.default=v,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.2.0",
|
|
3
|
-
"@nocobase/client": "0.19.0-alpha.
|
|
3
|
+
"@nocobase/client": "0.19.0-alpha.8",
|
|
4
4
|
"@formily/shared": "2.3.0",
|
|
5
5
|
"react-i18next": "11.18.6",
|
|
6
6
|
"@formily/react": "2.3.0",
|
|
7
|
-
"@nocobase/utils": "0.19.0-alpha.
|
|
7
|
+
"@nocobase/utils": "0.19.0-alpha.8",
|
|
8
8
|
"react-router-dom": "6.21.0",
|
|
9
9
|
"antd": "5.12.8",
|
|
10
|
-
"@nocobase/server": "0.19.0-alpha.
|
|
11
|
-
"@nocobase/test": "0.19.0-alpha.
|
|
10
|
+
"@nocobase/server": "0.19.0-alpha.8",
|
|
11
|
+
"@nocobase/test": "0.19.0-alpha.8"
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-action-bulk-update",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.8",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/plugins/action-bulk-update",
|
|
6
6
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/plugins/action-bulk-update",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@nocobase/server": "0.x",
|
|
15
15
|
"@nocobase/test": "0.x"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "b8fbe613e320e40ebf2da1bf64907eab0197b589",
|
|
18
18
|
"keywords": [
|
|
19
19
|
"Actions"
|
|
20
20
|
]
|