@nocobase/plugin-action-export 1.0.0-alpha.15 → 1.0.0-alpha.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.
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
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`
10
+ (function(a,d){typeof exports=="object"&&typeof module!="undefined"?d(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"],d):(a=typeof globalThis!="undefined"?globalThis:a||self,d(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,d,h,i,y,M,w,E,b,j){"use strict";var ne=Object.defineProperty;var V=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;var Y=(a,d,h)=>d in a?ne(a,d,{enumerable:!0,configurable:!0,writable:!0,value:h}):a[d]=h,Q=(a,d)=>{for(var h in d||(d={}))re.call(d,h)&&Y(a,h,d[h]);if(V)for(var h of V(d))ae.call(d,h)&&Y(a,h,d[h]);return a};var B=(a,d,h)=>new Promise((i,y)=>{var M=b=>{try{E(h.next(b))}catch(j){y(j)}},w=b=>{try{E(h.throw(b))}catch(j){y(j)}},E=b=>b.done?i(b.value):Promise.resolve(b.value).then(M,w);E((h=h.apply(a,d)).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),g=(l,f)=>{var o;if(!l.interface)return;const t={name:l.name,title:((o=l==null?void 0:l.uiSchema)==null?void 0:o.title)||l.name,schema:l==null?void 0:l.uiSchema};if(!l.target||f>=3)return t;if(l.target){const c=s(l.target),n=x(c,f+1).filter(Boolean);t.children=t.children||[],t.children.push(...n)}return t},x=(l,f)=>{const t=[];return l.forEach(o=>{const c=g(o,f);c&&t.push(c)}),t};return x(m,1)},Z=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),g={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 d.jsx(i.SchemaInitializerItem,{title:r.title,onClick:()=>{var u;g["x-action-settings"].exportSettings=Z(m);const x=h.merge(g||{},r.schema||{});(u=r==null?void 0:r.schemaInitialize)==null||u.call(r,x),e(x)}})},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
- `}}}}}}}},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"}})});
23
+ `}}}}}}}},$="action-export";function R(){return E.useTranslation([$,"client"],{nsMode:"fallback"})}const q=()=>{var l,f,t,o,c;const r=y.useField(),e=y.useFieldSchema(),{t:s}=R(),{dn:m}=i.useDesignable(),[g,x]=w.useState(),{schema:u}=L();return w.useEffect(()=>{x(u)},[r.address,(l=e==null?void 0:e["x-action-settings"])==null?void 0:l.exportSettings]),d.jsxs(i.GeneralSchemaDesigner,{disableInitializer:!0,children:[d.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:(f=e==null?void 0:e["x-component-props"])==null?void 0:f.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":((o=e==null?void 0:e["x-component-props"])==null?void 0:o.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:p,type:v})=>{e.title=n,r.title=n,r.componentProps.icon=p,r.componentProps.danger=v==="danger",r.componentProps.type=v,e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].icon=p,e["x-component-props"].danger=v==="danger",e["x-component-props"].type=v,m.emit("patch",{schema:{"x-uid":e["x-uid"],title:n,"x-component-props":Q({},e["x-component-props"])}}),m.refresh()}}),d.jsx(i.SchemaSettingsActionModalItem,{title:s("Exportable fields"),schema:g,initialValues:{exportSettings:(c=e==null?void 0:e["x-action-settings"])==null?void 0:c.exportSettings},scope:{t:s},components:{ArrayItems:M.ArrayItems},onSubmit:({exportSettings:n})=>{e["x-action-settings"].exportSettings=n==null?void 0:n.filter(p=>{var v;return(v=p==null?void 0:p.dataIndex)==null?void 0:v.length}).map(p=>({dataIndex:p.dataIndex.map(v=>{var I;return(I=v.name)!=null?I:v}),title:p.title})),m.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),m.refresh()}}),d.jsx(i.SchemaSettingsDivider,{}),d.jsx(i.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:n=>n["x-component"]==="Space"||n["x-component"].endsWith("ActionBar"),confirm:{title:s("Delete action")}})]})},_=r=>d.jsx(i.SchemaComponentOptions,{components:{ExportActionInitializer:D,ExportDesigner:q},scope:{useExportAction:U},children:r.children});var T=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()})(T,function(){function s(t,o){return typeof o=="undefined"?o={autoBom:!1}:typeof o!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.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,o,c){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){f(n.response,o,c)},n.onerror=function(){console.error("could not download file")},n.send()}function g(t){var o=new XMLHttpRequest;o.open("HEAD",t,!1);try{o.send()}catch(c){}return 200<=o.status&&299>=o.status}function x(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(c){var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof T=="object"&&T.global===T?T:void 0,l=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(t,o,c){var n=u.URL||u.webkitURL,p=document.createElement("a");o=o||t.name||"download",p.download=o,p.rel="noopener",typeof t=="string"?(p.href=t,p.origin===location.origin?x(p):g(p.href)?m(t,o,c):x(p,p.target="_blank")):(p.href=n.createObjectURL(t),setTimeout(function(){n.revokeObjectURL(p.href)},4e4),setTimeout(function(){x(p)},0))}:"msSaveOrOpenBlob"in navigator?function(t,o,c){if(o=o||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(s(t,c),o);else if(g(t))m(t,o,c);else{var n=document.createElement("a");n.href=t,n.target="_blank",setTimeout(function(){x(n)})}}:function(t,o,c,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof t=="string")return m(t,o,c);var p=t.type==="application/octet-stream",v=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||p&&v||l)&&typeof FileReader!="undefined"){var F=new FileReader;F.onloadend=function(){var A=F.result;A=I?A:A.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=A:location=A,n=null},F.readAsDataURL(t)}else{var k=u.URL||u.webkitURL,P=k.createObjectURL(t);n?n.location=P:location.href=P,n=null,setTimeout(function(){k.revokeObjectURL(P)},4e4)}});u.saveAs=f.saveAs=f,r.exports=f})})(z);var ee=z.exports;const U=()=>{var n,p;const{service:r,resource:e,props:s}=i.useBlockRequestContext(),m=s==null?void 0:s.params.filter,g=y.useFieldSchema(),x=i.useCompile(),{getCollectionJoinField:u}=i.useCollectionManager_deprecated(),{name:l,title:f}=i.useCollection_deprecated(),{t}=R(),{modal:o}=j.App.useApp(),c=((p=(n=r.params)==null?void 0:n[1])==null?void 0:p.filters)||{};return{onClick(){return B(this,null,function*(){var A,N,G,W;if(!(yield o.confirm({title:t("Export"),content:t("Export warning"),okText:t("Start export")})))return;const{exportSettings:F}=b.cloneDeep((A=g==null?void 0:g["x-action-settings"])!=null?A:{});F.forEach(C=>{var X,J;const{uiSchema:S,interface:oe}=(X=u(`${l}.${C.dataIndex.join(".")}`))!=null?X:{};C.enum=(J=S==null?void 0:S.enum)==null?void 0:J.map(K=>({value:K.value,label:K.label})),!C.enum&&(S==null?void 0:S.type)==="boolean"&&(C.enum=[{value:!0,label:t("Yes")},{value:!1,label:t("No")}]),C.defaultTitle=S==null?void 0:S.title,oe==="chinaRegion"&&C.dataIndex.push("name")});const{data:k}=yield e.export({title:x(f),appends:(G=(N=r.params[0])==null?void 0:N.appends)==null?void 0:G.join(),filter:i.mergeFilter([...Object.values(c),m]),sort:(W=r.params[0])==null?void 0:W.sort},{method:"post",data:{columns:x(F)},responseType:"blob"}),P=new Blob([k],{type:"application/x-xls"});ee.saveAs(P,`${x(f)}.xlsx`)})}}},te=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 l,f;const r=y.useField(),e=y.useFieldSchema(),{t:s}=E.useTranslation(),{dn:m}=i.useDesignable(),[g,x]=w.useState(),{schema:u}=L();return w.useEffect(()=>{x(u)},[r.address,(l=e==null?void 0:e["x-action-settings"])==null?void 0:l.exportSettings]),{title:s("Exportable fields"),schema:g,initialValues:{exportSettings:(f=e==null?void 0:e["x-action-settings"])==null?void 0:f.exportSettings},components:{ArrayItems:M.ArrayItems},onSubmit:({exportSettings:t})=>{e["x-action-settings"].exportSettings=t==null?void 0:t.filter(o=>{var c;return(c=o==null?void 0:o.dataIndex)==null?void 0:c.length}).map(o=>({dataIndex:o.dataIndex.map(c=>{var n;return(n=c.name)!=null?n:c}),title:o.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}=E.useTranslation();return{removeParentsIfNoChildren:!0,breakRemoveOn:e=>e["x-component"]==="Space"||e["x-component"].endsWith("ActionBar"),confirm:{title:r("Delete action")}}}}]});class H 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(te)})}}a.ExportActionInitializer=D,a.ExportDesigner=q,a.ExportPluginProvider=_,a.PluginActionExportClient=H,a.default=H,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.15",
13
+ "@nocobase/client": "1.0.0-alpha.17",
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.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"
19
+ "@nocobase/server": "1.0.0-alpha.17",
20
+ "@nocobase/actions": "1.0.0-alpha.17",
21
+ "@nocobase/database": "1.0.0-alpha.17",
22
+ "@nocobase/utils": "1.0.0-alpha.17"
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-21T02:59:56.961Z"}
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-27T06:54:37.553Z"}
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.15",
7
+ "version": "1.0.0-alpha.17",
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": "2793d371368e094ea2bba04cfbe9b9b73c44edba",
30
+ "gitHead": "a38719a9d25efc14e06e979209ff5085e049aca7",
31
31
  "keywords": [
32
32
  "Actions"
33
33
  ]