@nocobase/plugin-action-export 1.0.0-alpha.14 → 1.0.0-alpha.15

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.
@@ -6,11 +6,5 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Schema } from '@formily/react';
10
9
  import React from 'react';
11
- export declare const useCurrentSchema: (action: string, key: string, find?: (schema: Schema, key: string, action: string) => any, rm?: (schema: any, cb: any) => any) => {
12
- schema: any;
13
- exists: boolean;
14
- remove(): void;
15
- };
16
10
  export declare const ExportActionInitializer: () => React.JSX.Element;
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(s,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("react/jsx-runtime"),require("@formily/react"),require("@formily/shared"),require("@nocobase/client"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("lodash"),require("antd")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@formily/react","@formily/shared","@nocobase/client","@formily/antd-v5","react","react-i18next","lodash","antd"],l):(s=typeof globalThis!="undefined"?globalThis:s||self,l(s["@nocobase/plugin-action-export"]={},s.jsxRuntime,s["@formily/react"],s["@formily/shared"],s["@nocobase/client"],s["@formily/antd-v5"],s.react,s["react-i18next"],s.lodash,s.antd))})(this,function(s,l,h,k,i,M,w,E,y,j){"use strict";var re=Object.defineProperty,ae=Object.defineProperties;var se=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var Y=(s,l,h)=>l in s?re(s,l,{enumerable:!0,configurable:!0,writable:!0,value:h}):s[l]=h,B=(s,l)=>{for(var h in l||(l={}))ie.call(l,h)&&Y(s,h,l[h]);if(V)for(var h of V(l))ce.call(l,h)&&Y(s,h,l[h]);return s},Q=(s,l)=>ae(s,se(l));var D=(s,l,h)=>new Promise((k,i)=>{var M=y=>{try{E(h.next(y))}catch(j){i(j)}},w=y=>{try{E(h.throw(y))}catch(j){i(j)}},E=y=>y.done?k(y.value):Promise.resolve(y.value).then(M,w);E((h=h.apply(s,l)).next())});const O=o=>{var c;const e=h.useFieldSchema();(c=e==null?void 0:e["x-component-props"])!=null&&c.nonfilterable;const{getCollectionFields:a}=i.useCollectionManager_deprecated(),d=a(o),g=(p,x)=>{var r;if(!p.interface)return;const t={name:p.name,title:((r=p==null?void 0:p.uiSchema)==null?void 0:r.title)||p.name,schema:p==null?void 0:p.uiSchema};if(!p.target||x>=3)return t;if(p.target){const u=a(p.target),n=f(u,x+1).filter(Boolean);t.children=t.children||[],t.children.push(...n)}return t},f=(p,x)=>{const t=[];return p.forEach(r=>{const u=g(r,x);u&&t.push(u)}),t};return f(d,1)},L=(o,e,a)=>o.reduceProperties((d,g)=>{if(g[e]===a)return g;const f=L(g,e,a);return f||d}),Z=(o,e)=>e(o),R=(o,e,a=L,d=Z)=>{const g=h.useFieldSchema(),{remove:f}=i.useDesignable(),c=a(g,e,o);return{schema:c,exists:!!c,remove(){c&&d(c,f)}}},$=o=>o==null?void 0:o.filter(a=>!a.children).map(a=>({dataIndex:[a.name]})),q=()=>{const o=i.useSchemaInitializerItem(),{insert:e}=i.useSchemaInitializer(),{exists:a,remove:d}=R("export","x-action",o.find,o.remove),{name:g}=i.useCollection_deprecated(),f=O(g),c={type:"void",title:'{{ t("Export") }}',"x-action":"export","x-action-settings":{exportSettings:[]},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:export","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useExportAction","x-component-props":{icon:"clouddownloadoutlined"}};return l.jsx(i.SchemaInitializerSwitch,Q(B({},o),{checked:a,title:o.title,onClick:()=>{var x;if(a)return d();c["x-action-settings"].exportSettings=$(f);const p=k.merge(c||{},o.schema||{});(x=o==null?void 0:o.schemaInitialize)==null||x.call(o,p),e(p)}}))},_=()=>{const{name:o}=i.useCollection_deprecated(),e=O(o);return{schema:{type:"void","x-component":"Grid",properties:{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:i.css`
10
+ (function(a,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("react/jsx-runtime"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("lodash"),require("antd")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@formily/shared","@nocobase/client","@formily/react","@formily/antd-v5","react","react-i18next","lodash","antd"],l):(a=typeof globalThis!="undefined"?globalThis:a||self,l(a["@nocobase/plugin-action-export"]={},a.jsxRuntime,a["@formily/shared"],a["@nocobase/client"],a["@formily/react"],a["@formily/antd-v5"],a.react,a["react-i18next"],a.lodash,a.antd))})(this,function(a,l,f,i,y,k,I,w,b,T){"use strict";var ee=Object.defineProperty;var J=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var X=(a,l,f)=>l in a?ee(a,l,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[l]=f,K=(a,l)=>{for(var f in l||(l={}))te.call(l,f)&&X(a,f,l[f]);if(J)for(var f of J(l))oe.call(l,f)&&X(a,f,l[f]);return a};var B=(a,l,f)=>new Promise((i,y)=>{var k=b=>{try{w(f.next(b))}catch(T){y(T)}},I=b=>{try{w(f.throw(b))}catch(T){y(T)}},w=b=>b.done?i(b.value):Promise.resolve(b.value).then(k,I);w((f=f.apply(a,l)).next())});const O=r=>{var u;const e=y.useFieldSchema();(u=e==null?void 0:e["x-component-props"])!=null&&u.nonfilterable;const{getCollectionFields:s}=i.useCollectionManager_deprecated(),m=s(r),v=(d,x)=>{var n;if(!d.interface)return;const t={name:d.name,title:((n=d==null?void 0:d.uiSchema)==null?void 0:n.title)||d.name,schema:d==null?void 0:d.uiSchema};if(!d.target||x>=3)return t;if(d.target){const c=s(d.target),o=h(c,x+1).filter(Boolean);t.children=t.children||[],t.children.push(...o)}return t},h=(d,x)=>{const t=[];return d.forEach(n=>{const c=v(n,x);c&&t.push(c)}),t};return h(m,1)},V=r=>r==null?void 0:r.filter(s=>!s.children).map(s=>({dataIndex:[s.name]})),D=()=>{const r=i.useSchemaInitializerItem(),{insert:e}=i.useSchemaInitializer(),{name:s}=i.useCollection_deprecated(),m=O(s),v={type:"void",title:'{{ t("Export") }}',"x-action":"export","x-action-settings":{exportSettings:[]},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:export","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useExportAction","x-component-props":{icon:"clouddownloadoutlined"}};return l.jsx(i.SchemaInitializerItem,{title:r.title,onClick:()=>{var u;v["x-action-settings"].exportSettings=V(m);const h=f.merge(v||{},r.schema||{});(u=r==null?void 0:r.schemaInitialize)==null||u.call(r,h),e(h)}})},L=()=>{const{name:r}=i.useCollection_deprecated(),e=O(r);return{schema:{type:"void","x-component":"Grid",properties:{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:i.css`
11
11
  width: 100%;
12
12
  & .ant-space-item:nth-child(2),
13
13
  & .ant-space-item:nth-child(3) {
@@ -20,4 +20,4 @@
20
20
  border-color: var(--colorSettings);
21
21
  color: var(--colorSettings);
22
22
  }
23
- `}}}}}}}},ee="action-export";function z(){return E.useTranslation([ee,"client"],{nsMode:"fallback"})}const U=()=>{var p,x,t,r,u;const o=h.useField(),e=h.useFieldSchema(),{t:a}=z(),{dn:d}=i.useDesignable(),[g,f]=w.useState(),{schema:c}=_();return w.useEffect(()=>{f(c)},[o.address,(p=e==null?void 0:e["x-action-settings"])==null?void 0:p.exportSettings]),l.jsxs(i.GeneralSchemaDesigner,{disableInitializer:!0,children:[l.jsx(i.SchemaSettingsModalItem,{title:a("Edit button"),schema:{type:"object",title:a("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:a("Button title"),default:e.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:a("Button icon"),default:(x=e==null?void 0:e["x-component-props"])==null?void 0:x.icon,"x-component-props":{}},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:a("Button background color"),default:(t=e==null?void 0:e["x-component-props"])!=null&&t.danger?"danger":((r=e==null?void 0:e["x-component-props"])==null?void 0:r.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:({title:n,icon:m,type:v})=>{e.title=n,o.title=n,o.componentProps.icon=m,o.componentProps.danger=v==="danger",o.componentProps.type=v,e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].icon=m,e["x-component-props"].danger=v==="danger",e["x-component-props"].type=v,d.emit("patch",{schema:{"x-uid":e["x-uid"],title:n,"x-component-props":B({},e["x-component-props"])}}),d.refresh()}}),l.jsx(i.SchemaSettingsActionModalItem,{title:a("Exportable fields"),schema:g,initialValues:{exportSettings:(u=e==null?void 0:e["x-action-settings"])==null?void 0:u.exportSettings},scope:{t:a},components:{ArrayItems:M.ArrayItems},onSubmit:({exportSettings:n})=>{e["x-action-settings"].exportSettings=n==null?void 0:n.filter(m=>{var v;return(v=m==null?void 0:m.dataIndex)==null?void 0:v.length}).map(m=>({dataIndex:m.dataIndex.map(v=>{var S;return(S=v.name)!=null?S:v}),title:m.title})),d.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),d.refresh()}}),l.jsx(i.SchemaSettingsDivider,{}),l.jsx(i.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:n=>n["x-component"]==="Space"||n["x-component"].endsWith("ActionBar"),confirm:{title:a("Delete action")}})]})},N=o=>l.jsx(i.SchemaComponentOptions,{components:{ExportActionInitializer:q,ExportDesigner:U},scope:{useExportAction:G},children:o.children});var P=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},H={exports:{}};(function(o,e){(function(a,d){d()})(P,function(){function a(t,r){return typeof r=="undefined"?r={autoBom:!1}:typeof r!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\uFEFF",t],{type:t.type}):t}function d(t,r,u){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){x(n.response,r,u)},n.onerror=function(){console.error("could not download file")},n.send()}function g(t){var r=new XMLHttpRequest;r.open("HEAD",t,!1);try{r.send()}catch(u){}return 200<=r.status&&299>=r.status}function f(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(u){var r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(r)}}var c=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof P=="object"&&P.global===P?P:void 0,p=c.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),x=c.saveAs||(typeof window!="object"||window!==c?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(t,r,u){var n=c.URL||c.webkitURL,m=document.createElement("a");r=r||t.name||"download",m.download=r,m.rel="noopener",typeof t=="string"?(m.href=t,m.origin===location.origin?f(m):g(m.href)?d(t,r,u):f(m,m.target="_blank")):(m.href=n.createObjectURL(t),setTimeout(function(){n.revokeObjectURL(m.href)},4e4),setTimeout(function(){f(m)},0))}:"msSaveOrOpenBlob"in navigator?function(t,r,u){if(r=r||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(a(t,u),r);else if(g(t))d(t,r,u);else{var n=document.createElement("a");n.href=t,n.target="_blank",setTimeout(function(){f(n)})}}:function(t,r,u,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof t=="string")return d(t,r,u);var m=t.type==="application/octet-stream",v=/constructor/i.test(c.HTMLElement)||c.safari,S=/CriOS\/[\d]+/.test(navigator.userAgent);if((S||m&&v||p)&&typeof FileReader!="undefined"){var I=new FileReader;I.onloadend=function(){var A=I.result;A=S?A:A.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=A:location=A,n=null},I.readAsDataURL(t)}else{var T=c.URL||c.webkitURL,C=T.createObjectURL(t);n?n.location=C:location.href=C,n=null,setTimeout(function(){T.revokeObjectURL(C)},4e4)}});c.saveAs=x.saveAs=x,o.exports=x})})(H);var te=H.exports;const G=()=>{const{service:o,resource:e}=i.useBlockRequestContext();i.useAPIClient();const a=h.useFieldSchema(),d=i.useCompile(),{getCollectionJoinField:g}=i.useCollectionManager_deprecated(),{name:f,title:c,getField:p}=i.useCollection_deprecated(),{t:x}=z(),{modal:t}=j.App.useApp();return{onClick(){return D(this,null,function*(){var S,I,T,C,A;if(!(yield t.confirm({title:x("Export"),content:x("Export warning"),okText:x("Start export")})))return;const{exportSettings:n}=y.cloneDeep((S=a==null?void 0:a["x-action-settings"])!=null?S:{});n.forEach(F=>{var J,X;const{uiSchema:b,interface:ne}=(J=g(`${f}.${F.dataIndex.join(".")}`))!=null?J:{};F.enum=(X=b==null?void 0:b.enum)==null?void 0:X.map(K=>({value:K.value,label:K.label})),!F.enum&&(b==null?void 0:b.type)==="boolean"&&(F.enum=[{value:!0,label:x("Yes")},{value:!1,label:x("No")}]),F.defaultTitle=b==null?void 0:b.title,ne==="chinaRegion"&&F.dataIndex.push("name")});const{data:m}=yield e.export({title:d(c),appends:(T=(I=o.params[0])==null?void 0:I.appends)==null?void 0:T.join(),filter:JSON.stringify((C=o.params[0])==null?void 0:C.filter),sort:(A=o.params[0])==null?void 0:A.sort},{method:"post",data:{columns:d(n)},responseType:"blob"}),v=new Blob([m],{type:"application/x-xls"});te.saveAs(v,`${d(c)}.xlsx`)})}}},oe=new i.SchemaSettings({name:"actionSettings:export",items:[{name:"editButton",Component:i.ButtonEditor,useComponentProps(){const{buttonEditorProps:o}=i.useSchemaToolbar();return o}},{name:"exportableFields",type:"actionModal",useComponentProps(){var p,x;const o=h.useField(),e=h.useFieldSchema(),{t:a}=E.useTranslation(),{dn:d}=i.useDesignable(),[g,f]=w.useState(),{schema:c}=_();return w.useEffect(()=>{f(c)},[o.address,(p=e==null?void 0:e["x-action-settings"])==null?void 0:p.exportSettings]),{title:a("Exportable fields"),schema:g,initialValues:{exportSettings:(x=e==null?void 0:e["x-action-settings"])==null?void 0:x.exportSettings},components:{ArrayItems:M.ArrayItems},onSubmit:({exportSettings:t})=>{e["x-action-settings"].exportSettings=t==null?void 0:t.filter(r=>{var u;return(u=r==null?void 0:r.dataIndex)==null?void 0:u.length}).map(r=>({dataIndex:r.dataIndex.map(u=>{var n;return(n=u.name)!=null?n:u}),title:r.title})),d.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),d.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){const{t:o}=E.useTranslation();return{removeParentsIfNoChildren:!0,breakRemoveOn:e=>e["x-component"]==="Space"||e["x-component"].endsWith("ActionBar"),confirm:{title:o("Delete action")}}}}]});class W extends i.Plugin{load(){return D(this,null,function*(){this.app.use(N);const e={title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}}},a=this.app.schemaInitializerManager.get("table:configureActions");a==null||a.add("enableActions.export",e),this.app.schemaInitializerManager.addItem("gantt:configureActions","enableActions.export",e),this.app.schemaSettingsManager.add(oe)})}}s.ExportActionInitializer=q,s.ExportDesigner=U,s.ExportPluginProvider=N,s.PluginActionExportClient=W,s.default=W,s.useCurrentSchema=R,s.useExportAction=G,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
23
+ `}}}}}}}},Y="action-export";function R(){return w.useTranslation([Y,"client"],{nsMode:"fallback"})}const q=()=>{var d,x,t,n,c;const r=y.useField(),e=y.useFieldSchema(),{t:s}=R(),{dn:m}=i.useDesignable(),[v,h]=I.useState(),{schema:u}=L();return I.useEffect(()=>{h(u)},[r.address,(d=e==null?void 0:e["x-action-settings"])==null?void 0:d.exportSettings]),l.jsxs(i.GeneralSchemaDesigner,{disableInitializer:!0,children:[l.jsx(i.SchemaSettingsModalItem,{title:s("Edit button"),schema:{type:"object",title:s("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:s("Button title"),default:e.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:s("Button icon"),default:(x=e==null?void 0:e["x-component-props"])==null?void 0:x.icon,"x-component-props":{}},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:s("Button background color"),default:(t=e==null?void 0:e["x-component-props"])!=null&&t.danger?"danger":((n=e==null?void 0:e["x-component-props"])==null?void 0:n.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:({title:o,icon:p,type:g})=>{e.title=o,r.title=o,r.componentProps.icon=p,r.componentProps.danger=g==="danger",r.componentProps.type=g,e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].icon=p,e["x-component-props"].danger=g==="danger",e["x-component-props"].type=g,m.emit("patch",{schema:{"x-uid":e["x-uid"],title:o,"x-component-props":K({},e["x-component-props"])}}),m.refresh()}}),l.jsx(i.SchemaSettingsActionModalItem,{title:s("Exportable fields"),schema:v,initialValues:{exportSettings:(c=e==null?void 0:e["x-action-settings"])==null?void 0:c.exportSettings},scope:{t:s},components:{ArrayItems:k.ArrayItems},onSubmit:({exportSettings:o})=>{e["x-action-settings"].exportSettings=o==null?void 0:o.filter(p=>{var g;return(g=p==null?void 0:p.dataIndex)==null?void 0:g.length}).map(p=>({dataIndex:p.dataIndex.map(g=>{var A;return(A=g.name)!=null?A:g}),title:p.title})),m.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),m.refresh()}}),l.jsx(i.SchemaSettingsDivider,{}),l.jsx(i.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:o=>o["x-component"]==="Space"||o["x-component"].endsWith("ActionBar"),confirm:{title:s("Delete action")}})]})},_=r=>l.jsx(i.SchemaComponentOptions,{components:{ExportActionInitializer:D,ExportDesigner:q},scope:{useExportAction:U},children:r.children});var P=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},z={exports:{}};(function(r,e){(function(s,m){m()})(P,function(){function s(t,n){return typeof n=="undefined"?n={autoBom:!1}:typeof n!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),n={autoBom:!n}),n.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\uFEFF",t],{type:t.type}):t}function m(t,n,c){var o=new XMLHttpRequest;o.open("GET",t),o.responseType="blob",o.onload=function(){x(o.response,n,c)},o.onerror=function(){console.error("could not download file")},o.send()}function v(t){var n=new XMLHttpRequest;n.open("HEAD",t,!1);try{n.send()}catch(c){}return 200<=n.status&&299>=n.status}function h(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(c){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof P=="object"&&P.global===P?P:void 0,d=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),x=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(t,n,c){var o=u.URL||u.webkitURL,p=document.createElement("a");n=n||t.name||"download",p.download=n,p.rel="noopener",typeof t=="string"?(p.href=t,p.origin===location.origin?h(p):v(p.href)?m(t,n,c):h(p,p.target="_blank")):(p.href=o.createObjectURL(t),setTimeout(function(){o.revokeObjectURL(p.href)},4e4),setTimeout(function(){h(p)},0))}:"msSaveOrOpenBlob"in navigator?function(t,n,c){if(n=n||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(s(t,c),n);else if(v(t))m(t,n,c);else{var o=document.createElement("a");o.href=t,o.target="_blank",setTimeout(function(){h(o)})}}:function(t,n,c,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof t=="string")return m(t,n,c);var p=t.type==="application/octet-stream",g=/constructor/i.test(u.HTMLElement)||u.safari,A=/CriOS\/[\d]+/.test(navigator.userAgent);if((A||p&&g||d)&&typeof FileReader!="undefined"){var F=new FileReader;F.onloadend=function(){var E=F.result;E=A?E:E.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=E:location=E,o=null},F.readAsDataURL(t)}else{var M=u.URL||u.webkitURL,C=M.createObjectURL(t);o?o.location=C:location.href=C,o=null,setTimeout(function(){M.revokeObjectURL(C)},4e4)}});u.saveAs=x.saveAs=x,r.exports=x})})(z);var Q=z.exports;const U=()=>{const{service:r,resource:e}=i.useBlockRequestContext();i.useAPIClient();const s=y.useFieldSchema(),m=i.useCompile(),{getCollectionJoinField:v}=i.useCollectionManager_deprecated(),{name:h,title:u,getField:d}=i.useCollection_deprecated(),{t:x}=R(),{modal:t}=T.App.useApp();return{onClick(){return B(this,null,function*(){var A,F,M,C,E;if(!(yield t.confirm({title:x("Export"),content:x("Export warning"),okText:x("Start export")})))return;const{exportSettings:o}=b.cloneDeep((A=s==null?void 0:s["x-action-settings"])!=null?A:{});o.forEach(j=>{var H,G;const{uiSchema:S,interface:$}=(H=v(`${h}.${j.dataIndex.join(".")}`))!=null?H:{};j.enum=(G=S==null?void 0:S.enum)==null?void 0:G.map(W=>({value:W.value,label:W.label})),!j.enum&&(S==null?void 0:S.type)==="boolean"&&(j.enum=[{value:!0,label:x("Yes")},{value:!1,label:x("No")}]),j.defaultTitle=S==null?void 0:S.title,$==="chinaRegion"&&j.dataIndex.push("name")});const{data:p}=yield e.export({title:m(u),appends:(M=(F=r.params[0])==null?void 0:F.appends)==null?void 0:M.join(),filter:JSON.stringify((C=r.params[0])==null?void 0:C.filter),sort:(E=r.params[0])==null?void 0:E.sort},{method:"post",data:{columns:m(o)},responseType:"blob"}),g=new Blob([p],{type:"application/x-xls"});Q.saveAs(g,`${m(u)}.xlsx`)})}}},Z=new i.SchemaSettings({name:"actionSettings:export",items:[{name:"editButton",Component:i.ButtonEditor,useComponentProps(){const{buttonEditorProps:r}=i.useSchemaToolbar();return r}},{name:"exportableFields",type:"actionModal",useComponentProps(){var d,x;const r=y.useField(),e=y.useFieldSchema(),{t:s}=w.useTranslation(),{dn:m}=i.useDesignable(),[v,h]=I.useState(),{schema:u}=L();return I.useEffect(()=>{h(u)},[r.address,(d=e==null?void 0:e["x-action-settings"])==null?void 0:d.exportSettings]),{title:s("Exportable fields"),schema:v,initialValues:{exportSettings:(x=e==null?void 0:e["x-action-settings"])==null?void 0:x.exportSettings},components:{ArrayItems:k.ArrayItems},onSubmit:({exportSettings:t})=>{e["x-action-settings"].exportSettings=t==null?void 0:t.filter(n=>{var c;return(c=n==null?void 0:n.dataIndex)==null?void 0:c.length}).map(n=>({dataIndex:n.dataIndex.map(c=>{var o;return(o=c.name)!=null?o:c}),title:n.title})),m.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),m.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){const{t:r}=w.useTranslation();return{removeParentsIfNoChildren:!0,breakRemoveOn:e=>e["x-component"]==="Space"||e["x-component"].endsWith("ActionBar"),confirm:{title:r("Delete action")}}}}]});class N extends i.Plugin{load(){return B(this,null,function*(){this.app.use(_);const e={title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}}},s=this.app.schemaInitializerManager.get("table:configureActions");s==null||s.add("enableActions.export",e),this.app.schemaInitializerManager.addItem("gantt:configureActions","enableActions.export",e),this.app.schemaSettingsManager.add(Z)})}}a.ExportActionInitializer=D,a.ExportDesigner=q,a.ExportPluginProvider=_,a.PluginActionExportClient=N,a.default=N,a.useExportAction=U,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -10,14 +10,14 @@
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
12
  "@formily/shared": "2.3.0",
