@ingestro/importer-react 4.9.2 → 4.9.4
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/{chunk-QXD6LKS7.js → chunk-4CYOX7GB.js} +1 -1
- package/chunk-RQTPDEUS.js +1 -0
- package/{chunk-WKADKRGH.js → chunk-XRDVAOHU.js} +42 -42
- package/chunk-ZTSS4Z2R.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +466 -380
- package/package.json +1 -1
- package/workers/matchValues/index.js +1 -1
- package/workers/parseData/index.js +1 -1
- package/workers/searchAndReplace/index.js +1 -1
- package/chunk-JORVN4P2.js +0 -1
- package/chunk-WOBUOLP3.js +0 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as m,B as n,C as i,D as r,y as o,z as t}from"../../chunk-RQTPDEUS.js";import"../../chunk-ZTSS4Z2R.js";import"../../chunk-XRDVAOHU.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as e}from"comlink";var p=()=>!0;e({check:p,getValues:r,addToAllRows:o,joinWithoutColumns:t,joinOnColumns:m,appendToColumns:n,countMatching:i});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as
|
|
1
|
+
import{A as n,B as m,C as s,E as h,L as v,r as e,s as t,t as r,y as o,z as c}from"../../chunk-XRDVAOHU.js";import"../../chunk-3IKZH76S.js";import{expose as S}from"comlink";var p=()=>!0;S({convertCsv2Sheet:e,convertExcel2Sheet:m,convertJson2Sheet:r,convertXLS2Sheet:o,convertXML2Sheet:c,jsonParser:t,parseDateFormat:v,convertPdf2Sheets:n,convertNumbers2Sheet:s,buildXmlTree:h,check:p});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o,h as e}from"../../chunk-
|
|
1
|
+
import{e as o,h as e}from"../../chunk-4CYOX7GB.js";import"../../chunk-ZTSS4Z2R.js";import"../../chunk-XRDVAOHU.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import*as m from"comlink";var r=()=>!0;m.expose({check:r,getCountBySearchValue:o,getRowsToRemove:e});
|
package/chunk-JORVN4P2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as F,i as w,j as c,r as y}from"./chunk-WOBUOLP3.js";import{C as P,D as J,d as O,k as A,m as T}from"./chunk-WKADKRGH.js";import{b as p}from"./chunk-REPANPD5.js";import{isEmpty as G,uniq as Q}from"lodash";var H=0,I=class{constructor({sheet:e,columnKey:t,rows:s,id:o,label:r,refJoinSheetColum:a}){this.removed=!1;this.label="";this.rawRowsBeforeDateParse=null;this.dateRowsByInputFormat=new Map;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>(this.uniques===void 0&&(this.uniques=Q(this.getRows())),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.normalizeInputFormatKey=e=>{let t=typeof e=="string"?e.trim():"";return t!==""?t:null};this.dateInputFormatCacheKey=e=>this.normalizeInputFormatKey(e)??"\0auto";this.needsDateFormatParse=e=>!this.dateRowsByInputFormat.has(this.dateInputFormatCacheKey(e));this.hasParsedDateForInputFormat=e=>!this.needsDateFormatParse(e);this.getParsedRowsForInputFormat=e=>this.dateRowsByInputFormat.get(this.dateInputFormatCacheKey(e));this.getRowsForDateInputFormatParse=()=>this.rawRowsBeforeDateParse??this.rows;this.applyDateInputFormatParse=(e,t)=>{let s=this.getRowsForDateInputFormatParse();if(e.length!==s.length)throw new Error(`SheetColumn.applyDateInputFormatParse: parsed row count (${e.length}) must match source row count (${s.length}) for column "${this.columnKey}".`);this.dateRowsByInputFormat.set(this.dateInputFormatCacheKey(t),e)};this.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,Object.defineProperty(this,"sheet",{value:e,enumerable:!1,writable:!0,configurable:!0}),this.rows=G(s)?[""]:s,this.rawRowsBeforeDateParse=[...this.rows],typeof o>"u"?(H++,this.id=`${t}-${H}`):this.id=o,r&&(this.label=r),Object.defineProperty(this,"refJoinSheetColum",{value:a,enumerable:!1,writable:!0,configurable:!0})}setRows(e){this.rows=e,this.uniques=void 0}},f=I;var b=class extends f{constructor({sheet:t,sheetColumns:s,rows:o,id:r,columnKey:a}){super({columnKey:a,rows:o,sheet:t,id:r});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}},K=b;var B=["?",",","@"];import{isNaN as ee,minBy as te,isString as se,isEqual as oe,isEmpty as L,isNil as re}from"lodash";var x=class{constructor({sheets:e,filename:t,type:s,fileSize:o}){this.globalNumberFormat="eu";this.columnsNumberFormat=[];this.needsConfiguration=!1;this.pendingXmlConfigKey=null;this.pendingXmlConfig=null;this.sourceXml=null;this.keepSheetSelection=!1;this.addSheet=e=>{this.sheets.push(e)};this.setNeedsConfiguration=e=>{this.needsConfiguration=e};this.getNeedsConfiguration=()=>this.needsConfiguration;this.setPendingXmlConfigKey=e=>{this.pendingXmlConfigKey=e};this.getPendingXmlConfigKey=()=>this.pendingXmlConfigKey;this.setPendingXmlConfig=e=>{this.pendingXmlConfig=e};this.getPendingXmlConfig=()=>this.pendingXmlConfig;this.setSourceXml=e=>{this.sourceXml=e};this.getSourceXml=()=>this.sourceXml;this.setKeepSheetSelection=e=>{this.keepSheetSelection=e};this.getKeepSheetSelection=()=>this.keepSheetSelection;this.replaceSheets=e=>{let t=this.needsConfiguration||!!this.pendingXmlConfigKey||!!this.pendingXmlConfig||!!this.sourceXml;this.sheets=e,this.sheets.forEach(s=>{s.setSpreadSheet(this)}),this.needsConfiguration=!1,this.pendingXmlConfigKey=null,t?this.keepSheetSelection=!0:(this.pendingXmlConfig=null,this.sourceXml=null)};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.setType=e=>{this.type=e};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(r=>{r.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},z=x;var $=0,R=class{constructor({data:e,name:t,isNotSetColumn:s,id:o}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];this.columnsInitialized=!1;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 z({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.columnsInitialized=!1,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 r=this.addedColumns[o];if(r?.sourceCell){let a=`${r.sourceCell.row},${r.sourceCell.col}`;this.usedSourceCells.delete(a)}for(let a=0;a<this.data.length;a++)this.data[a].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 r=0;r<this.data.length;r++)this.data[r].length>o&&this.data[r].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.isLoneWhitelistCharacter=e=>{let t=e.toString()?.trim()??"";return B.some(s=>t===s)};this.isSignificantCell=e=>!L(e)&&!this.isLoneWhitelistCharacter(e);this.collapseAdjacentDuplicates=e=>e.filter((t,s)=>s===0||`${t}`!=`${e[s-1]}`);this.getSignificantCells=e=>{let t=(e??[]).filter(this.isSignificantCell);return this.collapseAdjacentDuplicates(t)};this.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:this.getSignificantCells(e).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((t,s)=>Math.max(t,s.length),0);this.isHeaderLikeCell=e=>!F.includes(se(e)?e.toLowerCase():e)&&ee(Number(e));this.countHeaderLikeCells=e=>this.getSignificantCells(e).filter(this.isHeaderLikeCell).length;this.setHeaderByAutoDetection=()=>{let t=this.getMaxLengthColumns(),s=this.getDataTransform().slice(0,50).filter(r=>r.length===t&&this.countHeaderLikeCells(r.data)===t),o=s.length===1?s[0].index:te(s,r=>r.length)?.index??0;this.setHeaderRowIndex(o)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>!e.isRemoved()));this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>p(e.getColumnKey())<p(t.getColumnKey())?-1:p(e.getColumnKey())>p(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>e.getType()!==1));this.getColumn=(e,t)=>(this.ensureColumnsBuilt(),this.columns.find(s=>t?p(s.getColumnKey())===p(`${e}`):s.getColumnKey()===e));this.getColumnsByKey=(e,t)=>(this.ensureColumnsBuilt(),this.columns.filter(s=>t?p(s.getColumnKey())===p(`${e}`):s.getColumnKey()===e));this.getValues=()=>{let e=this.data.filter((s,o)=>o>this.headerRowIndex);if(L(e))return[[]];let t=[];for(let s=0;s<e.length;s++){let o=[];for(let r=0;r<this.data[this.headerRowIndex].length;r++)re(this.data[this.headerRowIndex][r])||o.push(this.parseValue(e[s][r]));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.addColumn=e=>{this.ensureColumnsBuilt(),this.columns.push(new f({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.ensureColumnsBuilt(),this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{this.ensureColumnsBuilt(),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 r=o[e]??"";t.push(this.parseValue(r))}}return t};this.ensureColumnsBuilt=()=>{this.columnsInitialized||this.setColumns()};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 f({columnKey:`${o}`,sheet:this,rows:this.getRowsByColumnIndex(s)}))}this.columns=t}else this.columns=[];this.columnsInitialized=!0};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(o=>oe(`${o}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,typeof o>"u"?($++,this.id=`${t}-${$}`):this.id=o,this.columnsInitialized=!!s}},E=R;var V=class extends E{constructor({joinedData:t,sheets:s,mappings:o,mappingIndexes:r}){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 r=t-s.getColumns().length;return o.getColumns().filter((a,l)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(i=>i.target!==l))[r]};this.setJoinColumns=(t,s)=>{let o=this.data[this.headerRowIndex];if(!o){this.columns=[];return}let r=[];for(let a=0;a<o.length;++a){let l=o[a],i=s.findIndex(u=>u.source===a),h=this.columns[a]&&this.columns[a].getType()===1;if(i>=0||h){let u=t[i],d;h&&i>=0?d=[...this.columns[a].getJoinedSheetColumns(),u.target]:h?d=this.columns[a].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],r.push(new K({columnKey:`${l}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(a)}))}else{let u=this.columns[a]?this.columns[a].getRefJoinSheetColum()??this.columns[a]:this.findRefJoinSheetColumn(a);r.push(new f({columnKey:`${l}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(a),refJoinSheetColum:u}))}}this.columns=r};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,s,o,r)=>{this.setData(t.data),this.sheets.push(s),this.joinHistory.push({mappingIndexes:r,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(o,r)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:r,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=s,this.setJoinColumns(o,r)}},Pe=V;var X=({rowA:n,rowB:e},t)=>t.every(s=>{let o=`${n[s.source]??""}`,r=`${e[s.target]??""}`;return o===r&&o!==""&&r!==""}),ae=(n,e,t)=>{let s=[],o=n.headerRow,r=e.headerRow;for(let a=0;a<o.length;++a)s.push(o[a]);for(let a=0;a<r.length;++a)t.every(l=>l.target!==a)&&s.push(r[a]);return s},_e=async(n,e)=>{let t=n.values,s=e.values,o=n.headerRow,r=e.headerRow,a=[...o,...r],l=[];l.push(a);for(let i=0;i<t.length;++i)l.push([...t[i],...s[0]]);return{data:l,type:"ADD_TO_ALL_ROWS"}},ze=async(n,e)=>{let t=n.values,s=e.values,o=n.headerRow,r=e.headerRow,a=[...o,...r],l=[];l.push(a);for(let i=0;i<t.length;++i)l.push([...t[i],...r.map(()=>"")]);for(let i=0;i<s.length;++i)l.push([...o.map(()=>""),...s[i]]);return{data:l,type:"JOIN_WITHOUT_COLUMNS"}},Le=async(n,e,t)=>{let s=n.values,o=e.values,r=[],a=[],l={},i=ae(n,e,t);r.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 g=o[m];X({rowA:d,rowB:g},t)&&(l[m]=!0,u=!0,r.push([...d,...g.filter((M,q)=>t.every(Y=>Y.target!==q))]))}u||a.push([...d,...e.headerRow.filter((m,g)=>t.every(M=>M.target!==g)).map(()=>"")])}for(let h=0;h<o.length;++h){if(l[h])continue;let u=o[h],d=n.headerRow.map(()=>"");t.forEach(m=>{d[m.source]=u[m.target]}),a.push([...d,...u.filter((m,g)=>t.every(M=>M.target!==g))])}return a.forEach(h=>{r.push(h)}),{data:r,type:"JOIN_ON_COLUMNS"}},$e=async(n,e,t)=>{let s=e.headerRow.filter((l,i)=>t.every(h=>h.target!==i)),r=[[...n.headerRow,...s]];for(let l=0;l<n.values.length;++l){let i=[...n.values[l],...s.map(()=>"")];r.push(i)}let a=e.values;for(let l=0;l<a.length;++l){let i=n.headerRow.map(()=>""),h=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(m=>m.target===u);d?i[d.source]=a[l][u]:h.push(a[l][u])}r.push([...i,...h])}return{data:r,type:"APPEND_TO_COLUMNS"}},Ee=async(n,e,t)=>{let s=n.values,o=e.values,r=s.length+o.length,a=0,l={};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 g=o[m];if(X({rowA:h,rowB:g},t)&&(u=m,d++,d===2))break}d===1&&u!==null&&(a+=1,l[u]=!0)}for(let i=0;i<o.length;i++)l[i]&&(a+=1);return{count:a,total:r}};import{isNil as ie}from"lodash";var k=(n,e)=>{if(e.getType()!=="date")return c.parse(n,{dataModel:e});if(A(n))return null;let t=`${n}`,s=e.getInputFormat();return T(s)?O(t)?c.parse(t,{dataModel:e}):P(t,s)?c.parse(J([t],s)[0],{dataModel:e}):t:c.parse(t,{dataModel:e})};var v=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:s}){this.parseSheetValue=(e,t)=>t.dataModel.getType()==="date"?k(e,t.dataModel):c.parse(e,t);this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let s=this.sheetColumn.columnKey,r=this.detectedNumberFormats.columns.find(a=>a.column===s)?.numberFormat||this.detectedNumberFormats.global;return this.parseSheetValue(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:r})}else return e;for(let s=0;s<t.length;s++)if(`${t[s]?.sheetOption}`==`${e}`){let o=!ie(t[s]?.dataModelOptions)&&(t[s]?.dataModelOptions?.length??0)>0;if(t[s]?.autoPreserved===!0&&t[s]?.dataModelOption==null&&!o){if(this.matchedDataModel.dataModel instanceof y){let r=`${e}`,a=this.matchedDataModel.dataModel.getOptions().find(l=>l.label===r||l.value===r);if(a)return c.parse(a.value,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0})}return e}return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?c.parse(t[s]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?c.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],r=this.getOptionValue(o,this.matchedOptions);t.push(r)}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 r=this.matchedDataModel.matchedOptions[o];this.matchedDataModel.dataModel?.getIsMultiSelection()?r.dataModelOptions&&this.matchedOptions.push(r):r.dataModelOption!==void 0&&r.dataModelOption!==null?this.matchedOptions.push(r):r.autoPreserved===!0&&!r.userCleared&&this.matchedOptions.push(r)}}}},j=v;var N=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let s=t.matchedDataModel,r=new j({sheetColumn:t.sheetColumn,matchedDataModel:s,detectedNumberFormats:this.detectedNumberFormats}).getValues(),a=s.dataModel.getKey();r.forEach((l,i)=>{e[i]?e[i][a]=l:e[i]={[a]:l}})});for(let t=0;t<e.length;++t)for(let s=0;s<this.columns.length;++s){let r=this.columns[s].key;e[t][r]===void 0&&(e[t][r]=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??[]}},U=N;var pt=({matching:n,detectedNumberFormats:e,columns:t})=>new U({matching:n,detectedNumberFormats:e,columns:t}).getValues();import*as W from"comlink";var C=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>w.isTypeCategory(e.type)?new y({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,inputFormat:e.inputFormat,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})}};W.transferHandlers.set("Matching",{canHandle:n=>!!(n!==null&&typeof n=="object"&&n.matching),serialize:n=>S.serialize(n),deserialize:n=>S.deserialize(n)});export{f as a,z as b,E as c,Pe as d,_e as e,ze as f,Le as g,$e as h,Ee as i,pt as j,C as k};
|
package/chunk-WOBUOLP3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as T,D as V,a as G,b as q,c as Z,d as J,e as j,f as ee,h as te,l as re,m as f}from"./chunk-WKADKRGH.js";import{a as u,c as a,f as x,h as b}from"./chunk-REPANPD5.js";import{a as g}from"./chunk-J5WOZVPO.js";var U=class{constructor({validation:e,regex:t,fields:i,errorMessage:o,operator:n,value:s}){this.getValidation=()=>this.validation;this.getRegex=()=>this.regex;this.getFields=()=>this.fields;this.getErrorMessage=()=>this.errorMessage;this.getOperator=()=>this.operator;this.getValue=()=>this.value;this.serialize=()=>({validation:this.getValidation(),fields:this.getFields(),regex:this.getRegex(),errorMessage:this.getErrorMessage(),operator:this.getOperator(),value:this.getValue()});this.validation=e,this.regex=t,this.fields=i??[],this.errorMessage=o,this.operator=n,this.value=s}},ht=U;var h=class r{constructor({description:e,key:t,example:i,label:o,type:n,validators:s,mappingValidation:y,alternativeMatches:c,columnSize:l,creator:p,baseKey:m,baseKeyCounter:E,outputFormat:M,inputFormat:O,numberFormat:D,hidden:S,disabled:P,optionMappingConfiguration:R,columnWidth:I,excludeFromAutoMatching:_}){this.getDescription=()=>this.description;this.getKey=()=>this.key;this.getExample=()=>this.example;this.getLabel=()=>this.label;this.setLabel=e=>{this.label=e};this.getType=()=>this.type;this.getOutputFormat=()=>r.getOutputFormat(this.outputFormat);this.getInputFormat=()=>this.inputFormat;this.getValidators=()=>this.validators;this.getColumnSize=()=>this.columnSize;this.getColumnWidth=()=>this.columnWidth;this.getIsRequired=()=>!!this.validators.find(t=>t.getValidation()==="REQUIRED");this.getIsUnique=()=>!!this.validators.find(t=>t.getValidation()==="UNIQUE");this.getIsUniqueAndRequired=()=>this.getIsRequired()===!0&&this.getIsUnique()===!0;this.hasMappingValidation=()=>!!(this.mappingValidation&&this.mappingValidation.logic&&this.mappingValidation.logic.trim().length>0);this.getMappingValidation=()=>this.mappingValidation||void 0;this.getAlternativeMatches=()=>this.alternativeMatches.filter(e=>!!e);this.getCreator=()=>this.creator;this.getBaseKey=()=>this.baseKey;this.getBaseKeyCounter=()=>this.baseKeyCounter;this.setCustomKey=({key:e,baseKey:t,baseKeyCounter:i,creator:o})=>{this.baseKey=t,this.key=e,this.baseKeyCounter=i,this.creator=o};this.isDropdown=()=>r.isTypeDropdown(this.getType());this.isCategoryType=()=>r.isTypeCategory(this.getType());this.isBooleanType=()=>this.type==="boolean";this.serialize=()=>({description:this.getDescription(),example:this.getExample(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:[],alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),isMultiSelection:this.getIsMultiSelection(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()});this.getIsMultiSelection=()=>!1;this.getNumberFormat=()=>this.numberFormat;this.isDisabled=()=>this.disabled;this.isNumeric=()=>this.type==="int"||this.type==="float"||this.type==="currency_eur"||this.type==="currency_usd"||this.type==="percentage";this.isCurrency=()=>this.type==="currency_eur"||this.type==="currency_usd";this.baseClone=()=>{let e=this.serialize();return new r({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:this.getValidators(),alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,columnWidth:e.columnWidth,baseKey:e.baseKey,baseKeyCounter:e.baseKeyCounter,creator:e.creator,numberFormat:e.numberFormat,outputFormat:e.outputFormat,inputFormat:e.inputFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration,excludeFromAutoMatching:e.excludeFromAutoMatching})};this.isHidden=()=>this.hidden;this.isExcludedFromAutoMatching=()=>this.excludeFromAutoMatching;this.getOptionMappingConfiguration=()=>this.optionMappingConfiguration;this.description=e,this.key=t,this.example=i,this.label=o,this.type=n,this.validators=s??[],this.mappingValidation=y,this.alternativeMatches=c?[...c.filter(d=>d!==o&&d!==t)?.map(d=>d?.toString())]:[],this.columnSize=l,this.creator=p,this.baseKey=m||t,this.baseKeyCounter=E||0,this.outputFormat=M||"",this.inputFormat=O??null,this.numberFormat=D||"eu",this.hidden=S??!1,this.disabled=P??!1,this.optionMappingConfiguration=R,this.columnWidth=I,this.excludeFromAutoMatching=_??!1}static{this.getOutputFormat=e=>(e||"DD.MM.YYYY").replace(/d/g,"D").replace(/e|E/g,"")}static{this.isTypeDropdown=e=>r.isTypeCategory(e)||e==="boolean"}static{this.isTypeCategory=e=>e==="single-select"||e==="currency_code"||e==="country_code_alpha_2"||e==="country_code_alpha_3"}};import{isNil as z,escapeRegExp as Mt,isArray as gt}from"lodash";var N=()=>g.getInstance().getTruthyWords(),L=()=>g.getInstance().getFalsyWords(),Rt=()=>g.getInstance().getBooleanOptionToRender(),It=[...N(),...L()];import{isArray as Ae,isNil as Oe,isObject as De}from"lodash";var H=class{constructor(){this.parse=(e,t)=>Oe(e)||Ae(e)||De(e)?null:N().includes(`${e}`.toLowerCase())?!0:L().includes(`${e}`.toLowerCase())?!1:e===""?null:`${e}`}},oe=H;import{isArray as ne,isBoolean as se,isNil as ae,isObject as le}from"lodash";var Y=class{constructor(){this.parseSingle=(e,t)=>ae(e)||le(e)||ne(e)?null:se(e)?JSON.stringify(e):b({value:e,dataModel:t.dataModel,isTrim:!0});this.parseMultiple=(e,t)=>ne(e)?e.map(i=>b({value:i,dataModel:t.dataModel,isTrim:!0})):ae(e)||le(e)||e===""?null:se(e)?[JSON.stringify(e)]:[b({value:e,dataModel:t.dataModel,isTrim:!0})];this.parse=(e,t)=>t.dataModel.getIsMultiSelection()&&!t.forceSingle?this.parseMultiple(e,t):this.parseSingle(e,t)}},pe=Y;import{isArray as Se,isBoolean as Pe,isNil as Re,isObject as Ie}from"lodash";var w=class{constructor(){this.parse=(e,t)=>{if(Re(e)||Se(e)||Ie(e))return null;if(Pe(e))return JSON.stringify(e);if(e==="")return null;if(typeof e=="number"){let i=`${e}`;return a(u.isScientificNotation(i)?u.expandScientificNotation(i):i)}return a(`${e}`)}}},ue=w;import{isArray as _e,isBoolean as xe,isNil as Ve,isObject as Ue}from"lodash";var $=class{constructor(){this.parse=(e,t)=>Ve(e)?null:xe(e)?e?"1":"0":Ue(e)||_e(e)||e===""||a(e)===null?null:this.valueParser(e,t)}},C=$;var v=class extends C{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=u.convertStringToNumber(t,{format:i?.numberFormat});return o===null?a(`${t}`):Number(o)}}},me=v;var W=class extends C{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=u.convertStringToNumber(t,{format:i?.numberFormat});return o===null?a(`${t}`):Number(o)}}},de=W;import{isArray as Fe,isBoolean as Ne,isNil as Le,isNumber as He,isObject as Ye}from"lodash";var K=class{constructor(){this.parse=(e,t)=>{if(Le(e)||Ye(e)||Fe(e))return null;if(Ne(e))return JSON.stringify(e);if(He(e))return e;if(e===""||a(e)===null)return null;let i=u.convertStringToNumber(e,{adornment:"percentage"});return i===null?a(`${e}`):Number(i)}}},ye=K;import{isArray as we,isBoolean as $e,isNil as ve,isObject as We}from"lodash";var X=class{constructor(){this.parse=(e,t)=>{if(ve(e)||we(e)||We(e))return null;if($e(e))return JSON.stringify(e);if(e===""||a(e)===null)return null;let i=u.convertStringToNumber(e,{format:t?.numberFormat});return i===null?a(`${e}`):Number(i)}}},ce=X;var Me=["dd.MM.yyyy HH:mm","dd.MM.yyyy","dd/MM/yyyy HH:mm:ss","dd/MM/yyyy HH:mm","dd/MM/yyyy","dd-MM-yyyy HH:mm:ss","dd-MM-yyyy HH:mm","yyyy-MM-dd'T'HH:mm:ss","yyyy-MM-dd","yyyy-dd-MM","yyyy-MM-dd HH:mm:ss","dd-MM-yyyy","MM-dd-yyyy","MM/dd/yyyy","MM.dd.yyyy","yyyy/MM/dd","yyyyMMdd","dd MMM yyyy","dd MMMM yyyy","MM-dd-yyyy HH:mm:ss","MM/dd/yyyy HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd-yyyy HH:mm","MM/dd/yyyy HH:mm","dd-MMM-yyyy","MMM yyyy","MMMM yyyy","MMMM d, yyyy","MMM d, yyyy","MM dd yyyy","yyyy-MM-dd'T'HH:mm:ss.SSS","yyyy-MM-dd'T'HH:mm:ss.SSSxxx","yyyy.MM.dd","yyyy MM dd","yyyy/dd/MM","yyyy.dd.MM","dd yyyy MM","dd.yyyy.MM","dd-yyyy-MM","yyyy dd MM","MM yyyy dd","dd/yyyy/MM","MM/yyyy/dd"],Ke=["dd.MM.yyyy","dd/MM/yyyy","dd-MM-yyyy","MM.dd.yyyy","MM/dd/yyyy","MM-dd-yyyy","yyyy.MM.dd","yyyy/MM/dd","yyyy-MM-dd","yyyy.dd.MM","yyyy/dd/MM","yyyy-dd-MM","dd MMM yyyy","dd MMMM yyyy","MMM dd, yyyy","MMMM dd, yyyy","MMM dd yyyy","yyyy MMM dd"],Xe=["ddMMyyyy","MMddyyyy","yyyyMMdd"],Be=[""," HH:mm"," HH:mm:ss"],ke=["yyyy-MM-dd","yyyy-dd-MM"],ze=["'T'HH:mm:ss","'T'HH:mm:ss.SSS","'T'HH:mm:ss.SSSxxx"],Qe=[...Ke.flatMap(r=>Be.map(e=>`${r}${e}`)),...Xe,...ke.flatMap(r=>ze.map(e=>`${r}${e}`))],Ge=new Set(Me),ge=new Set([...Me,...Qe.filter(r=>!Ge.has(r))]);var qe={YYYY:"yyyy",YY:"yy",MMMM:"MMMM",MMM:"MMM",MM:"MM",M:"M",DD:"dd",D:"d",HH:"HH",H:"H",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"SSS",SS:"SS",S:"S",A:"a",a:"a",XXXXX:"XXXXX",XXXX:"XXXX",XXX:"XXX",XX:"XX",X:"X",xxxxx:"xxxxx",xxxx:"xxxx",xxx:"xxx",xx:"xx",x:"x",ZZ:"xxx",Z:"X"},fe=r=>r.replace(/'/g,"''"),Ze=r=>{let e="",t=0;for(;t<r.length;){let i=r[t];if(i==="'"){t+=1;let o="";for(;t<r.length;)if(r[t]==="'")if(r[t+1]==="'")o+="'",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${fe(o)}'`;continue}if(i==="["){t+=1;let o="";for(;t<r.length;)if(r[t]==="]")if(r[t+1]==="]")o+="]",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${fe(o)}'`;continue}if(i==="T"){e+="'T'",t+=1;continue}if(/[A-Za-z]/.test(i)){let o=1;for(;r[t+o]===i;)o++;let n=r.slice(t,t+o);e+=qe[n]??n,t+=o}else e+=i,t+=1}return e},Je=r=>{if(!f(r))return!1;let e=Ze(r.trim());return ge.has(e)},cr=r=>{if(!f(r))return null;let e=r.trim();return Je(e)?e:null},je=({sourceRows:r,inputFormat:e})=>{let t=e.trim(),i=0,o=0;for(let n=0;n<r.length;n++){let s=r[n];re(s)&&(o+=1,T(s.trim(),t)||(i+=1))}return{mismatchCount:i,totalCount:o}},Mr=(r,e)=>{let t=e.trim();if(T(r,t))return!1;let i=r.trim();return/^\d{4}-\d{2}-\d{2}/.test(i)?!!(t.includes("/")||t.includes(".")&&!t.includes("/")):!1},gr=({columnKey:r,sourceRows:e,inputFormat:t})=>{let{mismatchCount:i,totalCount:o}=je({sourceRows:e,inputFormat:t});i!==0&&console.warn(`Ingestro: Column '${r}': ${i} of ${o} cells did not match inputFormat '${t.trim()}'.`)};import{parse as et,format as tt}from"date-fns";import{isArray as rt,isBoolean as it,isNil as ot,isObject as nt}from"lodash";import A from"moment";var Te=/([+-](?:0\d|1[0-4]):?[0-5]\d|Z)$/i,he=(r,e)=>{let o=!!r.match(Te)?A.parseZone(r,e,!0):A(r,e,!0);return o.isValid()&&o.format(e)===r},B=class{constructor(){this.parse=(e,t)=>{if(ot(e)||rt(e)||nt(e))return null;if(it(e))return JSON.stringify(e);let i=t?.dataModel?.getType();if(!i)return a(`${e}`);if(typeof e=="string"){if(e==="")return null;try{if(t?.dataModel?.getType()==="date"){let o=t?.dataModel?.getOutputFormat(),n=t?.dataModel?.getInputFormat(),s=`${e}`,y=!1;if(f(n)&&!t?.skipDeclaredInputFormatNormalization){let m=J(s);if(T(s,n)||m)m||(s=`${V([s],n)[0]}`),y=!0;else{let M=V([s],n)[0];if(M===s)return he(s,o)?s:a(s);s=`${M}`,y=!0}}if(!y&&he(s,o))return s;let p=!!s.match(Te)?A.parseZone(s,Z):A(s,q);if(p.isValid())return p.format(o);throw new Error("invalid date")}else{let o=j[i];if(!o)return a(`${e}`);let n=et(e,G,new Date);return tt(n,o)}}catch{let n=ee[i];return n?a(te(e,n)):a(`${e}`)}}else return a(`${e}`)}}},Ee=B;import{isArray as st}from"lodash";var at=new me,lt=new de,pt=new ce,ut=new ye,mt=new oe,dt=new pe,yt=new ue,ct=new Ee,k=class{static{this.parse=(e,t)=>{let i;switch(t?.dataModel?.getType()){case"int":i=at;break;case"float":i=lt;break;case"boolean":i=mt;break;case"single-select":case"currency_code":case"country_code_alpha_2":case"country_code_alpha_3":i=dt;break;case"percentage":i=ut;break;case"currency_eur":case"currency_usd":i=pt;break;case"date":case"date_dmy":case"date_mdy":case"date_iso":case"datetime":case"time_hms":case"time_hms_24":case"time_hm":case"time_hm_24":i=ct;break;case"email":case"url_www":case"url_https":case"url":case"phone":case"zip_code_de":case"bic":case"vat_eu":case"gtin":case"iban":default:i=yt;break}return i.parse(e,t)}}static{this.parseRawValueToDisplayValue=(e,t)=>{let i=e;if(t.isNumeric)i=u.convertToFormat(e,{targetFormat:t.numberFormat||"eu",adornment:t.type==="percentage"?"percentage":void 0}),["currency_eur","currency_usd"].includes(t.type)&&(t.type==="currency_usd"?i=`$${i}`:i=`${i} \u20AC`);else if(t.type==="boolean"){let n=g.getInstance().getOptionsForReviewEntries().find(s=>`${s.value}`.includes(`${e}`));n&&(i=`${n.label}`)}else if(h.isTypeCategory(t.type))if(t.isMultiSelection){if(st(e)){let o=t.options?.filter(n=>e.some(s=>x(n,s)));o&&(i=o.map(n=>n.label).join(", "))}}else{let o=t.options?.find(n=>x(n,e));o&&(i=`${o?.label}`)}return`${i}`}}static{this.parseDisplayValueToRawValue=(e,t)=>{if(t.isNumeric){let i=u.convertToUsWithDecimal(`${e}`,t.numberFormat??"eu");if(i===null)return e;let o=u.convertStringToNumber(i,{format:"us"});return o!==null?Number(o):e}else return e}}},be=k;var Zr=(r,e)=>Number(r).toLocaleString(e??"de-DE"),ft={de:"de-DE",en:"en-US",es:"es-ES",fr:"fr-FR",it:"it-IT",nl:"nl-NL",pl:"pl-PL",pt:"pt-PT",sv:"sv-SE",cz:"cs-CZ",dk:"da-DK",hu:"hu-HU",lt:"lt-LT",no:"nb-NO",ru:"ru-RU",sk:"sk-SK",zh:"zh-CN"},Jr=r=>r?ft[r]??"de-DE":"de-DE",jr=(r,e)=>{let{value:t,isExact:i,columns:o,isEmptyValues:n}=e;if(n)return z(r)||r==="";if(gt(r)&&o[0]?.isMultiSelection){let y=o[0],c=r.map(l=>{let p=y.options?.find(m=>`${m.value}`==`${l}`);return p?p.label:`${l}`}).join(", ");return i?c===t:c.toLowerCase().includes(t.toLowerCase())}let s=be.parseRawValueToDisplayValue(r,o[0]);return i&&!z(r)&&s===t?!0:!!(!i&&!z(r)&&s?.toLowerCase()?.includes(t?.toLowerCase()))},ei=(r,e,t,i)=>{let o=r.map(l=>{let p=i.options?.find(m=>`${m.value}`==`${l}`);return p?p.label:`${l}`}),n=e.split(",").map(l=>l.trim()).filter(Boolean);if(n.length===0)return r;let s=-1;for(let l=0;l<=o.length-n.length;l++){let p=!0;for(let m=0;m<n.length;m++)if(o[l+m].toLowerCase()!==n[m].toLowerCase()){p=!1;break}if(p){s=l;break}}if(s===-1)return r;let y=[...r.slice(0,s),...t,...r.slice(s+n.length)],c=new Set;return y.filter(l=>{let p=`${l}`;return c.has(p)?!1:(c.add(p),!0)})},ti=(r,e,t)=>{let i=new RegExp(Mt(e),"gi");return`${r}`.replace(i,t)},ri=r=>typeof r=="string"?r.replace(/(\r\n|\n|\r)/gm,""):r,ii=(r,e)=>e?e.map((t,i)=>r.map(o=>({rowIndex:i,valid:!0,key:o.key,value:t[o.key]}))):[];var Q=class r extends h{constructor({description:t,key:i,example:o,label:n,type:s,options:y,validators:c,alternativeMatches:l,columnSize:p,isMultiSelection:m,allowCustomOptions:E,allowedCustomOptionTypes:M,preserveUnmappedOptions:O,creator:D,baseKey:S,baseKeyCounter:P,hidden:R,optionMappingConfiguration:I,..._}){super({description:t,key:i,example:o,label:n,type:s,validators:c,alternativeMatches:l,columnSize:p,creator:D,baseKey:S,baseKeyCounter:P,hidden:R,optionMappingConfiguration:I,..._});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 i=this.options[t];this.optionTypeMap.set(i.value,i.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(o=>o.serialize()),alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()},i=this.getOptions();return{...t,options:i,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=y?.map(d=>({...d,baseKey:d?.baseKey||d.value,baseKeyCounter:d.baseKeyCounter||0,alternativeMatches:d.alternativeMatches.filter(Ce=>Ce!==d.label),validations:d.validations||[]})),this.isMultiSelection=m,this.allowCustomOptions=E,this.allowedCustomOptionTypes=M?[...M]:void 0,this.preserveUnmappedOptions=O}clone(){let t=this.serialize();return new r({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,excludeFromAutoMatching:t.excludeFromAutoMatching})}},pi=Q;export{N as a,L as b,Rt as c,It as d,cr as e,Mr as f,gr as g,ht as h,h as i,be as j,Zr as k,Jr as l,jr as m,ei as n,ti as o,ri as p,ii as q,pi as r};
|