Skip to content

Commit

Permalink
Merge pull request #80 from securedeveloper/issues-fixes
Browse files Browse the repository at this point in the history
fixes of issues
  • Loading branch information
securedeveloper authored Sep 24, 2018
2 parents d65eeb3 + 0144afc commit 32f76ee
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 13 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 _xlsx = require("xlsx");
var _tempaXlsx = require("tempa-xlsx");

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

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 = _xlsx2.default.write(wb, { bookType: fileExtension, bookSST: true, type: 'binary' });
var wbout = _tempaXlsx2.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 _xlsx = require('xlsx');
var _tempaXlsx = require('tempa-xlsx');

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

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

Expand Down Expand Up @@ -67,7 +67,7 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet) {
var columnsWidth = [];
if (columns.length >= 0) {
columns.forEach(function (col, index) {
var cellRef = _xlsx2.default.utils.encode_cell({ c: xSteps + index, r: rowCount });
var cellRef = _tempaXlsx2.default.utils.encode_cell({ c: xSteps + index, r: rowCount });
fixRange(range, 0, 0, rowCount, xSteps, ySteps);
var colTitle = col;
if ((typeof col === 'undefined' ? 'undefined' : _typeof(col)) === 'object') {
Expand All @@ -86,15 +86,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 = _xlsx2.default.utils.encode_cell({ c: C + xSteps, r: rowCount });
var cellRef = _tempaXlsx2.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'] = _xlsx2.default.utils.encode_range(range);
ws['!ref'] = _tempaXlsx2.default.utils.encode_range(range);
}

return ws;
Expand Down Expand Up @@ -129,7 +129,7 @@ function getCell(v, cellRef, ws) {
cell.t = 'b';
} else if (isDate) {
cell.t = 'n';
cell.z = _xlsx2.default.SSF._table[14];
cell.z = _tempaXlsx2.default.SSF._table[14];
cell.v = dateToNumber(cell.v);
} else {
cell.t = 's';
Expand Down Expand Up @@ -182,14 +182,14 @@ var excelSheetFromAoA = function excelSheetFromAoA(data) {
continue;
}

var cellRef = _xlsx2.default.utils.encode_cell({ c: C, r: R });
var cellRef = _tempaXlsx2.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 = _xlsx2.default.SSF._table[14];
cell.z = _tempaXlsx2.default.SSF._table[14];
cell.v = dateToNumber(cell.v);
} else {
cell.t = 's';
Expand All @@ -200,7 +200,7 @@ var excelSheetFromAoA = function excelSheetFromAoA(data) {
}

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

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

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"prop-types": "15.6.0",
"react": "16.0.0",
"react-dom": "16.0.0",
"standard-version": "^4.4.0"
"standard-version": "^4.4.0",
"xlsx": "^0.14.0"
},
"scripts": {
"commitmsg": "commitlint -e $GIT_PARAMS",
Expand Down

0 comments on commit 32f76ee

Please sign in to comment.