@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.
package/dist/client/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(a,
|
|
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
|
-
`}}}}}}}}
|
|
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"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -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.
|
|
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.
|
|
20
|
-
"@nocobase/actions": "1.0.0-alpha.
|
|
21
|
-
"@nocobase/database": "1.0.0-alpha.
|
|
22
|
-
"@nocobase/utils": "1.0.0-alpha.
|
|
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-
|
|
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.
|
|
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": "
|
|
30
|
+
"gitHead": "a38719a9d25efc14e06e979209ff5085e049aca7",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Actions"
|
|
33
33
|
]
|