@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;
|
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(
|
|
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
|
-
`}}}}}}}},
|
|
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"}})});
|
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.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.
|
|
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.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-
|
|
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.
|
|
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": "
|
|
30
|
+
"gitHead": "2793d371368e094ea2bba04cfbe9b9b73c44edba",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Actions"
|
|
33
33
|
]
|