@loaders.gl/excel 3.1.0-beta.7 → 3.1.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
- const moduleExports = require('./index');
3
+ var 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,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"}
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"}
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports._typecheckLoader = exports.ExcelLoader = void 0;
7
- const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : 'latest';
8
- const DEFAULT_EXCEL_LOADER_OPTIONS = {
7
+ var VERSION = typeof "3.1.3" !== 'undefined' ? "3.1.3" : 'latest';
8
+ var DEFAULT_EXCEL_LOADER_OPTIONS = {
9
9
  excel: {
10
10
  shape: 'object-row-table',
11
11
  sheet: undefined
12
12
  }
13
13
  };
14
- const ExcelLoader = {
14
+ var ExcelLoader = {
15
15
  name: 'Excel',
16
16
  id: 'excel',
17
17
  module: 'excel',
@@ -24,6 +24,6 @@ const ExcelLoader = {
24
24
  options: DEFAULT_EXCEL_LOADER_OPTIONS
25
25
  };
26
26
  exports.ExcelLoader = ExcelLoader;
27
- const _typecheckLoader = ExcelLoader;
27
+ var _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,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"}
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,mBAAuB,WAAvB,aAAmD,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"}
package/dist/es5/index.js CHANGED
@@ -1,24 +1,35 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  Object.defineProperty(exports, "ExcelWorkerLoader", {
7
9
  enumerable: true,
8
- get: function () {
10
+ get: function get() {
9
11
  return _excelLoader.ExcelLoader;
10
12
  }
11
13
  });
12
14
  exports._typecheckLoader = exports.ExcelLoader = void 0;
13
15
 
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+
14
18
  var _excelLoader = require("./excel-loader");
15
19
 
16
20
  var _parseExcel = require("./lib/parse-excel");
17
21
 
18
- const ExcelLoader = { ..._excelLoader.ExcelLoader,
19
- parse: (arrayBuffer, options) => (0, _parseExcel.parseExcel)(arrayBuffer, options)
20
- };
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
+
21
32
  exports.ExcelLoader = ExcelLoader;
22
- const _typecheckLoader = ExcelLoader;
33
+ var _typecheckLoader = ExcelLoader;
23
34
  exports._typecheckLoader = _typecheckLoader;
24
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"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,41 +1,63 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.parseExcel = parseExcel;
7
9
 
8
- var _xlsx = require("xlsx");
9
-
10
- const dataTableNamesMap = {};
11
-
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] = [];
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
19
11
 
20
- if (workbook.SheetNames.length > 0) {
21
- var _options$excel, _options$excel2;
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
22
13
 
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;
14
+ var _xlsx = require("xlsx");
31
15
 
32
- sheetName = options === null || options === void 0 ? void 0 : (_options$excel3 = options.excel) === null || _options$excel3 === void 0 ? void 0 : _options$excel3.sheet;
33
- }
16
+ var dataTableNamesMap = {};
34
17
 
35
- const worksheet = workbook.Sheets[sheetName];
36
- dataRows = _xlsx.utils.sheet_to_json(worksheet);
37
- }
18
+ function parseExcel(_x, _x2) {
19
+ return _parseExcel.apply(this, arguments);
20
+ }
38
21
 
39
- return dataRows;
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);
40
62
  }
41
63
  //# 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,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
+ {"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,4 +1,4 @@
1
- const VERSION = typeof "3.1.0-beta.7" !== 'undefined' ? "3.1.0-beta.7" : 'latest';
1
+ const VERSION = typeof "3.1.3" !== 'undefined' ? "3.1.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,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"}
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,mBAAuB,WAAvB,aAAmD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/excel",
3
- "version": "3.1.0-beta.7",
3
+ "version": "3.1.3",
4
4
  "description": "Framework-independent loader for Excel files",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -31,13 +31,13 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "pre-build": "npm run build-bundle && npm run build-worker",
34
- "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js",
34
+ "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js",
35
35
  "build-worker": "esbuild src/workers/excel-worker.ts --bundle --outfile=dist/excel-worker.js"
36
36
  },
37
37
  "dependencies": {
38
- "@loaders.gl/loader-utils": "3.1.0-beta.7",
39
- "@loaders.gl/schema": "3.1.0-beta.7",
38
+ "@loaders.gl/loader-utils": "3.1.3",
39
+ "@loaders.gl/schema": "3.1.3",
40
40
  "xlsx": "^0.17.0"
41
41
  },
42
- "gitHead": "f3b4d81ac02758398c4e4eef5e556b206ef2dfbe"
42
+ "gitHead": "4a690c369779346d73c9a27395d1c08d77d279a4"
43
43
  }