read-excel-file 5.7.1 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +45 -19
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/read/coordinates.js +7 -10
- package/commonjs/read/coordinates.js.map +1 -1
- package/commonjs/read/dropEmptyColumns.js +6 -18
- package/commonjs/read/dropEmptyColumns.js.map +1 -1
- package/commonjs/read/dropEmptyColumns.test.js.map +1 -1
- package/commonjs/read/dropEmptyRows.js +11 -23
- package/commonjs/read/dropEmptyRows.js.map +1 -1
- package/commonjs/read/dropEmptyRows.test.js.map +1 -1
- package/commonjs/read/getData.js +31 -43
- package/commonjs/read/getData.js.map +1 -1
- package/commonjs/read/isDateTimestamp.js +51 -40
- package/commonjs/read/isDateTimestamp.js.map +1 -1
- package/commonjs/read/parseCell.js +3 -10
- package/commonjs/read/parseCell.js.map +1 -1
- package/commonjs/read/parseCellValue.js +28 -59
- package/commonjs/read/parseCellValue.js.map +1 -1
- package/commonjs/read/parseCells.js +3 -7
- package/commonjs/read/parseCells.js.map +1 -1
- package/commonjs/read/parseDate.js +5 -5
- package/commonjs/read/parseDate.js.map +1 -1
- package/commonjs/read/parseDate.test.js.map +1 -1
- package/commonjs/read/parseDimensions.js +6 -18
- package/commonjs/read/parseDimensions.js.map +1 -1
- package/commonjs/read/parseFilePaths.js +4 -11
- package/commonjs/read/parseFilePaths.js.map +1 -1
- package/commonjs/read/parseProperties.js +6 -8
- package/commonjs/read/parseProperties.js.map +1 -1
- package/commonjs/read/parseSharedStrings.js +0 -3
- package/commonjs/read/parseSharedStrings.js.map +1 -1
- package/commonjs/read/parseSheet.js +3 -7
- package/commonjs/read/parseSheet.js.map +1 -1
- package/commonjs/read/parseStyles.js +13 -21
- package/commonjs/read/parseStyles.js.map +1 -1
- package/commonjs/read/readSheetNamesBrowser.js +0 -3
- package/commonjs/read/readSheetNamesBrowser.js.map +1 -1
- package/commonjs/read/readSheetNamesNode.js +0 -3
- package/commonjs/read/readSheetNamesNode.js.map +1 -1
- package/commonjs/read/readSheetNamesNode.test.js.map +1 -1
- package/commonjs/read/readSheetNamesWebWorker.js +0 -3
- package/commonjs/read/readSheetNamesWebWorker.js.map +1 -1
- package/commonjs/read/readXlsx.js +34 -42
- package/commonjs/read/readXlsx.js.map +1 -1
- package/commonjs/read/readXlsxFileBrowser.js +0 -5
- package/commonjs/read/readXlsxFileBrowser.js.map +1 -1
- package/commonjs/read/readXlsxFileContents.js +12 -22
- package/commonjs/read/readXlsxFileContents.js.map +1 -1
- package/commonjs/read/readXlsxFileNode.js +0 -5
- package/commonjs/read/readXlsxFileNode.js.map +1 -1
- package/commonjs/read/readXlsxFileNode.test.js.map +1 -1
- package/commonjs/read/readXlsxFileWebWorker.js +0 -5
- package/commonjs/read/readXlsxFileWebWorker.js.map +1 -1
- package/commonjs/read/schema/convertMapToSchema.js +1 -8
- package/commonjs/read/schema/convertMapToSchema.js.map +1 -1
- package/commonjs/read/schema/convertMapToSchema.test.js.map +1 -1
- package/commonjs/read/schema/convertToJson.js +143 -142
- package/commonjs/read/schema/convertToJson.js.map +1 -1
- package/commonjs/read/schema/convertToJson.legacy.js +60 -0
- package/commonjs/read/schema/convertToJson.legacy.js.map +1 -0
- package/commonjs/read/schema/convertToJson.legacy.test.js.map +1 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.js +25 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.js.map +1 -0
- package/commonjs/read/schema/convertToJson.spreadsheet.test.js.map +1 -0
- package/commonjs/read/schema/convertToJson.test.js.map +1 -1
- package/commonjs/read/unpackXlsxFileBrowser.js +3 -9
- package/commonjs/read/unpackXlsxFileBrowser.js.map +1 -1
- package/commonjs/read/unpackXlsxFileNode.js +9 -15
- package/commonjs/read/unpackXlsxFileNode.js.map +1 -1
- package/commonjs/types/Boolean.js +0 -4
- package/commonjs/types/Boolean.js.map +1 -1
- package/commonjs/types/Date.js +0 -12
- package/commonjs/types/Date.js.map +1 -1
- package/commonjs/types/Email.js +0 -7
- package/commonjs/types/Email.js.map +1 -1
- package/commonjs/types/Email.test.js.map +1 -1
- package/commonjs/types/Integer.js +0 -7
- package/commonjs/types/Integer.js.map +1 -1
- package/commonjs/types/Integer.test.js.map +1 -1
- package/commonjs/types/InvalidError.js +8 -28
- package/commonjs/types/InvalidError.js.map +1 -1
- package/commonjs/types/Number.js +2 -10
- package/commonjs/types/Number.js.map +1 -1
- package/commonjs/types/String.js +4 -11
- package/commonjs/types/String.js.map +1 -1
- package/commonjs/types/URL.js +5 -8
- package/commonjs/types/URL.js.map +1 -1
- package/commonjs/types/URL.test.js.map +1 -1
- package/commonjs/xml/dom.js +6 -25
- package/commonjs/xml/dom.js.map +1 -1
- package/commonjs/xml/xlsx.js +1 -24
- package/commonjs/xml/xlsx.js.map +1 -1
- package/commonjs/xml/xml.js +1 -4
- package/commonjs/xml/xml.js.map +1 -1
- package/commonjs/xml/xmlBrowser.js +1 -2
- package/commonjs/xml/xmlBrowser.js.map +1 -1
- package/commonjs/xml/xpath/xlsx-xpath.js +3 -16
- package/commonjs/xml/xpath/xlsx-xpath.js.map +1 -1
- package/commonjs/xml/xpath/xpathBrowser.js +3 -5
- package/commonjs/xml/xpath/xpathBrowser.js.map +1 -1
- package/commonjs/xml/xpath/xpathNode.js +1 -5
- package/commonjs/xml/xpath/xpathNode.js.map +1 -1
- package/map/index.cjs +2 -0
- package/map/index.cjs.js +7 -0
- package/map/index.d.ts +11 -0
- package/map/index.js +1 -0
- package/map/package.json +17 -0
- package/modules/read/coordinates.js +7 -8
- package/modules/read/coordinates.js.map +1 -1
- package/modules/read/dropEmptyColumns.js +6 -17
- package/modules/read/dropEmptyColumns.js.map +1 -1
- package/modules/read/dropEmptyColumns.test.js.map +1 -1
- package/modules/read/dropEmptyRows.js +11 -22
- package/modules/read/dropEmptyRows.js.map +1 -1
- package/modules/read/dropEmptyRows.test.js.map +1 -1
- package/modules/read/getData.js +31 -39
- package/modules/read/getData.js.map +1 -1
- package/modules/read/isDateTimestamp.js +52 -39
- package/modules/read/isDateTimestamp.js.map +1 -1
- package/modules/read/parseCell.js +6 -6
- package/modules/read/parseCell.js.map +1 -1
- package/modules/read/parseCellValue.js +30 -55
- package/modules/read/parseCellValue.js.map +1 -1
- package/modules/read/parseCells.js +3 -3
- package/modules/read/parseCells.js.map +1 -1
- package/modules/read/parseDate.js +5 -4
- package/modules/read/parseDate.js.map +1 -1
- package/modules/read/parseDate.test.js.map +1 -1
- package/modules/read/parseDimensions.js +9 -17
- package/modules/read/parseDimensions.js.map +1 -1
- package/modules/read/parseFilePaths.js +5 -10
- package/modules/read/parseFilePaths.js.map +1 -1
- package/modules/read/parseProperties.js +8 -7
- package/modules/read/parseProperties.js.map +1 -1
- package/modules/read/parseSharedStrings.js +0 -1
- package/modules/read/parseSharedStrings.js.map +1 -1
- package/modules/read/parseSheet.js +3 -2
- package/modules/read/parseSheet.js.map +1 -1
- package/modules/read/parseStyles.js +16 -21
- package/modules/read/parseStyles.js.map +1 -1
- package/modules/read/readSheetNamesBrowser.js +1 -1
- package/modules/read/readSheetNamesBrowser.js.map +1 -1
- package/modules/read/readSheetNamesNode.js +1 -1
- package/modules/read/readSheetNamesNode.js.map +1 -1
- package/modules/read/readSheetNamesNode.test.js.map +1 -1
- package/modules/read/readSheetNamesWebWorker.js +1 -1
- package/modules/read/readSheetNamesWebWorker.js.map +1 -1
- package/modules/read/readXlsx.js +37 -35
- package/modules/read/readXlsx.js.map +1 -1
- package/modules/read/readXlsxFileBrowser.js +1 -1
- package/modules/read/readXlsxFileBrowser.js.map +1 -1
- package/modules/read/readXlsxFileContents.js +12 -17
- package/modules/read/readXlsxFileContents.js.map +1 -1
- package/modules/read/readXlsxFileNode.js +1 -1
- package/modules/read/readXlsxFileNode.js.map +1 -1
- package/modules/read/readXlsxFileNode.test.js.map +1 -1
- package/modules/read/readXlsxFileWebWorker.js +1 -1
- package/modules/read/readXlsxFileWebWorker.js.map +1 -1
- package/modules/read/schema/convertMapToSchema.js +1 -7
- package/modules/read/schema/convertMapToSchema.js.map +1 -1
- package/modules/read/schema/convertMapToSchema.test.js.map +1 -1
- package/modules/read/schema/convertToJson.js +143 -133
- package/modules/read/schema/convertToJson.js.map +1 -1
- package/modules/read/schema/convertToJson.legacy.js +53 -0
- package/modules/read/schema/convertToJson.legacy.js.map +1 -0
- package/modules/read/schema/convertToJson.legacy.test.js.map +1 -0
- package/modules/read/schema/convertToJson.spreadsheet.js +19 -0
- package/modules/read/schema/convertToJson.spreadsheet.js.map +1 -0
- package/modules/read/schema/convertToJson.spreadsheet.test.js.map +1 -0
- package/modules/read/schema/convertToJson.test.js.map +1 -1
- package/modules/read/unpackXlsxFileBrowser.js +4 -7
- package/modules/read/unpackXlsxFileBrowser.js.map +1 -1
- package/modules/read/unpackXlsxFileNode.js +9 -7
- package/modules/read/unpackXlsxFileNode.js.map +1 -1
- package/modules/types/Boolean.js +0 -1
- package/modules/types/Boolean.js.map +1 -1
- package/modules/types/Date.js +0 -8
- package/modules/types/Date.js.map +1 -1
- package/modules/types/Email.js +0 -2
- package/modules/types/Email.js.map +1 -1
- package/modules/types/Email.test.js.map +1 -1
- package/modules/types/Integer.js +0 -2
- package/modules/types/Integer.js.map +1 -1
- package/modules/types/Integer.test.js.map +1 -1
- package/modules/types/InvalidError.js +7 -25
- package/modules/types/InvalidError.js.map +1 -1
- package/modules/types/Number.js +2 -7
- package/modules/types/Number.js.map +1 -1
- package/modules/types/String.js +4 -8
- package/modules/types/String.js.map +1 -1
- package/modules/types/URL.js +5 -4
- package/modules/types/URL.js.map +1 -1
- package/modules/types/URL.test.js.map +1 -1
- package/modules/xml/dom.js +6 -18
- package/modules/xml/dom.js.map +1 -1
- package/modules/xml/xlsx.js +4 -13
- package/modules/xml/xlsx.js.map +1 -1
- package/modules/xml/xml.js.map +1 -1
- package/modules/xml/xmlBrowser.js.map +1 -1
- package/modules/xml/xpath/xlsx-xpath.js +2 -1
- package/modules/xml/xpath/xlsx-xpath.js.map +1 -1
- package/modules/xml/xpath/xpathBrowser.js +3 -4
- package/modules/xml/xpath/xpathBrowser.js.map +1 -1
- package/modules/xml/xpath/xpathNode.js +1 -0
- package/modules/xml/xpath/xpathNode.js.map +1 -1
- package/package.json +6 -1
- package/schema/index.cjs +2 -2
- package/schema/index.cjs.js +2 -2
- package/schema/index.d.ts +7 -2
- package/schema/index.js +1 -1
- package/types.d.ts +25 -2
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = isDateTimestamp;
|
|
7
|
-
|
|
8
7
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
|
|
10
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
-
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
10
|
// XLSX does have "d" type for dates, but it's not commonly used.
|
|
15
11
|
// Instead, it prefers using "n" type for storing dates as timestamps.
|
|
16
12
|
//
|
|
@@ -24,28 +20,30 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
24
20
|
function isDateTimestamp(styleId, styles, options) {
|
|
25
21
|
if (styleId) {
|
|
26
22
|
var style = styles[styleId];
|
|
27
|
-
|
|
28
23
|
if (!style) {
|
|
29
24
|
throw new Error("Cell style not found: ".concat(styleId));
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
if (!style.numberFormat) {
|
|
33
27
|
return false;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||
|
|
29
|
+
if (
|
|
30
|
+
// Whether it's a "number format" that's conventionally used for storing date timestamps.
|
|
31
|
+
BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||
|
|
32
|
+
// Whether it's a "number format" that uses a "formatting template"
|
|
38
33
|
// that the developer is certain is a date formatting template.
|
|
39
|
-
options.dateFormat && style.numberFormat.template === options.dateFormat ||
|
|
34
|
+
options.dateFormat && style.numberFormat.template === options.dateFormat ||
|
|
35
|
+
// Whether the "smart formatting template" feature is not disabled
|
|
40
36
|
// and it has detected that it's a date formatting template by looking at it.
|
|
41
37
|
options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template)) {
|
|
42
38
|
return true;
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
|
-
}
|
|
41
|
+
}
|
|
46
42
|
|
|
43
|
+
// https://hexdocs.pm/xlsxir/number_styles.html
|
|
44
|
+
var BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14, 15, 16, 17, 18, 19, 20, 21, 22, 27, 30, 36, 45, 46, 47, 50, 57];
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
// On some date formats, there's an "[$-414]" prefix.
|
|
49
47
|
// I don't have any idea what that is.
|
|
50
48
|
//
|
|
51
49
|
// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value
|
|
@@ -55,58 +53,71 @@ var BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14, 15, 16, 17, 18, 19, 20, 21, 22, 27, 3
|
|
|
55
53
|
// * 27 (built-in format) "[$-404]e/m/d"
|
|
56
54
|
// * 164 (custom format) "[$-414]mmmm\ yyyy;@"
|
|
57
55
|
//
|
|
56
|
+
var DATE_FORMAT_WEIRD_PREFIX = /^\[\$-414\]/;
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
// On some date formats, there's an ";@" postfix.
|
|
60
59
|
// I don't have any idea what that is.
|
|
61
60
|
// Examples:
|
|
62
61
|
//
|
|
63
62
|
// * 164 (custom format) "m/d/yyyy;@"
|
|
64
63
|
// * 164 (custom format) "[$-414]mmmm\ yyyy;@"
|
|
65
64
|
//
|
|
66
|
-
|
|
67
65
|
var DATE_FORMAT_WEIRD_POSTFIX = /;@$/;
|
|
68
|
-
|
|
69
66
|
function isDateTemplate(template) {
|
|
70
67
|
// Date format tokens could be in upper case or in lower case.
|
|
71
68
|
// There seems to be no single standard.
|
|
72
69
|
// So lowercase the template first.
|
|
73
|
-
template = template.toLowerCase();
|
|
74
|
-
// I don't have any idea what that is. Trim it.
|
|
70
|
+
template = template.toLowerCase();
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
// On some date formats, there's an "[$-414]" prefix.
|
|
77
73
|
// I don't have any idea what that is. Trim it.
|
|
74
|
+
template = template.replace(DATE_FORMAT_WEIRD_PREFIX, '');
|
|
78
75
|
|
|
76
|
+
// On some date formats, there's an ";@" postfix.
|
|
77
|
+
// I don't have any idea what that is. Trim it.
|
|
79
78
|
template = template.replace(DATE_FORMAT_WEIRD_POSTFIX, '');
|
|
80
79
|
var tokens = template.split(/\W+/);
|
|
81
|
-
|
|
82
80
|
for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
|
|
83
81
|
var token = _step.value;
|
|
84
|
-
|
|
85
82
|
if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {
|
|
86
83
|
return false;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
|
-
|
|
90
86
|
return true;
|
|
91
|
-
}
|
|
92
|
-
// There seems to be no single standard, so using lower case.
|
|
87
|
+
}
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
'
|
|
99
|
-
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
'
|
|
103
|
-
|
|
104
|
-
'
|
|
105
|
-
|
|
106
|
-
'
|
|
107
|
-
|
|
108
|
-
'
|
|
109
|
-
|
|
89
|
+
// These tokens could be in upper case or in lower case.
|
|
90
|
+
// There seems to be no single standard, so using lower case.
|
|
91
|
+
var DATE_TEMPLATE_TOKENS = [
|
|
92
|
+
// Seconds (min two digits). Example: "05".
|
|
93
|
+
'ss',
|
|
94
|
+
// Minutes (min two digits). Example: "05". Could also be "Months". Weird.
|
|
95
|
+
'mm',
|
|
96
|
+
// Hours. Example: "1".
|
|
97
|
+
'h',
|
|
98
|
+
// Hours (min two digits). Example: "01".
|
|
99
|
+
'hh',
|
|
100
|
+
// "AM" part of "AM/PM". Lowercased just in case.
|
|
101
|
+
'am',
|
|
102
|
+
// "PM" part of "AM/PM". Lowercased just in case.
|
|
103
|
+
'pm',
|
|
104
|
+
// Day. Example: "1"
|
|
105
|
+
'd',
|
|
106
|
+
// Day (min two digits). Example: "01"
|
|
107
|
+
'dd',
|
|
108
|
+
// Month (numeric). Example: "1".
|
|
109
|
+
'm',
|
|
110
|
+
// Month (numeric, min two digits). Example: "01". Could also be "Minutes". Weird.
|
|
111
|
+
'mm',
|
|
112
|
+
// Month (shortened month name). Example: "Jan".
|
|
113
|
+
'mmm',
|
|
114
|
+
// Month (full month name). Example: "January".
|
|
115
|
+
'mmmm',
|
|
116
|
+
// Two-digit year. Example: "20".
|
|
117
|
+
'yy',
|
|
118
|
+
// Full year. Example: "2020".
|
|
119
|
+
'yyyy',
|
|
120
|
+
// I don't have any idea what "e" means.
|
|
110
121
|
// It's used in "built-in" XLSX formats:
|
|
111
122
|
// * 27 '[$-404]e/m/d';
|
|
112
123
|
// * 36 '[$-404]e/m/d';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDateTimestamp.js","names":["isDateTimestamp","styleId","styles","options","style","Error","numberFormat","BUILT_IN_DATE_NUMBER_FORMAT_IDS","indexOf","Number","id","dateFormat","template","smartDateParser","isDateTemplate","DATE_FORMAT_WEIRD_PREFIX","DATE_FORMAT_WEIRD_POSTFIX","toLowerCase","replace","tokens","split","token","DATE_TEMPLATE_TOKENS"],"sources":["../../source/read/isDateTimestamp.js"],"sourcesContent":["// XLSX does have \"d\" type for dates, but it's not commonly used.\r\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n//\r\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\r\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\r\n// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\r\n//\r\n// The list of generic numeric value \"formats\":\r\n// https://xlsxwriter.readthedocs.io/format.html#format-set-num-format\r\n//\r\nexport default function isDateTimestamp(styleId, styles, options) {\r\n if (styleId) {\r\n const style = styles[styleId]\r\n if (!style) {\r\n throw new Error(`Cell style not found: ${styleId}`)\r\n }\r\n if (!style.numberFormat) {\r\n return false\r\n }\r\n if (\r\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\r\n BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||\r\n // Whether it's a \"number format\" that uses a \"formatting template\"\r\n // that the developer is certain is a date formatting template.\r\n (options.dateFormat && style.numberFormat.template === options.dateFormat) ||\r\n // Whether the \"smart formatting template\" feature is not disabled\r\n // and it has detected that it's a date formatting template by looking at it.\r\n (options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n }\r\n}\r\n\r\n// https://hexdocs.pm/xlsxir/number_styles.html\r\nconst BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]\r\n\r\n// On some date formats, there's an \"[$-414]\" prefix.\r\n// I don't have any idea what that is.\r\n//\r\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\r\n//\r\n// Examples:\r\n//\r\n// * 27 (built-in format) \"[$-404]e/m/d\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_PREFIX = /^\\[\\$-414\\]/\r\n\r\n// On some date formats, there's an \";@\" postfix.\r\n// I don't have any idea what that is.\r\n// Examples:\r\n//\r\n// * 164 (custom format) \"m/d/yyyy;@\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_POSTFIX = /;@$/\r\n\r\nfunction isDateTemplate(template) {\r\n // Date format tokens could be in upper case or in lower case.\r\n // There seems to be no single standard.\r\n // So lowercase the template first.\r\n template = template.toLowerCase()\r\n\r\n // On some date formats, there's an \"[$-414]\" prefix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_PREFIX, '')\r\n\r\n // On some date formats, there's an \";@\" postfix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_POSTFIX, '')\r\n\r\n const tokens = template.split(/\\W+/)\r\n for (const token of tokens) {\r\n if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\n// These tokens could be in upper case or in lower case.\r\n// There seems to be no single standard, so using lower case.\r\nconst DATE_TEMPLATE_TOKENS = [\r\n // Seconds (min two digits). Example: \"05\".\r\n 'ss',\r\n // Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\r\n 'mm',\r\n // Hours. Example: \"1\".\r\n 'h',\r\n // Hours (min two digits). Example: \"01\".\r\n 'hh',\r\n // \"AM\" part of \"AM/PM\". Lowercased just in case.\r\n 'am',\r\n // \"PM\" part of \"AM/PM\". Lowercased just in case.\r\n 'pm',\r\n // Day. Example: \"1\"\r\n 'd',\r\n // Day (min two digits). Example: \"01\"\r\n 'dd',\r\n // Month (numeric). Example: \"1\".\r\n 'm',\r\n // Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\r\n 'mm',\r\n // Month (shortened month name). Example: \"Jan\".\r\n 'mmm',\r\n // Month (full month name). Example: \"January\".\r\n 'mmmm',\r\n // Two-digit year. Example: \"20\".\r\n 'yy',\r\n // Full year. Example: \"2020\".\r\n 'yyyy',\r\n\r\n // I don't have any idea what \"e\" means.\r\n // It's used in \"built-in\" XLSX formats:\r\n // * 27 '[$-404]e/m/d';\r\n // * 36 '[$-404]e/m/d';\r\n // * 50 '[$-404]e/m/d';\r\n // * 57 '[$-404]e/m/d';\r\n 'e'\r\n];"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isDateTimestamp.js","names":["isDateTimestamp","styleId","styles","options","style","Error","concat","numberFormat","BUILT_IN_DATE_NUMBER_FORMAT_IDS","indexOf","Number","id","dateFormat","template","smartDateParser","isDateTemplate","DATE_FORMAT_WEIRD_PREFIX","DATE_FORMAT_WEIRD_POSTFIX","toLowerCase","replace","tokens","split","_iterator","_createForOfIteratorHelperLoose","_step","done","token","value","DATE_TEMPLATE_TOKENS"],"sources":["../../source/read/isDateTimestamp.js"],"sourcesContent":["// XLSX does have \"d\" type for dates, but it's not commonly used.\r\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n//\r\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\r\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\r\n// https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\r\n//\r\n// The list of generic numeric value \"formats\":\r\n// https://xlsxwriter.readthedocs.io/format.html#format-set-num-format\r\n//\r\nexport default function isDateTimestamp(styleId, styles, options) {\r\n if (styleId) {\r\n const style = styles[styleId]\r\n if (!style) {\r\n throw new Error(`Cell style not found: ${styleId}`)\r\n }\r\n if (!style.numberFormat) {\r\n return false\r\n }\r\n if (\r\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\r\n BUILT_IN_DATE_NUMBER_FORMAT_IDS.indexOf(Number(style.numberFormat.id)) >= 0 ||\r\n // Whether it's a \"number format\" that uses a \"formatting template\"\r\n // that the developer is certain is a date formatting template.\r\n (options.dateFormat && style.numberFormat.template === options.dateFormat) ||\r\n // Whether the \"smart formatting template\" feature is not disabled\r\n // and it has detected that it's a date formatting template by looking at it.\r\n (options.smartDateParser !== false && style.numberFormat.template && isDateTemplate(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n }\r\n}\r\n\r\n// https://hexdocs.pm/xlsxir/number_styles.html\r\nconst BUILT_IN_DATE_NUMBER_FORMAT_IDS = [14,15,16,17,18,19,20,21,22,27,30,36,45,46,47,50,57]\r\n\r\n// On some date formats, there's an \"[$-414]\" prefix.\r\n// I don't have any idea what that is.\r\n//\r\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\r\n//\r\n// Examples:\r\n//\r\n// * 27 (built-in format) \"[$-404]e/m/d\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_PREFIX = /^\\[\\$-414\\]/\r\n\r\n// On some date formats, there's an \";@\" postfix.\r\n// I don't have any idea what that is.\r\n// Examples:\r\n//\r\n// * 164 (custom format) \"m/d/yyyy;@\"\r\n// * 164 (custom format) \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\nconst DATE_FORMAT_WEIRD_POSTFIX = /;@$/\r\n\r\nfunction isDateTemplate(template) {\r\n // Date format tokens could be in upper case or in lower case.\r\n // There seems to be no single standard.\r\n // So lowercase the template first.\r\n template = template.toLowerCase()\r\n\r\n // On some date formats, there's an \"[$-414]\" prefix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_PREFIX, '')\r\n\r\n // On some date formats, there's an \";@\" postfix.\r\n // I don't have any idea what that is. Trim it.\r\n template = template.replace(DATE_FORMAT_WEIRD_POSTFIX, '')\r\n\r\n const tokens = template.split(/\\W+/)\r\n for (const token of tokens) {\r\n if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\n// These tokens could be in upper case or in lower case.\r\n// There seems to be no single standard, so using lower case.\r\nconst DATE_TEMPLATE_TOKENS = [\r\n // Seconds (min two digits). Example: \"05\".\r\n 'ss',\r\n // Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\r\n 'mm',\r\n // Hours. Example: \"1\".\r\n 'h',\r\n // Hours (min two digits). Example: \"01\".\r\n 'hh',\r\n // \"AM\" part of \"AM/PM\". Lowercased just in case.\r\n 'am',\r\n // \"PM\" part of \"AM/PM\". Lowercased just in case.\r\n 'pm',\r\n // Day. Example: \"1\"\r\n 'd',\r\n // Day (min two digits). Example: \"01\"\r\n 'dd',\r\n // Month (numeric). Example: \"1\".\r\n 'm',\r\n // Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\r\n 'mm',\r\n // Month (shortened month name). Example: \"Jan\".\r\n 'mmm',\r\n // Month (full month name). Example: \"January\".\r\n 'mmmm',\r\n // Two-digit year. Example: \"20\".\r\n 'yy',\r\n // Full year. Example: \"2020\".\r\n 'yyyy',\r\n\r\n // I don't have any idea what \"e\" means.\r\n // It's used in \"built-in\" XLSX formats:\r\n // * 27 '[$-404]e/m/d';\r\n // * 36 '[$-404]e/m/d';\r\n // * 50 '[$-404]e/m/d';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,EAAE;EAChC;EACA;EACA;EACAA,QAAQ,GAAGA,QAAQ,CAACK,WAAW,CAAC,CAAC;;EAEjC;EACA;EACAL,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACH,wBAAwB,EAAE,EAAE,CAAC;;EAEzD;EACA;EACAH,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAACF,yBAAyB,EAAE,EAAE,CAAC;EAE1D,IAAMG,MAAM,GAAGP,QAAQ,CAACQ,KAAK,CAAC,KAAK,CAAC;EACpC,SAAAC,SAAA,GAAAC,+BAAA,CAAoBH,MAAM,GAAAI,KAAA,IAAAA,KAAA,GAAAF,SAAA,IAAAG,IAAA,GAAE;IAAA,IAAjBC,KAAK,GAAAF,KAAA,CAAAG,KAAA;IACd,IAAIC,oBAAoB,CAACnB,OAAO,CAACiB,KAAK,CAAC,GAAG,CAAC,EAAE;MAC3C,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA,IAAME,oBAAoB,GAAG;AAC3B;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,KAAK;AACL;AACA,MAAM;AACN;AACA,IAAI;AACJ;AACA,MAAM;AAEN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,CACJ"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = parseCell;
|
|
7
|
-
|
|
8
7
|
var _parseCellValue = _interopRequireDefault(require("./parseCellValue.js"));
|
|
9
|
-
|
|
10
8
|
var _coordinates = require("./coordinates.js");
|
|
11
|
-
|
|
12
9
|
var _xlsx = require("../xml/xlsx.js");
|
|
13
|
-
|
|
14
10
|
var _dom = require("../xml/dom.js");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
// Example of a `<c/>`ell element:
|
|
19
13
|
//
|
|
20
14
|
// <c>
|
|
@@ -42,17 +36,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
42
36
|
//
|
|
43
37
|
function parseCell(node, sheet, xml, values, styles, properties, options) {
|
|
44
38
|
var coords = (0, _coordinates.parseCellCoordinates)(node.getAttribute('r'));
|
|
45
|
-
var valueElement = (0, _xlsx.getCellValue)(sheet, node);
|
|
39
|
+
var valueElement = (0, _xlsx.getCellValue)(sheet, node);
|
|
40
|
+
|
|
41
|
+
// For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.
|
|
46
42
|
// So using `value && ...` instead of `if (value !== undefined) { ... }` here
|
|
47
43
|
// for uniform compatibility with both `xpath` and native `DOMParser`.
|
|
48
|
-
|
|
49
44
|
var value = valueElement && valueElement.textContent;
|
|
50
45
|
var type;
|
|
51
|
-
|
|
52
46
|
if (node.hasAttribute('t')) {
|
|
53
47
|
type = node.getAttribute('t');
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
return {
|
|
57
50
|
row: coords[0],
|
|
58
51
|
column: coords[1],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseCell.js","names":["parseCell","node","sheet","xml","values","styles","properties","options","coords","parseCellCoordinates","getAttribute","valueElement","getCellValue","value","textContent","type","hasAttribute","row","column","parseCellValue","getInlineStringValue","getCellInlineStringValue","getInlineStringXml","getOuterXml","getStyleId"],"sources":["../../source/read/parseCell.js"],"sourcesContent":["import parseCellValue from './parseCellValue.js'\r\n\r\nimport {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getCellValue,\r\n getCellInlineStringValue\r\n} from '../xml/xlsx.js'\r\n\r\nimport {\r\n getOuterXml\r\n} from '../xml/dom.js'\r\n\r\n// Example of a `<c/>`ell element:\r\n//\r\n// <c>\r\n// <f>string</f> — formula.\r\n// <v>string</v> — formula pre-computed value.\r\n// <is>\r\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\r\n// <r>\r\n// <rPr>\r\n// ...\r\n// </rPr>\r\n// <t>string</t>\r\n// </r>\r\n// <rPh sb=\"1\" eb=\"1\">\r\n// <t>string</t>\r\n// </rPh>\r\n// <phoneticPr fontId=\"1\"/>\r\n// </is>\r\n// <extLst>\r\n// <ext>\r\n// <!--any element-->\r\n// </ext>\r\n// </extLst>\r\n// </c>\r\n//\r\nexport default function parseCell(node, sheet, xml, values, styles, properties, options) {\r\n const coords = parseCellCoordinates(node.getAttribute('r'))\r\n\r\n const valueElement = getCellValue(sheet, node)\r\n\r\n // For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.\r\n // So using `value && ...` instead of `if (value !== undefined) { ... }` here\r\n // for uniform compatibility with both `xpath` and native `DOMParser`.\r\n let value = valueElement && valueElement.textContent\r\n\r\n let type\r\n if (node.hasAttribute('t')) {\r\n type = node.getAttribute('t')\r\n }\r\n\r\n return {\r\n row: coords[0],\r\n column: coords[1],\r\n value: parseCellValue(value, type, {\r\n getInlineStringValue: () => getCellInlineStringValue(sheet, node),\r\n getInlineStringXml: () => getOuterXml(node),\r\n getStyleId: () => node.getAttribute('s'),\r\n styles,\r\n values,\r\n properties,\r\n options\r\n })\r\n }\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseCell.js","names":["_parseCellValue","_interopRequireDefault","require","_coordinates","_xlsx","_dom","obj","__esModule","parseCell","node","sheet","xml","values","styles","properties","options","coords","parseCellCoordinates","getAttribute","valueElement","getCellValue","value","textContent","type","hasAttribute","row","column","parseCellValue","getInlineStringValue","getCellInlineStringValue","getInlineStringXml","getOuterXml","getStyleId"],"sources":["../../source/read/parseCell.js"],"sourcesContent":["import parseCellValue from './parseCellValue.js'\r\n\r\nimport {\r\n parseCellCoordinates\r\n} from './coordinates.js'\r\n\r\nimport {\r\n getCellValue,\r\n getCellInlineStringValue\r\n} from '../xml/xlsx.js'\r\n\r\nimport {\r\n getOuterXml\r\n} from '../xml/dom.js'\r\n\r\n// Example of a `<c/>`ell element:\r\n//\r\n// <c>\r\n// <f>string</f> — formula.\r\n// <v>string</v> — formula pre-computed value.\r\n// <is>\r\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\r\n// <r>\r\n// <rPr>\r\n// ...\r\n// </rPr>\r\n// <t>string</t>\r\n// </r>\r\n// <rPh sb=\"1\" eb=\"1\">\r\n// <t>string</t>\r\n// </rPh>\r\n// <phoneticPr fontId=\"1\"/>\r\n// </is>\r\n// <extLst>\r\n// <ext>\r\n// <!--any element-->\r\n// </ext>\r\n// </extLst>\r\n// </c>\r\n//\r\nexport default function parseCell(node, sheet, xml, values, styles, properties, options) {\r\n const coords = parseCellCoordinates(node.getAttribute('r'))\r\n\r\n const valueElement = getCellValue(sheet, node)\r\n\r\n // For `xpath`, `value` can be `undefined` while for native `DOMParser` it's `null`.\r\n // So using `value && ...` instead of `if (value !== undefined) { ... }` here\r\n // for uniform compatibility with both `xpath` and native `DOMParser`.\r\n let value = valueElement && valueElement.textContent\r\n\r\n let type\r\n if (node.hasAttribute('t')) {\r\n type = node.getAttribute('t')\r\n }\r\n\r\n return {\r\n row: coords[0],\r\n column: coords[1],\r\n value: parseCellValue(value, type, {\r\n getInlineStringValue: () => getCellInlineStringValue(sheet, node),\r\n getInlineStringXml: () => getOuterXml(node),\r\n getStyleId: () => node.getAttribute('s'),\r\n styles,\r\n values,\r\n properties,\r\n options\r\n })\r\n }\r\n}"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AAEsB,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAA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(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = parseCellValue;
|
|
7
|
-
|
|
8
7
|
var _parseDate = _interopRequireDefault(require("./parseDate.js"));
|
|
9
|
-
|
|
10
8
|
var _isDateTimestamp = _interopRequireDefault(require("./isDateTimestamp.js"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
// Parses a string `value` of a cell.
|
|
15
11
|
function parseCellValue(value, type, _ref) {
|
|
16
12
|
var getInlineStringValue = _ref.getInlineStringValue,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
getInlineStringXml = _ref.getInlineStringXml,
|
|
14
|
+
getStyleId = _ref.getStyleId,
|
|
15
|
+
styles = _ref.styles,
|
|
16
|
+
values = _ref.values,
|
|
17
|
+
properties = _ref.properties,
|
|
18
|
+
options = _ref.options;
|
|
24
19
|
if (!type) {
|
|
25
20
|
// Default cell type is "n" (numeric).
|
|
26
21
|
// http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html
|
|
27
22
|
type = 'n';
|
|
28
|
-
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Available Excel cell types:
|
|
29
26
|
// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
|
|
30
27
|
//
|
|
31
28
|
// Some other document (seems to be old):
|
|
32
29
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html
|
|
33
30
|
//
|
|
34
|
-
|
|
35
|
-
|
|
36
31
|
switch (type) {
|
|
37
32
|
// XLSX tends to store all strings as "shared" (indexed) ones
|
|
38
33
|
// using "s" cell type (for saving on strage space).
|
|
@@ -41,46 +36,41 @@ function parseCellValue(value, type, _ref) {
|
|
|
41
36
|
case 'str':
|
|
42
37
|
value = parseString(value, options);
|
|
43
38
|
break;
|
|
39
|
+
|
|
44
40
|
// Sometimes, XLSX stores strings as "inline" strings rather than "shared" (indexed) ones.
|
|
45
41
|
// Perhaps the specification doesn't force it to use one or another.
|
|
46
42
|
// Example: `<sheetData><row r="1"><c r="A1" s="1" t="inlineStr"><is><t>Test 123</t></is></c></row></sheetData>`.
|
|
47
|
-
|
|
48
43
|
case 'inlineStr':
|
|
49
44
|
value = getInlineStringValue();
|
|
50
|
-
|
|
51
45
|
if (value === undefined) {
|
|
52
46
|
throw new Error("Unsupported \"inline string\" cell value structure: ".concat(getInlineStringXml()));
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
value = parseString(value, options);
|
|
56
49
|
break;
|
|
50
|
+
|
|
57
51
|
// XLSX tends to store string values as "shared" (indexed) ones.
|
|
58
52
|
// "Shared" strings is a way for an Excel editor to reduce
|
|
59
53
|
// the file size by storing "commonly used" strings in a dictionary
|
|
60
54
|
// and then referring to such strings by their index in that dictionary.
|
|
61
55
|
// Example: `<sheetData><row r="1"><c r="A1" s="1" t="s"><v>0</v></c></row></sheetData>`.
|
|
62
|
-
|
|
63
56
|
case 's':
|
|
64
57
|
// If a cell has no value then there's no `<c/>` element for it.
|
|
65
58
|
// If a `<c/>` element exists then it's not empty.
|
|
66
59
|
// The `<v/>`alue is a key in the "shared strings" dictionary of the
|
|
67
60
|
// XLSX file, so look it up in the `values` dictionary by the numeric key.
|
|
68
61
|
var sharedStringIndex = Number(value);
|
|
69
|
-
|
|
70
62
|
if (isNaN(sharedStringIndex)) {
|
|
71
63
|
throw new Error("Invalid \"shared\" string index: ".concat(value));
|
|
72
64
|
}
|
|
73
|
-
|
|
74
65
|
if (sharedStringIndex >= values.length) {
|
|
75
66
|
throw new Error("An out-of-bounds \"shared\" string index: ".concat(value));
|
|
76
67
|
}
|
|
77
|
-
|
|
78
68
|
value = values[sharedStringIndex];
|
|
79
69
|
value = parseString(value, options);
|
|
80
70
|
break;
|
|
71
|
+
|
|
81
72
|
// Boolean (TRUE/FALSE) values are stored as either "1" or "0"
|
|
82
73
|
// in cells of type "b".
|
|
83
|
-
|
|
84
74
|
case 'b':
|
|
85
75
|
if (value === '1') {
|
|
86
76
|
value = true;
|
|
@@ -89,55 +79,50 @@ function parseCellValue(value, type, _ref) {
|
|
|
89
79
|
} else {
|
|
90
80
|
throw new Error("Unsupported \"boolean\" cell value: ".concat(value));
|
|
91
81
|
}
|
|
92
|
-
|
|
93
82
|
break;
|
|
83
|
+
|
|
94
84
|
// XLSX specification seems to support cells of type "z":
|
|
95
85
|
// blank "stub" cells that should be ignored by data processing utilities.
|
|
96
|
-
|
|
97
86
|
case 'z':
|
|
98
87
|
value = undefined;
|
|
99
88
|
break;
|
|
89
|
+
|
|
100
90
|
// XLSX specification also defines cells of type "e" containing a numeric "error" code.
|
|
101
91
|
// It's not clear what that means though.
|
|
102
92
|
// They also wrote: "and `w` property stores its common name".
|
|
103
93
|
// It's unclear what they meant by that.
|
|
104
|
-
|
|
105
94
|
case 'e':
|
|
106
95
|
value = decodeError(value);
|
|
107
96
|
break;
|
|
97
|
+
|
|
108
98
|
// XLSX supports date cells of type "d", though seems like it (almost?) never
|
|
109
99
|
// uses it for storing dates, preferring "n" numeric timestamp cells instead.
|
|
110
100
|
// The value of a "d" cell is supposedly a string in "ISO 8601" format.
|
|
111
101
|
// I haven't seen an XLSX file having such cells.
|
|
112
102
|
// Example: `<sheetData><row r="1"><c r="A1" s="1" t="d"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.
|
|
113
|
-
|
|
114
103
|
case 'd':
|
|
115
104
|
if (value === undefined) {
|
|
116
105
|
break;
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
var parsedDate = new Date(value);
|
|
120
|
-
|
|
121
108
|
if (isNaN(parsedDate.valueOf())) {
|
|
122
109
|
throw new Error("Unsupported \"date\" cell value: ".concat(value));
|
|
123
110
|
}
|
|
124
|
-
|
|
125
111
|
value = parsedDate;
|
|
126
112
|
break;
|
|
127
|
-
// Numeric cells have type "n".
|
|
128
113
|
|
|
114
|
+
// Numeric cells have type "n".
|
|
129
115
|
case 'n':
|
|
130
116
|
if (value === undefined) {
|
|
131
117
|
break;
|
|
132
118
|
}
|
|
133
|
-
|
|
134
|
-
|
|
119
|
+
var isDateTimestampNumber = (0, _isDateTimestamp["default"])(getStyleId(), styles, options);
|
|
120
|
+
// XLSX does have "d" type for dates, but it's not commonly used.
|
|
135
121
|
// Instead, it prefers using "n" type for storing dates as timestamps.
|
|
136
|
-
|
|
137
122
|
if (isDateTimestampNumber) {
|
|
138
123
|
// Parse the number from string.
|
|
139
|
-
value = parseNumberDefault(value);
|
|
140
|
-
|
|
124
|
+
value = parseNumberDefault(value);
|
|
125
|
+
// Parse the number as a date timestamp.
|
|
141
126
|
value = (0, _parseDate["default"])(value, properties);
|
|
142
127
|
} else {
|
|
143
128
|
// Parse the number from string.
|
|
@@ -145,57 +130,45 @@ function parseCellValue(value, type, _ref) {
|
|
|
145
130
|
// https://gitlab.com/catamphetamine/read-excel-file/-/issues/85
|
|
146
131
|
value = (options.parseNumber || parseNumberDefault)(value);
|
|
147
132
|
}
|
|
148
|
-
|
|
149
133
|
break;
|
|
150
|
-
|
|
151
134
|
default:
|
|
152
135
|
throw new TypeError("Cell type not supported: ".concat(type));
|
|
153
|
-
}
|
|
154
|
-
|
|
136
|
+
}
|
|
155
137
|
|
|
138
|
+
// Convert empty values to `null`.
|
|
156
139
|
if (value === undefined) {
|
|
157
140
|
value = null;
|
|
158
141
|
}
|
|
159
|
-
|
|
160
142
|
return value;
|
|
161
|
-
}
|
|
162
|
-
// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
|
|
163
|
-
|
|
143
|
+
}
|
|
164
144
|
|
|
145
|
+
// Decodes numeric error code to a string code.
|
|
146
|
+
// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
|
|
165
147
|
function decodeError(errorCode) {
|
|
166
148
|
// While the error values are determined by the application,
|
|
167
149
|
// the following are some example error values that could be used:
|
|
168
150
|
switch (errorCode) {
|
|
169
151
|
case 0x00:
|
|
170
152
|
return '#NULL!';
|
|
171
|
-
|
|
172
153
|
case 0x07:
|
|
173
154
|
return '#DIV/0!';
|
|
174
|
-
|
|
175
155
|
case 0x0F:
|
|
176
156
|
return '#VALUE!';
|
|
177
|
-
|
|
178
157
|
case 0x17:
|
|
179
158
|
return '#REF!';
|
|
180
|
-
|
|
181
159
|
case 0x1D:
|
|
182
160
|
return '#NAME?';
|
|
183
|
-
|
|
184
161
|
case 0x24:
|
|
185
162
|
return '#NUM!';
|
|
186
|
-
|
|
187
163
|
case 0x2A:
|
|
188
164
|
return '#N/A';
|
|
189
|
-
|
|
190
165
|
case 0x2B:
|
|
191
166
|
return '#GETTING_DATA';
|
|
192
|
-
|
|
193
167
|
default:
|
|
194
168
|
// Such error code doesn't exist. I made it up.
|
|
195
169
|
return "#ERROR_".concat(errorCode);
|
|
196
170
|
}
|
|
197
171
|
}
|
|
198
|
-
|
|
199
172
|
function parseString(value, options) {
|
|
200
173
|
// In some weird cases, a developer might want to disable
|
|
201
174
|
// the automatic trimming of all strings.
|
|
@@ -204,27 +177,23 @@ function parseString(value, options) {
|
|
|
204
177
|
if (options.trim !== false) {
|
|
205
178
|
value = value.trim();
|
|
206
179
|
}
|
|
207
|
-
|
|
208
180
|
if (value === '') {
|
|
209
181
|
value = undefined;
|
|
210
182
|
}
|
|
211
|
-
|
|
212
183
|
return value;
|
|
213
|
-
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Parses a number from string.
|
|
214
187
|
// Throws an error if the number couldn't be parsed.
|
|
215
188
|
// When parsing floating-point number, is affected by
|
|
216
189
|
// the javascript number encoding precision issues:
|
|
217
190
|
// https://www.youtube.com/watch?v=2gIxbTn7GSc
|
|
218
191
|
// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues
|
|
219
|
-
|
|
220
|
-
|
|
221
192
|
function parseNumberDefault(stringifiedNumber) {
|
|
222
193
|
var parsedNumber = Number(stringifiedNumber);
|
|
223
|
-
|
|
224
194
|
if (isNaN(parsedNumber)) {
|
|
225
195
|
throw new Error("Invalid \"numeric\" cell value: ".concat(stringifiedNumber));
|
|
226
196
|
}
|
|
227
|
-
|
|
228
197
|
return parsedNumber;
|
|
229
198
|
}
|
|
230
199
|
//# sourceMappingURL=parseCellValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseCellValue.js","names":["parseCellValue","value","type","getInlineStringValue","getInlineStringXml","getStyleId","styles","values","properties","options","parseString","undefined","Error","sharedStringIndex","Number","isNaN","length","decodeError","parsedDate","Date","valueOf","isDateTimestampNumber","isDateTimestamp","parseNumberDefault","parseDate","parseNumber","TypeError","errorCode","trim","stringifiedNumber","parsedNumber"],"sources":["../../source/read/parseCellValue.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\nimport isDateTimestamp from './isDateTimestamp.js'\r\n\r\n// Parses a string `value` of a cell.\r\nexport default function parseCellValue(value, type, {\r\n getInlineStringValue,\r\n getInlineStringXml,\r\n getStyleId,\r\n styles,\r\n values,\r\n properties,\r\n options\r\n}) {\r\n if (!type) {\r\n // Default cell type is \"n\" (numeric).\r\n // http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html\r\n type = 'n'\r\n }\r\n\r\n // Available Excel cell types:\r\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\n //\r\n // Some other document (seems to be old):\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\r\n //\r\n switch (type) {\r\n // XLSX tends to store all strings as \"shared\" (indexed) ones\r\n // using \"s\" cell type (for saving on strage space).\r\n // \"str\" cell type is then generally only used for storing\r\n // formula-pre-calculated cell values.\r\n case 'str':\r\n value = parseString(value, options)\r\n break\r\n\r\n // Sometimes, XLSX stores strings as \"inline\" strings rather than \"shared\" (indexed) ones.\r\n // Perhaps the specification doesn't force it to use one or another.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"inlineStr\"><is><t>Test 123</t></is></c></row></sheetData>`.\r\n case 'inlineStr':\r\n value = getInlineStringValue()\r\n if (value === undefined) {\r\n throw new Error(`Unsupported \"inline string\" cell value structure: ${getInlineStringXml()}`)\r\n }\r\n value = parseString(value, options)\r\n break\r\n\r\n // XLSX tends to store string values as \"shared\" (indexed) ones.\r\n // \"Shared\" strings is a way for an Excel editor to reduce\r\n // the file size by storing \"commonly used\" strings in a dictionary\r\n // and then referring to such strings by their index in that dictionary.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"s\"><v>0</v></c></row></sheetData>`.\r\n case 's':\r\n // If a cell has no value then there's no `<c/>` element for it.\r\n // If a `<c/>` element exists then it's not empty.\r\n // The `<v/>`alue is a key in the \"shared strings\" dictionary of the\r\n // XLSX file, so look it up in the `values` dictionary by the numeric key.\r\n const sharedStringIndex = Number(value)\r\n if (isNaN(sharedStringIndex)) {\r\n throw new Error(`Invalid \"shared\" string index: ${value}`)\r\n }\r\n if (sharedStringIndex >= values.length) {\r\n throw new Error(`An out-of-bounds \"shared\" string index: ${value}`)\r\n }\r\n value = values[sharedStringIndex]\r\n value = parseString(value, options)\r\n break\r\n\r\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\"\r\n // in cells of type \"b\".\r\n case 'b':\r\n if (value === '1') {\r\n value = true\r\n } else if (value === '0') {\r\n value = false\r\n } else {\r\n throw new Error(`Unsupported \"boolean\" cell value: ${value}`)\r\n }\r\n break\r\n\r\n // XLSX specification seems to support cells of type \"z\":\r\n // blank \"stub\" cells that should be ignored by data processing utilities.\r\n case 'z':\r\n value = undefined\r\n break\r\n\r\n // XLSX specification also defines cells of type \"e\" containing a numeric \"error\" code.\r\n // It's not clear what that means though.\r\n // They also wrote: \"and `w` property stores its common name\".\r\n // It's unclear what they meant by that.\r\n case 'e':\r\n value = decodeError(value)\r\n break\r\n\r\n // XLSX supports date cells of type \"d\", though seems like it (almost?) never\r\n // uses it for storing dates, preferring \"n\" numeric timestamp cells instead.\r\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\r\n // I haven't seen an XLSX file having such cells.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"d\"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.\r\n case 'd':\r\n if (value === undefined) {\r\n break\r\n }\r\n const parsedDate = new Date(value)\r\n if (isNaN(parsedDate.valueOf())) {\r\n throw new Error(`Unsupported \"date\" cell value: ${value}`)\r\n }\r\n value = parsedDate\r\n break\r\n\r\n // Numeric cells have type \"n\".\r\n case 'n':\r\n if (value === undefined) {\r\n break\r\n }\r\n const isDateTimestampNumber = isDateTimestamp(getStyleId(), styles, options)\r\n // XLSX does have \"d\" type for dates, but it's not commonly used.\r\n // Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n if (isDateTimestampNumber) {\r\n // Parse the number from string.\r\n value = parseNumberDefault(value)\r\n // Parse the number as a date timestamp.\r\n value = parseDate(value, properties)\r\n } else {\r\n // Parse the number from string.\r\n // Supports custom parsing function to work around javascript number encoding precision issues.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\r\n value = (options.parseNumber || parseNumberDefault)(value)\r\n }\r\n break\r\n\r\n default:\r\n throw new TypeError(`Cell type not supported: ${type}`)\r\n }\r\n\r\n // Convert empty values to `null`.\r\n if (value === undefined) {\r\n value = null\r\n }\r\n\r\n return value\r\n}\r\n\r\n// Decodes numeric error code to a string code.\r\n// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\nfunction decodeError(errorCode) {\r\n // While the error values are determined by the application,\r\n // the following are some example error values that could be used:\r\n switch (errorCode) {\r\n case 0x00:\r\n return '#NULL!'\r\n case 0x07:\r\n return '#DIV/0!'\r\n case 0x0F:\r\n return '#VALUE!'\r\n case 0x17:\r\n return '#REF!'\r\n case 0x1D:\r\n return '#NAME?'\r\n case 0x24:\r\n return '#NUM!'\r\n case 0x2A:\r\n return '#N/A'\r\n case 0x2B:\r\n return '#GETTING_DATA'\r\n default:\r\n // Such error code doesn't exist. I made it up.\r\n return `#ERROR_${errorCode}`\r\n }\r\n}\r\n\r\nfunction parseString(value, options) {\r\n // In some weird cases, a developer might want to disable\r\n // the automatic trimming of all strings.\r\n // For example, leading spaces might express a tree-like hierarchy.\r\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\r\n if (options.trim !== false) {\r\n value = value.trim()\r\n }\r\n if (value === '') {\r\n value = undefined\r\n }\r\n return value\r\n}\r\n\r\n// Parses a number from string.\r\n// Throws an error if the number couldn't be parsed.\r\n// When parsing floating-point number, is affected by\r\n// the javascript number encoding precision issues:\r\n// https://www.youtube.com/watch?v=2gIxbTn7GSc\r\n// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues\r\nfunction parseNumberDefault(stringifiedNumber) {\r\n const parsedNumber = Number(stringifiedNumber)\r\n if (isNaN(parsedNumber)) {\r\n throw new Error(`Invalid \"numeric\" cell value: ${stringifiedNumber}`)\r\n }\r\n return parsedNumber\r\n}"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;AACe,SAASA,cAAT,CAAwBC,KAAxB,EAA+BC,IAA/B,QAQZ;EAAA,IAPDC,oBAOC,QAPDA,oBAOC;EAAA,IANDC,kBAMC,QANDA,kBAMC;EAAA,IALDC,UAKC,QALDA,UAKC;EAAA,IAJDC,MAIC,QAJDA,MAIC;EAAA,IAHDC,MAGC,QAHDA,MAGC;EAAA,IAFDC,UAEC,QAFDA,UAEC;EAAA,IADDC,OACC,QADDA,OACC;;EACD,IAAI,CAACP,IAAL,EAAW;IACT;IACA;IACAA,IAAI,GAAG,GAAP;EACD,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AO,OAAP;;IACF,KAAK,IAAL;MACE,OAAO,MAAP;;IACF,KAAK,IAAL;MACE,OAAO,eAAP;;IACF;MACE;MACA,wBAAiBA,SAAjB;EAnBJ;AAqBD;;AAED,SAASjB,WAAT,CAAqBT,KAArB,EAA4BQ,OAA5B,EAAqC;EACnC;EACA;EACA;EACA;EACA,IAAIA,OAAO,CAACmB,IAAR,KAAiB,KAArB,EAA4B;IAC1B3B,KAAK,GAAGA,KAAK,CAAC2B,IAAN,EAAR;EACD;;EACD,IAAI3B,KAAK,KAAK,EAAd,EAAkB;IAChBA,KAAK,GAAGU,SAAR;EACD;;EACD,OAAOV,KAAP;AACD,C,CAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASsB,kBAAT,CAA4BM,iBAA5B,EAA+C;EAC7C,IAAMC,YAAY,GAAGhB,MAAM,CAACe,iBAAD,CAA3B;;EACA,IAAId,KAAK,CAACe,YAAD,CAAT,EAAyB;IACvB,MAAM,IAAIlB,KAAJ,2CAA2CiB,iBAA3C,EAAN;EACD;;EACD,OAAOC,YAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"parseCellValue.js","names":["_parseDate","_interopRequireDefault","require","_isDateTimestamp","obj","__esModule","parseCellValue","value","type","_ref","getInlineStringValue","getInlineStringXml","getStyleId","styles","values","properties","options","parseString","undefined","Error","concat","sharedStringIndex","Number","isNaN","length","decodeError","parsedDate","Date","valueOf","isDateTimestampNumber","isDateTimestamp","parseNumberDefault","parseDate","parseNumber","TypeError","errorCode","trim","stringifiedNumber","parsedNumber"],"sources":["../../source/read/parseCellValue.js"],"sourcesContent":["import parseDate from './parseDate.js'\r\nimport isDateTimestamp from './isDateTimestamp.js'\r\n\r\n// Parses a string `value` of a cell.\r\nexport default function parseCellValue(value, type, {\r\n getInlineStringValue,\r\n getInlineStringXml,\r\n getStyleId,\r\n styles,\r\n values,\r\n properties,\r\n options\r\n}) {\r\n if (!type) {\r\n // Default cell type is \"n\" (numeric).\r\n // http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html\r\n type = 'n'\r\n }\r\n\r\n // Available Excel cell types:\r\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\n //\r\n // Some other document (seems to be old):\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\r\n //\r\n switch (type) {\r\n // XLSX tends to store all strings as \"shared\" (indexed) ones\r\n // using \"s\" cell type (for saving on strage space).\r\n // \"str\" cell type is then generally only used for storing\r\n // formula-pre-calculated cell values.\r\n case 'str':\r\n value = parseString(value, options)\r\n break\r\n\r\n // Sometimes, XLSX stores strings as \"inline\" strings rather than \"shared\" (indexed) ones.\r\n // Perhaps the specification doesn't force it to use one or another.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"inlineStr\"><is><t>Test 123</t></is></c></row></sheetData>`.\r\n case 'inlineStr':\r\n value = getInlineStringValue()\r\n if (value === undefined) {\r\n throw new Error(`Unsupported \"inline string\" cell value structure: ${getInlineStringXml()}`)\r\n }\r\n value = parseString(value, options)\r\n break\r\n\r\n // XLSX tends to store string values as \"shared\" (indexed) ones.\r\n // \"Shared\" strings is a way for an Excel editor to reduce\r\n // the file size by storing \"commonly used\" strings in a dictionary\r\n // and then referring to such strings by their index in that dictionary.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"s\"><v>0</v></c></row></sheetData>`.\r\n case 's':\r\n // If a cell has no value then there's no `<c/>` element for it.\r\n // If a `<c/>` element exists then it's not empty.\r\n // The `<v/>`alue is a key in the \"shared strings\" dictionary of the\r\n // XLSX file, so look it up in the `values` dictionary by the numeric key.\r\n const sharedStringIndex = Number(value)\r\n if (isNaN(sharedStringIndex)) {\r\n throw new Error(`Invalid \"shared\" string index: ${value}`)\r\n }\r\n if (sharedStringIndex >= values.length) {\r\n throw new Error(`An out-of-bounds \"shared\" string index: ${value}`)\r\n }\r\n value = values[sharedStringIndex]\r\n value = parseString(value, options)\r\n break\r\n\r\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\"\r\n // in cells of type \"b\".\r\n case 'b':\r\n if (value === '1') {\r\n value = true\r\n } else if (value === '0') {\r\n value = false\r\n } else {\r\n throw new Error(`Unsupported \"boolean\" cell value: ${value}`)\r\n }\r\n break\r\n\r\n // XLSX specification seems to support cells of type \"z\":\r\n // blank \"stub\" cells that should be ignored by data processing utilities.\r\n case 'z':\r\n value = undefined\r\n break\r\n\r\n // XLSX specification also defines cells of type \"e\" containing a numeric \"error\" code.\r\n // It's not clear what that means though.\r\n // They also wrote: \"and `w` property stores its common name\".\r\n // It's unclear what they meant by that.\r\n case 'e':\r\n value = decodeError(value)\r\n break\r\n\r\n // XLSX supports date cells of type \"d\", though seems like it (almost?) never\r\n // uses it for storing dates, preferring \"n\" numeric timestamp cells instead.\r\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\r\n // I haven't seen an XLSX file having such cells.\r\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"d\"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.\r\n case 'd':\r\n if (value === undefined) {\r\n break\r\n }\r\n const parsedDate = new Date(value)\r\n if (isNaN(parsedDate.valueOf())) {\r\n throw new Error(`Unsupported \"date\" cell value: ${value}`)\r\n }\r\n value = parsedDate\r\n break\r\n\r\n // Numeric cells have type \"n\".\r\n case 'n':\r\n if (value === undefined) {\r\n break\r\n }\r\n const isDateTimestampNumber = isDateTimestamp(getStyleId(), styles, options)\r\n // XLSX does have \"d\" type for dates, but it's not commonly used.\r\n // Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n if (isDateTimestampNumber) {\r\n // Parse the number from string.\r\n value = parseNumberDefault(value)\r\n // Parse the number as a date timestamp.\r\n value = parseDate(value, properties)\r\n } else {\r\n // Parse the number from string.\r\n // Supports custom parsing function to work around javascript number encoding precision issues.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\r\n value = (options.parseNumber || parseNumberDefault)(value)\r\n }\r\n break\r\n\r\n default:\r\n throw new TypeError(`Cell type not supported: ${type}`)\r\n }\r\n\r\n // Convert empty values to `null`.\r\n if (value === undefined) {\r\n value = null\r\n }\r\n\r\n return value\r\n}\r\n\r\n// Decodes numeric error code to a string code.\r\n// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\nfunction decodeError(errorCode) {\r\n // While the error values are determined by the application,\r\n // the following are some example error values that could be used:\r\n switch (errorCode) {\r\n case 0x00:\r\n return '#NULL!'\r\n case 0x07:\r\n return '#DIV/0!'\r\n case 0x0F:\r\n return '#VALUE!'\r\n case 0x17:\r\n return '#REF!'\r\n case 0x1D:\r\n return '#NAME?'\r\n case 0x24:\r\n return '#NUM!'\r\n case 0x2A:\r\n return '#N/A'\r\n case 0x2B:\r\n return '#GETTING_DATA'\r\n default:\r\n // Such error code doesn't exist. I made it up.\r\n return `#ERROR_${errorCode}`\r\n }\r\n}\r\n\r\nfunction parseString(value, options) {\r\n // In some weird cases, a developer might want to disable\r\n // the automatic trimming of all strings.\r\n // For example, leading spaces might express a tree-like hierarchy.\r\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\r\n if (options.trim !== false) {\r\n value = value.trim()\r\n }\r\n if (value === '') {\r\n value = undefined\r\n }\r\n return value\r\n}\r\n\r\n// Parses a number from string.\r\n// Throws an error if the number couldn't be parsed.\r\n// When parsing floating-point number, is affected by\r\n// the javascript number encoding precision issues:\r\n// https://www.youtube.com/watch?v=2gIxbTn7GSc\r\n// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues\r\nfunction parseNumberDefault(stringifiedNumber) {\r\n const parsedNumber = Number(stringifiedNumber)\r\n if (isNaN(parsedNumber)) {\r\n throw new Error(`Invalid \"numeric\" cell value: ${stringifiedNumber}`)\r\n }\r\n return parsedNumber\r\n}"],"mappings":";;;;;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C,IAAId,KAAK,CAACe,YAAY,CAAC,EAAE;IACvB,MAAM,IAAInB,KAAK,oCAAAC,MAAA,CAAkCiB,iBAAiB,CAAE,CAAC;EACvE;EACA,OAAOC,YAAY;AACrB"}
|
|
@@ -4,25 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = parseCells;
|
|
7
|
-
|
|
8
7
|
var _parseCell = _interopRequireDefault(require("./parseCell.js"));
|
|
9
|
-
|
|
10
8
|
var _xlsx = require("../xml/xlsx.js");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
function parseCells(sheet, xml, values, styles, properties, options) {
|
|
15
11
|
var cells = (0, _xlsx.getCells)(sheet);
|
|
16
|
-
|
|
17
12
|
if (cells.length === 0) {
|
|
18
13
|
return [];
|
|
19
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// const mergedCells = getMergedCells(sheet)
|
|
20
17
|
// for (const mergedCell of mergedCells) {
|
|
21
18
|
// const [from, to] = mergedCell.split(':').map(parseCellCoordinates)
|
|
22
19
|
// console.log('Merged Cell.', 'From:', from, 'To:', to)
|
|
23
20
|
// }
|
|
24
21
|
|
|
25
|
-
|
|
26
22
|
return cells.map(function (node) {
|
|
27
23
|
return (0, _parseCell["default"])(node, sheet, xml, values, styles, properties, options);
|
|
28
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseCells.js","names":["parseCells","sheet","xml","values","styles","properties","options","cells","getCells","length","map","node","parseCell"],"sources":["../../source/read/parseCells.js"],"sourcesContent":["import parseCell from './parseCell.js'\r\n\r\nimport {\r\n getCells,\r\n getMergedCells\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseCells(sheet, xml, values, styles, properties, options) {\r\n const cells = getCells(sheet)\r\n\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n // const mergedCells = getMergedCells(sheet)\r\n // for (const mergedCell of mergedCells) {\r\n // const [from, to] = mergedCell.split(':').map(parseCellCoordinates)\r\n // console.log('Merged Cell.', 'From:', from, 'To:', to)\r\n // }\r\n\r\n return cells.map((node) => {\r\n return parseCell(node, sheet, xml, values, styles, properties, options)\r\n })\r\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseCells.js","names":["_parseCell","_interopRequireDefault","require","_xlsx","obj","__esModule","parseCells","sheet","xml","values","styles","properties","options","cells","getCells","length","map","node","parseCell"],"sources":["../../source/read/parseCells.js"],"sourcesContent":["import parseCell from './parseCell.js'\r\n\r\nimport {\r\n getCells,\r\n getMergedCells\r\n} from '../xml/xlsx.js'\r\n\r\nexport default function parseCells(sheet, xml, values, styles, properties, options) {\r\n const cells = getCells(sheet)\r\n\r\n if (cells.length === 0) {\r\n return []\r\n }\r\n\r\n // const mergedCells = getMergedCells(sheet)\r\n // for (const mergedCell of mergedCells) {\r\n // const [from, to] = mergedCell.split(':').map(parseCellCoordinates)\r\n // console.log('Merged Cell.', 'From:', from, 'To:', to)\r\n // }\r\n\r\n return cells.map((node) => {\r\n return parseCell(node, sheet, xml, values, styles, properties, options)\r\n })\r\n}"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAGuB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAER,SAASE,UAAUA,CAACC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAClF,IAAMC,KAAK,GAAG,IAAAC,cAAQ,EAACP,KAAK,CAAC;EAE7B,IAAIM,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IACtB,OAAO,EAAE;EACX;;EAEA;EACA;EACA;EACA;EACA;;EAEA,OAAOF,KAAK,CAACG,GAAG,CAAC,UAACC,IAAI,EAAK;IACzB,OAAO,IAAAC,qBAAS,EAACD,IAAI,EAAEV,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,CAAC;EACzE,CAAC,CAAC;AACJ"}
|