@loaders.gl/excel 3.1.0-alpha.4 → 3.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var moduleExports = require('./index');
3
+ const moduleExports = require('./index');
4
4
 
5
5
  globalThis.loaders = globalThis.loaders || {};
6
6
  module.exports = Object.assign(globalThis.loaders, moduleExports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
1
+ {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports._typecheckLoader = exports.ExcelLoader = void 0;
7
- var VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
8
- var DEFAULT_EXCEL_LOADER_OPTIONS = {
7
+ const VERSION = typeof "3.1.0-beta.3" !== 'undefined' ? "3.1.0-beta.3" : '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
- var ExcelLoader = {
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
- var _typecheckLoader = ExcelLoader;
27
+ const _typecheckLoader = ExcelLoader;
28
28
  exports._typecheckLoader = _typecheckLoader;
29
29
  //# sourceMappingURL=excel-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/excel-loader.ts"],"names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","_typecheckLoader"],"mappings":";;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AASA,IAAMC,4BAAgD,GAAG;AACvDC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,kBADF;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADgD,CAAzD;AAUO,IAAMC,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,EAAE,EAAE,OAFqB;AAGzBC,EAAAA,MAAM,EAAE,OAHiB;AAIzBC,EAAAA,OAAO,EAAEV,OAJgB;AAKzBW,EAAAA,MAAM,EAAE,IALiB;AAMzBC,EAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,MAAR,EAAgB,MAAhB,EAAwB,MAAxB,CANa;AAOzBC,EAAAA,SAAS,EAAE,CACT,mEADS,EAET,0BAFS,CAPc;AAWzBC,EAAAA,QAAQ,EAAE,OAXe;AAYzBC,EAAAA,MAAM,EAAE,IAZiB;AAazBC,EAAAA,OAAO,EAAEf;AAbgB,CAApB;;AAgBA,IAAMgB,gBAAwB,GAAGX,WAAjC","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"],"file":"excel-loader.js"}
1
+ {"version":3,"sources":["../../src/excel-loader.ts"],"names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","_typecheckLoader"],"mappings":";;;;;;AAIA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AASA,MAAMC,4BAAgD,GAAG;AACvDC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,kBADF;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADgD,CAAzD;AAUO,MAAMC,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,EAAE,EAAE,OAFqB;AAGzBC,EAAAA,MAAM,EAAE,OAHiB;AAIzBC,EAAAA,OAAO,EAAEV,OAJgB;AAKzBW,EAAAA,MAAM,EAAE,IALiB;AAMzBC,EAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,MAAR,EAAgB,MAAhB,EAAwB,MAAxB,CANa;AAOzBC,EAAAA,SAAS,EAAE,CACT,mEADS,EAET,0BAFS,CAPc;AAWzBC,EAAAA,QAAQ,EAAE,OAXe;AAYzBC,EAAAA,MAAM,EAAE,IAZiB;AAazBC,EAAAA,OAAO,EAAEf;AAbgB,CAApB;;AAgBA,MAAMgB,gBAAwB,GAAGX,WAAjC","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"],"file":"excel-loader.js"}
package/dist/es5/index.js CHANGED
@@ -1,35 +1,24 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  Object.defineProperty(exports, "ExcelWorkerLoader", {
9
7
  enumerable: true,
10
- get: function get() {
8
+ get: function () {
11
9
  return _excelLoader.ExcelLoader;
12
10
  }
13
11
  });
14
12
  exports._typecheckLoader = exports.ExcelLoader = void 0;
15
13
 
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
14
  var _excelLoader = require("./excel-loader");
19
15
 
20
16
  var _parseExcel = require("./lib/parse-excel");
21
17
 
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
-
26
- var ExcelLoader = _objectSpread(_objectSpread({}, _excelLoader.ExcelLoader), {}, {
27
- parse: function parse(arrayBuffer, options) {
28
- return (0, _parseExcel.parseExcel)(arrayBuffer, options);
29
- }
30
- });
31
-
18
+ const ExcelLoader = { ..._excelLoader.ExcelLoader,
19
+ parse: (arrayBuffer, options) => (0, _parseExcel.parseExcel)(arrayBuffer, options)
20
+ };
32
21
  exports.ExcelLoader = ExcelLoader;
33
- var _typecheckLoader = ExcelLoader;
22
+ const _typecheckLoader = ExcelLoader;
34
23
  exports._typecheckLoader = _typecheckLoader;
35
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":["ExcelLoader","ExcelWorkerLoader","parse","arrayBuffer","options","_typecheckLoader"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;;;;;AAUO,IAAMA,WAAW,mCACnBC,wBADmB;AAEtBC,EAAAA,KAAK,EAAE,eAACC,WAAD,EAA2BC,OAA3B;AAAA,WACL,4BAAWD,WAAX,EAAwBC,OAAxB,CADK;AAAA;AAFe,EAAjB;;;AAMA,IAAMC,gBAAkC,GAAGL,WAA3C","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"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":["ExcelLoader","ExcelWorkerLoader","parse","arrayBuffer","options","_typecheckLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAUO,MAAMA,WAAW,GAAG,EACzB,GAAGC,wBADsB;AAEzBC,EAAAA,KAAK,EAAE,CAACC,WAAD,EAA2BC,OAA3B,KACL,4BAAWD,WAAX,EAAwBC,OAAxB;AAHuB,CAApB;;AAMA,MAAMC,gBAAkC,GAAGL,WAA3C","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"],"file":"index.js"}
@@ -1,63 +1,41 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.parseExcel = parseExcel;
9
7
 
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
+ var _xlsx = require("xlsx");
11
9
 
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ const dataTableNamesMap = {};
13
11
 
14
- var _xlsx = require("xlsx");
12
+ async function parseExcel(arrayBuffer, options) {
13
+ const dataUrl = 'dummy';
14
+ const workbook = (0, _xlsx.read)(arrayBuffer, {
15
+ type: 'array'
16
+ });
17
+ let dataRows = [];
18
+ dataTableNamesMap[dataUrl] = [];
15
19
 
16
- var dataTableNamesMap = {};
20
+ if (workbook.SheetNames.length > 0) {
21
+ var _options$excel, _options$excel2;
17
22
 
18
- function parseExcel(_x, _x2) {
19
- return _parseExcel.apply(this, arguments);
20
- }
23
+ if (workbook.SheetNames.length > 1) {
24
+ dataTableNamesMap[dataUrl] = workbook.SheetNames;
25
+ }
26
+
27
+ let sheetName = workbook.SheetNames[0];
28
+
29
+ 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) {
30
+ var _options$excel3;
31
+
32
+ sheetName = options === null || options === void 0 ? void 0 : (_options$excel3 = options.excel) === null || _options$excel3 === void 0 ? void 0 : _options$excel3.sheet;
33
+ }
34
+
35
+ const worksheet = workbook.Sheets[sheetName];
36
+ dataRows = _xlsx.utils.sheet_to_json(worksheet);
37
+ }
21
38
 
22
- function _parseExcel() {
23
- _parseExcel = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
24
- var dataUrl, workbook, dataRows, _options$excel, _options$excel2, sheetName, _options$excel3, worksheet;
25
-
26
- return _regenerator.default.wrap(function _callee$(_context) {
27
- while (1) {
28
- switch (_context.prev = _context.next) {
29
- case 0:
30
- dataUrl = 'dummy';
31
- workbook = (0, _xlsx.read)(arrayBuffer, {
32
- type: 'array'
33
- });
34
- dataRows = [];
35
- dataTableNamesMap[dataUrl] = [];
36
-
37
- if (workbook.SheetNames.length > 0) {
38
- if (workbook.SheetNames.length > 1) {
39
- dataTableNamesMap[dataUrl] = workbook.SheetNames;
40
- }
41
-
42
- sheetName = workbook.SheetNames[0];
43
-
44
- 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) {
45
- sheetName = options === null || options === void 0 ? void 0 : (_options$excel3 = options.excel) === null || _options$excel3 === void 0 ? void 0 : _options$excel3.sheet;
46
- }
47
-
48
- worksheet = workbook.Sheets[sheetName];
49
- dataRows = _xlsx.utils.sheet_to_json(worksheet);
50
- }
51
-
52
- return _context.abrupt("return", dataRows);
53
-
54
- case 6:
55
- case "end":
56
- return _context.stop();
57
- }
58
- }
59
- }, _callee);
60
- }));
61
- return _parseExcel.apply(this, arguments);
39
+ return dataRows;
62
40
  }
