@tachybase/plugin-action-import 1.3.18 → 1.3.19
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,9 +1,9 @@
|
|
|
1
|
-
(function(l,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("@ant-design/icons"),require("antd"),require("react-i18next"),require("@tachybase/schema"),require("lodash"),require("@tachybase/components")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","react-dom","@ant-design/icons","antd","react-i18next","@tachybase/schema","lodash","@tachybase/components"],o):(l=typeof globalThis!="undefined"?globalThis:l||self,o(l["@tachybase/plugin-action-import"]={},l["@tachybase/client"],l.jsxRuntime,l.react,l["react-dom"],l["@ant-design/icons"],l.antd,l["react-i18next"],l["@tachybase/schema"],l.lodash,l["@tachybase/components"]))})(this,function(l,o,d,w,
|
|
1
|
+
(function(l,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("@ant-design/icons"),require("antd"),require("react-i18next"),require("@tachybase/schema"),require("lodash"),require("@tachybase/components")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","react-dom","@ant-design/icons","antd","react-i18next","@tachybase/schema","lodash","@tachybase/components"],o):(l=typeof globalThis!="undefined"?globalThis:l||self,o(l["@tachybase/plugin-action-import"]={},l["@tachybase/client"],l.jsxRuntime,l.react,l["react-dom"],l["@ant-design/icons"],l.antd,l["react-i18next"],l["@tachybase/schema"],l.lodash,l["@tachybase/components"]))})(this,function(l,o,d,w,L,_,E,C,g,O,X){"use strict";var be=Object.defineProperty,Ae=Object.defineProperties;var we=Object.getOwnPropertyDescriptors;var me=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable;var ue=(l,o,d)=>o in l?be(l,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[o]=d,B=(l,o)=>{for(var d in o||(o={}))Ce.call(o,d)&&ue(l,d,o[d]);if(me)for(var d of me(o))Te.call(o,d)&&ue(l,d,o[d]);return l},H=(l,o)=>Ae(l,we(o));var R=(l,o,d)=>new Promise((w,L)=>{var _=g=>{try{C(d.next(g))}catch(O){L(O)}},E=g=>{try{C(d.throw(g))}catch(O){L(O)}},C=g=>g.done?w(g.value):Promise.resolve(g.value).then(_,E);C((d=d.apply(l,o)).next())});const V=w.createContext(null);V.displayName="ImportContext";const G=()=>w.useContext(V);var k=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},q={exports:{}},xe=q.exports,J;function he(){return J||(J=1,function(t,e){(function(c,n){n()})(xe,function(){function c(a,i){return typeof i=="undefined"?i={autoBom:!1}:typeof i!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function n(a,i,f){var u=new XMLHttpRequest;u.open("GET",a),u.responseType="blob",u.onload=function(){h(u.response,i,f)},u.onerror=function(){console.error("could not download file")},u.send()}function x(a){var i=new XMLHttpRequest;i.open("HEAD",a,!1);try{i.send()}catch(f){}return 200<=i.status&&299>=i.status}function s(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(f){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(i)}}var r=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof k=="object"&&k.global===k?k:void 0,p=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=r.saveAs||(typeof window!="object"||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(a,i,f){var u=r.URL||r.webkitURL,m=document.createElement("a");i=i||a.name||"download",m.download=i,m.rel="noopener",typeof a=="string"?(m.href=a,m.origin===location.origin?s(m):x(m.href)?n(a,i,f):s(m,m.target="_blank")):(m.href=u.createObjectURL(a),setTimeout(function(){u.revokeObjectURL(m.href)},4e4),setTimeout(function(){s(m)},0))}:"msSaveOrOpenBlob"in navigator?function(a,i,f){if(i=i||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(c(a,f),i);else if(x(a))n(a,i,f);else{var u=document.createElement("a");u.href=a,u.target="_blank",setTimeout(function(){s(u)})}}:function(a,i,f,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof a=="string")return n(a,i,f);var m=a.type==="application/octet-stream",y=/constructor/i.test(r.HTMLElement)||r.safari,v=/CriOS\/[\d]+/.test(navigator.userAgent);if((v||m&&y||p)&&typeof FileReader!="undefined"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=v?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=S:location=S,u=null},I.readAsDataURL(a)}else{var T=r.URL||r.webkitURL,F=T.createObjectURL(a);u?u.location=F:location.href=F,u=null,setTimeout(function(){T.revokeObjectURL(F)},4e4)}});r.saveAs=h.saveAs=h,t.exports=h})}(q)),q.exports}var W=he();const b="action-import",$={IMPORTING:1,IMPORTED:2},fe=t=>{const{t:e}=C.useTranslation(b),{importModalVisible:c,importStatus:n,importResult:x,setImportModalVisible:s}=G(),{data:r,meta:p}=x!=null?x:{},h=()=>{s(!1)},a=()=>{const i=new Int8Array(r==null?void 0:r.data),f=new Blob([i],{type:"application/x-xls"});W.saveAs(f,"fail.xlsx")};return d.jsx(E.Modal,{title:e("Import Data"),width:"50%",styles:{body:{height:"calc(80vh - 200px)"}},open:c,footer:null,closable:n===$.IMPORTED,onCancel:h,children:d.jsxs("div",{className:o.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
5
5
|
height: 100%;
|
|
6
|
-
`,children:[n===$.IMPORTING&&d.jsx(
|
|
6
|
+
`,children:[n===$.IMPORTING&&d.jsx(E.Spin,{indicator:d.jsx(_.LoadingOutlined,{style:{fontSize:24},spin:!0}),tip:e("Excel data importing")}),n===$.IMPORTED&&d.jsxs(E.Space,{direction:"vertical",align:"center",children:[d.jsx(_.ExclamationCircleFilled,{style:{fontSize:72,color:"#1890ff"}}),d.jsx("p",{children:e("Import done, total success have {{successCount}} , total failure have {{failureCount}}",B({},p!=null?p:{}))}),d.jsxs(E.Space,{children:[(p==null?void 0:p.failureCount)>0&&d.jsx(E.Button,{onClick:a,children:e("To download the failure data")}),d.jsx(E.Button,{type:"primary",onClick:h,children:e("Done")})]})]})]})})},K=t=>{let e=t;for(;e&&e["x-action"]!=="importXlsx";)e=e.parent;return{schema:e}},Y=t=>!t||!Array.isArray(t)?[]:t,Q=()=>{const{service:t,resource:e}=o.useBlockRequestContext();o.useAPIClient();const c=g.useFieldSchema(),n=o.useCompile(),{getCollectionJoinField:x,getCollectionField:s}=o.useCollectionManager_deprecated(),{name:r,title:p,getField:h}=o.useCollection_deprecated(),{t:a}=C.useTranslation(b),{schema:i}=K(c);return{run(){return R(this,null,function*(){var T,F;const{importColumns:u,explain:m}=O.cloneDeep((F=(T=i==null?void 0:i["x-action-settings"])==null?void 0:T.importSettings)!=null?F:{}),y=Y(u).map(S=>{var D,N;const M=s(`${r}.${S.dataIndex[0]}`);if(M){if(S.defaultTitle=n((D=M==null?void 0:M.uiSchema)==null?void 0:D.title)||M.name,S.dataIndex.length>1){const P=x(`${r}.${S.dataIndex.join(".")}`);if(!P)return;S.defaultTitle=S.defaultTitle+"/"+n((N=P==null?void 0:P.uiSchema)==null?void 0:N.title)||P.name}return M.interface==="chinaRegion"&&S.dataIndex.push("name"),S}}).filter(Boolean),{data:v}=yield e.downloadXlsxTemplate({values:{title:n(p),explain:m,columns:n(y)}},{method:"post",responseType:"blob"}),I=new Blob([v],{type:"application/x-xls"});W.saveAs(I,`${n(p)}.xlsx`)})}}},Z=()=>{const{service:t,resource:e}=o.useBlockRequestContext(),c=o.useAPIClient(),n=g.useFieldSchema(),x=o.useCompile(),{getCollectionJoinField:s,getCollectionField:r}=o.useCollectionManager_deprecated(),{name:p,title:h,getField:a}=o.useCollection_deprecated(),{t:i}=C.useTranslation(b),{schema:f}=K(n),u=g.useForm(),{setVisible:m}=o.useActionContext(),{setImportModalVisible:y,setImportStatus:v,setImportResult:I}=G();return{run(){return R(this,null,function*(){var P,ce,pe;const{importColumns:F,explain:S}=O.cloneDeep((ce=(P=f==null?void 0:f["x-action-settings"])==null?void 0:P.importSettings)!=null?ce:{}),M=Y(F).map(A=>{var le,de;const j=r(`${p}.${A.dataIndex[0]}`);if(j){if(A.defaultTitle=x((le=j==null?void 0:j.uiSchema)==null?void 0:le.title)||j.name,A.dataIndex.length>1){const U=s(`${p}.${A.dataIndex.join(".")}`);if(!U)return;A.defaultTitle=A.defaultTitle+"/"+x((de=U==null?void 0:U.uiSchema)==null?void 0:de.title)||U.name}return j.interface==="chinaRegion"&&A.dataIndex.push("name"),A}}).filter(Boolean),D=new FormData,N=u.values.upload.map(A=>A.originFileObj);D.append("file",N[0]),D.append("columns",JSON.stringify(M)),D.append("explain",S),m(!1),y(!0),v($.IMPORTING);try{const{data:A}=yield c.axios.post(`${p}:importXlsx`,D,{timeout:6e5});I(A),u.reset(),yield(pe=t==null?void 0:t.refresh)==null?void 0:pe.call(t),v($.IMPORTED)}catch(A){y(!1),m(!0)}})}}},ge=["id","createdAt","createdBy","updatedAt","updatedBy"],ee=t=>{const{getCollectionFields:e}=o.useCollectionManager_deprecated(),c=e(t),n=(s,r)=>{var h;if(!s.interface||ge.includes(s.interface))return;const p={name:s.name,title:((h=s==null?void 0:s.uiSchema)==null?void 0:h.title)||s.name,schema:s==null?void 0:s.uiSchema};if(!s.target||r>=2)return p;if(s.target){const a=e(s.target),i=x(a,r+1).filter(Boolean);p.children=p.children||[],p.children.push(...i)}return p},x=(s,r)=>{const p=[];return s.forEach(h=>{const a=n(h,r);a&&p.push(a)}),p};return x(c,1)},ye=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],z=()=>{const{t}=C.useTranslation(b),{name:e}=o.useCollection_deprecated(),c=ee(e);return{importSettingsSchema:{type:"void","x-component":"Grid",properties:{explain:{type:"string",title:`{{ t("Import explain", {ns: "${b}"}) }}`,"x-decorator":"FormItem","x-component":"Input.TextArea"},importColumns:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:o.css`
|
|
7
7
|
width: 100%;
|
|
8
8
|
& .ant-space-item:nth-child(2) {
|
|
9
9
|
flex: 1;
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
border-color: var(--colorSettings);
|
|
16
16
|
color: var(--colorSettings);
|
|
17
17
|
}
|
|
18
|
-
`}}}}}},beforeUploadHandler(){return!1},uploadValidator(n,x){var r;if(n.length>1)return{type:"error",message:t("Only one file is allowed to be uploaded")};const s=(r=n[0])!=null?r:{};return s.size>10*1024*1024?{type:"error",message:t("File size cannot exceed 10M")}:ye.includes(s.type)?"":{type:"error",message:t("Please upload the file of Excel")}},validateUpload(n,x,s){var p;const[r]=s;x.disabled=(r==null?void 0:r.length)===0,x.componentProps=H(
|
|
18
|
+
`}}}}}},beforeUploadHandler(){return!1},uploadValidator(n,x){var r;if(n.length>1)return{type:"error",message:t("Only one file is allowed to be uploaded")};const s=(r=n[0])!=null?r:{};return s.size>10*1024*1024?{type:"error",message:t("File size cannot exceed 10M")}:ye.includes(s.type)?"":{type:"error",message:t("Please upload the file of Excel")}},validateUpload(n,x,s){var p;const[r]=s;x.disabled=(r==null?void 0:r.length)===0,x.componentProps=H(B({},x.componentProps),{disabled:(r==null?void 0:r.length)===0||((p=n.errors)==null?void 0:p.length)>0})}}},te=t=>{const{uploadValidator:e,beforeUploadHandler:c,validateUpload:n}=z();return d.jsx(o.SchemaComponentOptions,{components:{ImportActionInitializer:ae,ImportDesigner:se},scope:{uploadValidator:e,validateUpload:n,beforeUploadHandler:c,useDownloadXlsxTemplateAction:Q,useImportStartAction:Z},children:d.jsx(oe,{children:t.children})})},oe=t=>{const[e,c]=w.useState(!1),[n,x]=w.useState($.IMPORTING),[s,r]=w.useState(null);return d.jsxs(V.Provider,{value:{importModalVisible:e,setImportModalVisible:c,importStatus:n,setImportStatus:x,importResult:s,setImportResult:r},children:[L.createPortal(d.jsx(fe,{}),document.body),t.children]})},ve=new o.SchemaSettings({name:"actionSettings:import",items:[{name:"editButton",Component:o.ButtonEditor,useComponentProps(){const{buttonEditorProps:t}=o.useSchemaToolbar();return t}},{name:"importableFields",type:"actionModal",useComponentProps(){var p,h,a;const t=g.useField(),e=g.useFieldSchema(),{t:c}=C.useTranslation(),{dn:n}=o.useDesignable(),[x,s]=w.useState(),{importSettingsSchema:r}=z();return w.useEffect(()=>{s(r)},[t.address,(p=e==null?void 0:e["x-action-settings"])==null?void 0:p.importSettings]),{title:c("Importable fields"),schema:x,initialValues:B({},(a=(h=e==null?void 0:e["x-action-settings"])==null?void 0:h.importSettings)!=null?a:{}),components:{ArrayItems:X.ArrayItems},onSubmit:({importColumns:i,explain:f})=>{const u=i==null?void 0:i.filter(m=>{var y;return(y=m==null?void 0:m.dataIndex)==null?void 0:y.length}).map(m=>({dataIndex:m.dataIndex.map(y=>{var v;return(v=y.name)!=null?v:y}),title:m.title}));e["x-action-settings"].importSettings={importColumns:u,explain:f},n.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),n.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){const{t}=C.useTranslation();return{removeParentsIfNoChildren:!0,breakRemoveOn:e=>e["x-component"]==="Space"||e["x-component"].endsWith("ActionBar"),confirm:{title:t("Delete action")}}}}]}),ne=(t,e,c)=>t.reduceProperties((n,x)=>{if(x[e]===c)return x;const s=ne(x,e,c);return s||n}),Se=(t,e)=>e(t),re=(t,e,c=ne,n=Se)=>{const x=g.useFieldSchema(),{remove:s}=o.useDesignable(),r=c(x,e,t);return{schema:r,exists:!!r,remove(){r&&n(r,s)}}},Ie=t=>({importColumns:t==null?void 0:t.filter(c=>!c.children).map(c=>({dataIndex:[c.name]})),explain:""}),ae=()=>{const t=o.useSchemaInitializerItem(),{insert:e}=o.useSchemaInitializer(),{exists:c,remove:n}=re("importXlsx","x-action",t.find,t.remove),{name:x}=o.useCollection_deprecated(),s=ee(x),r={type:"void",title:'{{ t("Import") }}',"x-action":"importXlsx","x-action-settings":{importSettings:{importColumns:[],explain:""}},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:import","x-component":"Action","x-component-props":{icon:"CloudUploadOutlined",openMode:"modal"},properties:{modal:{type:"void",title:`{{ t("Import Data", {ns: "${b}" }) }}`,"x-component":"Action.Container","x-decorator":"Form","x-component-props":{width:"50%",className:o.css`
|
|
19
19
|
.ant-formily-item-label {
|
|
20
20
|
height: var(--controlHeightLG);
|
|
21
21
|
}
|
|
22
22
|
`},properties:{formLayout:{type:"void","x-component":"FormLayout",properties:{download:{type:"void",title:`{{ t("Step 1: Download template", {ns: "${b}" }) }}`,"x-component":"FormItem","x-acl-ignore":!0,properties:{tip:{type:"void","x-component":"Markdown.Void","x-editable":!1,"x-component-props":{style:{padding:"var(--paddingContentVerticalSM)",backgroundColor:"var(--colorInfoBg)",border:"1px solid var(--colorInfoBorder)",color:"var(--colorText)",marginBottom:"var(--marginSM)"},content:`{{ t("Download tip", {ns: "${b}" }) }}`}},downloadAction:{type:"void",title:`{{ t("Download template", {ns: "${b}" }) }}`,"x-component":"Action","x-component-props":{className:o.css`
|
|
23
23
|
margin-top: 5px;
|
|
24
|
-
`,useAction:"{{ useDownloadXlsxTemplateAction }}"}}}},upload:{type:"array",title:`{{ t("Step 2: Upload Excel", {ns: "${b}" }) }}`,"x-decorator":"FormItem","x-acl-ignore":!0,"x-component":"Upload.Dragger","x-validator":"{{ uploadValidator }}","x-component-props":{action:"",height:"150px",tipContent:`{{ t("Upload placeholder", {ns: "${b}" }) }}`,beforeUpload:"{{ beforeUploadHandler }}"}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},startImport:{type:"void",title:`{{ t("Start import", {ns: "${b}" }) }}`,"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useImportStartAction }}"},"x-reactions":{dependencies:["upload"],fulfill:{run:"validateUpload($form, $self, $deps)"}}}}}}}}}}};return d.jsx(o.SchemaInitializerSwitch,H(
|
|
24
|
+
`,useAction:"{{ useDownloadXlsxTemplateAction }}"}}}},upload:{type:"array",title:`{{ t("Step 2: Upload Excel", {ns: "${b}" }) }}`,"x-decorator":"FormItem","x-acl-ignore":!0,"x-component":"Upload.Dragger","x-validator":"{{ uploadValidator }}","x-component-props":{action:"",height:"150px",tipContent:`{{ t("Upload placeholder", {ns: "${b}" }) }}`,beforeUpload:"{{ beforeUploadHandler }}"}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},startImport:{type:"void",title:`{{ t("Start import", {ns: "${b}" }) }}`,"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useImportStartAction }}"},"x-reactions":{dependencies:["upload"],fulfill:{run:"validateUpload($form, $self, $deps)"}}}}}}}}}}};return d.jsx(o.SchemaInitializerSwitch,H(B({},t),{checked:c,title:t.title,onClick:()=>{var h;if(c)return n();r["x-action-settings"].importSettings=Ie(s);const p=g.merge(r||{},t.schema||{});(h=t==null?void 0:t.schemaInitialize)==null||h.call(t,p),e(p)}}))},se=()=>{var p,h,a,i,f,u;const t=g.useField(),e=g.useFieldSchema(),{t:c}=C.useTranslation(),{dn:n}=o.useDesignable(),[x,s]=w.useState(),{importSettingsSchema:r}=z();return w.useEffect(()=>{s(r)},[t.address,(p=e==null?void 0:e["x-action-settings"])==null?void 0:p.importSettings]),d.jsxs(o.GeneralSchemaDesigner,{disableInitializer:!0,children:[d.jsx(o.SchemaSettingsModalItem,{title:c("Edit button"),schema:{type:"object",title:c("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:c("Button title"),default:e.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:c("Button icon"),default:(h=e==null?void 0:e["x-component-props"])==null?void 0:h.icon,"x-component-props":{}},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:c("Button background color"),default:(a=e==null?void 0:e["x-component-props"])!=null&&a.danger?"danger":((i=e==null?void 0:e["x-component-props"])==null?void 0:i.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:({title:m,icon:y,type:v})=>{e.title=m,t.title=m,t.componentProps.icon=y,t.componentProps.danger=v==="danger",t.componentProps.type=v,e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].icon=y,e["x-component-props"].danger=v==="danger",e["x-component-props"].type=v,n.emit("patch",{schema:{"x-uid":e["x-uid"],title:m,"x-component-props":B({},e["x-component-props"])}}),n.refresh()}}),d.jsx(o.SchemaSettingsActionModalItem,{title:c("Importable fields"),schema:x,initialValues:B({},(u=(f=e==null?void 0:e["x-action-settings"])==null?void 0:f.importSettings)!=null?u:{}),components:{ArrayItems:X.ArrayItems},onSubmit:({importColumns:m,explain:y})=>{const v=m==null?void 0:m.filter(I=>{var T;return(T=I==null?void 0:I.dataIndex)==null?void 0:T.length}).map(I=>({dataIndex:I.dataIndex.map(T=>{var F;return(F=T.name)!=null?F:T}),title:I.title}));e["x-action-settings"].importSettings={importColumns:v,explain:y},n.emit("patch",{schema:{"x-uid":e["x-uid"],"x-action-settings":e["x-action-settings"]}}),n.refresh()}}),d.jsx(o.SchemaSettingsDivider,{}),d.jsx(o.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:m=>m["x-component"]==="Space"||m["x-component"].endsWith("ActionBar"),confirm:{title:c("Delete action")}})]})};class ie extends o.Plugin{load(){return R(this,null,function*(){this.app.use(te);const e={title:"{{t('Import')}}",Component:"ImportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action":"importXlsx","x-acl-action-props":{skipScopeCheck:!0}},useVisible(){const n=o.useCollection_deprecated();return(n.template!=="view"||(n==null?void 0:n.writableView))&&n.template!=="file"&&n.template!=="sql"}},c=this.app.schemaInitializerManager.get("table:configureActions");c==null||c.add("enableActions.import",e),this.app.schemaInitializerManager.addItem("gantt:configureActions","enableActions.import",e),this.app.schemaSettingsManager.add(ve)})}}l.ImportActionInitializer=ae,l.ImportContextProvider=oe,l.ImportDesigner=se,l.ImportPlugin=ie,l.ImportPluginProvider=te,l.default=ie,l.useCurrentSchema=re,l.useDownloadXlsxTemplateAction=Q,l.useImportStartAction=Z,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/schema": "1.3.
|
|
5
|
-
"@tachybase/components": "1.3.
|
|
3
|
+
"@tachybase/client": "1.3.19",
|
|
4
|
+
"@tachybase/schema": "1.3.19",
|
|
5
|
+
"@tachybase/components": "1.3.19",
|
|
6
6
|
"react-i18next": "15.2.0",
|
|
7
7
|
"@ant-design/icons": "5.3.7",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
9
|
"react-dom": "18.3.1",
|
|
10
10
|
"lodash": "4.17.21",
|
|
11
|
-
"@tachybase/server": "1.3.
|
|
12
|
-
"@tachybase/actions": "1.3.
|
|
13
|
-
"@tachybase/database": "1.3.
|
|
14
|
-
"@tachybase/utils": "1.3.
|
|
11
|
+
"@tachybase/server": "1.3.19",
|
|
12
|
+
"@tachybase/actions": "1.3.19",
|
|
13
|
+
"@tachybase/database": "1.3.19",
|
|
14
|
+
"@tachybase/utils": "1.3.19",
|
|
15
15
|
"mathjs": "10.6.4"
|
|
16
16
|
};
|
|
@@ -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-07-
|
|
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-07-17T10:56:24.345Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"xlsx","version":"0.18.5","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{"adler-32":"~1.3.0","cfb":"~1.2.1","codepage":"~1.15.0","crc-32":"~1.2.1","ssf":"~0.11.2","wmf":"~1.0.1","word":"~0.3.0"},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","alex":"8.1.1","blanket":"~1.2.3","commander":"~2.17.1","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","typescript":"2.2.0"},"repository":{"type":"git","url":"git://github.com/SheetJS/sheetjs.git"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","bugs":{"url":"https://github.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2025-07-
|
|
1
|
+
{"name":"xlsx","version":"0.18.5","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{"adler-32":"~1.3.0","cfb":"~1.2.1","codepage":"~1.15.0","crc-32":"~1.2.1","ssf":"~0.11.2","wmf":"~1.0.1","word":"~0.3.0"},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","alex":"8.1.1","blanket":"~1.2.3","commander":"~2.17.1","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","typescript":"2.2.0"},"repository":{"type":"git","url":"git://github.com/SheetJS/sheetjs.git"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","bugs":{"url":"https://github.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2025-07-17T10:56:26.602Z"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-action-import",
|
|
3
3
|
"displayName": "Action: Import records",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.19",
|
|
5
5
|
"description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Actions"
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"react-dom": "^18.3.1",
|
|
22
22
|
"react-i18next": "^15.2.0",
|
|
23
23
|
"xlsx": "^0.18.5",
|
|
24
|
-
"@tachybase/components": "1.3.
|
|
25
|
-
"@tachybase/schema": "1.3.
|
|
24
|
+
"@tachybase/components": "1.3.19",
|
|
25
|
+
"@tachybase/schema": "1.3.19"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@tachybase/actions": "1.3.
|
|
29
|
-
"@tachybase/client": "1.3.
|
|
30
|
-
"@tachybase/
|
|
31
|
-
"@tachybase/
|
|
32
|
-
"@tachybase/
|
|
33
|
-
"@tachybase/
|
|
28
|
+
"@tachybase/actions": "1.3.19",
|
|
29
|
+
"@tachybase/client": "1.3.19",
|
|
30
|
+
"@tachybase/database": "1.3.19",
|
|
31
|
+
"@tachybase/server": "1.3.19",
|
|
32
|
+
"@tachybase/utils": "1.3.19",
|
|
33
|
+
"@tachybase/test": "1.3.19"
|
|
34
34
|
},
|
|
35
35
|
"description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。",
|
|
36
36
|
"displayName.zh-CN": "操作:导入记录",
|