read-excel-file 5.3.2 → 5.3.5
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/CHANGELOG.md +15 -0
- package/README.md +73 -32
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/read/isDateTimestamp.js +112 -0
- package/commonjs/read/isDateTimestamp.js.map +1 -0
- package/commonjs/read/parseCell.js +5 -0
- package/commonjs/read/parseCell.js.map +1 -1
- package/commonjs/read/parseCellValue.js +78 -93
- package/commonjs/read/parseCellValue.js.map +1 -1
- package/commonjs/read/parseDate.js.map +1 -1
- package/commonjs/read/schema/convertToJson.js +99 -31
- package/commonjs/read/schema/convertToJson.js.map +1 -1
- package/commonjs/read/schema/convertToJson.test.js.map +1 -1
- package/commonjs/xml/dom.js +29 -0
- package/commonjs/xml/dom.js.map +1 -1
- package/commonjs/xml/xlsx.js.map +1 -1
- package/commonjs/xml/xml.js +2 -4
- package/commonjs/xml/xml.js.map +1 -1
- package/commonjs/xml/{xlsx-xpath.js → xpath/xlsx-xpath.js} +1 -0
- package/commonjs/xml/xpath/xlsx-xpath.js.map +1 -0
- package/commonjs/xml/{xpathBrowser.js → xpath/xpathBrowser.js} +1 -0
- package/commonjs/xml/xpath/xpathBrowser.js.map +1 -0
- package/commonjs/xml/{xpathNode.js → xpath/xpathNode.js} +1 -1
- package/commonjs/xml/xpath/xpathNode.js.map +1 -0
- package/modules/read/isDateTimestamp.js +104 -0
- package/modules/read/isDateTimestamp.js.map +1 -0
- package/modules/read/parseCell.js +5 -1
- package/modules/read/parseCell.js.map +1 -1
- package/modules/read/parseCellValue.js +76 -91
- package/modules/read/parseCellValue.js.map +1 -1
- package/modules/read/parseDate.js.map +1 -1
- package/modules/read/schema/convertToJson.js +99 -31
- package/modules/read/schema/convertToJson.js.map +1 -1
- package/modules/read/schema/convertToJson.test.js.map +1 -1
- package/modules/xml/dom.js +27 -0
- package/modules/xml/dom.js.map +1 -1
- package/modules/xml/xlsx.js.map +1 -1
- package/modules/xml/xml.js +2 -2
- package/modules/xml/xml.js.map +1 -1
- package/modules/xml/{xlsx-xpath.js → xpath/xlsx-xpath.js} +1 -0
- package/modules/xml/xpath/xlsx-xpath.js.map +1 -0
- package/modules/xml/{xpathBrowser.js → xpath/xpathBrowser.js} +1 -0
- package/modules/xml/xpath/xpathBrowser.js.map +1 -0
- package/modules/xml/{xpathNode.js → xpath/xpathNode.js} +1 -1
- package/modules/xml/xpath/xpathNode.js.map +1 -0
- package/package.json +1 -1
- package/types.d.ts +11 -6
- package/commonjs/xml/xlsx-xpath.js.map +0 -1
- package/commonjs/xml/xpathBrowser.js.map +0 -1
- package/commonjs/xml/xpathNode.js.map +0 -1
- package/modules/xml/xlsx-xpath.js.map +0 -1
- package/modules/xml/xpathBrowser.js.map +0 -1
- package/modules/xml/xpathNode.js.map +0 -1
package/modules/xml/xml.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DOMParser } from '@xmldom/xmldom';
|
|
2
2
|
export default {
|
|
3
3
|
createDocument: function createDocument(content) {
|
|
4
|
-
return new
|
|
4
|
+
return new DOMParser().parseFromString(content);
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=xml.js.map
|
package/modules/xml/xml.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.js","names":["
|
|
1
|
+
{"version":3,"file":"xml.js","names":["DOMParser","createDocument","content","parseFromString"],"sources":["../../source/xml/xml.js"],"sourcesContent":["import { DOMParser } from '@xmldom/xmldom'\r\n\r\nexport default {\r\n\tcreateDocument(content) {\r\n\t\treturn new DOMParser().parseFromString(content)\r\n\t}\r\n}"],"mappings":"AAAA,SAASA,SAAT,QAA0B,gBAA1B;AAEA,eAAe;EACdC,cADc,0BACCC,OADD,EACU;IACvB,OAAO,IAAIF,SAAJ,GAAgBG,eAAhB,CAAgCD,OAAhC,CAAP;EACA;AAHa,CAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xlsx-xpath.js","names":["xpath","namespaces","a","r","rr","getCells","document","getMergedCells","getCellValue","node","getCellInlineStringValue","textContent","getDimensions","dimensions","getBaseStyles","getCellStyles","getNumberFormats","getSharedStrings","map","string","_","join","getWorkbookProperties","getRelationships","getSheets"],"sources":["../../../source/xml/xpath/xlsx-xpath.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nimport xpath from './xpathNode'\r\n\r\nconst namespaces = {\r\n a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n // This one seems to be for `r:id` attributes on `<sheet>`s.\r\n r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n // This one seems to be for `<Relationships/>` file.\r\n rr: 'http://schemas.openxmlformats.org/package/2006/relationships'\r\n}\r\n\r\nexport function getCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces)\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces)\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return xpath(document, node, './a:v', namespaces)[0]\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n return xpath(document, node, './a:is/a:t', namespaces)[0].textContent\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0]\r\n if (dimensions) {\r\n return dimensions.textContent\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n return xpath(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces)\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n // The \".//a:t[not(ancestor::a:rPh)]\" selector means:\r\n // \"select all `<t/>` that are not children of `<rPh/>`\". \r\n\t// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean\r\n // `<rPh><t></t></rPh>` seems to be some \"phonetic data\" added for languages like Japanese that should be ignored.\r\n // https://github.com/doy/spreadsheet-parsexlsx/issues/72\r\n return xpath(document, null, '/a:sst/a:si', namespaces)\r\n .map(string => xpath(document, string, './/a:t[not(ancestor::a:rPh)]', namespaces)\r\n .map(_ => _.textContent).join('')\r\n )\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n return xpath(document, null, '/a:workbook/a:workbookPr', namespaces)[0]\r\n}\r\n\r\nexport function getRelationships(document) {\r\n return xpath(document, null, '/rr:Relationships/rr:Relationship', namespaces)\r\n}\r\n\r\nexport function getSheets(document) {\r\n return xpath(document, null, '/a:workbook/a:sheets/a:sheet', namespaces)\r\n}"],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,aAAlB;AAEA,IAAMC,UAAU,G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BV,QAA1B,EAAoC;EACzC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,kCAAjB,EAAqDL,UAArD,CAAZ;AACD;AAED,OAAO,SAASgB,gBAAT,CAA0BX,QAA1B,EAAoC;EAC1C;EACA;EACA;EAEC;EACA;EACD;EACC;EACA;EACA,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,aAAjB,EAAgCL,UAAhC,CAAL,CACJiB,GADI,CACA,UAAAC,MAAM;IAAA,OAAInB,KAAK,CAACM,QAAD,EAAWa,MAAX,EAAmB,8BAAnB,EAAmDlB,UAAnD,CAAL,CACViB,GADU,CACN,UAAAE,CAAC;MAAA,OAAIA,CAAC,CAACT,WAAN;IAAA,CADK,EACcU,IADd,CACmB,EADnB,CAAJ;EAAA,CADN,CAAP;AAID;AAED,OAAO,SAASC,qBAAT,CAA+BhB,QAA/B,EAAyC;EAC9C,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,0BAAjB,EAA6CL,UAA7C,CAAL,CAA8D,CAA9D,CAAP;AACD;AAED,OAAO,SAASsB,gBAAT,CAA0BjB,QAA1B,EAAoC;EACzC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,mCAAjB,EAAsDL,UAAtD,CAAZ;AACD;AAED,OAAO,SAASuB,SAAT,CAAmBlB,QAAnB,EAA6B;EAClC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,8BAAjB,EAAiDL,UAAjD,CAAZ;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xpathBrowser.js","names":["xpath","document","node","path","namespaces","nodes","evaluate","prefix","XPathResult","ANY_TYPE","results","result","iterateNext","push"],"sources":["../../../source/xml/xpath/xpathBrowser.js"],"sourcesContent":["// This file is no longer used.\r\n\r\n// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nexport default function xpath(document, node, path, namespaces = {}) {\r\n\tconst nodes = document.evaluate(\r\n\t\tpath,\r\n\t\tnode || document,\r\n\t\tprefix => namespaces[prefix],\r\n\t\tXPathResult.ANY_TYPE,\r\n\t\tnull\r\n\t)\r\n\t// Convert iterator to an array.\r\n\tconst results = []\r\n\tlet result = nodes.iterateNext()\r\n\twhile (result) {\r\n\t\tresults.push(result)\r\n\t\tresult = nodes.iterateNext()\r\n\t}\r\n\treturn results\r\n}"],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,KAAT,CAAeC,QAAf,EAAyBC,IAAzB,EAA+BC,IAA/B,EAAsD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;EACpE,IAAMC,KAAK,GAAGJ,QAAQ,CAACK,QAAT,CACbH,IADa,EAEbD,IAAI,IAAID,QAFK,EAGb,UAAAM,MAAM;IAAA,OAAIH,UAAU,CAACG,MAAD,CAAd;EAAA,CAHO,EAIbC,WAAW,CAACC,QAJC,EAKb,IALa,CAAd,CADoE,CAQpE;;EACA,IAAMC,OAAO,GAAG,EAAhB;EACA,IAAIC,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAb;;EACA,OAAOD,MAAP,EAAe;IACdD,OAAO,CAACG,IAAR,CAAaF,MAAb;IACAA,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAT;EACA;;EACD,OAAOF,OAAP;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xpathNode.js","names":["xpath","document","node","path","namespaces","select","useNamespaces"],"sources":["../../../source/xml/xpath/xpathNode.js"],"sourcesContent":["// This file is no longer used.\r\n\r\nimport xpath from 'xpath'\r\n\r\nexport default function(document, node, path, namespaces = {}) {\r\n\tconst select = xpath.useNamespaces(namespaces)\r\n\treturn select(path, node || document)\r\n}"],"mappings":"AAAA;AAEA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,eAAe,UAASC,QAAT,EAAmBC,IAAnB,EAAyBC,IAAzB,EAAgD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;EAC9D,IAAMC,MAAM,GAAGL,KAAK,CAACM,aAAN,CAAoBF,UAApB,CAAf;EACA,OAAOC,MAAM,CAACF,IAAD,EAAOD,IAAI,IAAID,QAAf,CAAb;AACA"}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export type Schema = Record<string, SchemaEntry>
|
|
|
43
43
|
|
|
44
44
|
export interface Error {
|
|
45
45
|
error: string;
|
|
46
|
+
reason?: string;
|
|
46
47
|
row: number;
|
|
47
48
|
column: string;
|
|
48
49
|
value?: any;
|
|
@@ -57,10 +58,14 @@ export interface ParsedObjectsResult<T extends object> {
|
|
|
57
58
|
errors: Error[];
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
interface ParseCommonOptions {
|
|
62
|
+
sheet?: number | string;
|
|
63
|
+
trim?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ParseWithSchemaOptions<T extends object> extends ParseCommonOptions {
|
|
61
67
|
schema: Schema;
|
|
62
68
|
transformData?: (rows: Row[]) => Row[];
|
|
63
|
-
sheet?: number | string;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
type MapProperty = string;
|
|
@@ -69,12 +74,12 @@ type MapObject = {
|
|
|
69
74
|
};
|
|
70
75
|
type Map = MapObject;
|
|
71
76
|
|
|
72
|
-
export interface ParseWithMapOptions {
|
|
77
|
+
export interface ParseWithMapOptions extends ParseCommonOptions {
|
|
73
78
|
map: Map;
|
|
74
79
|
transformData?: (rows: Row[]) => Row[];
|
|
75
|
-
|
|
80
|
+
dateFormat?: string;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
export interface ParseWithoutSchemaOptions {
|
|
79
|
-
|
|
83
|
+
export interface ParseWithoutSchemaOptions extends ParseCommonOptions {
|
|
84
|
+
dateFormat?: string;
|
|
80
85
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx-xpath.js","names":["namespaces","a","r","rr","getCells","document","xpath","getMergedCells","getCellValue","node","getCellInlineStringValue","textContent","getDimensions","dimensions","getBaseStyles","getCellStyles","getNumberFormats","getSharedStrings","map","string","_","join","getWorkbookProperties","getRelationships","getSheets"],"sources":["../../source/xml/xlsx-xpath.js"],"sourcesContent":["// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nimport xpath from './xpathNode'\r\n\r\nconst namespaces = {\r\n a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n // This one seems to be for `r:id` attributes on `<sheet>`s.\r\n r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n // This one seems to be for `<Relationships/>` file.\r\n rr: 'http://schemas.openxmlformats.org/package/2006/relationships'\r\n}\r\n\r\nexport function getCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces)\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces)\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return xpath(document, node, './a:v', namespaces)[0]\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n return xpath(document, node, './a:is/a:t', namespaces)[0].textContent\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0]\r\n if (dimensions) {\r\n return dimensions.textContent\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n return xpath(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces)\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n // The \".//a:t[not(ancestor::a:rPh)]\" selector means:\r\n // \"select all `<t/>` that are not children of `<rPh/>`\". \r\n\t// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean\r\n // `<rPh><t></t></rPh>` seems to be some \"phonetic data\" added for languages like Japanese that should be ignored.\r\n // https://github.com/doy/spreadsheet-parsexlsx/issues/72\r\n return xpath(document, null, '/a:sst/a:si', namespaces)\r\n .map(string => xpath(document, string, './/a:t[not(ancestor::a:rPh)]', namespaces)\r\n .map(_ => _.textContent).join('')\r\n )\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n return xpath(document, null, '/a:workbook/a:workbookPr', namespaces)[0]\r\n}\r\n\r\nexport function getRelationships(document) {\r\n return xpath(document, null, '/rr:Relationships/rr:Relationship', namespaces)\r\n}\r\n\r\nexport function getSheets(document) {\r\n return xpath(document, null, '/a:workbook/a:sheets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,SAASe,aAAT,CAAuBV,QAAvB,EAAiC;EACtC,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,8BAAtB,EAAsDL,UAAtD,CAAP;AACD;;AAEM,SAASgB,gBAAT,CAA0BX,QAA1B,EAAoC;EACzC,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,kCAAtB,EAA0DL,UAA1D,CAAP;AACD;;AAEM,SAASiB,gBAAT,CAA0BZ,QAA1B,EAAoC;EAC1C;EACA;EACA;EAEC;EACA;EACD;EACC;EACA;EACA,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,aAAtB,EAAqCL,UAArC,EACJkB,GADI,CACA,UAAAC,MAAM;IAAA,OAAI,IAAAb,qBAAA,EAAMD,QAAN,EAAgBc,MAAhB,EAAwB,8BAAxB,EAAwDnB,UAAxD,EACVkB,GADU,CACN,UAAAE,CAAC;MAAA,OAAIA,CAAC,CAACT,WAAN;IAAA,CADK,EACcU,IADd,CACmB,EADnB,CAAJ;EAAA,CADN,CAAP;AAID;;AAEM,SAASC,qBAAT,CAA+BjB,QAA/B,EAAyC;EAC9C,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,0BAAtB,EAAkDL,UAAlD,EAA8D,CAA9D,CAAP;AACD;;AAEM,SAASuB,gBAAT,CAA0BlB,QAA1B,EAAoC;EACzC,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,mCAAtB,EAA2DL,UAA3D,CAAP;AACD;;AAEM,SAASwB,SAAT,CAAmBnB,QAAnB,EAA6B;EAClC,OAAO,IAAAC,qBAAA,EAAMD,QAAN,EAAgB,IAAhB,EAAsB,8BAAtB,EAAsDL,UAAtD,CAAP;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xpathBrowser.js","names":["xpath","document","node","path","namespaces","nodes","evaluate","prefix","XPathResult","ANY_TYPE","results","result","iterateNext","push"],"sources":["../../source/xml/xpathBrowser.js"],"sourcesContent":["// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nexport default function xpath(document, node, path, namespaces = {}) {\r\n\tconst nodes = document.evaluate(\r\n\t\tpath,\r\n\t\tnode || document,\r\n\t\tprefix => namespaces[prefix],\r\n\t\tXPathResult.ANY_TYPE,\r\n\t\tnull\r\n\t)\r\n\t// Convert iterator to an array.\r\n\tconst results = []\r\n\tlet result = nodes.iterateNext()\r\n\twhile (result) {\r\n\t\tresults.push(result)\r\n\t\tresult = nodes.iterateNext()\r\n\t}\r\n\treturn results\r\n}"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,KAAT,CAAeC,QAAf,EAAyBC,IAAzB,EAA+BC,IAA/B,EAAsD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;EACpE,IAAMC,KAAK,GAAGJ,QAAQ,CAACK,QAAT,CACbH,IADa,EAEbD,IAAI,IAAID,QAFK,EAGb,UAAAM,MAAM;IAAA,OAAIH,UAAU,CAACG,MAAD,CAAd;EAAA,CAHO,EAIbC,WAAW,CAACC,QAJC,EAKb,IALa,CAAd,CADoE,CAQpE;;EACA,IAAMC,OAAO,GAAG,EAAhB;EACA,IAAIC,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAb;;EACA,OAAOD,MAAP,EAAe;IACdD,OAAO,CAACG,IAAR,CAAaF,MAAb;IACAA,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAT;EACA;;EACD,OAAOF,OAAP;AACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xpathNode.js","names":["document","node","path","namespaces","select","xpath","useNamespaces"],"sources":["../../source/xml/xpathNode.js"],"sourcesContent":["// The `xpath` dependency is about as large as `jszip`.\r\nimport xpath from 'xpath'\r\n\r\nexport default function(document, node, path, namespaces = {}) {\r\n\tconst select = xpath.useNamespaces(namespaces)\r\n\treturn select(path, node || document)\r\n}"],"mappings":";;;;;;;AACA;;;;AADA;AAGe,kBAASA,QAAT,EAAmBC,IAAnB,EAAyBC,IAAzB,EAAgD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;;EAC9D,IAAMC,MAAM,GAAGC,iBAAA,CAAMC,aAAN,CAAoBH,UAApB,CAAf;;EACA,OAAOC,MAAM,CAACF,IAAD,EAAOD,IAAI,IAAID,QAAf,CAAb;AACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xlsx-xpath.js","names":["xpath","namespaces","a","r","rr","getCells","document","getMergedCells","getCellValue","node","getCellInlineStringValue","textContent","getDimensions","dimensions","getBaseStyles","getCellStyles","getNumberFormats","getSharedStrings","map","string","_","join","getWorkbookProperties","getRelationships","getSheets"],"sources":["../../source/xml/xlsx-xpath.js"],"sourcesContent":["// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nimport xpath from './xpathNode'\r\n\r\nconst namespaces = {\r\n a: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n // This one seems to be for `r:id` attributes on `<sheet>`s.\r\n r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n // This one seems to be for `<Relationships/>` file.\r\n rr: 'http://schemas.openxmlformats.org/package/2006/relationships'\r\n}\r\n\r\nexport function getCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:sheetData/a:row/a:c', namespaces)\r\n}\r\n\r\nexport function getMergedCells(document) {\r\n return xpath(document, null, '/a:worksheet/a:mergedCells/a:mergedCell/@ref', namespaces)\r\n}\r\n\r\nexport function getCellValue(document, node) {\r\n return xpath(document, node, './a:v', namespaces)[0]\r\n}\r\n\r\nexport function getCellInlineStringValue(document, node) {\r\n return xpath(document, node, './a:is/a:t', namespaces)[0].textContent\r\n}\r\n\r\nexport function getDimensions(document) {\r\n const dimensions = xpath(document, null, '/a:worksheet/a:dimension/@ref', namespaces)[0]\r\n if (dimensions) {\r\n return dimensions.textContent\r\n }\r\n}\r\n\r\nexport function getBaseStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellStyleXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getCellStyles(document) {\r\n return xpath(document, null, '/a:styleSheet/a:cellXfs/a:xf', namespaces)\r\n}\r\n\r\nexport function getNumberFormats(document) {\r\n return xpath(document, null, '/a:styleSheet/a:numFmts/a:numFmt', namespaces)\r\n}\r\n\r\nexport function getSharedStrings(document) {\r\n\t// An `<si/>` element can contain a `<t/>` (simplest case) or a set of `<r/>` (\"rich formatting\") elements having `<t/>`.\r\n\t// https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sharedstringitem?redirectedfrom=MSDN&view=openxml-2.8.1\r\n\t// http://www.datypic.com/sc/ooxml/e-ssml_si-1.html\r\n\r\n // The \".//a:t[not(ancestor::a:rPh)]\" selector means:\r\n // \"select all `<t/>` that are not children of `<rPh/>`\". \r\n\t// https://stackoverflow.com/questions/42773772/xpath-span-what-does-the-dot-mean\r\n // `<rPh><t></t></rPh>` seems to be some \"phonetic data\" added for languages like Japanese that should be ignored.\r\n // https://github.com/doy/spreadsheet-parsexlsx/issues/72\r\n return xpath(document, null, '/a:sst/a:si', namespaces)\r\n .map(string => xpath(document, string, './/a:t[not(ancestor::a:rPh)]', namespaces)\r\n .map(_ => _.textContent).join('')\r\n )\r\n}\r\n\r\nexport function getWorkbookProperties(document) {\r\n return xpath(document, null, '/a:workbook/a:workbookPr', namespaces)[0]\r\n}\r\n\r\nexport function getRelationships(document) {\r\n return xpath(document, null, '/rr:Relationships/rr:Relationship', namespaces)\r\n}\r\n\r\nexport function getSheets(document) {\r\n return xpath(document, null, '/a:workbook/a:sheets/a:sheet', namespaces)\r\n}"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,aAAlB;AAEA,IAAMC,UAAU,GAAG;EACjBC,CAAC,EAAE,2DADc;EAEjB;EACAC,CAAC,EAAE,qEAHc;EAIjB;EACAC,EAAE,EAAE;AALa,CAAnB;AAQA,OAAO,SAASC,QAAT,CAAkBC,QAAlB,EAA4B;EACjC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,oCAAjB,EAAuDL,UAAvD,CAAZ;AACD;AAED,OAAO,SAASM,cAAT,CAAwBD,QAAxB,EAAkC;EACvC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,8CAAjB,EAAiEL,UAAjE,CAAZ;AACD;AAED,OAAO,SAASO,YAAT,CAAsBF,QAAtB,EAAgCG,IAAhC,EAAsC;EAC3C,OAAOT,KAAK,CAACM,QAAD,EAAWG,IAAX,EAAiB,OAAjB,EAA0BR,UAA1B,CAAL,CAA2C,CAA3C,CAAP;AACD;AAED,OAAO,SAASS,wBAAT,CAAkCJ,QAAlC,EAA4CG,IAA5C,EAAkD;EACvD,OAAOT,KAAK,CAACM,QAAD,EAAWG,IAAX,EAAiB,YAAjB,EAA+BR,UAA/B,CAAL,CAAgD,CAAhD,EAAmDU,WAA1D;AACD;AAED,OAAO,SAASC,aAAT,CAA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,EAAW,IAAX,EAAiB,mCAAjB,EAAsDL,UAAtD,CAAZ;AACD;AAED,OAAO,SAASuB,SAAT,CAAmBlB,QAAnB,EAA6B;EAClC,OAAON,KAAK,CAACM,QAAD,EAAW,IAAX,EAAiB,8BAAjB,EAAiDL,UAAjD,CAAZ;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xpathBrowser.js","names":["xpath","document","node","path","namespaces","nodes","evaluate","prefix","XPathResult","ANY_TYPE","results","result","iterateNext","push"],"sources":["../../source/xml/xpathBrowser.js"],"sourcesContent":["// Turns out IE11 doesn't support XPath, so not using `./xpathBrowser` for browsers.\r\n// https://github.com/catamphetamine/read-excel-file/issues/26\r\n// The inclusion of `xpath` package in `./xpathNode`\r\n// increases the bundle size by about 100 kilobytes.\r\n// IE11 is a wide-spread browser and it's unlikely that\r\n// anyone would ignore it for now.\r\n// There could be a separate export `read-excel-file/ie11`\r\n// for using `./xpathNode` instead of `./xpathBrowser`\r\n// but this library has been migrated to not using `xpath` anyway.\r\n// This code is just alternative/historical now, it seems.\r\nexport default function xpath(document, node, path, namespaces = {}) {\r\n\tconst nodes = document.evaluate(\r\n\t\tpath,\r\n\t\tnode || document,\r\n\t\tprefix => namespaces[prefix],\r\n\t\tXPathResult.ANY_TYPE,\r\n\t\tnull\r\n\t)\r\n\t// Convert iterator to an array.\r\n\tconst results = []\r\n\tlet result = nodes.iterateNext()\r\n\twhile (result) {\r\n\t\tresults.push(result)\r\n\t\tresult = nodes.iterateNext()\r\n\t}\r\n\treturn results\r\n}"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,KAAT,CAAeC,QAAf,EAAyBC,IAAzB,EAA+BC,IAA/B,EAAsD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;EACpE,IAAMC,KAAK,GAAGJ,QAAQ,CAACK,QAAT,CACbH,IADa,EAEbD,IAAI,IAAID,QAFK,EAGb,UAAAM,MAAM;IAAA,OAAIH,UAAU,CAACG,MAAD,CAAd;EAAA,CAHO,EAIbC,WAAW,CAACC,QAJC,EAKb,IALa,CAAd,CADoE,CAQpE;;EACA,IAAMC,OAAO,GAAG,EAAhB;EACA,IAAIC,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAb;;EACA,OAAOD,MAAP,EAAe;IACdD,OAAO,CAACG,IAAR,CAAaF,MAAb;IACAA,MAAM,GAAGN,KAAK,CAACO,WAAN,EAAT;EACA;;EACD,OAAOF,OAAP;AACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xpathNode.js","names":["xpath","document","node","path","namespaces","select","useNamespaces"],"sources":["../../source/xml/xpathNode.js"],"sourcesContent":["// The `xpath` dependency is about as large as `jszip`.\r\nimport xpath from 'xpath'\r\n\r\nexport default function(document, node, path, namespaces = {}) {\r\n\tconst select = xpath.useNamespaces(namespaces)\r\n\treturn select(path, node || document)\r\n}"],"mappings":"AAAA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,eAAe,UAASC,QAAT,EAAmBC,IAAnB,EAAyBC,IAAzB,EAAgD;EAAA,IAAjBC,UAAiB,uEAAJ,EAAI;EAC9D,IAAMC,MAAM,GAAGL,KAAK,CAACM,aAAN,CAAoBF,UAApB,CAAf;EACA,OAAOC,MAAM,CAACF,IAAD,EAAOD,IAAI,IAAID,QAAf,CAAb;AACA"}
|