@loaders.gl/excel 3.4.13 → 3.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/excel-loader.js +4 -4
- package/dist/es5/excel-loader.js.map +1 -1
- package/dist/es5/index.js +6 -11
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/parse-excel.js +22 -38
- package/dist/es5/lib/parse-excel.js.map +1 -1
- package/dist/esm/excel-loader.js +1 -1
- package/dist/excel-worker.js +1 -1
- package/package.json +4 -4
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
|
package/dist/es5/excel-loader.js
CHANGED
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports._typecheckLoader = exports.ExcelLoader = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
8
|
+
const DEFAULT_EXCEL_LOADER_OPTIONS = {
|
|
9
9
|
excel: {
|
|
10
10
|
shape: 'object-row-table',
|
|
11
11
|
sheet: undefined
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
const ExcelLoader = {
|
|
15
15
|
name: 'Excel',
|
|
16
16
|
id: 'excel',
|
|
17
17
|
module: 'excel',
|
|
@@ -24,6 +24,6 @@ var ExcelLoader = {
|
|
|
24
24
|
options: DEFAULT_EXCEL_LOADER_OPTIONS
|
|
25
25
|
};
|
|
26
26
|
exports.ExcelLoader = ExcelLoader;
|
|
27
|
-
|
|
27
|
+
const _typecheckLoader = ExcelLoader;
|
|
28
28
|
exports._typecheckLoader = _typecheckLoader;
|
|
29
29
|
//# sourceMappingURL=excel-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-loader.js","names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","exports","_typecheckLoader"],"sources":["../../src/excel-loader.ts"],"sourcesContent":["import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ExcelLoaderOptions = LoaderOptions & {\n excel?: {\n shape: /* 'array-row-table' | */ 'object-row-table';\n sheet?: string; // Load default Sheet\n };\n};\n\nconst DEFAULT_EXCEL_LOADER_OPTIONS: ExcelLoaderOptions = {\n excel: {\n shape: 'object-row-table',\n sheet: undefined // Load default Sheet\n }\n};\n\n/**\n * Worker Loader for Excel files\n */\nexport const ExcelLoader = {\n name: 'Excel',\n id: 'excel',\n module: 'excel',\n version: VERSION,\n worker: true,\n extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],\n mimeTypes: [\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-excel'\n ],\n category: 'table',\n binary: true,\n options: DEFAULT_EXCEL_LOADER_OPTIONS\n};\n\nexport const _typecheckLoader: Loader = ExcelLoader;\n"],"mappings":";;;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"excel-loader.js","names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","exports","_typecheckLoader"],"sources":["../../src/excel-loader.ts"],"sourcesContent":["import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ExcelLoaderOptions = LoaderOptions & {\n excel?: {\n shape: /* 'array-row-table' | */ 'object-row-table';\n sheet?: string; // Load default Sheet\n };\n};\n\nconst DEFAULT_EXCEL_LOADER_OPTIONS: ExcelLoaderOptions = {\n excel: {\n shape: 'object-row-table',\n sheet: undefined // Load default Sheet\n }\n};\n\n/**\n * Worker Loader for Excel files\n */\nexport const ExcelLoader = {\n name: 'Excel',\n id: 'excel',\n module: 'excel',\n version: VERSION,\n worker: true,\n extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],\n mimeTypes: [\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-excel'\n ],\n category: 'table',\n binary: true,\n options: DEFAULT_EXCEL_LOADER_OPTIONS\n};\n\nexport const _typecheckLoader: Loader = ExcelLoader;\n"],"mappings":";;;;;;AAIA,MAAMA,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAS3E,MAAMC,4BAAgD,GAAG;EACvDC,KAAK,EAAE;IACLC,KAAK,EAAE,kBAAkB;IACzBC,KAAK,EAAEC;EACT;AACF,CAAC;AAKM,MAAMC,WAAW,GAAG;EACzBC,IAAI,EAAE,OAAO;EACbC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEV,OAAO;EAChBW,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;EAC3CC,SAAS,EAAE,CACT,mEAAmE,EACnE,0BAA0B,CAC3B;EACDC,QAAQ,EAAE,OAAO;EACjBC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEf;AACX,CAAC;AAACgB,OAAA,CAAAX,WAAA,GAAAA,WAAA;AAEK,MAAMY,gBAAwB,GAAGZ,WAAW;AAACW,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
|
package/dist/es5/index.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.ExcelLoader = void 0;
|
|
8
7
|
Object.defineProperty(exports, "ExcelWorkerLoader", {
|
|
9
8
|
enumerable: true,
|
|
10
|
-
get: function
|
|
9
|
+
get: function () {
|
|
11
10
|
return _excelLoader.ExcelLoader;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
exports._typecheckLoader = void 0;
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
14
|
var _excelLoader = require("./excel-loader");
|
|
17
15
|
var _parseExcel = require("./lib/parse-excel");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (0, _parseExcel.parseExcel)(arrayBuffer, options);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
16
|
+
const ExcelLoader = {
|
|
17
|
+
..._excelLoader.ExcelLoader,
|
|
18
|
+
parse: (arrayBuffer, options) => (0, _parseExcel.parseExcel)(arrayBuffer, options)
|
|
19
|
+
};
|
|
25
20
|
exports.ExcelLoader = ExcelLoader;
|
|
26
|
-
|
|
21
|
+
const _typecheckLoader = ExcelLoader;
|
|
27
22
|
exports._typecheckLoader = _typecheckLoader;
|
|
28
23
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_excelLoader","require","_parseExcel","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_excelLoader","require","_parseExcel","ExcelLoader","ExcelWorkerLoader","parse","arrayBuffer","options","parseExcel","exports","_typecheckLoader"],"sources":["../../src/index.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {ExcelLoader as ExcelWorkerLoader, ExcelLoaderOptions} from './excel-loader';\nimport {parseExcel} from './lib/parse-excel';\n\n// Excel Loader\n\nexport type {ExcelLoaderOptions};\nexport {ExcelWorkerLoader};\n\n/**\n * Loader for Excel files\n */\nexport const ExcelLoader = {\n ...ExcelWorkerLoader,\n parse: (arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions) =>\n parseExcel(arrayBuffer, options)\n};\n\nexport const _typecheckLoader: LoaderWithParser = ExcelLoader;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAUO,MAAME,WAAW,GAAG;EACzB,GAAGC,wBAAiB;EACpBC,KAAK,EAAEA,CAACC,WAAwB,EAAEC,OAA4B,KAC5D,IAAAC,sBAAU,EAACF,WAAW,EAAEC,OAAO;AACnC,CAAC;AAACE,OAAA,CAAAN,WAAA,GAAAA,WAAA;AAEK,MAAMO,gBAAkC,GAAGP,WAAW;AAACM,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1,47 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.parseExcel = parseExcel;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
7
|
var _xlsx = require("xlsx");
|
|
11
|
-
|
|
12
|
-
function parseExcel(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
sheetName = options === null || options === void 0 ? void 0 : (_options$excel3 = options.excel) === null || _options$excel3 === void 0 ? void 0 : _options$excel3.sheet;
|
|
34
|
-
}
|
|
35
|
-
worksheet = workbook.Sheets[sheetName];
|
|
36
|
-
dataRows = _xlsx.utils.sheet_to_json(worksheet);
|
|
37
|
-
}
|
|
38
|
-
return _context.abrupt("return", dataRows);
|
|
39
|
-
case 6:
|
|
40
|
-
case "end":
|
|
41
|
-
return _context.stop();
|
|
42
|
-
}
|
|
43
|
-
}, _callee);
|
|
44
|
-
}));
|
|
45
|
-
return _parseExcel.apply(this, arguments);
|
|
8
|
+
const dataTableNamesMap = {};
|
|
9
|
+
async function parseExcel(arrayBuffer, options) {
|
|
10
|
+
const dataUrl = 'dummy';
|
|
11
|
+
const workbook = (0, _xlsx.read)(arrayBuffer, {
|
|
12
|
+
type: 'array'
|
|
13
|
+
});
|
|
14
|
+
let dataRows = [];
|
|
15
|
+
dataTableNamesMap[dataUrl] = [];
|
|
16
|
+
if (workbook.SheetNames.length > 0) {
|
|
17
|
+
var _options$excel, _options$excel2;
|
|
18
|
+
if (workbook.SheetNames.length > 1) {
|
|
19
|
+
dataTableNamesMap[dataUrl] = workbook.SheetNames;
|
|
20
|
+
}
|
|
21
|
+
let sheetName = workbook.SheetNames[0];
|
|
22
|
+
if (options !== null && options !== void 0 && (_options$excel = options.excel) !== null && _options$excel !== void 0 && _options$excel.sheet && workbook.SheetNames.indexOf(options === null || options === void 0 ? void 0 : (_options$excel2 = options.excel) === null || _options$excel2 === void 0 ? void 0 : _options$excel2.sheet) >= 0) {
|
|
23
|
+
var _options$excel3;
|
|
24
|
+
sheetName = options === null || options === void 0 ? void 0 : (_options$excel3 = options.excel) === null || _options$excel3 === void 0 ? void 0 : _options$excel3.sheet;
|
|
25
|
+
}
|
|
26
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
27
|
+
dataRows = _xlsx.utils.sheet_to_json(worksheet);
|
|
28
|
+
}
|
|
29
|
+
return dataRows;
|
|
46
30
|
}
|
|
47
31
|
//# sourceMappingURL=parse-excel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-excel.js","names":["_xlsx","require","dataTableNamesMap","parseExcel","
|
|
1
|
+
{"version":3,"file":"parse-excel.js","names":["_xlsx","require","dataTableNamesMap","parseExcel","arrayBuffer","options","dataUrl","workbook","read","type","dataRows","SheetNames","length","_options$excel","_options$excel2","sheetName","excel","sheet","indexOf","_options$excel3","worksheet","Sheets","utils","sheet_to_json"],"sources":["../../../src/lib/parse-excel.ts"],"sourcesContent":["import type {ExcelLoaderOptions} from '../excel-loader';\nimport {utils, read} from 'xlsx';\n// import {convertToArrayRow} from '@loaders.gl/schema';\n\n// local table names cache with dataUrl/tableNames array key/values\nconst dataTableNamesMap = {};\n\n/**\n * Gets local or remote Excel file data.\n * @param arrayBuffer Loaded data\n * @param options Data parse options.\n */\nexport async function parseExcel(arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions) {\n const dataUrl = 'dummy';\n // const dataFileType: string = dataUrl.substr(dataUrl.lastIndexOf('.')); // file extension\n\n // create Excel 'workbook'\n const workbook = read(arrayBuffer, {\n type: 'array'\n // cellDates: true\n });\n\n // load data sheets\n let dataRows = [];\n dataTableNamesMap[dataUrl] = [];\n if (workbook.SheetNames.length > 0) {\n if (workbook.SheetNames.length > 1) {\n // cache sheet names\n dataTableNamesMap[dataUrl] = workbook.SheetNames;\n // eslint-ignore-next-line\n // console.debug(`getData(): file: sheetNames:`, workbook.SheetNames);\n }\n\n // determine spreadsheet to load\n let sheetName = workbook.SheetNames[0];\n if (options?.excel?.sheet && workbook.SheetNames.indexOf(options?.excel?.sheet) >= 0) {\n // reset to requested table name\n sheetName = options?.excel?.sheet;\n }\n\n // get worksheet data row objects array\n const worksheet = workbook.Sheets[sheetName];\n dataRows = utils.sheet_to_json(worksheet);\n\n // const headers = dataRows.length ? Object.keys(dataRows[0]) : [];\n // if (options?.excel?.type === 'array-row-table') {\n // dataRows = dataRows.map(row => convertToArrayRow(row, headers))\n // }\n }\n\n return dataRows;\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAIA,MAAMC,iBAAiB,GAAG,CAAC,CAAC;AAOrB,eAAeC,UAAUA,CAACC,WAAwB,EAAEC,OAA4B,EAAE;EACvF,MAAMC,OAAO,GAAG,OAAO;EAIvB,MAAMC,QAAQ,GAAG,IAAAC,UAAI,EAACJ,WAAW,EAAE;IACjCK,IAAI,EAAE;EAER,CAAC,CAAC;EAGF,IAAIC,QAAQ,GAAG,EAAE;EACjBR,iBAAiB,CAACI,OAAO,CAAC,GAAG,EAAE;EAC/B,IAAIC,QAAQ,CAACI,UAAU,CAACC,MAAM,GAAG,CAAC,EAAE;IAAA,IAAAC,cAAA,EAAAC,eAAA;IAClC,IAAIP,QAAQ,CAACI,UAAU,CAACC,MAAM,GAAG,CAAC,EAAE;MAElCV,iBAAiB,CAACI,OAAO,CAAC,GAAGC,QAAQ,CAACI,UAAU;IAGlD;IAGA,IAAII,SAAS,GAAGR,QAAQ,CAACI,UAAU,CAAC,CAAC,CAAC;IACtC,IAAIN,OAAO,aAAPA,OAAO,gBAAAQ,cAAA,GAAPR,OAAO,CAAEW,KAAK,cAAAH,cAAA,eAAdA,cAAA,CAAgBI,KAAK,IAAIV,QAAQ,CAACI,UAAU,CAACO,OAAO,CAACb,OAAO,aAAPA,OAAO,wBAAAS,eAAA,GAAPT,OAAO,CAAEW,KAAK,cAAAF,eAAA,uBAAdA,eAAA,CAAgBG,KAAK,CAAC,IAAI,CAAC,EAAE;MAAA,IAAAE,eAAA;MAEpFJ,SAAS,GAAGV,OAAO,aAAPA,OAAO,wBAAAc,eAAA,GAAPd,OAAO,CAAEW,KAAK,cAAAG,eAAA,uBAAdA,eAAA,CAAgBF,KAAK;IACnC;IAGA,MAAMG,SAAS,GAAGb,QAAQ,CAACc,MAAM,CAACN,SAAS,CAAC;IAC5CL,QAAQ,GAAGY,WAAK,CAACC,aAAa,CAACH,SAAS,CAAC;EAM3C;EAEA,OAAOV,QAAQ;AACjB"}
|
package/dist/esm/excel-loader.js
CHANGED
package/dist/excel-worker.js
CHANGED
|
@@ -35954,7 +35954,7 @@
|
|
|
35954
35954
|
}
|
|
35955
35955
|
|
|
35956
35956
|
// src/excel-loader.ts
|
|
35957
|
-
var VERSION = true ? "3.4.
|
|
35957
|
+
var VERSION = true ? "3.4.15" : "latest";
|
|
35958
35958
|
var DEFAULT_EXCEL_LOADER_OPTIONS = {
|
|
35959
35959
|
excel: {
|
|
35960
35960
|
shape: "object-row-table",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/excel",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.15",
|
|
4
4
|
"description": "Framework-independent loader for Excel files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"build-worker": "esbuild src/workers/excel-worker.ts --bundle --outfile=dist/excel-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@loaders.gl/loader-utils": "3.4.
|
|
39
|
-
"@loaders.gl/schema": "3.4.
|
|
38
|
+
"@loaders.gl/loader-utils": "3.4.15",
|
|
39
|
+
"@loaders.gl/schema": "3.4.15",
|
|
40
40
|
"xlsx": "^0.17.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "19e941d5805568e449ef9092490d6568a4853298"
|
|
43
43
|
}
|