@ingestro/importer-react 4.5.0 → 4.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.
@@ -1 +1 @@
1
- import{a as F}from"./chunk-AINUNGZU.js";import{e as O,f as c,r as w,s as M}from"./chunk-CQHSLEFA.js";import{isEmpty as k,uniq as W}from"lodash";var A=0,y=class{constructor({sheet:e,columnKey:t,rows:s,id:o,notSetUnique:a=!1,label:r,refJoinSheetColum:n}){this.removed=!1;this.label="";this.parsedDate=!1;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>this.uniques;this.remove=()=>{this.removed=!0};this.unRemove=()=>{this.removed=!1};this.isRemoved=()=>this.removed;this.getType=()=>0;this.getFileName=()=>this.sheet.getSheetFileName();this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,type:this.getType()});this.equal=e=>this.getId()===e.getId();this.keyEqual=e=>this.columnKey===e.columnKey;this.setIndex=e=>{this.index=e};this.getIndex=()=>this.index;this.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,this.rows=k(s)?[""]:s,typeof o>"u"?(A++,this.id=`${t}-${A}`):this.id=o,a?this.uniques=[]:this.uniques=W(this.getRows()),r&&(this.label=r),this.refJoinSheetColum=n}setRows(e){this.rows=e}setParsedDate(e){this.parsedDate=e}hasParsedDate(){return this.parsedDate}},g=y;var D=class extends g{constructor({sheet:t,sheetColumns:s,rows:o,id:a,columnKey:r}){super({columnKey:r,rows:o,sheet:t,id:a});this.getType=()=>1;this.getJoinedSheetColumns=()=>this.sheetColumns;this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,sheetColumns:this.sheetColumns.map(t=>t.toJSON()),type:this.getType()});this.sheetColumns=s}},J=D;var T=["?",",","@"];import{isNaN as X,minBy as G,isString as Q,isEqual as Y,isEmpty as b,isNil as K}from"lodash";var x=class{constructor({sheets:e,filename:t,type:s,fileSize:o}){this.globalNumberFormat="eu";this.columnsNumberFormat=[];this.addSheet=e=>{this.sheets.push(e)};this.isSelected=()=>{for(let e=0;e<this.sheets.length;e++)if(this.sheets[e].isSelected())return!0;return!1};this.getSheets=()=>this.sheets;this.getSelectedSheets=()=>this.sheets.filter(e=>e.isSelected());this.getFilename=()=>this.filename;this.selectAllSheet=e=>this.sheets.forEach(t=>{t.setSelected(e)});this.getType=()=>this.type;this.getFileSize=()=>{let e=this.fileSize/1e6;return Number(parseFloat(`${e}`).toFixed(4))};this.sheets=e,this.filename=t,this.type=s,this.fileSize=o??0,this.sheets.forEach(a=>{a.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},_=x;var B=0,R=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];this.headerRowIndex=0;this.transposed=!1;this.headerRowIndexes=[];this.addedColumns=[];this.usedSourceCells=new Set;this.mergedHeadersActive=!1;this.mergedRowsBackup=null;this.availableRows=null;this.spreadSheet=new _({filename:"",sheets:[],type:"xlsx",fileSize:0});this.getId=()=>this.id;this.setSpreadSheet=e=>{this.spreadSheet=e};this.getSpreadSheet=()=>this.spreadSheet;this.setSelected=e=>{this.selected=e};this.isSelected=()=>this.selected;this.setHeaderRowIndex=e=>{this.headerRowIndex=e,this.setColumns(),this.mergedHeadersActive||(this.headerRowIndexes=[e])};this.setTransposed=e=>{this.transposed=e};this.getTransposed=()=>this.transposed;this.setHeaderRowIndexes=e=>{this.headerRowIndexes=[...e]};this.getHeaderRowIndexes=()=>this.headerRowIndexes.length>0?this.headerRowIndexes:[this.headerRowIndex];this.addAddedColumn=e=>{if(this.addedColumns.push(e),e.sourceCell){let o=`${e.sourceCell.row},${e.sourceCell.col}`;this.usedSourceCells.add(o)}let t=this.data[this.headerRowIndex],s=this.data.length>0?Math.max(...this.data.map(o=>o.length)):0;t&&t.push(e.columnName);for(let o=0;o<this.data.length;o++)if(o!==this.headerRowIndex){for(;this.data[o].length<s;)this.data[o].push("");o<this.headerRowIndex?this.data[o].push(""):this.data[o].push(e.value)}this.setColumns()};this.removeAddedColumn=e=>{let s=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length,o=e-s;if(o<0||o>=this.addedColumns.length)return;let a=this.addedColumns[o];if(a?.sourceCell){let r=`${a.sourceCell.row},${a.sourceCell.col}`;this.usedSourceCells.delete(r)}for(let r=0;r<this.data.length;r++)this.data[r].splice(e,1);this.addedColumns.splice(o,1),this.setColumns()};this.removeColumnFromData=e=>{if(!(e<0))for(let t=0;t<this.data.length;t++)this.data[t].length>e&&this.data[t].splice(e,1)};this.clearAddedColumns=()=>{if(this.addedColumns.length>0){let t=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length;for(let s=this.addedColumns.length-1;s>=0;s--){let o=t+s;for(let a=0;a<this.data.length;a++)this.data[a].length>o&&this.data[a].splice(o,1)}}this.addedColumns=[],this.usedSourceCells.clear(),this.setColumns()};this.isSourceCellUsed=(e,t)=>{let s=`${e},${t}`;return this.usedSourceCells.has(s)};this.getAddedColumnBySourceCell=(e,t)=>this.addedColumns.find(s=>s.sourceCell&&s.sourceCell.row===e&&s.sourceCell.col===t);this.getAddedColumns=()=>this.addedColumns;this.setMergedHeadersActive=e=>{this.mergedHeadersActive=e};this.isMergedHeadersActive=()=>this.mergedHeadersActive;this.setMergedRowsBackup=e=>{this.mergedRowsBackup=e};this.getMergedRowsBackup=()=>this.mergedRowsBackup;this.setAvailableRows=e=>{this.availableRows=e};this.getAvailableRows=()=>this.availableRows;this.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:e.filter(s=>s).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((s,o)=>Math.max(s,o.data?.filter(a=>!b(a)&&!T.some(r=>r===a.toString()?.trim()&&a.toString()?.startsWith(r))).length),0);this.setHeaderByAutoDetection=()=>{let e=this.getMaxLengthColumns(),t=this.getDataTransform(),s=[];for(let a=0;a<(t.length>50?50:t.length);a++){let r=t[a],n=r.length===e;r.data.filter(h=>!O.includes(Q(h)?h.toLowerCase():h)&&X(Number(h))).length===e&&n&&s.push(r)}let o=s.length===1?s[0].index:G(s,a=>a.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>this.columns.filter(e=>!e.isRemoved());this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>c(e.getColumnKey())<c(t.getColumnKey())?-1:c(e.getColumnKey())>c(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>this.columns.filter(e=>e.getType()!==1);this.getColumn=(e,t)=>this.columns.find(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getColumnsByKey=(e,t)=>this.columns.filter(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(b(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let a=0;a<this.data[this.headerRowIndex].length;a++)K(this.data[this.headerRowIndex][a])||o.push(this.parseValue(e[s][a]));t.push(o)}return t};this.getData=()=>this.data;this.getName=()=>this.name;this.getDisplayName=({t:e})=>{if(this.getName()?.length>0)return this.getName();switch(this.spreadSheet.getType()){case"json":return`${e("txt_default_sheet_prefix_name")} 1`;case"csv":return`${e("txt_default_sheet_prefix_name")} 1`;default:return""}};this.getSheetFileName=()=>`${this.spreadSheet.getFilename()}`;this.getIsManualSelectHeader=()=>this.isManualSelectHeader;this.setIsManualSelectHeader=()=>{this.isManualSelectHeader=!0};this.clearIsManualSelectHeader=()=>{this.isManualSelectHeader=!1};this.getDataAsResults=()=>{let e=[],t=this.getColumnsWithRemoved(),s=this.data.filter((o,a)=>a>this.headerRowIndex);for(let o=0;o<s.length;o++){let a=s[o];e[o]={};for(let r=0;r<t.length;r++){let n=a?.[r];if(!b(n)&&!K(n)){let i=t[r].getColumnKey();e[o][i]=this.parseValue(n)}}}return e};this.addColumn=e=>{this.columns.push(new g({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{this.columns.find((t,s)=>s===e)?.remove()};this.setData=e=>{this.data=e};this.toJSON=()=>({name:this.name,id:this.id,type:this.getType(),values:this.getValues(),headerRow:this.getHeaderRow()});this.equal=e=>this.id===e.getId();this.getType=()=>0;this.getRowsByColumnIndex=e=>{if(e===-1)return[];let t=[];for(let s=0;s<this.data.length;s++){let o=this.data[s];if(s>this.headerRowIndex){let a=o[e]??"";t.push(this.parseValue(a))}}return t};this.setColumns=()=>{let e=this.data[this.headerRowIndex];if(e){let t=[];for(let s=0;s<e.length;++s){let o=e[s];o&&t.push(new g({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[]};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>Y(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?(B++,this.id=`${t}-${B}`):this.id=o,s||this.setColumns(),this.modifiedData=this.getDataAsResults()}getModifiedData(){return this.modifiedData}mergedModifiedData(e){let t=[],s=this.getColumns();for(let o=0;o<s.length;o++){let a=s[o],r=[];if(!a.isRemoved()){for(let n=0;n<e.length;n++){t[n]||(t[n]=[]);let i=e[n][o];t[n][o]=i,r[n]=i}a.setRows(r)}}this.setData(t)}},P=R;var N=class extends P{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:a}){super({data:t.data,name:"join-sheet",isNotSetColumn:!0});this.sheets=[];this.joinHistory=[];this.findRefJoinSheetColumn=t=>{let s=this.sheets.length===2?this.sheets[0]:this,o=this.sheets[this.sheets.length-1];if(t<s.getColumns().length)return s.getColumns()[t];let a=t-s.getColumns().length;return o.getColumns().filter((r,n)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==n))[a]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let a=[];for(let r=0;r<o.length;++r){let n=o[r],i=s.findIndex(u=>u.source===r),h=this.columns[r]&&this.columns[r].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[r].getJoinedSheetColumns(),u.target]:h?d=this.columns[r].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],a.push(new J({columnKey:`${n}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(r)}))}else{let u=this.columns[r]?this.columns[r].getRefJoinSheetColum()??this.columns[r]:this.findRefJoinSheetColumn(r);a.push(new g({columnKey:`${n}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(r),refJoinSheetColum:u}))}}this.columns=a};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,a)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,a)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,a)}},Re=N;var L=({rowA:l,rowB:e},t)=>t.every(s=>{let o=`${l[s.source]??""}`,a=`${e[s.target]??""}`;return o===a&&o!==""&&a!==""}),Z=(l,e,t)=>{let s=[],o=l.headerRow,a=e.headerRow;for(let r=0;r<o.length;++r)s.push(o[r]);for(let r=0;r<a.length;++r)t.every(n=>n.target!==r)&&s.push(a[r]);return s},Fe=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...s[0]]);return{data:n,type:"ADD_TO_ALL_ROWS"}},Ae=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...a.map(()=>"")]);for(let i=0;i<s.length;++i)n.push([...o.map(()=>""),...s[i]]);return{data:n,type:"JOIN_WITHOUT_COLUMNS"}},Je=async(l,e,t)=>{let s=l.values,o=e.values,a=[],r=[],n={},i=Z(l,e,t);a.push(i);for(let h=0;h<s.length;++h){let u=!1,d=s[h];for(let m=0;m<o.length;++m){let p=o[m];L({rowA:d,rowB:p},t)&&(n[m]=!0,u=!0,a.push([...d,...p.filter((S,E)=>t.every(U=>U.target!==E))]))}u||r.push([...d,...e.headerRow.filter((m,p)=>t.every(S=>S.target!==p)).map(()=>"")])}for(let h=0;h<o.length;++h){if(n[h])continue;let u=o[h],d=l.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),r.push([...d,...u.filter((m,p)=>t.every(S=>S.target!==p))])}return r.forEach(h=>{a.push(h)}),{data:a,type:"JOIN_ON_COLUMNS"}},Te=async(l,e,t)=>{let s=e.headerRow.filter((n,i)=>t.every(h=>h.target!==i)),a=[[...l.headerRow,...s]];for(let n=0;n<l.values.length;++n){let i=[...l.values[n],...s.map(()=>"")];a.push(i)}let r=e.values;for(let n=0;n<r.length;++n){let i=l.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=r[n][u]:h.push(r[n][u])}a.push([...i,...h])}return{data:a,type:"APPEND_TO_COLUMNS"}},He=async(l,e,t)=>{let s=l.values,o=e.values,a=s.length+o.length,r=0,n={};for(let i=0;i<s.length;i++){let h=s[i],u=null,d=0;for(let m=0;m<o.length;m++){let p=o[m];if(L({rowA:h,rowB:p},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(r+=1,n[u]=!0)}for(let i=0;i<o.length;i++)n[i]&&(r+=1);return{count:r,total:a}};var v=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,a=this.detectedNumberFormats.columns.find(r=>r.column===s)?.numberFormat||this.detectedNumberFormats.global;return M.parse(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:a})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`)return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?M.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?M.parse(t[s]?.dataModelOption,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):t[s]?.dataModelOption};this.getValues=()=>{let e=this.sheetColumn.rows,t=[];for(let s=0;s<e.length;s++){let o=e[s];t.push(this.getOptionValue(o,this.matchedOptions))}return t};if(this.sheetColumn=e,this.matchedDataModel=t,this.matchedOptions=void 0,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.matchedDataModel.matchedOptions){this.matchedOptions=[];for(let o=0;o<(this.matchedDataModel.matchedOptions?.length??0);o++)this.matchedDataModel.dataModel?.getIsMultiSelection()?this.matchedDataModel.matchedOptions?.[o].dataModelOptions&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o]):this.matchedDataModel.matchedOptions?.[o].dataModelOption!==void 0&&this.matchedDataModel.matchedOptions?.[o].dataModelOption!==null&&this.matchedOptions.push(this.matchedDataModel.matchedOptions?.[o])}}},z=v;var V=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,a=new z({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),r=s.dataModel.getKey();a.forEach((n,i)=>{e[i]?e[i][r]=n:e[i]={[r]:n}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let a=this.columns[s].key;e[t][a]===void 0&&(e[t][a]=null)}return e};this.getValues=()=>(this.matchedColumns=[],this.matching.filter(t=>t.matchedDataModel?.dataModel).forEach(t=>{this.matchedColumns.push({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel})}),this.parseValues());let{matching:t,detectedNumberFormats:s}=e;this.matching=t,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.columns=e.columns??[]}},$=V;var We=({matching:l,detectedNumberFormats:e,columns:t})=>new $({matching:l,detectedNumberFormats:e,columns:t}).getValues();import*as j from"comlink";var f=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>w.isTypeCategory(e.type)?new F({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,options:e.options,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,isMultiSelection:e.isMultiSelection??!1,allowCustomOptions:e.allowCustomOptions,allowedCustomOptionTypes:e.allowedCustomOptionTypes,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration}):new w({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,outputFormat:e.outputFormat,numberFormat:e.numberFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})}};var C=class{static{this.serialize=e=>{let t={matching:[],detectedNumberFormats:e.detectedNumberFormats,columns:e.columns};return t.matching=e.matching.map(s=>({sheetColumn:s.sheetColumn,matchedDataModel:s.matchedDataModel?{dataModel:s.matchedDataModel.dataModel?f.serialize(s.matchedDataModel.dataModel):s.matchedDataModel.dataModel,matchedOptions:s.matchedDataModel.matchedOptions}:s.matchedDataModel})),[t,[]]}}static{this.deserialize=e=>({matching:e.matching.map(t=>({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel?{dataModel:t.matchedDataModel.dataModel?f.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};j.transferHandlers.set("Matching",{canHandle:l=>!!(typeof l=="object"&&l.matching),serialize:l=>C.serialize(l),deserialize:l=>C.deserialize(l)});export{g as a,_ as b,P as c,Re as d,Fe as e,Ae as f,Je as g,Te as h,He as i,We as j,f as k};
1
+ import{a as w}from"./chunk-VJNSVCH6.js";import{e as F,f as c,r as y,s as f}from"./chunk-F7ASAXPY.js";import{isEmpty as k,uniq as W}from"lodash";var A=0,I=class{constructor({sheet:e,columnKey:t,rows:s,id:o,notSetUnique:a=!1,label:r,refJoinSheetColum:n}){this.removed=!1;this.label="";this.parsedDate=!1;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>this.uniques;this.remove=()=>{this.removed=!0};this.unRemove=()=>{this.removed=!1};this.isRemoved=()=>this.removed;this.getType=()=>0;this.getFileName=()=>this.sheet.getSheetFileName();this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,type:this.getType()});this.equal=e=>this.getId()===e.getId();this.keyEqual=e=>this.columnKey===e.columnKey;this.setIndex=e=>{this.index=e};this.getIndex=()=>this.index;this.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,this.rows=k(s)?[""]:s,typeof o>"u"?(A++,this.id=`${t}-${A}`):this.id=o,a?this.uniques=[]:this.uniques=W(this.getRows()),r&&(this.label=r),this.refJoinSheetColum=n}setRows(e){this.rows=e}setParsedDate(e){this.parsedDate=e}hasParsedDate(){return this.parsedDate}},g=I;var x=class extends g{constructor({sheet:t,sheetColumns:s,rows:o,id:a,columnKey:r}){super({columnKey:r,rows:o,sheet:t,id:a});this.getType=()=>1;this.getJoinedSheetColumns=()=>this.sheetColumns;this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,sheetColumns:this.sheetColumns.map(t=>t.toJSON()),type:this.getType()});this.sheetColumns=s}},J=x;var T=["?",",","@"];import{isNaN as X,minBy as G,isString as Q,isEqual as Y,isEmpty as R,isNil as P}from"lodash";var b=class{constructor({sheets:e,filename:t,type:s,fileSize:o}){this.globalNumberFormat="eu";this.columnsNumberFormat=[];this.addSheet=e=>{this.sheets.push(e)};this.isSelected=()=>{for(let e=0;e<this.sheets.length;e++)if(this.sheets[e].isSelected())return!0;return!1};this.getSheets=()=>this.sheets;this.getSelectedSheets=()=>this.sheets.filter(e=>e.isSelected());this.getFilename=()=>this.filename;this.selectAllSheet=e=>this.sheets.forEach(t=>{t.setSelected(e)});this.getType=()=>this.type;this.getFileSize=()=>{let e=this.fileSize/1e6;return Number(parseFloat(`${e}`).toFixed(4))};this.sheets=e,this.filename=t,this.type=s,this.fileSize=o??0,this.sheets.forEach(a=>{a.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},_=b;var K=0,N=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];this.headerRowIndex=0;this.transposed=!1;this.headerRowIndexes=[];this.addedColumns=[];this.usedSourceCells=new Set;this.mergedHeadersActive=!1;this.mergedRowsBackup=null;this.availableRows=null;this.spreadSheet=new _({filename:"",sheets:[],type:"xlsx",fileSize:0});this.getId=()=>this.id;this.setSpreadSheet=e=>{this.spreadSheet=e};this.getSpreadSheet=()=>this.spreadSheet;this.setSelected=e=>{this.selected=e};this.isSelected=()=>this.selected;this.setHeaderRowIndex=e=>{this.headerRowIndex=e,this.setColumns(),this.mergedHeadersActive||(this.headerRowIndexes=[e])};this.setTransposed=e=>{this.transposed=e};this.getTransposed=()=>this.transposed;this.setHeaderRowIndexes=e=>{this.headerRowIndexes=[...e]};this.getHeaderRowIndexes=()=>this.headerRowIndexes.length>0?this.headerRowIndexes:[this.headerRowIndex];this.addAddedColumn=e=>{if(this.addedColumns.push(e),e.sourceCell){let o=`${e.sourceCell.row},${e.sourceCell.col}`;this.usedSourceCells.add(o)}let t=this.data[this.headerRowIndex],s=this.data.length>0?Math.max(...this.data.map(o=>o.length)):0;t&&t.push(e.columnName);for(let o=0;o<this.data.length;o++)if(o!==this.headerRowIndex){for(;this.data[o].length<s;)this.data[o].push("");o<this.headerRowIndex?this.data[o].push(""):this.data[o].push(e.value)}this.setColumns()};this.removeAddedColumn=e=>{let s=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length,o=e-s;if(o<0||o>=this.addedColumns.length)return;let a=this.addedColumns[o];if(a?.sourceCell){let r=`${a.sourceCell.row},${a.sourceCell.col}`;this.usedSourceCells.delete(r)}for(let r=0;r<this.data.length;r++)this.data[r].splice(e,1);this.addedColumns.splice(o,1),this.setColumns()};this.removeColumnFromData=e=>{if(!(e<0))for(let t=0;t<this.data.length;t++)this.data[t].length>e&&this.data[t].splice(e,1)};this.clearAddedColumns=()=>{if(this.addedColumns.length>0){let t=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length;for(let s=this.addedColumns.length-1;s>=0;s--){let o=t+s;for(let a=0;a<this.data.length;a++)this.data[a].length>o&&this.data[a].splice(o,1)}}this.addedColumns=[],this.usedSourceCells.clear(),this.setColumns()};this.isSourceCellUsed=(e,t)=>{let s=`${e},${t}`;return this.usedSourceCells.has(s)};this.getAddedColumnBySourceCell=(e,t)=>this.addedColumns.find(s=>s.sourceCell&&s.sourceCell.row===e&&s.sourceCell.col===t);this.getAddedColumns=()=>this.addedColumns;this.setMergedHeadersActive=e=>{this.mergedHeadersActive=e};this.isMergedHeadersActive=()=>this.mergedHeadersActive;this.setMergedRowsBackup=e=>{this.mergedRowsBackup=e};this.getMergedRowsBackup=()=>this.mergedRowsBackup;this.setAvailableRows=e=>{this.availableRows=e};this.getAvailableRows=()=>this.availableRows;this.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:e.filter(s=>s).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((s,o)=>Math.max(s,o.data?.filter(a=>!R(a)&&!T.some(r=>r===a.toString()?.trim()&&a.toString()?.startsWith(r))).length),0);this.setHeaderByAutoDetection=()=>{let e=this.getMaxLengthColumns(),t=this.getDataTransform(),s=[];for(let a=0;a<(t.length>50?50:t.length);a++){let r=t[a],n=r.length===e;r.data.filter(h=>!F.includes(Q(h)?h.toLowerCase():h)&&X(Number(h))).length===e&&n&&s.push(r)}let o=s.length===1?s[0].index:G(s,a=>a.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>this.columns.filter(e=>!e.isRemoved());this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>c(e.getColumnKey())<c(t.getColumnKey())?-1:c(e.getColumnKey())>c(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>this.columns.filter(e=>e.getType()!==1);this.getColumn=(e,t)=>this.columns.find(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getColumnsByKey=(e,t)=>this.columns.filter(s=>t?c(s.getColumnKey())===c(`${e}`):s.getColumnKey()===e);this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(R(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let a=0;a<this.data[this.headerRowIndex].length;a++)P(this.data[this.headerRowIndex][a])||o.push(this.parseValue(e[s][a]));t.push(o)}return t};this.getData=()=>this.data;this.getName=()=>this.name;this.getDisplayName=({t:e})=>{if(this.getName()?.length>0)return this.getName();switch(this.spreadSheet.getType()){case"json":return`${e("txt_default_sheet_prefix_name")} 1`;case"csv":return`${e("txt_default_sheet_prefix_name")} 1`;default:return""}};this.getSheetFileName=()=>`${this.spreadSheet.getFilename()}`;this.getIsManualSelectHeader=()=>this.isManualSelectHeader;this.setIsManualSelectHeader=()=>{this.isManualSelectHeader=!0};this.clearIsManualSelectHeader=()=>{this.isManualSelectHeader=!1};this.getDataAsResults=()=>{let e=[],t=this.getColumnsWithRemoved(),s=this.data.filter((o,a)=>a>this.headerRowIndex);for(let o=0;o<s.length;o++){let a=s[o];e[o]={};for(let r=0;r<t.length;r++){let n=a?.[r];if(!R(n)&&!P(n)){let i=t[r].getColumnKey();e[o][i]=this.parseValue(n)}}}return e};this.addColumn=e=>{this.columns.push(new g({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{this.columns.find((t,s)=>s===e)?.remove()};this.setData=e=>{this.data=e};this.toJSON=()=>({name:this.name,id:this.id,type:this.getType(),values:this.getValues(),headerRow:this.getHeaderRow()});this.equal=e=>this.id===e.getId();this.getType=()=>0;this.getRowsByColumnIndex=e=>{if(e===-1)return[];let t=[];for(let s=0;s<this.data.length;s++){let o=this.data[s];if(s>this.headerRowIndex){let a=o[e]??"";t.push(this.parseValue(a))}}return t};this.setColumns=()=>{let e=this.data[this.headerRowIndex];if(e){let t=[];for(let s=0;s<e.length;++s){let o=e[s];o&&t.push(new g({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[]};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>Y(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?(K++,this.id=`${t}-${K}`):this.id=o,s||this.setColumns(),this.modifiedData=this.getDataAsResults()}getModifiedData(){return this.modifiedData}mergedModifiedData(e){let t=[],s=this.getColumns();for(let o=0;o<s.length;o++){let a=s[o],r=[];if(!a.isRemoved()){for(let n=0;n<e.length;n++){t[n]||(t[n]=[]);let i=e[n][o];t[n][o]=i,r[n]=i}a.setRows(r)}}this.setData(t)}},B=N;var v=class extends B{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:a}){super({data:t.data,name:"join-sheet",isNotSetColumn:!0});this.sheets=[];this.joinHistory=[];this.findRefJoinSheetColumn=t=>{let s=this.sheets.length===2?this.sheets[0]:this,o=this.sheets[this.sheets.length-1];if(t<s.getColumns().length)return s.getColumns()[t];let a=t-s.getColumns().length;return o.getColumns().filter((r,n)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==n))[a]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let a=[];for(let r=0;r<o.length;++r){let n=o[r],i=s.findIndex(u=>u.source===r),h=this.columns[r]&&this.columns[r].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[r].getJoinedSheetColumns(),u.target]:h?d=this.columns[r].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],a.push(new J({columnKey:`${n}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(r)}))}else{let u=this.columns[r]?this.columns[r].getRefJoinSheetColum()??this.columns[r]:this.findRefJoinSheetColumn(r);a.push(new g({columnKey:`${n}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(r),refJoinSheetColum:u}))}}this.columns=a};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,a)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,a)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,a)}},Ne=v;var L=({rowA:l,rowB:e},t)=>t.every(s=>{let o=`${l[s.source]??""}`,a=`${e[s.target]??""}`;return o===a&&o!==""&&a!==""}),Z=(l,e,t)=>{let s=[],o=l.headerRow,a=e.headerRow;for(let r=0;r<o.length;++r)s.push(o[r]);for(let r=0;r<a.length;++r)t.every(n=>n.target!==r)&&s.push(a[r]);return s},Ae=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...s[0]]);return{data:n,type:"ADD_TO_ALL_ROWS"}},Je=async(l,e)=>{let t=l.values,s=e.values,o=l.headerRow,a=e.headerRow,r=[...o,...a],n=[];n.push(r);for(let i=0;i<t.length;++i)n.push([...t[i],...a.map(()=>"")]);for(let i=0;i<s.length;++i)n.push([...o.map(()=>""),...s[i]]);return{data:n,type:"JOIN_WITHOUT_COLUMNS"}},Te=async(l,e,t)=>{let s=l.values,o=e.values,a=[],r=[],n={},i=Z(l,e,t);a.push(i);for(let h=0;h<s.length;++h){let u=!1,d=s[h];for(let m=0;m<o.length;++m){let p=o[m];L({rowA:d,rowB:p},t)&&(n[m]=!0,u=!0,a.push([...d,...p.filter((M,E)=>t.every(U=>U.target!==E))]))}u||r.push([...d,...e.headerRow.filter((m,p)=>t.every(M=>M.target!==p)).map(()=>"")])}for(let h=0;h<o.length;++h){if(n[h])continue;let u=o[h],d=l.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),r.push([...d,...u.filter((m,p)=>t.every(M=>M.target!==p))])}return r.forEach(h=>{a.push(h)}),{data:a,type:"JOIN_ON_COLUMNS"}},He=async(l,e,t)=>{let s=e.headerRow.filter((n,i)=>t.every(h=>h.target!==i)),a=[[...l.headerRow,...s]];for(let n=0;n<l.values.length;++n){let i=[...l.values[n],...s.map(()=>"")];a.push(i)}let r=e.values;for(let n=0;n<r.length;++n){let i=l.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=r[n][u]:h.push(r[n][u])}a.push([...i,...h])}return{data:a,type:"APPEND_TO_COLUMNS"}},_e=async(l,e,t)=>{let s=l.values,o=e.values,a=s.length+o.length,r=0,n={};for(let i=0;i<s.length;i++){let h=s[i],u=null,d=0;for(let m=0;m<o.length;m++){let p=o[m];if(L({rowA:h,rowB:p},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(r+=1,n[u]=!0)}for(let i=0;i<o.length;i++)n[i]&&(r+=1);return{count:r,total:a}};import{isNil as ee}from"lodash";var V=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,a=this.detectedNumberFormats.columns.find(r=>r.column===s)?.numberFormat||this.detectedNumberFormats.global;return f.parse(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:a})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`){let o=!ee(t[s]?.dataModelOptions)&&(t[s]?.dataModelOptions?.length??0)>0;if(t[s]?.autoPreserved===!0&&t[s]?.dataModelOption==null&&!o){if(this.matchedDataModel.dataModel instanceof w){let a=`${e}`,r=this.matchedDataModel.dataModel.getOptions().find(n=>n.label===a||n.value===a);if(r)return f.parse(r.value,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0})}return e}return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?f.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?f.parse(t[s]?.dataModelOption,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):t[s]?.dataModelOption}};this.getValues=()=>{let e=this.sheetColumn.rows,t=[];for(let s=0;s<e.length;s++){let o=e[s];t.push(this.getOptionValue(o,this.matchedOptions))}return t};if(this.sheetColumn=e,this.matchedDataModel=t,this.matchedOptions=void 0,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.matchedDataModel.matchedOptions){this.matchedOptions=[];for(let o=0;o<(this.matchedDataModel.matchedOptions?.length??0);o++){let a=this.matchedDataModel.matchedOptions[o];this.matchedDataModel.dataModel?.getIsMultiSelection()?a.dataModelOptions&&this.matchedOptions.push(a):a.dataModelOption!==void 0&&a.dataModelOption!==null?this.matchedOptions.push(a):a.autoPreserved===!0&&!a.userCleared&&this.matchedOptions.push(a)}}}},$=V;var O=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,a=new $({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),r=s.dataModel.getKey();a.forEach((n,i)=>{e[i]?e[i][r]=n:e[i]={[r]:n}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let a=this.columns[s].key;e[t][a]===void 0&&(e[t][a]=null)}return e};this.getValues=()=>(this.matchedColumns=[],this.matching.filter(t=>t.matchedDataModel?.dataModel).forEach(t=>{this.matchedColumns.push({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel})}),this.parseValues());let{matching:t,detectedNumberFormats:s}=e;this.matching=t,this.detectedNumberFormats=s||{global:"eu",columns:[]},this.columns=e.columns??[]}},z=O;var Ge=({matching:l,detectedNumberFormats:e,columns:t})=>new z({matching:l,detectedNumberFormats:e,columns:t}).getValues();import*as j from"comlink";var C=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>y.isTypeCategory(e.type)?new w({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,options:e.options,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,isMultiSelection:e.isMultiSelection??!1,allowCustomOptions:e.allowCustomOptions,allowedCustomOptionTypes:e.allowedCustomOptionTypes,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration}):new y({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,outputFormat:e.outputFormat,numberFormat:e.numberFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})}};var S=class{static{this.serialize=e=>{let t={matching:[],detectedNumberFormats:e.detectedNumberFormats,columns:e.columns};return t.matching=e.matching.map(s=>({sheetColumn:s.sheetColumn,matchedDataModel:s.matchedDataModel?{dataModel:s.matchedDataModel.dataModel?C.serialize(s.matchedDataModel.dataModel):s.matchedDataModel.dataModel,matchedOptions:s.matchedDataModel.matchedOptions}:s.matchedDataModel})),[t,[]]}}static{this.deserialize=e=>({matching:e.matching.map(t=>({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel?{dataModel:t.matchedDataModel.dataModel?C.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};j.transferHandlers.set("Matching",{canHandle:l=>!!(typeof l=="object"&&l.matching),serialize:l=>S.serialize(l),deserialize:l=>S.deserialize(l)});export{g as a,_ as b,B as c,Ne as d,Ae as e,Je as f,Te as g,He as h,_e as i,Ge as j,C as k};
@@ -0,0 +1 @@
1
+ import{r as p}from"./chunk-F7ASAXPY.js";var n=class a extends p{constructor({description:t,key:o,example:i,label:r,type:l,options:u,validators:d,alternativeMatches:m,columnSize:h,isMultiSelection:g,allowCustomOptions:O,allowedCustomOptionTypes:s,preserveUnmappedOptions:y,creator:C,baseKey:M,baseKeyCounter:c,hidden:v,optionMappingConfiguration:b,...w}){super({description:t,key:o,example:i,label:r,type:l,validators:d,alternativeMatches:m,columnSize:h,creator:C,baseKey:M,baseKeyCounter:c,hidden:v,optionMappingConfiguration:b,...w});this.optionTypeMap=null;this.getOptions=()=>this.options;this.getOptionTypeMap=()=>{if(!this.optionTypeMap){this.optionTypeMap=new Map;for(let t=0;t<this.options.length;t++){let o=this.options[t];this.optionTypeMap.set(o.value,o.type??"string")}}return this.optionTypeMap};this.setOptions=t=>{this.options=t,this.optionTypeMap=null};this.serialize=()=>{let t={description:this.getDescription(),example:this.getExample(),isRequired:this.getIsRequired(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:this.getValidators().map(i=>i.serialize()),alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration()},o=this.getOptions();return{...t,options:o,isMultiSelection:this.isMultiSelection,allowCustomOptions:this.allowCustomOptions,allowedCustomOptionTypes:this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0,preserveUnmappedOptions:this.preserveUnmappedOptions}};this.getIsMultiSelection=()=>this.isMultiSelection;this.getAllowCustomOptions=()=>this.allowCustomOptions;this.getAllowedCustomOptionTypes=()=>this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0;this.getPreserveUnmappedOptions=()=>this.preserveUnmappedOptions;this.options=u?.map(e=>({...e,baseKey:e?.baseKey||e.value,baseKeyCounter:e.baseKeyCounter||0,alternativeMatches:e.alternativeMatches.filter(T=>T!==e.label),validations:e.validations||[]})),this.isMultiSelection=g,this.allowCustomOptions=O,this.allowedCustomOptionTypes=s?[...s]:void 0,this.preserveUnmappedOptions=y}clone(){let t=this.serialize();return new a({description:t.description,example:t.example,key:t.key,label:t.label,type:t.type,options:t.options,validators:this.getValidators(),alternativeMatches:t.alternativeMatches,columnSize:t.columnSize,columnWidth:t.columnWidth,isMultiSelection:t.isMultiSelection,allowCustomOptions:t.allowCustomOptions,allowedCustomOptionTypes:t.allowedCustomOptionTypes,preserveUnmappedOptions:t.preserveUnmappedOptions,hidden:t.hidden,disabled:t.disabled,optionMappingConfiguration:t.optionMappingConfiguration})}},K=n;export{K as a};
package/index.d.ts CHANGED
@@ -60,6 +60,7 @@ type SpreadSheetType =
60
60
  | 'tsv'
61
61
  | 'psv'
62
62
  | 'xlsx'
63
+ | 'ods'
63
64
  | 'json'
64
65
  | 'xml'
65
66
  | 'dynamic-import';
@@ -309,6 +310,27 @@ export type IStepHandler = {
309
310
  reviewStep?: IReviewStepHandler;
310
311
  };
311
312
 
313
+ export type StepIdentifier =
314
+ | 'upload'
315
+ | 'sheet-selection'
316
+ | 'header-selection'
317
+ | 'join-sheets'
318
+ | 'match-columns'
319
+ | 'review-entries'
320
+ | 'complete';
321
+
322
+ export declare const STEP_IDENTIFIERS: {
323
+ readonly UPLOAD: 'upload';
324
+ readonly SHEET_SELECTION: 'sheet-selection';
325
+ readonly HEADER_SELECTION: 'header-selection';
326
+ readonly JOIN_SHEETS: 'join-sheets';
327
+ readonly MATCH_COLUMNS: 'match-columns';
328
+ readonly REVIEW_ENTRIES: 'review-entries';
329
+ readonly COMPLETE: 'complete';
330
+ };
331
+
332
+ export type OnStepChange = (step: StepIdentifier) => void;
333
+
312
334
  export type ConfigureAPI = {
313
335
  licenseKey: string;
314
336
  settings: SettingsAPI;
@@ -317,6 +339,7 @@ export type ConfigureAPI = {
317
339
  onCancel?: OnCancel;
318
340
  onEntryChange?: OnEntryChange;
319
341
  onEntryInit?: OnEntryInit;
342
+ onStepChange?: OnStepChange;
320
343
  /** @deprecated - this setting is deprecated. */
321
344
  dataHandler?: DataHandler;
322
345
  stepHandler?: IStepHandler;
@@ -354,6 +377,22 @@ export type ColumnType =
354
377
  | 'gtin'
355
378
  | 'iban';
356
379
 
380
+ export type ActiveColumnType = Exclude<
381
+ ColumnType,
382
+ | 'category'
383
+ | 'date_dmy'
384
+ | 'date_mdy'
385
+ | 'date_iso'
386
+ | 'datetime'
387
+ | 'time_hms'
388
+ | 'time_hms_24'
389
+ | 'time_hm'
390
+ | 'time_hm_24'
391
+ | 'country_code_alpha_2'
392
+ | 'country_code_alpha_3'
393
+ | 'currency_code'
394
+ >;
395
+
357
396
  export type ValidationTypeAPI =
358
397
  | 'required'
359
398
  | 'unique'
@@ -381,6 +420,12 @@ export type ValidatorAPI = {
381
420
 
382
421
  export type DropdownOptionType = 'string' | 'float' | 'int';
383
422
 
423
+ export type PreserveUnmappedOptions =
424
+ | 'none'
425
+ | 'optional-off'
426
+ | 'optional-on'
427
+ | 'always';
428
+
384
429
  export type ButtonModeType = 'import' | 'edit' | 'both';
385
430
 
386
431
  export type ProcessorType = 'default' | 'node';
@@ -393,7 +438,8 @@ export type InputType =
393
438
  | 'tsv'
394
439
  | 'xlsx'
395
440
  | 'xls'
396
- | 'psv';
441
+ | 'psv'
442
+ | 'ods';
397
443
 
398
444
  export type DropdownOptionAPI = DropdownOptionAPIBase &
399
445
  (DropdownOptionAPIString | DropdownOptionAPINumber);
@@ -472,6 +518,7 @@ export type ColumnAPI = {
472
518
  outputFormat?: string | null;
473
519
  allowCustomOptions?: boolean;
474
520
  allowedCustomOptionTypes?: DropdownOptionType[];
521
+ preserveUnmappedOptions?: PreserveUnmappedOptions;
475
522
  numberFormat?: 'eu' | 'us';
476
523
  /**
477
524
  * @deprecated This property should not be used
@@ -548,6 +595,7 @@ export type SettingsAPI = {
548
595
  allowManualInput?: boolean;
549
596
  onlyMappedColumns?: boolean;
550
597
  allowCustomColumns?: boolean;
598
+ allowedCustomColumnTypes?: ActiveColumnType[];
551
599
  columnResize?: boolean;
552
600
  /** @deprecated - this setting will be deprecated. Use allowCustomOptions from Target Data Model instead. */
553
601
  allowCustomOptions?: boolean;
@@ -1179,10 +1227,6 @@ type ColumnMatchThemeAPI = {
1179
1227
  };
1180
1228
  errorPopover?: CSSInterpolation;
1181
1229
  };
1182
- notMatchingValue?: {
1183
- root?: CSSInterpolation;
1184
- icon?: CSSInterpolation;
1185
- };
1186
1230
  joinBadge?: CSSInterpolation;
1187
1231
  sheetInfo?: CSSInterpolation;
1188
1232
  dialogCreateCustomColumn?: DialogCreateCustomColumn;