63
41
  //# sourceMappingURL=parse-excel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/parse-excel.ts"],"names":["dataTableNamesMap","parseExcel","arrayBuffer","options","dataUrl","workbook","type","dataRows","SheetNames","length","sheetName","excel","sheet","indexOf","worksheet","Sheets","utils","sheet_to_json"],"mappings":";;;;;;;;;;;;;AACA;;AAIA,IAAMA,iBAAiB,GAAG,EAA1B;;SAOsBC,U;;;;;0EAAf,iBAA0BC,WAA1B,EAAoDC,OAApD;AAAA;;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,OADD,GACW,OADX;AAKCC,YAAAA,QALD,GAKY,gBAAKH,WAAL,EAAkB;AACjCI,cAAAA,IAAI,EAAE;AAD2B,aAAlB,CALZ;AAWDC,YAAAA,QAXC,GAWU,EAXV;AAYLP,YAAAA,iBAAiB,CAACI,OAAD,CAAjB,GAA6B,EAA7B;;AACA,gBAAIC,QAAQ,CAACG,UAAT,CAAoBC,MAApB,GAA6B,CAAjC,EAAoC;AAClC,kBAAIJ,QAAQ,CAACG,UAAT,CAAoBC,MAApB,GAA6B,CAAjC,EAAoC;AAElCT,gBAAAA,iBAAiB,CAACI,OAAD,CAAjB,GAA6BC,QAAQ,CAACG,UAAtC;AAGD;;AAGGE,cAAAA,SAT8B,GASlBL,QAAQ,CAACG,UAAT,CAAoB,CAApB,CATkB;;AAUlC,kBAAIL,OAAO,SAAP,IAAAA,OAAO,WAAP,sBAAAA,OAAO,CAAEQ,KAAT,0DAAgBC,KAAhB,IAAyBP,QAAQ,CAACG,UAAT,CAAoBK,OAApB,CAA4BV,OAA5B,aAA4BA,OAA5B,0CAA4BA,OAAO,CAAEQ,KAArC,oDAA4B,gBAAgBC,KAA5C,KAAsD,CAAnF,EAAsF;AAEpFF,gBAAAA,SAAS,GAAGP,OAAH,aAAGA,OAAH,0CAAGA,OAAO,CAAEQ,KAAZ,oDAAG,gBAAgBC,KAA5B;AACD;;AAGKE,cAAAA,SAhB4B,GAgBhBT,QAAQ,CAACU,MAAT,CAAgBL,SAAhB,CAhBgB;AAiBlCH,cAAAA,QAAQ,GAAGS,YAAMC,aAAN,CAAoBH,SAApB,CAAX;AAMD;;AApCI,6CAsCEP,QAtCF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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"],"file":"parse-excel.js"}
