Skip to content

Commit

Permalink
Revert "fix(graphite): move to npm package"
Browse files Browse the repository at this point in the history
  • Loading branch information
securedeveloper authored Apr 24, 2018
1 parent 3efc7e2 commit 3d55a67
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 36 deletions.
6 changes: 3 additions & 3 deletions dist/ExcelPlugin/components/ExcelFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var _propTypes2 = _interopRequireDefault(_propTypes);

var _fileSaver = require("file-saver");

var _tempaXlsx = require("tempa-xlsx");
var _xlsx = require("xlsx");

var _tempaXlsx2 = _interopRequireDefault(_tempaXlsx);
var _xlsx2 = _interopRequireDefault(_xlsx);

var _ExcelSheet = require("../elements/ExcelSheet");

Expand Down Expand Up @@ -101,7 +101,7 @@ var ExcelFile = function (_React$Component) {

var fileExtension = this.getFileExtension();
var fileName = this.getFileName();
var wbout = _tempaXlsx2.default.write(wb, { bookType: fileExtension, bookSST: true, type: 'binary' });
var wbout = _xlsx2.default.write(wb, { bookType: fileExtension, bookSST: true, type: 'binary' });

(0, _fileSaver.saveAs)(new Blob([(0, _DataUtil.strToArrBuffer)(wbout)], { type: "application/octet-stream" }), fileName);
}
Expand Down
18 changes: 9 additions & 9 deletions dist/ExcelPlugin/utils/DataUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ exports.excelSheetFromDataSet = exports.excelSheetFromAoA = exports.dateToNumber

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _tempaXlsx = require('tempa-xlsx');
var _xlsx = require('xlsx');

var _tempaXlsx2 = _interopRequireDefault(_tempaXlsx);
var _xlsx2 = _interopRequireDefault(_xlsx);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

Expand Down Expand Up @@ -66,7 +66,7 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet) {

if (columns.length >= 0) {
columns.forEach(function (col, index) {
var cellRef = _tempaXlsx2.default.utils.encode_cell({ c: xSteps + index, r: rowCount });
var cellRef = _xlsx2.default.utils.encode_cell({ c: xSteps + index, r: rowCount });
fixRange(range, 0, 0, rowCount, xSteps, ySteps);
getHeaderCell(col, cellRef, ws);
});
Expand All @@ -76,15 +76,15 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet) {

for (var R = 0; R != data.length; ++R, rowCount++) {
for (var C = 0; C != data[R].length; ++C) {
var cellRef = _tempaXlsx2.default.utils.encode_cell({ c: C + xSteps, r: rowCount });
var cellRef = _xlsx2.default.utils.encode_cell({ c: C + xSteps, r: rowCount });
fixRange(range, R, C, rowCount, xSteps, ySteps);
getCell(data[R][C], cellRef, ws);
}
}
});

if (range.s.c < 10000000) {
ws['!ref'] = _tempaXlsx2.default.utils.encode_range(range);
ws['!ref'] = _xlsx2.default.utils.encode_range(range);
}

return ws;
Expand Down Expand Up @@ -112,7 +112,7 @@ function getCell(v, cellRef, ws) {
cell.t = 'b';
} else if (v instanceof Date) {
cell.t = 'n';
cell.z = _tempaXlsx2.default.SSF._table[14];
cell.z = _xlsx2.default.SSF._table[14];
cell.v = dateToNumber(cell.v);
} else if ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object') {
cell.v = v.value;
Expand Down Expand Up @@ -169,14 +169,14 @@ var excelSheetFromAoA = function excelSheetFromAoA(data) {
continue;
}

var cellRef = _tempaXlsx2.default.utils.encode_cell({ c: C, r: R });
var cellRef = _xlsx2.default.utils.encode_cell({ c: C, r: R });
if (typeof cell.v === 'number') {
cell.t = 'n';
} else if (typeof cell.v === 'boolean') {
cell.t = 'b';
} else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = _tempaXlsx2.default.SSF._table[14];
cell.z = _xlsx2.default.SSF._table[14];
cell.v = dateToNumber(cell.v);
} else {
cell.t = 's';
Expand All @@ -187,7 +187,7 @@ var excelSheetFromAoA = function excelSheetFromAoA(data) {
}

if (range.s.c < 10000000) {
ws['!ref'] = _tempaXlsx2.default.utils.encode_range(range);
ws['!ref'] = _xlsx2.default.utils.encode_range(range);
}

return ws;
Expand Down
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"homepage": "https://github.com/securedeveloper/react-data-export#readme",
"dependencies": {
"file-saver": "1.3.3",
"tempa-xlsx": "0.0.1",
"xlsx": "git+https://github.com/securedeveloper/js-xlsx.git"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/ExcelPlugin/components/ExcelFile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import {saveAs} from "file-saver";
import XLSX from "tempa-xlsx";
import XLSX from "xlsx";

import ExcelSheet from "../elements/ExcelSheet";
import {strToArrBuffer, excelSheetFromAoA, excelSheetFromDataSet} from "../utils/DataUtil";
Expand Down
2 changes: 1 addition & 1 deletion src/ExcelPlugin/utils/DataUtil.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import XLSX from "tempa-xlsx";
import XLSX from "xlsx";

const strToArrBuffer = (s) => {
var buf = new ArrayBuffer(s.length);
Expand Down

0 comments on commit 3d55a67

Please sign in to comment.