@tachybase/plugin-action-bulk-update 1.3.16 → 1.3.17
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 +5 -5
- package/dist/index.js +4 -4
- package/package.json +6 -6
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/schema"),require("react-i18next"),require("react"),require("@tachybase/utils/client"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/schema","react-i18next","react","@tachybase/utils/client","antd","react-router-dom"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a["@tachybase/plugin-action-bulk-update"]={},a["@tachybase/client"],a.jsxRuntime,a["@tachybase/schema"],a["react-i18next"],a.react,a["@tachybase/utils"],a.antd,a["react-router-dom"]))})(this,function(a,e,n,c,g,M,C,d,l){"use strict";var ie=Object.defineProperty,ne=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var H=(a,e,n)=>e in a?ie(a,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[e]=n,S=(a,e)=>{for(var n in e||(e={}))ce.call(e,n)&&H(a,n,e[n]);if($)for(var n of $(e))ue.call(e,n)&&H(a,n,e[n]);return a},B=(a,e)=>ne(a,re(e));var m=(a,e,n)=>new Promise((c,g)=>{var M=l=>{try{d(n.next(l))}catch(h){g(h)}},C=l=>{try{d(n.throw(l))}catch(h){g(h)}},d=l=>l.done?c(l.value):Promise.resolve(l.value).then(M,C);d((n=n.apply(a,e)).next())});function h(){var r;const{dn:i}=e.useDesignable(),{t:s}=g.useTranslation(),o=c.useFieldSchema();return n.jsx(e.SchemaSettingsSelectItem,{title:s("Data will be updated"),options:[{label:s("Selected"),value:"selected"},{label:s("All"),value:"all"}],value:(r=o==null?void 0:o["x-action-settings"])==null?void 0:r.updateMode,onChange:p=>{o["x-action-settings"].updateMode=p,i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}}),i.refresh()}})}function J(){var r;const{dn:i}=e.useDesignable(),{t:s}=g.useTranslation(),o=c.useFieldSchema();return n.jsx(e.SchemaSettingsModalItem,{title:s("After successful submission"),initialValues:(r=o==null?void 0:o["x-action-settings"])==null?void 0:r.onSuccess,schema:{type:"object",title:s("After successful submission"),properties:{successMessage:{title:s("Popup message"),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}},manualClose:{title:s("Popup close method"),enum:[{label:s("Automatic close"),value:!1},{label:s("Manually close"),value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{}},redirecting:{title:s("Then"),enum:[{label:s("Stay on current page"),value:!1},{label:s("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:s("Link"),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:p=>{o["x-action-settings"].onSuccess=p,i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}})}})}const V=[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps(){const{buttonEditorProps:i}=e.useSchemaToolbar();return i}},{name:"updateMode",Component:h,useVisible(){const i=c.useFieldSchema();return["customize:bulkUpdate","customize:bulkEdit"].includes(i["x-action"])}},{name:"assignFieldValues",Component:e.AssignedFieldValues},{name:"afterSuccess",Component:J,useVisible(){var s;const i=c.useFieldSchema();return c.isValid((s=i==null?void 0:i["x-action-settings"])==null?void 0:s.onSuccess)}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps(){const{removeButtonProps:i}=e.useSchemaToolbar();return i}}],Q=new e.SchemaSettings({name:"ActionSettings:customize:bulkUpdate",items:V}),W=new e.SchemaSettings({name:"actionSettings:bulkUpdate",items:V}),X=()=>{const i=e.useSchemaInitializerItem(),s={type:"void",title:'{{ t("Bulk update") }}',"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","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"}};return n.jsx(e.BlockInitializer,B(S({},i),{schema:s,item:i}))},Y=()=>{const i=e.useSchemaInitializerItem();return n.jsx(e.BlockInitializer,B(S({},i),{item:i}))},Z="bulk-update";function ee(){return g.useTranslation(Z,{nsMode:"fallback"})}const v=()=>{const{field:i,resource:s,__parent:o,service:r}=e.useBlockRequestContext(),p=M.useContext(c.SchemaExpressionScopeContext),T=c.useFieldSchema(),F=e.useTableBlockContext(),{rowKey:te}=F,w=l.useNavigate(),q=e.useCompile(),{t:k}=ee(),b=c.useField(),{modal:j}=d.App.useApp(),I=e.useVariables();e.useRecord();const{name:le,getField:ae}=e.useCollection_deprecated(),se=e.useLocalVariables();return{onClick(){return m(this,null,function*(){var E,L,O,G,K;const{assignedValues:R={},onSuccess:t,updateMode:D}=(E=T==null?void 0:T["x-action-settings"])!=null?E:{};b.data=i.data||{},b.data.loading=!0;const A=(K=(G=(O=(L=F.field)==null?void 0:L.data)==null?void 0:O.selectedRowKeys)!=null?G:p==null?void 0:p.selectedRecordKeys)!=null?K:{},z={},oe=Object.keys(R).map(f=>m(
|
|
1
|
+
(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/schema"),require("react-i18next"),require("react"),require("@tachybase/utils/client"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/schema","react-i18next","react","@tachybase/utils/client","antd","react-router-dom"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a["@tachybase/plugin-action-bulk-update"]={},a["@tachybase/client"],a.jsxRuntime,a["@tachybase/schema"],a["react-i18next"],a.react,a["@tachybase/utils"],a.antd,a["react-router-dom"]))})(this,function(a,e,n,c,g,M,C,d,l){"use strict";var ie=Object.defineProperty,ne=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var H=(a,e,n)=>e in a?ie(a,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[e]=n,S=(a,e)=>{for(var n in e||(e={}))ce.call(e,n)&&H(a,n,e[n]);if($)for(var n of $(e))ue.call(e,n)&&H(a,n,e[n]);return a},B=(a,e)=>ne(a,re(e));var m=(a,e,n)=>new Promise((c,g)=>{var M=l=>{try{d(n.next(l))}catch(h){g(h)}},C=l=>{try{d(n.throw(l))}catch(h){g(h)}},d=l=>l.done?c(l.value):Promise.resolve(l.value).then(M,C);d((n=n.apply(a,e)).next())});function h(){var r;const{dn:i}=e.useDesignable(),{t:s}=g.useTranslation(),o=c.useFieldSchema();return n.jsx(e.SchemaSettingsSelectItem,{title:s("Data will be updated"),options:[{label:s("Selected"),value:"selected"},{label:s("All"),value:"all"}],value:(r=o==null?void 0:o["x-action-settings"])==null?void 0:r.updateMode,onChange:p=>{o["x-action-settings"].updateMode=p,i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}}),i.refresh()}})}function J(){var r;const{dn:i}=e.useDesignable(),{t:s}=g.useTranslation(),o=c.useFieldSchema();return n.jsx(e.SchemaSettingsModalItem,{title:s("After successful submission"),initialValues:(r=o==null?void 0:o["x-action-settings"])==null?void 0:r.onSuccess,schema:{type:"object",title:s("After successful submission"),properties:{successMessage:{title:s("Popup message"),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{}},manualClose:{title:s("Popup close method"),enum:[{label:s("Automatic close"),value:!1},{label:s("Manually close"),value:!0}],"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{}},redirecting:{title:s("Then"),enum:[{label:s("Stay on current page"),value:!1},{label:s("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:s("Link"),"x-decorator":"FormItem","x-component":"Input","x-component-props":{}}}},onSubmit:p=>{o["x-action-settings"].onSuccess=p,i.emit("patch",{schema:{"x-uid":o["x-uid"],"x-action-settings":o["x-action-settings"]}})}})}const V=[{name:"editButton",Component:e.ActionDesigner.ButtonEditor,useComponentProps(){const{buttonEditorProps:i}=e.useSchemaToolbar();return i}},{name:"updateMode",Component:h,useVisible(){const i=c.useFieldSchema();return["customize:bulkUpdate","customize:bulkEdit"].includes(i["x-action"])}},{name:"assignFieldValues",Component:e.AssignedFieldValues},{name:"afterSuccess",Component:J,useVisible(){var s;const i=c.useFieldSchema();return c.isValid((s=i==null?void 0:i["x-action-settings"])==null?void 0:s.onSuccess)}},{name:"remove",sort:100,Component:e.ActionDesigner.RemoveButton,useComponentProps(){const{removeButtonProps:i}=e.useSchemaToolbar();return i}}],Q=new e.SchemaSettings({name:"ActionSettings:customize:bulkUpdate",items:V}),W=new e.SchemaSettings({name:"actionSettings:bulkUpdate",items:V}),X=()=>{const i=e.useSchemaInitializerItem(),s={type:"void",title:'{{ t("Bulk update") }}',"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","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"}};return n.jsx(e.BlockInitializer,B(S({},i),{schema:s,item:i}))},Y=()=>{const i=e.useSchemaInitializerItem();return n.jsx(e.BlockInitializer,B(S({},i),{item:i}))},Z="bulk-update";function ee(){return g.useTranslation(Z,{nsMode:"fallback"})}const v=()=>{const{field:i,resource:s,__parent:o,service:r}=e.useBlockRequestContext(),p=M.useContext(c.SchemaExpressionScopeContext),T=c.useFieldSchema(),F=e.useTableBlockContext(),{rowKey:te}=F,w=l.useNavigate(),q=e.useCompile(),{t:k}=ee(),b=c.useField(),{modal:j}=d.App.useApp(),I=e.useVariables();e.useRecord();const{name:le,getField:ae}=e.useCollection_deprecated(),se=e.useLocalVariables();return{onClick(){return m(this,null,function*(){var E,L,O,G,K;const{assignedValues:R={},onSuccess:t,updateMode:D}=(E=T==null?void 0:T["x-action-settings"])!=null?E:{};b.data=i.data||{},b.data.loading=!0;const A=(K=(G=(O=(L=F.field)==null?void 0:L.data)==null?void 0:O.selectedRowKeys)!=null?G:p==null?void 0:p.selectedRecordKeys)!=null?K:{},z={},oe=Object.keys(R).map(f=>m(null,null,function*(){const u=R[f],U=ae(f);if(e.isVariable(u)){const x=yield I==null?void 0:I.parseVariable(u,se);x&&(z[f]=e.transformVariableValue(x,{targetCollectionField:U}))}else u!=null&&u!==""&&(z[f]=u)}));yield Promise.all(oe),j.confirm({title:k("Bulk update",{ns:"core"}),content:D==="selected"?k("Update selected data?",{ns:"core"}):k("Update all data?",{ns:"core"}),onOk(){return m(this,null,function*(){var U,x,N,y,_;const{filter:f}=(x=(U=r.params)==null?void 0:U[0])!=null?x:{},u={values:S({},z),filter:f,forceUpdate:!1};if(D==="selected"){if(!(A!=null&&A.length)){d.message.error(k("Please select the records to be updated")),b.data.loading=!1;return}u.filter={$and:[{[te||"id"]:{$in:A}}]}}u.filter||(u.forceUpdate=!0);try{yield s.update(u)}catch(de){}finally{b.data.loading=!1}(N=r==null?void 0:r.refresh)==null||N.call(r),s instanceof e.TableFieldResource||(_=(y=o==null?void 0:o.service)==null?void 0:y.refresh)==null||_.call(y),t!=null&&t.successMessage&&(t!=null&&t.manualClose?j.success({title:q(t==null?void 0:t.successMessage),onOk:()=>m(null,null,function*(){t!=null&&t.redirecting&&(t!=null&&t.redirectTo)&&(C.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)&&(C.isURL(t.redirectTo)?window.location.href=t.redirectTo:w(t.redirectTo))))})},onCancel(){return m(this,null,function*(){b.data.loading=!1})}})})}}};class P 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(Q),this.app.schemaSettingsManager.add(W);const s={title:'{{t("Bulk update")}}',Component:X,name:"bulkUpdate",useVisible(){const o=e.useCollection_deprecated();return(o.template!=="view"||(o==null?void 0:o.writableView))&&o.template!=="file"&&o.template!=="sql"}};this.app.schemaInitializerManager.addItem("table:configureActions","customize.bulkUpdate",s),this.app.schemaInitializerManager.addItem("gantt:configureActions","customize.bulkUpdate",s),this.app.schemaInitializerManager.addItem("map:configureActions","customize.bulkUpdate",s)})}}a.PluginActionBulkUpdateClient=P,a.default=P,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/schema": "1.3.
|
|
3
|
+
"@tachybase/client": "1.3.17",
|
|
4
|
+
"@tachybase/schema": "1.3.17",
|
|
5
5
|
"react-i18next": "15.2.0",
|
|
6
|
-
"@tachybase/utils": "1.3.
|
|
6
|
+
"@tachybase/utils": "1.3.17",
|
|
7
7
|
"antd": "5.22.5",
|
|
8
8
|
"react-router-dom": "6.28.1",
|
|
9
|
-
"@tachybase/server": "1.3.
|
|
10
|
-
"@tachybase/test": "1.3.
|
|
9
|
+
"@tachybase/server": "1.3.17",
|
|
10
|
+
"@tachybase/test": "1.3.17"
|
|
11
11
|
};
|
package/dist/index.js
CHANGED
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
31
|
default: () => import_server.default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
__reExport(
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
__reExport(index_exports, require("./server"), module.exports);
|
|
35
35
|
var import_server = __toESM(require("./server"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-action-bulk-update",
|
|
3
3
|
"displayName": "Action: Batch update",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.17",
|
|
5
5
|
"description": "Batch update all records or selected records.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Actions"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"antd": "5.22.5",
|
|
14
14
|
"react-i18next": "^15.2.0",
|
|
15
15
|
"react-router-dom": "6.28.1",
|
|
16
|
-
"@tachybase/schema": "1.3.
|
|
16
|
+
"@tachybase/schema": "1.3.17"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@tachybase/
|
|
20
|
-
"@tachybase/
|
|
21
|
-
"@tachybase/
|
|
22
|
-
"@tachybase/
|
|
19
|
+
"@tachybase/server": "1.3.17",
|
|
20
|
+
"@tachybase/utils": "1.3.17",
|
|
21
|
+
"@tachybase/test": "1.3.17",
|
|
22
|
+
"@tachybase/client": "1.3.17"
|
|
23
23
|
},
|
|
24
24
|
"description.zh-CN": "对全部数据或选中的数据进行批量更新。",
|
|
25
25
|
"displayName.zh-CN": "操作:批量更新",
|