@loaders.gl/excel 3.4.14 → 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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var moduleExports = require('./index');
3
+ const moduleExports = require('./index');
4
4
  globalThis.loaders = globalThis.loaders || {};
5
5
  module.exports = Object.assign(globalThis.loaders, moduleExports);
6
6
  //# sourceMappingURL=bundle.js.map
@@ -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,IAAMA,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"}
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"}
@@ -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.4.14" !== 'undefined' ? "3.4.14" : 'latest';
8
- var DEFAULT_EXCEL_LOADER_OPTIONS = {
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
- 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,"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,IAAMA,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAS3E,IAAMC,4BAAgD,GAAG;EACvDC,KAAK,EAAE;IACLC,KAAK,EAAE,kBAAkB;IACzBC,KAAK,EAAEC;EACT;AACF,CAAC;AAKM,IAAMC,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,IAAMY,gBAAwB,GAAGZ,WAAW;AAACW,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
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 get() {
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
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
- var ExcelLoader = _objectSpread(_objectSpread({}, _excelLoader.ExcelLoader), {}, {
21
- parse: function parse(arrayBuffer, options) {
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
- var _typecheckLoader = ExcelLoader;
21
+ const _typecheckLoader = ExcelLoader;
27
22
  exports._typecheckLoader = _typecheckLoader;
28
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_excelLoader","require","_parseExcel","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","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;AAA6C,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB,MAAA,CAAAoB,gBAAA,CAAAV,MAAA,EAAAV,MAAA,CAAAmB,yBAAA,CAAAL,MAAA,KAAAlB,OAAA,CAAAI,MAAA,CAAAc,MAAA,GAAAC,OAAA,WAAAC,GAAA,IAAAhB,MAAA,CAAAqB,cAAA,CAAAX,MAAA,EAAAM,GAAA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAUtC,IAAMY,WAAW,GAAAb,aAAA,CAAAA,aAAA,KACnBc,wBAAiB;EACpBC,KAAK,EAAE,SAAAA,MAACC,WAAwB,EAAEC,OAA4B;IAAA,OAC5D,IAAAC,sBAAU,EAACF,WAAW,EAAEC,OAAO,CAAC;EAAA;AAAA,EACnC;AAACE,OAAA,CAAAN,WAAA,GAAAA,WAAA;AAEK,IAAMO,gBAAkC,GAAGP,WAAW;AAACM,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
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
- var dataTableNamesMap = {};
12
- function parseExcel(_x, _x2) {
13
- return _parseExcel.apply(this, arguments);
14
- }
15
- function _parseExcel() {
16
- _parseExcel = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
17
- var dataUrl, workbook, dataRows, _options$excel, _options$excel2, sheetName, _options$excel3, worksheet;
18
- return _regenerator.default.wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- dataUrl = 'dummy';
22
- workbook = (0, _xlsx.read)(arrayBuffer, {
23
- type: 'array'
24
- });
25
- dataRows = [];
26
- dataTableNamesMap[dataUrl] = [];
27
- if (workbook.SheetNames.length > 0) {
28
- if (workbook.SheetNames.length > 1) {
29
- dataTableNamesMap[dataUrl] = workbook.SheetNames;
30
- }
31
- sheetName = workbook.SheetNames[0];
32
- 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) {
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","_x","_x2","_parseExcel","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","options","dataUrl","workbook","dataRows","_options$excel","_options$excel2","sheetName","_options$excel3","worksheet","wrap","_callee$","_context","prev","next","read","type","SheetNames","length","excel","sheet","indexOf","Sheets","utils","sheet_to_json","abrupt","stop"],"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,IAAMC,iBAAiB,GAAG,CAAC,CAAC;AAAC,SAOPC,UAAUA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,WAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,YAAA;EAAAA,WAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAzB,SAAAC,QAA0BC,WAAwB,EAAEC,OAA4B;IAAA,IAAAC,OAAA,EAAAC,QAAA,EAAAC,QAAA,EAAAC,cAAA,EAAAC,eAAA,EAAAC,SAAA,EAAAC,eAAA,EAAAC,SAAA;IAAA,OAAAZ,YAAA,CAAAD,OAAA,CAAAc,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAC/EZ,OAAO,GAAG,OAAO;UAIjBC,QAAQ,GAAG,IAAAY,UAAI,EAACf,WAAW,EAAE;YACjCgB,IAAI,EAAE;UAER,CAAC,CAAC;UAGEZ,QAAQ,GAAG,EAAE;UACjBhB,iBAAiB,CAACc,OAAO,CAAC,GAAG,EAAE;UAC/B,IAAIC,QAAQ,CAACc,UAAU,CAACC,MAAM,GAAG,CAAC,EAAE;YAClC,IAAIf,QAAQ,CAACc,UAAU,CAACC,MAAM,GAAG,CAAC,EAAE;cAElC9B,iBAAiB,CAACc,OAAO,CAAC,GAAGC,QAAQ,CAACc,UAAU;YAGlD;YAGIV,SAAS,GAAGJ,QAAQ,CAACc,UAAU,CAAC,CAAC,CAAC;YACtC,IAAIhB,OAAO,aAAPA,OAAO,gBAAAI,cAAA,GAAPJ,OAAO,CAAEkB,KAAK,cAAAd,cAAA,eAAdA,cAAA,CAAgBe,KAAK,IAAIjB,QAAQ,CAACc,UAAU,CAACI,OAAO,CAACpB,OAAO,aAAPA,OAAO,wBAAAK,eAAA,GAAPL,OAAO,CAAEkB,KAAK,cAAAb,eAAA,uBAAdA,eAAA,CAAgBc,KAAK,CAAC,IAAI,CAAC,EAAE;cAEpFb,SAAS,GAAGN,OAAO,aAAPA,OAAO,wBAAAO,eAAA,GAAPP,OAAO,CAAEkB,KAAK,cAAAX,eAAA,uBAAdA,eAAA,CAAgBY,KAAK;YACnC;YAGMX,SAAS,GAAGN,QAAQ,CAACmB,MAAM,CAACf,SAAS,CAAC;YAC5CH,QAAQ,GAAGmB,WAAK,CAACC,aAAa,CAACf,SAAS,CAAC;UAM3C;UAAC,OAAAG,QAAA,CAAAa,MAAA,WAEMrB,QAAQ;QAAA;QAAA;UAAA,OAAAQ,QAAA,CAAAc,IAAA;MAAA;IAAA,GAAA3B,OAAA;EAAA,CAChB;EAAA,OAAAP,WAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
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"}
@@ -1,4 +1,4 @@
1
- const VERSION = typeof "3.4.14" !== 'undefined' ? "3.4.14" : 'latest';
1
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
2
2
  const DEFAULT_EXCEL_LOADER_OPTIONS = {
3
3
  excel: {
4
4
  shape: 'object-row-table',
@@ -35954,7 +35954,7 @@
35954
35954
  }
35955
35955
 
35956
35956
  // src/excel-loader.ts
35957
- var VERSION = true ? "3.4.14" : "latest";
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.14",
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.14",
39
- "@loaders.gl/schema": "3.4.14",
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": "dffa197c6ae79bac5277d5e8a132f4cd274e74e5"
42
+ "gitHead": "19e941d5805568e449ef9092490d6568a4853298"
43
43
  }