1
+ {"version":3,"sources":["../../../src/lib/parse-excel.ts"],"names":["dataTableNamesMap","parseExcel","arrayBuffer","options","dataUrl","workbook","type","dataRows","SheetNames","length","sheetName","excel","sheet","indexOf","worksheet","Sheets","utils","sheet_to_json"],"mappings":";;;;;;;AACA;;AAIA,MAAMA,iBAAiB,GAAG,EAA1B;;AAOO,eAAeC,UAAf,CAA0BC,WAA1B,EAAoDC,OAApD,EAAkF;AACvF,QAAMC,OAAO,GAAG,OAAhB;AAIA,QAAMC,QAAQ,GAAG,gBAAKH,WAAL,EAAkB;AACjCI,IAAAA,IAAI,EAAE;AAD2B,GAAlB,CAAjB;AAMA,MAAIC,QAAQ,GAAG,EAAf;AACAP,EAAAA,iBAAiB,CAACI,OAAD,CAAjB,GAA6B,EAA7B;;AACA,MAAIC,QAAQ,CAACG,UAAT,CAAoBC,MAApB,GAA6B,CAAjC,EAAoC;AAAA;;AAClC,QAAIJ,QAAQ,CAACG,UAAT,CAAoBC,MAApB,GAA6B,CAAjC,EAAoC;AAElCT,MAAAA,iBAAiB,CAACI,OAAD,CAAjB,GAA6BC,QAAQ,CAACG,UAAtC;AAGD;;AAGD,QAAIE,SAAS,GAAGL,QAAQ,CAACG,UAAT,CAAoB,CAApB,CAAhB;;AACA,QAAIL,OAAO,SAAP,IAAAA,OAAO,WAAP,sBAAAA,OAAO,CAAEQ,KAAT,0DAAgBC,KAAhB,IAAyBP,QAAQ,CAACG,UAAT,CAAoBK,OAApB,CAA4BV,OAA5B,aAA4BA,OAA5B,0CAA4BA,OAAO,CAAEQ,KAArC,oDAA4B,gBAAgBC,KAA5C,KAAsD,CAAnF,EAAsF;AAAA;;AAEpFF,MAAAA,SAAS,GAAGP,OAAH,aAAGA,OAAH,0CAAGA,OAAO,CAAEQ,KAAZ,oDAAG,gBAAgBC,KAA5B;AACD;;AAGD,UAAME,SAAS,GAAGT,QAAQ,CAACU,MAAT,CAAgBL,SAAhB,CAAlB;AACAH,IAAAA,QAAQ,GAAGS,YAAMC,aAAN,CAAoBH,SAApB,CAAX;AAMD;;AAED,SAAOP,QAAP;AACD","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"],"file":"parse-excel.js"}
@@ -1,4 +1,4 @@
1
- const VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
1
+ const VERSION = typeof "3.1.0-beta.3" !== 'undefined' ? "3.1.0-beta.3" : 'latest';
2
2
  const DEFAULT_EXCEL_LOADER_OPTIONS = {
3
3
  excel: {
4
4
  shape: 'object-row-table',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/excel-loader.ts"],"names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","_typecheckLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AASA,MAAMC,4BAAgD,GAAG;AACvDC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,kBADF;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADgD,CAAzD;AAUA,OAAO,MAAMC,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,EAAE,EAAE,OAFqB;AAGzBC,EAAAA,MAAM,EAAE,OAHiB;AAIzBC,EAAAA,OAAO,EAAEV,OAJgB;AAKzBW,EAAAA,MAAM,EAAE,IALiB;AAMzBC,EAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,MAAR,EAAgB,MAAhB,EAAwB,MAAxB,CANa;AAOzBC,EAAAA,SAAS,EAAE,CACT,mEADS,EAET,0BAFS,CAPc;AAWzBC,EAAAA,QAAQ,EAAE,OAXe;AAYzBC,EAAAA,MAAM,EAAE,IAZiB;AAazBC,EAAAA,OAAO,EAAEf;AAbgB,CAApB;AAgBP,OAAO,MAAMgB,gBAAwB,GAAGX,WAAjC","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"],"file":"excel-loader.js"}
1
+ {"version":3,"sources":["../../src/excel-loader.ts"],"names":["VERSION","DEFAULT_EXCEL_LOADER_OPTIONS","excel","shape","sheet","undefined","ExcelLoader","name","id","module","version","worker","extensions","mimeTypes","category","binary","options","_typecheckLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AASA,MAAMC,4BAAgD,GAAG;AACvDC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,kBADF;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADgD,CAAzD;AAUA,OAAO,MAAMC,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,EAAE,EAAE,OAFqB;AAGzBC,EAAAA,MAAM,EAAE,OAHiB;AAIzBC,EAAAA,OAAO,EAAEV,OAJgB;AAKzBW,EAAAA,MAAM,EAAE,IALiB;AAMzBC,EAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,MAAR,EAAgB,MAAhB,EAAwB,MAAxB,CANa;AAOzBC,EAAAA,SAAS,EAAE,CACT,mEADS,EAET,0BAFS,CAPc;AAWzBC,EAAAA,QAAQ,EAAE,OAXe;AAYzBC,EAAAA,MAAM,EAAE,IAZiB;AAazBC,EAAAA,OAAO,EAAEf;AAbgB,CAApB;AAgBP,OAAO,MAAMgB,gBAAwB,GAAGX,WAAjC","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"],"file":"excel-loader.js"}
@@ -0,0 +1,24 @@
1
+ import type { Loader, LoaderOptions } from '@loaders.gl/loader-utils';
2
+ export declare type ExcelLoaderOptions = LoaderOptions & {
3
+ excel?: {
4
+ shape: 'object-row-table';
5
+ sheet?: string;
6
+ };
7
+ };
8
+ /**
9
+ * Worker Loader for Excel files
10
+ */
11
+ export declare const ExcelLoader: {
12
+ name: string;
13
+ id: string;
14
+ module: string;
15
+ version: any;
16
+ worker: boolean;
17
+ extensions: string[];
18
+ mimeTypes: string[];
19
+ category: string;
20
+ binary: boolean;
21
+ options: ExcelLoaderOptions;
22
+ };
23
+ export declare const _typecheckLoader: Loader;
24
+ //# sourceMappingURL=excel-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAMpE,oBAAY,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAA4B,kBAAkB,CAAC;QACpD,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AASF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;CAcvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAoB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._typecheckLoader = exports.ExcelLoader = void 0;
4
+ // __VERSION__ is injected by babel-plugin-version-inline
5
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
7
+ const DEFAULT_EXCEL_LOADER_OPTIONS = {
8
+ excel: {
9
+ shape: 'object-row-table',
10
+ sheet: undefined // Load default Sheet
11
+ }
12
+ };
13
+ /**
14
+ * Worker Loader for Excel files
15
+ */
16
+ exports.ExcelLoader = {
17
+ name: 'Excel',
18
+ id: 'excel',
19
+ module: 'excel',
20
+ version: VERSION,
21
+ worker: true,
22
+ extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],
23
+ mimeTypes: [
24
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
25
+ 'application/vnd.ms-excel'
26
+ ],
27
+ category: 'table',
28
+ binary: true,
29
+ options: DEFAULT_EXCEL_LOADER_OPTIONS
30
+ };
31
+ exports._typecheckLoader = exports.ExcelLoader;