@tachybase/plugin-action-bulk-update 1.3.21 → 1.3.23
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/server/plugin.d.ts +1 -1
- package/dist/server/plugin.js +1 -1
- package/package.json +8 -12
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("@
|
|
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("@tego/client"),require("antd"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/schema","react-i18next","react","@tego/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["@tego/client"],a.antd,a["react-router-dom"]))})(this,function(a,e,n,c,g,T,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,M=(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 T=l=>{try{d(n.next(l))}catch(x){g(x)}},C=l=>{try{d(n.throw(l))}catch(x){g(x)}},d=l=>l.done?c(l.value):Promise.resolve(l.value).then(T,C);d((n=n.apply(a,e)).next())});function x(){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:x,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(M({},i),{schema:s,item:i}))},Y=()=>{const i=e.useSchemaInitializerItem();return n.jsx(e.BlockInitializer,B(M({},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=T.useContext(c.SchemaExpressionScopeContext),y=c.useFieldSchema(),F=e.useTableBlockContext(),{rowKey:te}=F,w=l.useNavigate(),q=e.useCompile(),{t:k}=ee(),h=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=y==null?void 0:y["x-action-settings"])!=null?E:{};h.data=i.data||{},h.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 b=yield I==null?void 0:I.parseVariable(u,se);b&&(z[f]=e.transformVariableValue(b,{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,b,N,S,_;const{filter:f}=(b=(U=r.params)==null?void 0:U[0])!=null?b:{},u={values:M({},z),filter:f,forceUpdate:!1};if(D==="selected"){if(!(A!=null&&A.length)){d.message.error(k("Please select the records to be updated")),h.data.loading=!1;return}u.filter={$and:[{[te||"id"]:{$in:A}}]}}u.filter||(u.forceUpdate=!0);try{yield s.update(u)}catch(de){}finally{h.data.loading=!1}(N=r==null?void 0:r.refresh)==null||N.call(r),s instanceof e.TableFieldResource||(_=(S=o==null?void 0:o.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(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*(){h.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.23",
|
|
4
|
+
"@tachybase/schema": "1.3.43",
|
|
5
5
|
"react-i18next": "15.2.0",
|
|
6
|
-
"@
|
|
6
|
+
"@tego/client": "1.3.43",
|
|
7
7
|
"antd": "5.22.5",
|
|
8
8
|
"react-router-dom": "6.28.1",
|
|
9
|
-
"@
|
|
10
|
-
"@tachybase/test": "1.3.
|
|
9
|
+
"@tego/server": "1.3.43",
|
|
10
|
+
"@tachybase/test": "1.3.43"
|
|
11
11
|
};
|
package/dist/server/plugin.d.ts
CHANGED
package/dist/server/plugin.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(plugin_exports, {
|
|
|
21
21
|
default: () => plugin_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
-
var import_server = require("@
|
|
24
|
+
var import_server = require("@tego/server");
|
|
25
25
|
class PluginActionBulkUpdateServer extends import_server.Plugin {
|
|
26
26
|
afterAdd() {
|
|
27
27
|
}
|
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.23",
|
|
5
5
|
"description": "Batch update all records or selected records.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Actions"
|
|
@@ -10,20 +10,16 @@
|
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@tachybase/schema": "^1.3.43",
|
|
14
|
+
"@tachybase/test": "^1.3.43",
|
|
15
|
+
"@tego/client": "^1.3.43",
|
|
16
|
+
"@tego/server": "^1.3.43",
|
|
13
17
|
"antd": "5.22.5",
|
|
14
|
-
"react-i18next": "
|
|
18
|
+
"react-i18next": "15.2.0",
|
|
15
19
|
"react-router-dom": "6.28.1",
|
|
16
|
-
"@tachybase/
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"@tachybase/client": "1.3.21",
|
|
20
|
-
"@tachybase/server": "1.3.21",
|
|
21
|
-
"@tachybase/test": "1.3.21",
|
|
22
|
-
"@tachybase/utils": "1.3.21"
|
|
20
|
+
"@tachybase/client": "1.3.23"
|
|
23
21
|
},
|
|
24
22
|
"description.zh-CN": "对全部数据或选中的数据进行批量更新。",
|
|
25
23
|
"displayName.zh-CN": "操作:批量更新",
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tachybase-build --no-dts @tachybase/plugin-action-bulk-update"
|
|
28
|
-
}
|
|
24
|
+
"scripts": {}
|
|
29
25
|
}
|