@tachybase/plugin-action-export 1.5.0 → 1.6.0
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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(i,
|
|
1
|
+
(function(i,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("@tego/client"),require("react-i18next"),require("antd"),require("lodash")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@tachybase/schema","@tego/client","react-i18next","antd","lodash"],o):(i=typeof globalThis!="undefined"?globalThis:i||self,o(i["@tachybase/plugin-action-export"]={},i["@tachybase/client"],i.jsxRuntime,i.react,i["@tachybase/schema"],i["@tego/client"],i["react-i18next"],i.antd,i.lodash))})(this,function(i,o,m,A,y,B,I,P,S){"use strict";var ae=Object.defineProperty,se=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Y=(i,o,m)=>o in i?ae(i,o,{enumerable:!0,configurable:!0,writable:!0,value:m}):i[o]=m,T=(i,o)=>{for(var m in o||(o={}))ce.call(o,m)&&Y(i,m,o[m]);if(K)for(var m of K(o))pe.call(o,m)&&Y(i,m,o[m]);return i},Q=(i,o)=>se(i,ie(o));var L=(i,o,m)=>new Promise((A,y)=>{var B=S=>{try{P(m.next(S))}catch(F){y(F)}},I=S=>{try{P(m.throw(S))}catch(F){y(F)}},P=S=>S.done?A(S.value):Promise.resolve(S.value).then(B,I);P((m=m.apply(i,o)).next())});const F=n=>m.jsx(o.SchemaComponentOptions,{components:{ExportActionInitializer:N,ExportDesigner:H},scope:{useExportAction:G},children:n.children}),_=n=>{var p;const e=y.useFieldSchema();(p=e==null?void 0:e["x-component-props"])!=null&&p.nonfilterable;const{getCollectionFields:s}=o.useCollectionManager_deprecated(),d=s(n),x=(c,f)=>{var r;if(!c.interface)return;const t={name:c.name,title:((r=c==null?void 0:c.uiSchema)==null?void 0:r.title)||c.name,schema:c==null?void 0:c.uiSchema};if(!c.target||f>=3)return t;if(c.target){const l=s(c.target),a=h(l,f+1).filter(Boolean);t.children=t.children||[],t.children.push(...a)}return t},h=(c,f)=>{const t=[];return c.forEach(r=>{const l=x(r,f);l&&t.push(l)}),t};return h(d,1)},q=()=>{const{name:n}=o.useCollection_deprecated(),e=_(n);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:o.css`
|
|
2
2
|
width: 100%;
|
|
3
3
|
& .ant-space-item:nth-child(2),
|
|
4
4
|
& .ant-space-item:nth-child(3) {
|
|
5
5
|
flex: 1;
|
|
6
6
|
}
|
|
7
|
-
`},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":
|
|
7
|
+
`},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":o.Cascader,required:!0,enum:e,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:o.css`
|
|
8
8
|
border-color: var(--colorSettings);
|
|
9
9
|
color: var(--colorSettings);
|
|
10
10
|
&.ant-btn-dashed:hover {
|
|
11
11
|
border-color: var(--colorSettings);
|
|
12
12
|
color: var(--colorSettings);
|
|
13
13
|
}
|
|
14
|
-
`}}}}}}}},
|
|
14
|
+
`}}}}}}}},Z=new o.SchemaSettings({name:"actionSettings:export",items:[{name:"editButton",Component:o.ButtonEditor,useComponentProps(){const{buttonEditorProps:n}=o.useSchemaToolbar();return n}},{name:"exportableFields",type:"actionModal",useComponentProps(){var c,f;const n=y.useField(),e=y.useFieldSchema(),{t:s}=I.useTranslation(),{dn:d}=o.useDesignable(),[x,h]=A.useState(),{schema:p}=q();return A.useEffect(()=>{h(p)},[n.address,(c=e==null?void 0:e["x-action-settings"])==null?void 0:c.exportSettings]),{title:s("Exportable fields"),schema:x,initialValues:{exportSettings:(f=e==null?void 0:e["x-action-settings"])==null?void 0:f.exportSettings},components:{ArrayItems:B.ArrayItems},onSubmit:({exportSettings:t})=>{e["x-action-settings"].exportSettings=t==null?void 0:t.filter(r=>{var l;return(l=r==null?void 0:r.dataIndex)==null?void 0:l.length}).map(r=>({dataIndex:r.dataIndex.map(l=>{var a;return(a=l.name)!=null?a:l}),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:n}=I.useTranslation();return{removeParentsIfNoChildren:!0,breakRemoveOn:e=>e["x-component"]==="Space"||e["x-component"].endsWith("ActionBar"),confirm:{title:n("Delete action")}}}}]}),z=(n,e,s)=>n.reduceProperties((d,x)=>{if(x[e]===s)return x;const h=z(x,e,s);return h||d}),ee=(n,e)=>e(n),U=(n,e,s=z,d=ee)=>{const x=y.useFieldSchema(),{remove:h}=o.useDesignable(),p=s(x,e,n);return{schema:p,exists:!!p,remove(){p&&d(p,h)}}},te=n=>n==null?void 0:n.filter(s=>!s.children).map(s=>({dataIndex:[s.name]})),N=()=>{const n=o.useSchemaInitializerItem(),{insert:e}=o.useSchemaInitializer(),{exists:s,remove:d}=U("export","x-action",n.find,n.remove),{name:x}=o.useCollection_deprecated(),h=_(x),p={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 m.jsx(o.SchemaInitializerSwitch,Q(T({},n),{checked:s,title:n.title,onClick:()=>{var f;if(s)return d();p["x-action-settings"].exportSettings=te(h);const c=y.merge(p||{},n.schema||{});(f=n==null?void 0:n.schemaInitialize)==null||f.call(n,c),e(c)}}))},H=()=>{var c,f,t,r,l;const n=y.useField(),e=y.useFieldSchema(),{t:s}=I.useTranslation(),{dn:d}=o.useDesignable(),[x,h]=A.useState(),{schema:p}=q();return A.useEffect(()=>{h(p)},[n.address,(c=e==null?void 0:e["x-action-settings"])==null?void 0:c.exportSettings]),m.jsxs(o.GeneralSchemaDesigner,{disableInitializer:!0,children:[m.jsx(o.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":((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:a,icon:u,type:v})=>{e.title=a,n.title=a,n.componentProps.icon=u,n.componentProps.danger=v==="danger",n.componentProps.type=v,e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].icon=u,e["x-component-props"].danger=v==="danger",e["x-component-props"].type=v,d.emit("patch",{schema:{"x-uid":e["x-uid"],title:a,"x-component-props":T({},e["x-component-props"])}}),d.refresh()}}),m.jsx(o.SchemaSettingsActionModalItem,{title:s("Exportable fields"),schema:x,initialValues:{exportSettings:(l=e==null?void 0:e["x-action-settings"])==null?void 0:l.exportSettings},components:{ArrayItems:B.ArrayItems},onSubmit:({exportSettings:a})=>{e["x-action-settings"].exportSettings=a==null?void 0:a.filter(u=>{var v;return(v=u==null?void 0:u.dataIndex)==null?void 0:v.length}).map(u=>({dataIndex:u.dataIndex.map(v=>{var w;return(w=v.name)!=null?w:v}),title:u.title})),d.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),d.refresh()}}),m.jsx(o.SchemaSettingsDivider,{}),m.jsx(o.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:a=>a["x-component"]==="Space"||a["x-component"].endsWith("ActionBar"),confirm:{title:s("Delete action")}})]})};var D=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},O={exports:{}},oe=O.exports,$;function ne(){return $||($=1,function(n,e){(function(s,d){d()})(oe,function(){function s(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,l){var a=new XMLHttpRequest;a.open("GET",t),a.responseType="blob",a.onload=function(){f(a.response,r,l)},a.onerror=function(){console.error("could not download file")},a.send()}function x(t){var r=new XMLHttpRequest;r.open("HEAD",t,!1);try{r.send()}catch(l){}return 200<=r.status&&299>=r.status}function h(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(l){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 p=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof D=="object"&&D.global===D?D:void 0,c=p.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=p.saveAs||(typeof window!="object"||window!==p?function(){}:"download"in HTMLAnchorElement.prototype&&!c?function(t,r,l){var a=p.URL||p.webkitURL,u=document.createElement("a");r=r||t.name||"download",u.download=r,u.rel="noopener",typeof t=="string"?(u.href=t,u.origin===location.origin?h(u):x(u.href)?d(t,r,l):h(u,u.target="_blank")):(u.href=a.createObjectURL(t),setTimeout(function(){a.revokeObjectURL(u.href)},4e4),setTimeout(function(){h(u)},0))}:"msSaveOrOpenBlob"in navigator?function(t,r,l){if(r=r||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(s(t,l),r);else if(x(t))d(t,r,l);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout(function(){h(a)})}}:function(t,r,l,a){if(a=a||open("","_blank"),a&&(a.document.title=a.document.body.innerText="downloading..."),typeof t=="string")return d(t,r,l);var u=t.type==="application/octet-stream",v=/constructor/i.test(p.HTMLElement)||p.safari,w=/CriOS\/[\d]+/.test(navigator.userAgent);if((w||u&&v||c)&&typeof FileReader!="undefined"){var C=new FileReader;C.onloadend=function(){var E=C.result;E=w?E:E.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=E:location=E,a=null},C.readAsDataURL(t)}else{var M=p.URL||p.webkitURL,j=M.createObjectURL(t);a?a.location=j:location.href=j,a=null,setTimeout(function(){M.revokeObjectURL(j)},4e4)}});p.saveAs=f.saveAs=f,n.exports=f})}(O)),O.exports}var re=ne();const G=()=>{var l,a,u;const{service:n,resource:e}=o.useBlockRequestContext(),s=o.useTableBlockContext();o.useAPIClient();const d=y.useFieldSchema(),x=o.useCompile(),{getCollectionJoinField:h}=o.useCollectionManager_deprecated(),{name:p,title:c,getField:f}=o.useCollection_deprecated(),{t}=I.useTranslation(),r=T(T(T({},(l=n.params[0])==null?void 0:l.filter),(a=s.params)==null?void 0:a.filter),(u=s.service.params[0])==null?void 0:u.filter);return{onClick(){return L(this,null,function*(){var M,j,E,W;const{exportSettings:w}=S.cloneDeep((M=d==null?void 0:d["x-action-settings"])!=null?M:{});w.forEach(b=>{var R,V;const{uiSchema:g,interface:k}=(R=h(`${p}.${b.dataIndex.join(".")}`))!=null?R:{};b.enum=(V=g==null?void 0:g.enum)==null?void 0:V.map(X=>({value:X.value,label:X.label})),!b.enum&&(g==null?void 0:g.type)==="boolean"&&(b.enum=[{value:!0,label:t("Yes")},{value:!1,label:t("No")}]),b.defaultTitle=g==null?void 0:g.title,k==="chinaRegion"&&b.dataIndex.push("name")});const C=P.message.loading(t("Exporting Data..."),0);try{const b=yield e.export({title:x(c),appends:(E=(j=n.params[0])==null?void 0:j.appends)==null?void 0:E.join(),filter:JSON.stringify(r),sort:(W=n.params[0])==null?void 0:W.sort},{method:"post",data:{columns:x(w)},responseType:"blob"}),{data:g}=b;if(g.type==="application/json"){const k=yield g.text(),{data:{filename:R}}=JSON.parse(k);window.location.href=R}else{const k=new Blob([g],{type:"application/x-xls"});re.saveAs(k,`${x(c)}.xlsx`)}C()}catch(b){console.error(b),C()}})}}};class J extends o.Plugin{load(){return L(this,null,function*(){this.app.use(F);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)})}}i.ExportActionInitializer=N,i.ExportDesigner=H,i.ExportPlugin=J,i.ExportPluginProvider=F,i.default=J,i.useCurrentSchema=U,i.useExportAction=G,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"node-xlsx","author":"Olivier Louvignes <olivier@mg-crea.com>","version":"0.24.0","description":"NodeJS Excel files parser & builder","type":"module","main":"./dist/index.cjs","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js","types":"./dist/index.d.ts"}},"bin":{"node-xlsx":"./dist/bin/cli.js"},"files":["dist"],"scripts":{"start":"npm run spec -- --watch","build":"tsup --entry src/index.ts --format cjs,esm --sourcemap --dts --clean --entry src/bin/cli.ts","lint":"eslint src/ test/","prettycheck":"prettier --check src/ test/","prettify":"prettier --write src/ test/","typecheck":"tsc --noEmit","spec":"DEBUG=node-xlsx* vitest --run","watch":"DEBUG=node-xlsx* vitest --watch","test":"npm run lint && npm run prettycheck && npm run typecheck && npm run spec","prepublishOnly":"npm run build"},"repository":"github:mgcrea/node-xlsx","license":"Apache-2.0","dependencies":{"xlsx":"https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"},"devDependencies":{"@mgcrea/eslint-config-node":"^0.10.0","@tsconfig/node-lts":"^20.1.1","@types/node":"^20.12.7","eslint":"^8.57.0","prettier":"^3.2.5","prettier-plugin-organize-imports":"^3.2.4","tsup":"^8.0.2","typescript":"^5.4.5","vite-tsconfig-paths":"^4.3.2","vitest":"^1.5.0"},"engines":{"node":">=10.0.0"},"keywords":["excel","parser","builder","xlsx","xls"],"_lastModified":"2025-11-
|
|
1
|
+
{"name":"node-xlsx","author":"Olivier Louvignes <olivier@mg-crea.com>","version":"0.24.0","description":"NodeJS Excel files parser & builder","type":"module","main":"./dist/index.cjs","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.js","types":"./dist/index.d.ts"}},"bin":{"node-xlsx":"./dist/bin/cli.js"},"files":["dist"],"scripts":{"start":"npm run spec -- --watch","build":"tsup --entry src/index.ts --format cjs,esm --sourcemap --dts --clean --entry src/bin/cli.ts","lint":"eslint src/ test/","prettycheck":"prettier --check src/ test/","prettify":"prettier --write src/ test/","typecheck":"tsc --noEmit","spec":"DEBUG=node-xlsx* vitest --run","watch":"DEBUG=node-xlsx* vitest --watch","test":"npm run lint && npm run prettycheck && npm run typecheck && npm run spec","prepublishOnly":"npm run build"},"repository":"github:mgcrea/node-xlsx","license":"Apache-2.0","dependencies":{"xlsx":"https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"},"devDependencies":{"@mgcrea/eslint-config-node":"^0.10.0","@tsconfig/node-lts":"^20.1.1","@types/node":"^20.12.7","eslint":"^8.57.0","prettier":"^3.2.5","prettier-plugin-organize-imports":"^3.2.4","tsup":"^8.0.2","typescript":"^5.4.5","vite-tsconfig-paths":"^4.3.2","vitest":"^1.5.0"},"engines":{"node":">=10.0.0"},"keywords":["excel","parser","builder","xlsx","xls"],"_lastModified":"2025-11-20T08:10:41.842Z"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-action-export",
|
|
3
3
|
"displayName": "Action: Export records",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "Export filtered records to excel, you can configure which fields to export.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Actions"
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@tachybase/schema": "
|
|
14
|
-
"@tachybase/test": "
|
|
15
|
-
"@tego/client": "
|
|
16
|
-
"@tego/server": "
|
|
13
|
+
"@tachybase/schema": "1.3.52",
|
|
14
|
+
"@tachybase/test": "1.3.52",
|
|
15
|
+
"@tego/client": "1.3.52",
|
|
16
|
+
"@tego/server": "1.3.52",
|
|
17
17
|
"antd": "5.22.5",
|
|
18
|
-
"dayjs": "
|
|
18
|
+
"dayjs": "1.11.13",
|
|
19
19
|
"file-saver": "^2.0.5",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
21
|
"node-xlsx": "^0.24.0",
|
|
22
22
|
"react": "18.3.1",
|
|
23
23
|
"react-i18next": "16.2.1",
|
|
24
|
-
"@tachybase/client": "1.
|
|
24
|
+
"@tachybase/client": "1.6.0"
|
|
25
25
|
},
|
|
26
26
|
"description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。",
|
|
27
27
|
"displayName.zh-CN": "操作:导出记录",
|