13
- "@nocobase/client": "1.0.0-alpha.14",
13
+ "@nocobase/client": "1.0.0-alpha.15",
14
14
  "react": "18.2.0",
15
15
  "@formily/antd-v5": "1.1.9",
16
16
  "react-i18next": "11.18.6",
17
17
  "lodash": "4.17.21",
18
18
  "antd": "5.12.8",
19
- "@nocobase/server": "1.0.0-alpha.14",
20
- "@nocobase/actions": "1.0.0-alpha.14",
21
- "@nocobase/database": "1.0.0-alpha.14",
22
- "@nocobase/utils": "1.0.0-alpha.14"
19
+ "@nocobase/server": "1.0.0-alpha.15",
20
+ "@nocobase/actions": "1.0.0-alpha.15",
21
+ "@nocobase/database": "1.0.0-alpha.15",
22
+ "@nocobase/utils": "1.0.0-alpha.15"
23
23
  };
@@ -1 +1 @@
1
- {"name":"node-xlsx","author":"Olivier Louvignes <olivier@mg-crea.com>","version":"0.16.2","description":"NodeJS Excel files parser & builder","main":"lib/index.js","scripts":{"start":"yarn test:watch","test":"NODE_ENV=test jest --runInBand","test:watch":"yarn test -- --watch","test:coverage":"yarn test -- --coverage","lint":"NODE_ENV=test eslint src/ test/","build":"rimraf lib/*; NODE_ENV=production babel src/ -d lib/ -s","build:watch":"yarn build -- -w","prepublish":"yarn build"},"repository":"github:mgcrea/node-xlsx","license":"Apache-2.0","dependencies":{"@babel/runtime":"^7.14.6","buffer-from":"^1.1.1","xlsx":"^0.17.0"},"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","babel-eslint":"^10.1.0","codacy-coverage":"^3.4.0","debug-utils":"^0.5.3","eslint":"^7.30.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","expect":"^27.0.6","jest":"^27.0.6","rimraf":"^3.0.2"},"engines":{"node":">=4.0.0"},"keywords":["excel","parser","builder","xlsx","xls"],"jest":{"testEnvironment":"node","setupFiles":["<rootDir>/test/setup.js"]},"_lastModified":"2024-05-16T13:59:55.636Z"}
1
+ {"name":"node-xlsx","author":"Olivier Louvignes <olivier@mg-crea.com>","version":"0.16.2","description":"NodeJS Excel files parser & builder","main":"lib/index.js","scripts":{"start":"yarn test:watch","test":"NODE_ENV=test jest --runInBand","test:watch":"yarn test -- --watch","test:coverage":"yarn test -- --coverage","lint":"NODE_ENV=test eslint src/ test/","build":"rimraf lib/*; NODE_ENV=production babel src/ -d lib/ -s","build:watch":"yarn build -- -w","prepublish":"yarn build"},"repository":"github:mgcrea/node-xlsx","license":"Apache-2.0","dependencies":{"@babel/runtime":"^7.14.6","buffer-from":"^1.1.1","xlsx":"^0.17.0"},"devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","babel-eslint":"^10.1.0","codacy-coverage":"^3.4.0","debug-utils":"^0.5.3","eslint":"^7.30.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","expect":"^27.0.6","jest":"^27.0.6","rimraf":"^3.0.2"},"engines":{"node":">=4.0.0"},"keywords":["excel","parser","builder","xlsx","xls"],"jest":{"testEnvironment":"node","setupFiles":["<rootDir>/test/setup.js"]},"_lastModified":"2024-05-21T02:59:56.961Z"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "操作:导出记录",
5
5
  "description": "Export filtered records to excel, you can configure which fields to export.",
6
6
  "description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。",
7
- "version": "1.0.0-alpha.14",
7
+ "version": "1.0.0-alpha.15",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/action-export",
@@ -27,7 +27,7 @@
27
27
  "@nocobase/test": "1.x",
28
28
  "@nocobase/utils": "1.x"
29
29
  },
30
- "gitHead": "829078819e5b9720a4c2501c340a301315c0d029",
30
+ "gitHead": "2793d371368e094ea2bba04cfbe9b9b73c44edba",
31
31
  "keywords": [
32
32
  "Actions"
33
33
  ]