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

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,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
- `}}}}}}}},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
+ `}}}}}}}},$="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.14",
13
+ "@nocobase/client": "1.0.0-alpha.16",
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.16",
20
+ "@nocobase/actions": "1.0.0-alpha.16",
21
+ "@nocobase/database": "1.0.0-alpha.16",
22
+ "@nocobase/utils": "1.0.0-alpha.16"
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-27T01:33:37.934Z"}
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.16",
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": "2a80f1804e0f0972d40e1a201310b192914849d0",
31
31
  "keywords": [
32
32
  "Actions"
33
33
  ]