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