Comparing version 3.9.0 to 3.10.0
@@ -139,3 +139,3 @@ "use strict"; | ||
var worksheet = this.workbook.addWorksheet(options.sheetName); | ||
var dateFormats = options.dateFormats || ['YYYY-MM-DD[T]HH:mm:ss', 'MM-DD-YYYY', 'YYYY-MM-DD']; | ||
var dateFormats = options.dateFormats || ['YYYY-MM-DD[T]HH:mm:ssZ', 'YYYY-MM-DD[T]HH:mm:ss', 'MM-DD-YYYY', 'YYYY-MM-DD']; | ||
@@ -142,0 +142,0 @@ var map = options.map || function (datum) { |
@@ -11,2 +11,4 @@ "use strict"; | ||
var _ = require('../utils/under-dash'); | ||
var Note = /*#__PURE__*/function () { | ||
@@ -22,5 +24,7 @@ function Note(note) { | ||
get: function get() { | ||
var value = null; | ||
switch (_typeof(this.note)) { | ||
case 'string': | ||
return { | ||
value = { | ||
type: 'note', | ||
@@ -33,12 +37,16 @@ note: { | ||
}; | ||
break; | ||
default: | ||
return { | ||
value = { | ||
type: 'note', | ||
note: this.note | ||
}; | ||
} | ||
break; | ||
} // Suitable for all cell comments | ||
return _.deepMerge({}, Note.DEFAULT_CONFIGS, value); | ||
}, | ||
set: function set(value) { | ||
// convenience - simplify unstyled notes | ||
var note = value.note; | ||
@@ -65,3 +73,16 @@ var texts = note.texts; | ||
Note.DEFAULT_CONFIGS = { | ||
note: { | ||
margins: { | ||
insetmode: 'auto', | ||
inset: [0.13, 0.13, 0.25, 0.25] | ||
}, | ||
protection: { | ||
locked: 'True', | ||
lockText: 'True' | ||
}, | ||
editAs: 'absolute' | ||
} | ||
}; | ||
module.exports = Note; | ||
//# sourceMappingURL=note.js.map |
@@ -13,3 +13,3 @@ 'use strict'; | ||
var colCache = require('./../utils/col-cache'); | ||
var colCache = require('../utils/col-cache'); | ||
@@ -91,4 +91,8 @@ var Cell = require('./cell'); | ||
value: function splice(start, count) { | ||
var inserts = Array.prototype.slice.call(arguments, 2); | ||
var nKeep = start + count; | ||
for (var _len = arguments.length, inserts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
inserts[_key - 2] = arguments[_key]; | ||
} | ||
var nExpand = inserts.length - count; | ||
@@ -95,0 +99,0 @@ var nEnd = this._cells.length; |
@@ -23,3 +23,3 @@ "use strict"; | ||
var colCache = require('./../utils/col-cache'); | ||
var colCache = require('../utils/col-cache'); | ||
@@ -109,3 +109,3 @@ var Range = require('./range'); | ||
}, options.pageSetup); | ||
this.headerFooter = { | ||
this.headerFooter = Object.assign({}, { | ||
differentFirst: false, | ||
@@ -119,3 +119,3 @@ differentOddEven: false, | ||
firstFooter: null | ||
}; | ||
}, options.headerFooter); | ||
this.dataValidations = new DataValidations(); // for freezepanes, split, zoom, gridlines, etc | ||
@@ -192,7 +192,9 @@ | ||
// each member of inserts is a column of data. | ||
var inserts = Array.prototype.slice.call(arguments, 2); | ||
var rows = this._rows; | ||
var nRows = rows.length; | ||
for (var _len = arguments.length, inserts = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
inserts[_key - 2] = arguments[_key]; | ||
} | ||
if (inserts.length > 0) { | ||
@@ -321,4 +323,8 @@ var _loop = function _loop(i) { | ||
// same problem as row.splice, except worse. | ||
var inserts = Array.prototype.slice.call(arguments, 2); | ||
var nKeep = start + count; | ||
for (var _len2 = arguments.length, inserts = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
inserts[_key2 - 2] = arguments[_key2]; | ||
} | ||
var nExpand = inserts.length - count; | ||
@@ -449,4 +455,8 @@ var nEnd = this._rows.length; | ||
value: function mergeCells() { | ||
var dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
for (var _len3 = arguments.length, cells = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
cells[_key3] = arguments[_key3]; | ||
} | ||
var dimensions = new Range(cells); | ||
this._mergeCellsInternal(dimensions); | ||
@@ -457,4 +467,8 @@ } | ||
value: function mergeCellsWithoutStyle() { | ||
var dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
for (var _len4 = arguments.length, cells = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
cells[_key4] = arguments[_key4]; | ||
} | ||
var dimensions = new Range(cells); | ||
this._mergeCellsInternal(dimensions, true); | ||
@@ -509,5 +523,8 @@ } | ||
value: function unMergeCells() { | ||
var dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
// find any cells in that range and unmerge them | ||
for (var _len5 = arguments.length, cells = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
cells[_key5] = arguments[_key5]; | ||
} | ||
var dimensions = new Range(cells); // find any cells in that range and unmerge them | ||
for (var i = dimensions.top; i <= dimensions.bottom; i++) { | ||
@@ -555,2 +572,3 @@ for (var j = dimensions.left; j <= dimensions.right; j++) { | ||
} else { | ||
// eslint-disable-next-line no-mixed-operators | ||
getResult = function getResult(row, col) { | ||
@@ -642,3 +660,3 @@ return results[(row - top) * width + (col - left)]; | ||
// force spinCount to be integer >= 0 | ||
options.spinCount = isFinite(options.spinCount) ? Math.round(Math.max(0, options.spinCount)) : 100000; | ||
options.spinCount = Number.isFinite(options.spinCount) ? Math.round(Math.max(0, options.spinCount)) : 100000; | ||
} | ||
@@ -645,0 +663,0 @@ |
@@ -6,4 +6,2 @@ "use strict"; | ||
require('core-js/modules/es.string.includes'); | ||
require('core-js/modules/es.object.assign'); | ||
@@ -15,27 +13,2 @@ | ||
var rewritePattern = require('regexpu-core'); | ||
var _require = require('@babel/helper-create-regexp-features-plugin/lib/util'), | ||
generateRegexpuOptions = _require.generateRegexpuOptions; | ||
var _global = global, | ||
RegExp = _global.RegExp; | ||
try { | ||
RegExp('a', 'u'); | ||
} catch (err) { | ||
global.RegExp = function (pattern, flags) { | ||
if (flags && flags.includes('u')) { | ||
return new RegExp(rewritePattern(pattern, flags, generateRegexpuOptions({ | ||
flags: flags, | ||
pattern: pattern | ||
}))); | ||
} | ||
return new RegExp(pattern, flags); | ||
}; | ||
global.RegExp.prototype = RegExp; | ||
} | ||
var ExcelJS = { | ||
@@ -42,0 +15,0 @@ Workbook: require('./doc/workbook') |
@@ -17,3 +17,3 @@ "use strict"; | ||
var VmlNoteXform = require('../../xlsx/xform/comment/vml-note-xform'); | ||
var VmlShapeXform = require('../../xlsx/xform/comment/vml-shape-xform'); | ||
@@ -69,5 +69,5 @@ var SheetCommentsWriter = /*#__PURE__*/function () { | ||
this.commentsStream.write(commentsXmlStream.xml); | ||
var vmlNoteXform = new VmlNoteXform(); | ||
var vmlShapeXform = new VmlShapeXform(); | ||
var vmlXmlStream = new XmlStream(); | ||
vmlNoteXform.render(vmlXmlStream, comment, index); | ||
vmlShapeXform.render(vmlXmlStream, comment, index); | ||
this.vmlStream.write(vmlXmlStream.xml); | ||
@@ -74,0 +74,0 @@ } |
@@ -208,3 +208,4 @@ "use strict"; | ||
views: options.views, | ||
autoFilter: options.autoFilter | ||
autoFilter: options.autoFilter, | ||
headerFooter: options.headerFooter | ||
}); | ||
@@ -211,0 +212,0 @@ this._worksheets[id] = worksheet; |
@@ -64,5 +64,9 @@ "use strict"; | ||
var ConditionalFormattingsXform = require('../../xlsx/xform/sheet/cf/conditional-formattings-xform'); // since prepare and render are functional, we can use singletons | ||
var ConditionalFormattingsXform = require('../../xlsx/xform/sheet/cf/conditional-formattings-xform'); | ||
var HeaderFooterXform = require('../../xlsx/xform/sheet/header-footer-xform'); | ||
var RowBreaksXform = require('../../xlsx/xform/sheet/row-breaks-xform'); // since prepare and render are functional, we can use singletons | ||
var xform = { | ||
@@ -93,3 +97,5 @@ dataValidations: new DataValidationsXform(), | ||
picture: new PictureXform(), | ||
conditionalFormattings: new ConditionalFormattingsXform() | ||
conditionalFormattings: new ConditionalFormattingsXform(), | ||
headerFooter: new HeaderFooterXform(), | ||
rowBreaks: new RowBreaksXform() | ||
}; // ============================================================================================ | ||
@@ -113,3 +119,3 @@ | ||
this._keys = {}; // keep record of all merges | ||
this._keys = {}; // keep a record of all row and column pageBreaks | ||
@@ -136,4 +142,6 @@ this._merges = []; | ||
this.conditionalFormatting = []; // for default row height, outline levels, etc | ||
this.conditionalFormatting = []; // keep a record of all row and column pageBreaks | ||
this.rowBreaks = []; // for default row height, outline levels, etc | ||
this.properties = Object.assign({}, { | ||
@@ -144,3 +152,13 @@ defaultRowHeight: 15, | ||
outlineLevelRow: 0 | ||
}, options.properties); // for all things printing | ||
}, options.properties); | ||
this.headerFooter = Object.assign({}, { | ||
differentFirst: false, | ||
differentOddEven: false, | ||
oddHeader: null, | ||
oddFooter: null, | ||
evenHeader: null, | ||
evenFooter: null, | ||
firstHeader: null, | ||
firstFooter: null | ||
}, options.headerFooter); // for all things printing | ||
@@ -242,5 +260,9 @@ this.pageSetup = Object.assign({}, { | ||
this._writeBackground(); // Legacy Data tag for comments | ||
this._writeBackground(); | ||
this._writeHeaderFooter(); | ||
this._writeRowBreaks(); // Legacy Data tag for comments | ||
this._writeLegacyData(); | ||
@@ -405,5 +427,8 @@ | ||
value: function mergeCells() { | ||
for (var _len = arguments.length, cells = new Array(_len), _key = 0; _key < _len; _key++) { | ||
cells[_key] = arguments[_key]; | ||
} | ||
// may fail if rows have been comitted | ||
var dimensions = new Dimensions(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
// check cells aren't already merged | ||
var dimensions = new Dimensions(cells); // check cells aren't already merged | ||
@@ -440,4 +465,2 @@ this._merges.forEach(function (merge) { | ||
value: function removeConditionalFormatting(filter) { | ||
console.log('conditionalFormatting', this.conditionalFormatting); | ||
if (typeof filter === 'number') { | ||
@@ -600,2 +623,7 @@ this.conditionalFormatting.splice(filter, 1); | ||
}, { | ||
key: "_writeRowBreaks", | ||
value: function _writeRowBreaks() { | ||
this.stream.write(xform.rowBreaks.toXml(this.rowBreaks)); | ||
} | ||
}, { | ||
key: "_writeDataValidations", | ||
@@ -621,2 +649,7 @@ value: function _writeDataValidations() { | ||
}, { | ||
key: "_writeHeaderFooter", | ||
value: function _writeHeaderFooter() { | ||
this.stream.write(xform.headerFooter.toXml(this.headerFooter)); | ||
} | ||
}, { | ||
key: "_writeAutoFilter", | ||
@@ -623,0 +656,0 @@ value: function _writeAutoFilter() { |
@@ -5,2 +5,3 @@ "use strict"; | ||
var toString = Object.prototype.toString; | ||
var _ = { | ||
@@ -104,2 +105,38 @@ each: function each(obj, cb) { | ||
return 0; | ||
}, | ||
isUndefined: function isUndefined(val) { | ||
return toString.call(val) === '[object Undefined]'; | ||
}, | ||
isObject: function isObject(val) { | ||
return toString.call(val) === '[object Object]'; | ||
}, | ||
deepMerge: function deepMerge() { | ||
var target = arguments[0] || {}; | ||
var length = arguments.length; // eslint-disable-next-line one-var | ||
var src, clone, copyIsArray; | ||
function assignValue(val, key) { | ||
src = target[key]; | ||
copyIsArray = Array.isArray(val); | ||
if (_.isObject(val) || copyIsArray) { | ||
if (copyIsArray) { | ||
copyIsArray = false; | ||
clone = src && Array.isArray(src) ? src : []; | ||
} else { | ||
clone = src && _.isObject(src) ? src : {}; | ||
} | ||
target[key] = _.deepMerge(clone, val); | ||
} else if (!_.isUndefined(val)) { | ||
target[key] = val; | ||
} | ||
} | ||
for (var i = 0; i < length; i++) { | ||
_.each(arguments[i], assignValue); | ||
} | ||
return target; | ||
} | ||
@@ -106,0 +143,0 @@ }; |
@@ -224,5 +224,7 @@ "use strict"; | ||
return; | ||
} | ||
} // if rel.Target start with `[space]/xl/` or `/xl/` , then it will be replaced with `''` and spliced behind `xl/`, | ||
// otherwise it will be spliced directly behind `xl/`. i.g. | ||
worksheet = model.worksheetHash["xl/".concat(rel.Target)]; // If there are "chartsheets" in the file, rel.Target will | ||
worksheet = model.worksheetHash["xl/".concat(rel.Target.replace(/^(\s|\/xl\/)+/, ''))]; // If there are "chartsheets" in the file, rel.Target will | ||
// come out as chartsheets/sheet1.xml or similar here, and | ||
@@ -229,0 +231,0 @@ // that won't be in model.worksheetHash. |
@@ -72,2 +72,24 @@ "use strict"; | ||
}, { | ||
key: "parseOpen", | ||
value: function parseOpen(node) { | ||
switch (node.name) { | ||
case this.tag: | ||
this.text = ''; | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
}, { | ||
key: "parseText", | ||
value: function parseText(text) { | ||
this.text = text; | ||
} | ||
}, { | ||
key: "parseClose", | ||
value: function parseClose() { | ||
return false; | ||
} | ||
}, { | ||
key: "tag", | ||
@@ -74,0 +96,0 @@ get: function get() { |
@@ -29,3 +29,3 @@ "use strict"; | ||
var VmlNoteXform = require('./vml-note-xform'); // This class is (currently) single purposed to insert the triangle | ||
var VmlShapeXform = require('./vml-shape-xform'); // This class is (currently) single purposed to insert the triangle | ||
// drawing icons on commented cells | ||
@@ -40,5 +40,11 @@ | ||
function VmlNotesXform() { | ||
var _this; | ||
_classCallCheck(this, VmlNotesXform); | ||
return _super.apply(this, arguments); | ||
_this = _super.call(this); | ||
_this.map = { | ||
'v:shape': new VmlShapeXform() | ||
}; | ||
return _this; | ||
} | ||
@@ -49,2 +55,4 @@ | ||
value: function render(xmlStream, model) { | ||
var _this2 = this; | ||
xmlStream.openXml(XmlStream.StdDocAttributes); | ||
@@ -75,3 +83,3 @@ xmlStream.openNode(this.tag, VmlNotesXform.DRAWING_ATTRIBUTES); | ||
model.comments.forEach(function (item, index) { | ||
VmlNotesXform.vmlCommentXform.render(xmlStream, item, index); | ||
_this2.map['v:shape'].render(xmlStream, item, index); | ||
}); | ||
@@ -92,3 +100,3 @@ xmlStream.closeNode(); | ||
this.model = { | ||
anchors: [] | ||
comments: [] | ||
}; | ||
@@ -121,3 +129,3 @@ break; | ||
if (!this.parser.parseClose(name)) { | ||
this.model.anchors.push(this.parser.model); | ||
this.model.comments.push(this.parser.model); | ||
this.parser = undefined; | ||
@@ -141,9 +149,9 @@ } | ||
value: function reconcile(model, options) { | ||
var _this = this; | ||
var _this3 = this; | ||
model.anchors.forEach(function (anchor) { | ||
if (anchor.br) { | ||
_this.map['xdr:twoCellAnchor'].reconcile(anchor, options); | ||
_this3.map['xdr:twoCellAnchor'].reconcile(anchor, options); | ||
} else { | ||
_this.map['xdr:oneCellAnchor'].reconcile(anchor, options); | ||
_this3.map['xdr:oneCellAnchor'].reconcile(anchor, options); | ||
} | ||
@@ -167,4 +175,3 @@ }); | ||
}; | ||
VmlNotesXform.vmlCommentXform = new VmlNoteXform(); | ||
module.exports = VmlNotesXform; | ||
//# sourceMappingURL=vml-notes-xform.js.map |
@@ -25,3 +25,4 @@ "use strict"; | ||
var uuid = require('uuid'); | ||
var _require = require('uuid'), | ||
uuidv4 = _require.v4; | ||
@@ -64,3 +65,3 @@ var BaseXform = require('../../base-xform'); | ||
if (CfRuleExtXform.isExt(model)) { | ||
model.x14Id = "{".concat(uuid.v4(), "}").toUpperCase(); | ||
model.x14Id = "{".concat(uuidv4(), "}").toUpperCase(); | ||
} | ||
@@ -101,3 +102,3 @@ } | ||
priority: model.priority, | ||
id: model.x14Id || "{".concat(uuid.v4(), "}") | ||
id: model.x14Id || "{".concat(uuidv4(), "}") | ||
}); | ||
@@ -104,0 +105,0 @@ this.iconSetXform.render(xmlStream, model); |
@@ -95,3 +95,3 @@ "use strict"; | ||
if (node.attributes.hidden) { | ||
if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') { | ||
model.hidden = true; | ||
@@ -98,0 +98,0 @@ } |
@@ -234,7 +234,5 @@ "use strict"; | ||
this._address = node.attributes.sqref; | ||
var dataValidation = node.attributes.type ? { | ||
type: node.attributes.type, | ||
var dataValidation = { | ||
type: node.attributes.type || 'any', | ||
formulae: [] | ||
} : { | ||
type: 'any' | ||
}; | ||
@@ -241,0 +239,0 @@ |
@@ -125,3 +125,3 @@ "use strict"; | ||
if (node.attributes.hidden) { | ||
if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') { | ||
model.hidden = true; | ||
@@ -128,0 +128,0 @@ } |
@@ -475,3 +475,3 @@ "use strict"; | ||
{ | ||
var properties = this.map.sheetFormatPr.model; | ||
var properties = this.map.sheetFormatPr.model || {}; | ||
@@ -483,3 +483,3 @@ if (this.map.sheetPr.model && this.map.sheetPr.model.tabColor) { | ||
if (this.map.sheetPr.model && this.map.sheetPr.model.outlineProperties) { | ||
properties.outlineProperties = this.map.sheetPr.model.outlinePropertiesx; | ||
properties.outlineProperties = this.map.sheetPr.model.outlineProperties; | ||
} | ||
@@ -538,2 +538,9 @@ | ||
if (rel.Type === RelType.VmlDrawing && model.comments && model.comments.length) { | ||
var vmlComment = options.vmlDrawings[rel.Target].comments; | ||
model.comments.forEach(function (comment, index) { | ||
comment.note = Object.assign({}, comment.note, vmlComment[index]); | ||
}); | ||
} | ||
return h; | ||
@@ -540,0 +547,0 @@ }, {}); |
@@ -62,9 +62,14 @@ "use strict"; | ||
value: function render(xmlStream, model) { | ||
var _this2 = this; | ||
xmlStream.openNode(this.tag); | ||
if (model && model.hasOwnProperty('richText') && model.richText) { | ||
var r = this.map.r; | ||
model.richText.forEach(function (text) { | ||
r.render(xmlStream, text); | ||
}); | ||
if (model.richText.length) { | ||
model.richText.forEach(function (text) { | ||
_this2.map.r.render(xmlStream, text); | ||
}); | ||
} else { | ||
this.map.t.render(xmlStream, ''); | ||
} | ||
} else if (model !== undefined && model !== null) { | ||
@@ -71,0 +76,0 @@ this.map.t.render(xmlStream, model); |
@@ -46,4 +46,4 @@ "use strict"; | ||
}; | ||
_this.hash = {}; | ||
_this.rich = {}; | ||
_this.hash = Object.create(null); | ||
_this.rich = Object.create(null); | ||
return _this; | ||
@@ -50,0 +50,0 @@ } |
@@ -189,3 +189,4 @@ "use strict"; | ||
comments: model.comments, | ||
tables: model.tables | ||
tables: model.tables, | ||
vmlDrawings: model.vmlDrawings | ||
}; | ||
@@ -207,2 +208,3 @@ model.worksheets.forEach(function (worksheet) { | ||
delete model.drawingRels; | ||
delete model.vmlDrawings; | ||
} | ||
@@ -451,5 +453,6 @@ }, { | ||
}, { | ||
key: "_processThemeEntry", | ||
key: "_processVmlDrawingEntry", | ||
value: function () { | ||
var _processThemeEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(entry, model, name) { | ||
var _processVmlDrawingEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(entry, model, name) { | ||
var xform, vmlDrawing; | ||
return regeneratorRuntime.wrap(function _callee9$(_context9) { | ||
@@ -459,3 +462,33 @@ while (1) { | ||
case 0: | ||
_context9.next = 2; | ||
xform = new VmlNotesXform(); | ||
_context9.next = 3; | ||
return xform.parseStream(entry); | ||
case 3: | ||
vmlDrawing = _context9.sent; | ||
model.vmlDrawings["../drawings/".concat(name, ".vml")] = vmlDrawing; | ||
case 5: | ||
case "end": | ||
return _context9.stop(); | ||
} | ||
} | ||
}, _callee9); | ||
})); | ||
function _processVmlDrawingEntry(_x25, _x26, _x27) { | ||
return _processVmlDrawingEntry2.apply(this, arguments); | ||
} | ||
return _processVmlDrawingEntry; | ||
}() | ||
}, { | ||
key: "_processThemeEntry", | ||
value: function () { | ||
var _processThemeEntry2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(entry, model, name) { | ||
return regeneratorRuntime.wrap(function _callee10$(_context10) { | ||
while (1) { | ||
switch (_context10.prev = _context10.next) { | ||
case 0: | ||
_context10.next = 2; | ||
return new Promise(function (resolve, reject) { | ||
@@ -475,9 +508,9 @@ // TODO: stream entry into buffer and store the xml in the model.themes[] | ||
case "end": | ||
return _context9.stop(); | ||
return _context10.stop(); | ||
} | ||
} | ||
}, _callee9); | ||
}, _callee10); | ||
})); | ||
function _processThemeEntry(_x25, _x26, _x27) { | ||
function _processThemeEntry(_x28, _x29, _x30) { | ||
return _processThemeEntry2.apply(this, arguments); | ||
@@ -513,3 +546,4 @@ } | ||
comments: {}, | ||
tables: {} | ||
tables: {}, | ||
vmlDrawings: {} | ||
}; // we have to be prepared to read the zip entries in whatever order they arrive | ||
@@ -524,9 +558,9 @@ | ||
stream.on('entry', function (entry) { | ||
promises.push(_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() { | ||
promises.push(_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { | ||
var entryPath, workbook, appXform, appProperties, coreXform, coreProperties, match; | ||
return regeneratorRuntime.wrap(function _callee10$(_context10) { | ||
return regeneratorRuntime.wrap(function _callee11$(_context11) { | ||
while (1) { | ||
switch (_context10.prev = _context10.next) { | ||
switch (_context11.prev = _context11.next) { | ||
case 0: | ||
_context10.prev = 0; | ||
_context11.prev = 0; | ||
entryPath = entry.path; | ||
@@ -538,20 +572,20 @@ | ||
_context10.t0 = entryPath; | ||
_context10.next = _context10.t0 === '_rels/.rels' ? 6 : _context10.t0 === 'xl/workbook.xml' ? 10 : _context10.t0 === 'xl/_rels/workbook.xml.rels' ? 19 : _context10.t0 === 'xl/sharedStrings.xml' ? 23 : _context10.t0 === 'xl/styles.xml' ? 27 : _context10.t0 === 'docProps/app.xml' ? 31 : _context10.t0 === 'docProps/core.xml' ? 38 : 44; | ||
_context11.t0 = entryPath; | ||
_context11.next = _context11.t0 === '_rels/.rels' ? 6 : _context11.t0 === 'xl/workbook.xml' ? 10 : _context11.t0 === 'xl/_rels/workbook.xml.rels' ? 19 : _context11.t0 === 'xl/sharedStrings.xml' ? 23 : _context11.t0 === 'xl/styles.xml' ? 27 : _context11.t0 === 'docProps/app.xml' ? 31 : _context11.t0 === 'docProps/core.xml' ? 38 : 44; | ||
break; | ||
case 6: | ||
_context10.next = 8; | ||
_context11.next = 8; | ||
return _this.parseRels(entry); | ||
case 8: | ||
model.globalRels = _context10.sent; | ||
return _context10.abrupt("break", 85); | ||
model.globalRels = _context11.sent; | ||
return _context11.abrupt("break", 90); | ||
case 10: | ||
_context10.next = 12; | ||
_context11.next = 12; | ||
return _this.parseWorkbook(entry); | ||
case 12: | ||
workbook = _context10.sent; | ||
workbook = _context11.sent; | ||
model.sheets = workbook.sheets; | ||
@@ -562,48 +596,48 @@ model.definedNames = workbook.definedNames; | ||
model.calcProperties = workbook.calcProperties; | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
case 19: | ||
_context10.next = 21; | ||
_context11.next = 21; | ||
return _this.parseRels(entry); | ||
case 21: | ||
model.workbookRels = _context10.sent; | ||
return _context10.abrupt("break", 85); | ||
model.workbookRels = _context11.sent; | ||
return _context11.abrupt("break", 90); | ||
case 23: | ||
model.sharedStrings = new SharedStringsXform(); | ||
_context10.next = 26; | ||
_context11.next = 26; | ||
return model.sharedStrings.parseStream(entry); | ||
case 26: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
case 27: | ||
model.styles = new StylesXform(); | ||
_context10.next = 30; | ||
_context11.next = 30; | ||
return model.styles.parseStream(entry); | ||
case 30: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
case 31: | ||
appXform = new AppXform(); | ||
_context10.next = 34; | ||
_context11.next = 34; | ||
return appXform.parseStream(entry); | ||
case 34: | ||
appProperties = _context10.sent; | ||
appProperties = _context11.sent; | ||
model.company = appProperties.company; | ||
model.manager = appProperties.manager; | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
case 38: | ||
coreXform = new CoreXform(); | ||
_context10.next = 41; | ||
_context11.next = 41; | ||
return coreXform.parseStream(entry); | ||
case 41: | ||
coreProperties = _context10.sent; | ||
coreProperties = _context11.sent; | ||
Object.assign(model, coreProperties); | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -614,11 +648,11 @@ case 44: | ||
if (!match) { | ||
_context10.next = 49; | ||
_context11.next = 49; | ||
break; | ||
} | ||
_context10.next = 48; | ||
_context11.next = 48; | ||
return _this._processWorksheetEntry(entry, model, match[1], options); | ||
case 48: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -629,11 +663,11 @@ case 49: | ||
if (!match) { | ||
_context10.next = 54; | ||
_context11.next = 54; | ||
break; | ||
} | ||
_context10.next = 53; | ||
_context11.next = 53; | ||
return _this._processWorksheetRelsEntry(entry, model, match[1]); | ||
case 53: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -644,11 +678,11 @@ case 54: | ||
if (!match) { | ||
_context10.next = 59; | ||
_context11.next = 59; | ||
break; | ||
} | ||
_context10.next = 58; | ||
_context11.next = 58; | ||
return _this._processThemeEntry(entry, model, match[1]); | ||
case 58: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -659,11 +693,11 @@ case 59: | ||
if (!match) { | ||
_context10.next = 64; | ||
_context11.next = 64; | ||
break; | ||
} | ||
_context10.next = 63; | ||
_context11.next = 63; | ||
return _this._processMediaEntry(entry, model, match[1]); | ||
case 63: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -674,11 +708,11 @@ case 64: | ||
if (!match) { | ||
_context10.next = 69; | ||
_context11.next = 69; | ||
break; | ||
} | ||
_context10.next = 68; | ||
_context11.next = 68; | ||
return _this._processDrawingEntry(entry, model, match[1]); | ||
case 68: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -689,11 +723,11 @@ case 69: | ||
if (!match) { | ||
_context10.next = 74; | ||
_context11.next = 74; | ||
break; | ||
} | ||
_context10.next = 73; | ||
_context11.next = 73; | ||
return _this._processCommentEntry(entry, model, match[1]); | ||
case 73: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -704,11 +738,11 @@ case 74: | ||
if (!match) { | ||
_context10.next = 79; | ||
_context11.next = 79; | ||
break; | ||
} | ||
_context10.next = 78; | ||
_context11.next = 78; | ||
return _this._processTableEntry(entry, model, match[1]); | ||
case 78: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
@@ -719,39 +753,53 @@ case 79: | ||
if (!match) { | ||
_context10.next = 84; | ||
_context11.next = 84; | ||
break; | ||
} | ||
_context10.next = 83; | ||
_context11.next = 83; | ||
return _this._processDrawingRelsEntry(entry, model, match[1]); | ||
case 83: | ||
return _context10.abrupt("break", 85); | ||
return _context11.abrupt("break", 90); | ||
case 84: | ||
match = entry.path.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/); | ||
if (!match) { | ||
_context11.next = 89; | ||
break; | ||
} | ||
_context11.next = 88; | ||
return _this._processVmlDrawingEntry(entry, model, match[1]); | ||
case 88: | ||
return _context11.abrupt("break", 90); | ||
case 89: | ||
entry.autodrain(); | ||
case 85: | ||
_context10.next = 90; | ||
case 90: | ||
_context11.next = 95; | ||
break; | ||
case 87: | ||
_context10.prev = 87; | ||
_context10.t1 = _context10["catch"](0); | ||
_this.error = _context10.t1; | ||
case 92: | ||
_context11.prev = 92; | ||
_context11.t1 = _context11["catch"](0); | ||
_this.error = _context11.t1; | ||
case 90: | ||
case 95: | ||
case "end": | ||
return _context10.stop(); | ||
return _context11.stop(); | ||
} | ||
} | ||
}, _callee10, null, [[0, 87]]); | ||
}, _callee11, null, [[0, 92]]); | ||
}))()); | ||
}); | ||
stream.on('finished', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { | ||
return regeneratorRuntime.wrap(function _callee11$(_context11) { | ||
stream.on('finished', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() { | ||
return regeneratorRuntime.wrap(function _callee12$(_context12) { | ||
while (1) { | ||
switch (_context11.prev = _context11.next) { | ||
switch (_context12.prev = _context12.next) { | ||
case 0: | ||
_context11.prev = 0; | ||
_context11.next = 3; | ||
_context12.prev = 0; | ||
_context12.next = 3; | ||
return Promise.all(promises); | ||
@@ -761,3 +809,3 @@ | ||
if (!_this.error) { | ||
_context11.next = 5; | ||
_context12.next = 5; | ||
break; | ||
@@ -774,16 +822,16 @@ } | ||
stream.emit('done'); | ||
_context11.next = 13; | ||
_context12.next = 13; | ||
break; | ||
case 10: | ||
_context11.prev = 10; | ||
_context11.t0 = _context11["catch"](0); | ||
stream.emit('error', _context11.t0); | ||
_context12.prev = 10; | ||
_context12.t0 = _context12["catch"](0); | ||
stream.emit('error', _context12.t0); | ||
case 13: | ||
case "end": | ||
return _context11.stop(); | ||
return _context12.stop(); | ||
} | ||
} | ||
}, _callee11, null, [[0, 10]]); | ||
}, _callee12, null, [[0, 10]]); | ||
}))); | ||
@@ -843,17 +891,17 @@ return stream; | ||
value: function () { | ||
var _addMedia = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(zip, model) { | ||
return regeneratorRuntime.wrap(function _callee13$(_context13) { | ||
var _addMedia = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(zip, model) { | ||
return regeneratorRuntime.wrap(function _callee14$(_context14) { | ||
while (1) { | ||
switch (_context13.prev = _context13.next) { | ||
switch (_context14.prev = _context14.next) { | ||
case 0: | ||
_context13.next = 2; | ||
_context14.next = 2; | ||
return Promise.all(model.media.map( /*#__PURE__*/function () { | ||
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(medium) { | ||
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(medium) { | ||
var filename, data, dataimg64, content; | ||
return regeneratorRuntime.wrap(function _callee12$(_context12) { | ||
return regeneratorRuntime.wrap(function _callee13$(_context13) { | ||
while (1) { | ||
switch (_context12.prev = _context12.next) { | ||
switch (_context13.prev = _context13.next) { | ||
case 0: | ||
if (!(medium.type === 'image')) { | ||
_context12.next = 13; | ||
_context13.next = 13; | ||
break; | ||
@@ -865,12 +913,12 @@ } | ||
if (!medium.filename) { | ||
_context12.next = 7; | ||
_context13.next = 7; | ||
break; | ||
} | ||
_context12.next = 5; | ||
_context13.next = 5; | ||
return fsReadFileAsync(medium.filename); | ||
case 5: | ||
data = _context12.sent; | ||
return _context12.abrupt("return", zip.append(data, { | ||
data = _context13.sent; | ||
return _context13.abrupt("return", zip.append(data, { | ||
name: filename | ||
@@ -881,7 +929,7 @@ })); | ||
if (!medium.buffer) { | ||
_context12.next = 9; | ||
_context13.next = 9; | ||
break; | ||
} | ||
return _context12.abrupt("return", zip.append(medium.buffer, { | ||
return _context13.abrupt("return", zip.append(medium.buffer, { | ||
name: filename | ||
@@ -892,3 +940,3 @@ })); | ||
if (!medium.base64) { | ||
_context12.next = 13; | ||
_context13.next = 13; | ||
break; | ||
@@ -899,3 +947,3 @@ } | ||
content = dataimg64.substring(dataimg64.indexOf(',') + 1); | ||
return _context12.abrupt("return", zip.append(content, { | ||
return _context13.abrupt("return", zip.append(content, { | ||
name: filename, | ||
@@ -910,9 +958,9 @@ base64: true | ||
case "end": | ||
return _context12.stop(); | ||
return _context13.stop(); | ||
} | ||
} | ||
}, _callee12); | ||
}, _callee13); | ||
})); | ||
return function (_x30) { | ||
return function (_x33) { | ||
return _ref3.apply(this, arguments); | ||
@@ -924,9 +972,9 @@ }; | ||
case "end": | ||
return _context13.stop(); | ||
return _context14.stop(); | ||
} | ||
} | ||
}, _callee13); | ||
}, _callee14); | ||
})); | ||
function addMedia(_x28, _x29) { | ||
function addMedia(_x31, _x32) { | ||
return _addMedia.apply(this, arguments); | ||
@@ -976,7 +1024,7 @@ } | ||
value: function () { | ||
var _addContentTypes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(zip, model) { | ||
var _addContentTypes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(zip, model) { | ||
var xform, xml; | ||
return regeneratorRuntime.wrap(function _callee14$(_context14) { | ||
return regeneratorRuntime.wrap(function _callee15$(_context15) { | ||
while (1) { | ||
switch (_context14.prev = _context14.next) { | ||
switch (_context15.prev = _context15.next) { | ||
case 0: | ||
@@ -991,9 +1039,9 @@ xform = new ContentTypesXform(); | ||
case "end": | ||
return _context14.stop(); | ||
return _context15.stop(); | ||
} | ||
} | ||
}, _callee14); | ||
}, _callee15); | ||
})); | ||
function addContentTypes(_x31, _x32) { | ||
function addContentTypes(_x34, _x35) { | ||
return _addContentTypes.apply(this, arguments); | ||
@@ -1007,7 +1055,7 @@ } | ||
value: function () { | ||
var _addApp = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(zip, model) { | ||
var _addApp = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(zip, model) { | ||
var xform, xml; | ||
return regeneratorRuntime.wrap(function _callee15$(_context15) { | ||
return regeneratorRuntime.wrap(function _callee16$(_context16) { | ||
while (1) { | ||
switch (_context15.prev = _context15.next) { | ||
switch (_context16.prev = _context16.next) { | ||
case 0: | ||
@@ -1022,9 +1070,9 @@ xform = new AppXform(); | ||
case "end": | ||
return _context15.stop(); | ||
return _context16.stop(); | ||
} | ||
} | ||
}, _callee15); | ||
}, _callee16); | ||
})); | ||
function addApp(_x33, _x34) { | ||
function addApp(_x36, _x37) { | ||
return _addApp.apply(this, arguments); | ||
@@ -1038,7 +1086,7 @@ } | ||
value: function () { | ||
var _addCore = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(zip, model) { | ||
var _addCore = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(zip, model) { | ||
var coreXform; | ||
return regeneratorRuntime.wrap(function _callee16$(_context16) { | ||
return regeneratorRuntime.wrap(function _callee17$(_context17) { | ||
while (1) { | ||
switch (_context16.prev = _context16.next) { | ||
switch (_context17.prev = _context17.next) { | ||
case 0: | ||
@@ -1052,9 +1100,9 @@ coreXform = new CoreXform(); | ||
case "end": | ||
return _context16.stop(); | ||
return _context17.stop(); | ||
} | ||
} | ||
}, _callee16); | ||
}, _callee17); | ||
})); | ||
function addCore(_x35, _x36) { | ||
function addCore(_x38, _x39) { | ||
return _addCore.apply(this, arguments); | ||
@@ -1068,7 +1116,7 @@ } | ||
value: function () { | ||
var _addThemes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(zip, model) { | ||
var _addThemes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(zip, model) { | ||
var themes; | ||
return regeneratorRuntime.wrap(function _callee17$(_context17) { | ||
return regeneratorRuntime.wrap(function _callee18$(_context18) { | ||
while (1) { | ||
switch (_context17.prev = _context17.next) { | ||
switch (_context18.prev = _context18.next) { | ||
case 0: | ||
@@ -1088,9 +1136,9 @@ themes = model.themes || { | ||
case "end": | ||
return _context17.stop(); | ||
return _context18.stop(); | ||
} | ||
} | ||
}, _callee17); | ||
}, _callee18); | ||
})); | ||
function addThemes(_x37, _x38) { | ||
function addThemes(_x40, _x41) { | ||
return _addThemes.apply(this, arguments); | ||
@@ -1104,7 +1152,7 @@ } | ||
value: function () { | ||
var _addOfficeRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(zip) { | ||
var _addOfficeRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(zip) { | ||
var xform, xml; | ||
return regeneratorRuntime.wrap(function _callee18$(_context18) { | ||
return regeneratorRuntime.wrap(function _callee19$(_context19) { | ||
while (1) { | ||
switch (_context18.prev = _context18.next) { | ||
switch (_context19.prev = _context19.next) { | ||
case 0: | ||
@@ -1131,9 +1179,9 @@ xform = new RelationshipsXform(); | ||
case "end": | ||
return _context18.stop(); | ||
return _context19.stop(); | ||
} | ||
} | ||
}, _callee18); | ||
}, _callee19); | ||
})); | ||
function addOfficeRels(_x39) { | ||
function addOfficeRels(_x42) { | ||
return _addOfficeRels.apply(this, arguments); | ||
@@ -1147,7 +1195,7 @@ } | ||
value: function () { | ||
var _addWorkbookRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(zip, model) { | ||
var _addWorkbookRels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(zip, model) { | ||
var count, relationships, xform, xml; | ||
return regeneratorRuntime.wrap(function _callee19$(_context19) { | ||
return regeneratorRuntime.wrap(function _callee20$(_context20) { | ||
while (1) { | ||
switch (_context19.prev = _context19.next) { | ||
switch (_context20.prev = _context20.next) { | ||
case 0: | ||
@@ -1189,9 +1237,9 @@ count = 1; | ||
case "end": | ||
return _context19.stop(); | ||
return _context20.stop(); | ||
} | ||
} | ||
}, _callee19); | ||
}, _callee20); | ||
})); | ||
function addWorkbookRels(_x40, _x41) { | ||
function addWorkbookRels(_x43, _x44) { | ||
return _addWorkbookRels.apply(this, arguments); | ||
@@ -1205,6 +1253,6 @@ } | ||
value: function () { | ||
var _addSharedStrings = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(zip, model) { | ||
return regeneratorRuntime.wrap(function _callee20$(_context20) { | ||
var _addSharedStrings = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(zip, model) { | ||
return regeneratorRuntime.wrap(function _callee21$(_context21) { | ||
while (1) { | ||
switch (_context20.prev = _context20.next) { | ||
switch (_context21.prev = _context21.next) { | ||
case 0: | ||
@@ -1219,9 +1267,9 @@ if (model.sharedStrings && model.sharedStrings.count) { | ||
case "end": | ||
return _context20.stop(); | ||
return _context21.stop(); | ||
} | ||
} | ||
}, _callee20); | ||
}, _callee21); | ||
})); | ||
function addSharedStrings(_x42, _x43) { | ||
function addSharedStrings(_x45, _x46) { | ||
return _addSharedStrings.apply(this, arguments); | ||
@@ -1235,7 +1283,7 @@ } | ||
value: function () { | ||
var _addStyles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(zip, model) { | ||
var _addStyles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(zip, model) { | ||
var xml; | ||
return regeneratorRuntime.wrap(function _callee21$(_context21) { | ||
return regeneratorRuntime.wrap(function _callee22$(_context22) { | ||
while (1) { | ||
switch (_context21.prev = _context21.next) { | ||
switch (_context22.prev = _context22.next) { | ||
case 0: | ||
@@ -1252,9 +1300,9 @@ xml = model.styles.xml; | ||
case "end": | ||
return _context21.stop(); | ||
return _context22.stop(); | ||
} | ||
} | ||
}, _callee21); | ||
}, _callee22); | ||
})); | ||
function addStyles(_x44, _x45) { | ||
function addStyles(_x47, _x48) { | ||
return _addStyles.apply(this, arguments); | ||
@@ -1268,7 +1316,7 @@ } | ||
value: function () { | ||
var _addWorkbook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(zip, model) { | ||
var _addWorkbook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(zip, model) { | ||
var xform; | ||
return regeneratorRuntime.wrap(function _callee22$(_context22) { | ||
return regeneratorRuntime.wrap(function _callee23$(_context23) { | ||
while (1) { | ||
switch (_context22.prev = _context22.next) { | ||
switch (_context23.prev = _context23.next) { | ||
case 0: | ||
@@ -1282,9 +1330,9 @@ xform = new WorkbookXform(); | ||
case "end": | ||
return _context22.stop(); | ||
return _context23.stop(); | ||
} | ||
} | ||
}, _callee22); | ||
}, _callee23); | ||
})); | ||
function addWorkbook(_x46, _x47) { | ||
function addWorkbook(_x49, _x50) { | ||
return _addWorkbook.apply(this, arguments); | ||
@@ -1298,7 +1346,7 @@ } | ||
value: function () { | ||
var _addWorksheets = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(zip, model) { | ||
var _addWorksheets = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(zip, model) { | ||
var worksheetXform, relationshipsXform, commentsXform, vmlNotesXform; | ||
return regeneratorRuntime.wrap(function _callee23$(_context23) { | ||
return regeneratorRuntime.wrap(function _callee24$(_context24) { | ||
while (1) { | ||
switch (_context23.prev = _context23.next) { | ||
switch (_context24.prev = _context24.next) { | ||
case 0: | ||
@@ -1342,9 +1390,9 @@ // preparation phase | ||
case "end": | ||
return _context23.stop(); | ||
return _context24.stop(); | ||
} | ||
} | ||
}, _callee23); | ||
}, _callee24); | ||
})); | ||
function addWorksheets(_x48, _x49) { | ||
function addWorksheets(_x51, _x52) { | ||
return _addWorksheets.apply(this, arguments); | ||
@@ -1411,7 +1459,7 @@ } | ||
value: function () { | ||
var _write = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(stream, options) { | ||
var _write = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(stream, options) { | ||
var model, zip; | ||
return regeneratorRuntime.wrap(function _callee24$(_context24) { | ||
return regeneratorRuntime.wrap(function _callee25$(_context25) { | ||
while (1) { | ||
switch (_context24.prev = _context24.next) { | ||
switch (_context25.prev = _context25.next) { | ||
case 0: | ||
@@ -1424,57 +1472,57 @@ options = options || {}; | ||
_context24.next = 7; | ||
_context25.next = 7; | ||
return this.addContentTypes(zip, model); | ||
case 7: | ||
_context24.next = 9; | ||
_context25.next = 9; | ||
return this.addOfficeRels(zip, model); | ||
case 9: | ||
_context24.next = 11; | ||
_context25.next = 11; | ||
return this.addWorkbookRels(zip, model); | ||
case 11: | ||
_context24.next = 13; | ||
_context25.next = 13; | ||
return this.addWorksheets(zip, model); | ||
case 13: | ||
_context24.next = 15; | ||
_context25.next = 15; | ||
return this.addSharedStrings(zip, model); | ||
case 15: | ||
_context24.next = 17; | ||
_context25.next = 17; | ||
return this.addDrawings(zip, model); | ||
case 17: | ||
_context24.next = 19; | ||
_context25.next = 19; | ||
return this.addTables(zip, model); | ||
case 19: | ||
_context24.next = 21; | ||
_context25.next = 21; | ||
return Promise.all([this.addThemes(zip, model), this.addStyles(zip, model)]); | ||
case 21: | ||
_context24.next = 23; | ||
_context25.next = 23; | ||
return this.addMedia(zip, model); | ||
case 23: | ||
_context24.next = 25; | ||
_context25.next = 25; | ||
return Promise.all([this.addApp(zip, model), this.addCore(zip, model)]); | ||
case 25: | ||
_context24.next = 27; | ||
_context25.next = 27; | ||
return this.addWorkbook(zip, model); | ||
case 27: | ||
return _context24.abrupt("return", this._finalize(zip)); | ||
return _context25.abrupt("return", this._finalize(zip)); | ||
case 28: | ||
case "end": | ||
return _context24.stop(); | ||
return _context25.stop(); | ||
} | ||
} | ||
}, _callee24, this); | ||
}, _callee25, this); | ||
})); | ||
function write(_x50, _x51) { | ||
function write(_x53, _x54) { | ||
return _write.apply(this, arguments); | ||
@@ -1507,24 +1555,24 @@ } | ||
value: function () { | ||
var _writeBuffer = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(options) { | ||
var _writeBuffer = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(options) { | ||
var stream; | ||
return regeneratorRuntime.wrap(function _callee25$(_context25) { | ||
return regeneratorRuntime.wrap(function _callee26$(_context26) { | ||
while (1) { | ||
switch (_context25.prev = _context25.next) { | ||
switch (_context26.prev = _context26.next) { | ||
case 0: | ||
stream = new StreamBuf(); | ||
_context25.next = 3; | ||
_context26.next = 3; | ||
return this.write(stream, options); | ||
case 3: | ||
return _context25.abrupt("return", stream.read()); | ||
return _context26.abrupt("return", stream.read()); | ||
case 4: | ||
case "end": | ||
return _context25.stop(); | ||
return _context26.stop(); | ||
} | ||
} | ||
}, _callee25, this); | ||
}, _callee26, this); | ||
})); | ||
function writeBuffer(_x52) { | ||
function writeBuffer(_x55) { | ||
return _writeBuffer.apply(this, arguments); | ||
@@ -1531,0 +1579,0 @@ } |
111
index.d.ts
@@ -378,6 +378,22 @@ declare interface Buffer extends ArrayBuffer { } | ||
export interface Comment { | ||
texts: RichText[]; | ||
} | ||
export interface CommentMargins { | ||
insetmode: 'auto' | 'custom'; | ||
inset: Number[]; | ||
} | ||
export interface CommentProtection { | ||
locked: 'True' | 'False'; | ||
lockText: 'True' | 'False'; | ||
} | ||
export type CommentEditAs = 'twoCells' | 'oneCells' | 'absolute'; | ||
export interface Comment { | ||
texts?: RichText[]; | ||
margins?: Partial<CommentMargins>; | ||
protection?: Partial<CommentProtection>; | ||
editAs?: CommentEditAs; | ||
} | ||
export interface CellModel { | ||
@@ -438,3 +454,3 @@ address: Address; | ||
*/ | ||
note: Comment; | ||
note: string | Comment; | ||
@@ -960,3 +976,3 @@ /** | ||
pageSetup: Partial<PageSetup>; | ||
headerFooter: HeaderFooter; | ||
headerFooter: Partial<HeaderFooter>; | ||
rowBreaks: RowBreak[]; | ||
@@ -973,8 +989,8 @@ views: WorksheetView[]; | ||
export type TimePeriodTypes = 'lastWeek' | 'thisWeek' | 'nextWeek' | 'yesterday' | 'today' | 'tomorrow' | 'last7Days' | 'lastMonth' | ||
| 'thisMonth' | 'nextMonth'; | ||
export type TimePeriodTypes = 'lastWeek' | 'thisWeek' | 'nextWeek' | 'yesterday' | 'today' | 'tomorrow' | 'last7Days' | 'lastMonth' | ||
| 'thisMonth' | 'nextMonth'; | ||
export type IconSetTypes = '5Arrows' | '5ArrowsGray' | '5Boxes' | '5Quarters' | '5Rating' | '4Arrows' | '4ArrowsGray' | ||
| '4Rating' | '4RedToBlack' | '4TrafficLights' | 'NoIcons' | '3Arrows' | '3ArrowsGray' | '3Flags' | '3Signs' | ||
| '3Stars' | '3Symbols' | '3Symbols2' | '3TrafficLights1' | '3TrafficLights2' | '3Triangles'; | ||
export type IconSetTypes = '5Arrows' | '5ArrowsGray' | '5Boxes' | '5Quarters' | '5Rating' | '4Arrows' | '4ArrowsGray' | ||
| '4Rating' | '4RedToBlack' | '4TrafficLights' | 'NoIcons' | '3Arrows' | '3ArrowsGray' | '3Flags' | '3Signs' | ||
| '3Stars' | '3Symbols' | '3Symbols2' | '3TrafficLights1' | '3TrafficLights2' | '3Triangles'; | ||
@@ -1054,4 +1070,4 @@ export type CfvoTypes = 'percentile' | 'percent' | 'num' | 'min' | 'max' | 'formula' | 'autoMin' | 'autoMax'; | ||
export type ConditionalFormattingRule = ExpressionRuleType | CellIsRuleType | Top10RuleType | AboveAverageRuleType | ColorScaleRuleType | IconSetRuleType | ||
| ContainsTextRuleType | TimePeriodRuleType | DataBarRuleType; | ||
export type ConditionalFormattingRule = ExpressionRuleType | CellIsRuleType | Top10RuleType | AboveAverageRuleType | ColorScaleRuleType | IconSetRuleType | ||
| ContainsTextRuleType | TimePeriodRuleType | DataBarRuleType; | ||
@@ -1061,3 +1077,3 @@ export interface ConditionalFormattingOptions { | ||
rules: ConditionalFormattingRule[]; | ||
} | ||
} | ||
@@ -1079,3 +1095,3 @@ export interface Worksheet { | ||
*/ | ||
headerFooter: HeaderFooter; | ||
headerFooter: Partial<HeaderFooter>; | ||
@@ -1276,3 +1292,3 @@ /** | ||
*/ | ||
addImage(imageId: number, range: string | { editAs?: string; } & ImageRange & {hyperlinks?: ImageHyperlinkValue} | { editAs?: string; } & ImagePosition & {hyperlinks?: ImageHyperlinkValue}): void; | ||
addImage(imageId: number, range: string | { editAs?: string; } & ImageRange & { hyperlinks?: ImageHyperlinkValue } | { editAs?: string; } & ImagePosition & { hyperlinks?: ImageHyperlinkValue }): void; | ||
@@ -1365,2 +1381,3 @@ getImages(): Array<{ | ||
pageSetup: Partial<PageSetup>; | ||
headerFooter: Partial<HeaderFooter>; | ||
views: Array<Partial<WorksheetView>>; | ||
@@ -1856,38 +1873,38 @@ state: WorksheetState; | ||
interface ArchiverZipOptions { | ||
comment: string; | ||
forceLocalTime: boolean; | ||
forceZip64: boolean; | ||
store: boolean; | ||
zlib: Partial<ZlibOptions>; | ||
} | ||
interface ArchiverZipOptions { | ||
comment: string; | ||
forceLocalTime: boolean; | ||
forceZip64: boolean; | ||
store: boolean; | ||
zlib: Partial<ZlibOptions>; | ||
} | ||
interface ZlibOptions { | ||
/** | ||
* @default constants.Z_NO_FLUSH | ||
*/ | ||
flush: number; | ||
/** | ||
* @default constants.Z_FINISH | ||
*/ | ||
finishFlush: number; | ||
/** | ||
* @default 16*1024 | ||
*/ | ||
chunkSize: number; | ||
windowBits: number; | ||
level: number; // compression only | ||
memLevel: number; // compression only | ||
strategy: number; // compression only | ||
dictionary: Buffer | NodeJS.TypedArray | DataView | ArrayBuffer; // deflate/inflate only, empty dictionary by default | ||
} | ||
interface ZlibOptions { | ||
/** | ||
* @default constants.Z_NO_FLUSH | ||
*/ | ||
flush: number; | ||
/** | ||
* @default constants.Z_FINISH | ||
*/ | ||
finishFlush: number; | ||
/** | ||
* @default 16*1024 | ||
*/ | ||
chunkSize: number; | ||
windowBits: number; | ||
level: number; // compression only | ||
memLevel: number; // compression only | ||
strategy: number; // compression only | ||
dictionary: Buffer | NodeJS.TypedArray | DataView | ArrayBuffer; // deflate/inflate only, empty dictionary by default | ||
} | ||
interface WorkbookStreamWriterOptions extends WorkbookWriterOptions { | ||
/** | ||
* Specifies whether to add style information to the workbook. | ||
* Styles can add some performance overhead. Default is false | ||
*/ | ||
zip: Partial<ArchiverZipOptions>; | ||
} | ||
/** | ||
* Specifies whether to add style information to the workbook. | ||
* Styles can add some performance overhead. Default is false | ||
*/ | ||
zip: Partial<ArchiverZipOptions>; | ||
} | ||
@@ -1894,0 +1911,0 @@ class WorkbookWriter extends Workbook { |
@@ -68,3 +68,3 @@ const fs = require('fs'); | ||
const dateFormats = options.dateFormats || ['YYYY-MM-DD[T]HH:mm:ss', 'MM-DD-YYYY', 'YYYY-MM-DD']; | ||
const dateFormats = options.dateFormats || ['YYYY-MM-DD[T]HH:mm:ssZ', 'YYYY-MM-DD[T]HH:mm:ss', 'MM-DD-YYYY', 'YYYY-MM-DD']; | ||
const map = | ||
@@ -71,0 +71,0 @@ options.map || |
@@ -0,1 +1,3 @@ | ||
const _ = require('../utils/under-dash'); | ||
class Note { | ||
@@ -7,21 +9,28 @@ constructor(note) { | ||
get model() { | ||
let value = null; | ||
switch (typeof this.note) { | ||
case 'string': | ||
return { | ||
value = { | ||
type: 'note', | ||
note: { | ||
texts: [{text: this.note}], | ||
texts: [ | ||
{ | ||
text: this.note, | ||
}, | ||
], | ||
}, | ||
}; | ||
break; | ||
default: | ||
return { | ||
value = { | ||
type: 'note', | ||
note: this.note, | ||
}; | ||
break; | ||
} | ||
// Suitable for all cell comments | ||
return _.deepMerge({}, Note.DEFAULT_CONFIGS, value); | ||
} | ||
set model(value) { | ||
// convenience - simplify unstyled notes | ||
const {note} = value; | ||
@@ -43,2 +52,16 @@ const {texts} = note; | ||
Note.DEFAULT_CONFIGS = { | ||
note: { | ||
margins: { | ||
insetmode: 'auto', | ||
inset: [0.13, 0.13, 0.25, 0.25], | ||
}, | ||
protection: { | ||
locked: 'True', | ||
lockText: 'True', | ||
}, | ||
editAs: 'absolute', | ||
}, | ||
}; | ||
module.exports = Note; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const Enums = require('./enums'); | ||
const colCache = require('./../utils/col-cache'); | ||
const colCache = require('../utils/col-cache'); | ||
const Cell = require('./cell'); | ||
@@ -78,4 +78,3 @@ | ||
// remove cell(s) and shift all higher cells down by count | ||
splice(start, count) { | ||
const inserts = Array.prototype.slice.call(arguments, 2); | ||
splice(start, count, ...inserts) { | ||
const nKeep = start + count; | ||
@@ -82,0 +81,0 @@ const nExpand = inserts.length - count; |
const _ = require('../utils/under-dash'); | ||
const colCache = require('./../utils/col-cache'); | ||
const colCache = require('../utils/col-cache'); | ||
const Range = require('./range'); | ||
@@ -92,12 +92,16 @@ const Row = require('./row'); | ||
this.headerFooter = { | ||
differentFirst: false, | ||
differentOddEven: false, | ||
oddHeader: null, | ||
oddFooter: null, | ||
evenHeader: null, | ||
evenFooter: null, | ||
firstHeader: null, | ||
firstFooter: null, | ||
}; | ||
this.headerFooter = Object.assign( | ||
{}, | ||
{ | ||
differentFirst: false, | ||
differentOddEven: false, | ||
oddHeader: null, | ||
oddFooter: null, | ||
evenHeader: null, | ||
evenFooter: null, | ||
firstHeader: null, | ||
firstFooter: null, | ||
}, | ||
options.headerFooter | ||
); | ||
@@ -211,5 +215,3 @@ this.dataValidations = new DataValidations(); | ||
spliceColumns(start, count) { | ||
// each member of inserts is a column of data. | ||
const inserts = Array.prototype.slice.call(arguments, 2); | ||
spliceColumns(start, count, ...inserts) { | ||
const rows = this._rows; | ||
@@ -369,5 +371,4 @@ const nRows = rows.length; | ||
spliceRows(start, count) { | ||
spliceRows(start, count, ...inserts) { | ||
// same problem as row.splice, except worse. | ||
const inserts = Array.prototype.slice.call(arguments, 2); | ||
const nKeep = start + count; | ||
@@ -478,9 +479,9 @@ const nExpand = inserts.length - count; | ||
// convert the range defined by ['tl:br'], [tl,br] or [t,l,b,r] into a single 'merged' cell | ||
mergeCells() { | ||
const dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
mergeCells(...cells) { | ||
const dimensions = new Range(cells); | ||
this._mergeCellsInternal(dimensions); | ||
} | ||
mergeCellsWithoutStyle() { | ||
const dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
mergeCellsWithoutStyle(...cells) { | ||
const dimensions = new Range(cells); | ||
this._mergeCellsInternal(dimensions, true); | ||
@@ -533,4 +534,4 @@ } | ||
// atomic - either they're all merged or all un-merged. | ||
unMergeCells() { | ||
const dimensions = new Range(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
unMergeCells(...cells) { | ||
const dimensions = new Range(cells); | ||
@@ -572,2 +573,3 @@ // find any cells in that range and unmerge them | ||
} else { | ||
// eslint-disable-next-line no-mixed-operators | ||
getResult = (row, col) => results[(row - top) * width + (col - left)]; | ||
@@ -640,3 +642,3 @@ } | ||
// force spinCount to be integer >= 0 | ||
options.spinCount = isFinite(options.spinCount) ? Math.round(Math.max(0, options.spinCount)) : 100000; | ||
options.spinCount = Number.isFinite(options.spinCount) ? Math.round(Math.max(0, options.spinCount)) : 100000; | ||
} | ||
@@ -643,0 +645,0 @@ if (password) { |
/* eslint-disable import/no-extraneous-dependencies,node/no-unpublished-require */ | ||
require('core-js/modules/es.promise'); | ||
require('core-js/modules/es.string.includes'); | ||
require('core-js/modules/es.object.assign'); | ||
@@ -8,18 +7,2 @@ require('core-js/modules/es.object.keys'); | ||
const rewritePattern = require('regexpu-core'); | ||
const {generateRegexpuOptions} = require('@babel/helper-create-regexp-features-plugin/lib/util'); | ||
const {RegExp} = global; | ||
try { | ||
RegExp('a', 'u'); | ||
} catch (err) { | ||
global.RegExp = function(pattern, flags) { | ||
if (flags && flags.includes('u')) { | ||
return new RegExp(rewritePattern(pattern, flags, generateRegexpuOptions({flags, pattern}))); | ||
} | ||
return new RegExp(pattern, flags); | ||
}; | ||
global.RegExp.prototype = RegExp; | ||
} | ||
const ExcelJS = { | ||
@@ -26,0 +9,0 @@ Workbook: require('./doc/workbook'), |
@@ -5,3 +5,3 @@ const XmlStream = require('../../utils/xml-stream'); | ||
const CommentXform = require('../../xlsx/xform/comment/comment-xform'); | ||
const VmlNoteXform = require('../../xlsx/xform/comment/vml-note-xform'); | ||
const VmlShapeXform = require('../../xlsx/xform/comment/vml-shape-xform'); | ||
@@ -81,5 +81,5 @@ class SheetCommentsWriter { | ||
const vmlNoteXform = new VmlNoteXform(); | ||
const vmlShapeXform = new VmlShapeXform(); | ||
const vmlXmlStream = new XmlStream(); | ||
vmlNoteXform.render(vmlXmlStream, comment, index); | ||
vmlShapeXform.render(vmlXmlStream, comment, index); | ||
this.vmlStream.write(vmlXmlStream.xml); | ||
@@ -86,0 +86,0 @@ } |
@@ -160,2 +160,3 @@ const fs = require('fs'); | ||
autoFilter: options.autoFilter, | ||
headerFooter: options.headerFooter, | ||
}); | ||
@@ -162,0 +163,0 @@ |
@@ -34,2 +34,4 @@ const _ = require('../../utils/under-dash'); | ||
const ConditionalFormattingsXform = require('../../xlsx/xform/sheet/cf/conditional-formattings-xform'); | ||
const HeaderFooterXform = require('../../xlsx/xform/sheet/header-footer-xform'); | ||
const RowBreaksXform = require('../../xlsx/xform/sheet/row-breaks-xform'); | ||
@@ -51,2 +53,4 @@ // since prepare and render are functional, we can use singletons | ||
conditionalFormattings: new ConditionalFormattingsXform(), | ||
headerFooter: new HeaderFooterXform(), | ||
rowBreaks: new RowBreaksXform(), | ||
}; | ||
@@ -77,3 +81,3 @@ | ||
// keep record of all merges | ||
// keep a record of all row and column pageBreaks | ||
this._merges = []; | ||
@@ -106,2 +110,5 @@ this._merges.add = function() {}; // ignore cell instruction | ||
// keep a record of all row and column pageBreaks | ||
this.rowBreaks = []; | ||
// for default row height, outline levels, etc | ||
@@ -119,2 +126,17 @@ this.properties = Object.assign( | ||
this.headerFooter = Object.assign( | ||
{}, | ||
{ | ||
differentFirst: false, | ||
differentOddEven: false, | ||
oddHeader: null, | ||
oddFooter: null, | ||
evenHeader: null, | ||
evenFooter: null, | ||
firstHeader: null, | ||
firstFooter: null, | ||
}, | ||
options.headerFooter | ||
); | ||
// for all things printing | ||
@@ -222,2 +244,4 @@ this.pageSetup = Object.assign( | ||
this._writeBackground(); | ||
this._writeHeaderFooter(); | ||
this._writeRowBreaks(); | ||
@@ -405,5 +429,5 @@ // Legacy Data tag for comments | ||
mergeCells() { | ||
mergeCells(...cells) { | ||
// may fail if rows have been comitted | ||
const dimensions = new Dimensions(Array.prototype.slice.call(arguments, 0)); // convert arguments into Array | ||
const dimensions = new Dimensions(cells); | ||
@@ -438,3 +462,2 @@ // check cells aren't already merged | ||
removeConditionalFormatting(filter) { | ||
console.log('conditionalFormatting', this.conditionalFormatting); | ||
if (typeof filter === 'number') { | ||
@@ -591,2 +614,6 @@ this.conditionalFormatting.splice(filter, 1); | ||
_writeRowBreaks() { | ||
this.stream.write(xform.rowBreaks.toXml(this.rowBreaks)); | ||
} | ||
_writeDataValidations() { | ||
@@ -608,2 +635,6 @@ this.stream.write(xform.dataValidations.toXml(this.dataValidations.model)); | ||
_writeHeaderFooter() { | ||
this.stream.write(xform.headerFooter.toXml(this.headerFooter)); | ||
} | ||
_writeAutoFilter() { | ||
@@ -610,0 +641,0 @@ this.stream.write(xform.autoFilter.toXml(this.autoFilter)); |
@@ -0,1 +1,3 @@ | ||
const {toString} = Object.prototype; | ||
const _ = { | ||
@@ -98,4 +100,40 @@ each: function each(obj, cb) { | ||
}, | ||
isUndefined(val) { | ||
return toString.call(val) === '[object Undefined]'; | ||
}, | ||
isObject(val) { | ||
return toString.call(val) === '[object Object]'; | ||
}, | ||
deepMerge() { | ||
const target = arguments[0] || {}; | ||
const {length} = arguments; | ||
// eslint-disable-next-line one-var | ||
let src, clone, copyIsArray; | ||
function assignValue(val, key) { | ||
src = target[key]; | ||
copyIsArray = Array.isArray(val); | ||
if (_.isObject(val) || copyIsArray) { | ||
if (copyIsArray) { | ||
copyIsArray = false; | ||
clone = src && Array.isArray(src) ? src : []; | ||
} else { | ||
clone = src && _.isObject(src) ? src : {}; | ||
} | ||
target[key] = _.deepMerge(clone, val); | ||
} else if (!_.isUndefined(val)) { | ||
target[key] = val; | ||
} | ||
} | ||
for (let i = 0; i < length; i++) { | ||
_.each(arguments[i], assignValue); | ||
} | ||
return target; | ||
}, | ||
}; | ||
module.exports = _; |
@@ -160,3 +160,5 @@ const _ = require('../../../utils/under-dash'); | ||
} | ||
worksheet = model.worksheetHash[`xl/${rel.Target}`]; | ||
// if rel.Target start with `[space]/xl/` or `/xl/` , then it will be replaced with `''` and spliced behind `xl/`, | ||
// otherwise it will be spliced directly behind `xl/`. i.g. | ||
worksheet = model.worksheetHash[`xl/${rel.Target.replace(/^(\s|\/xl\/)+/, '')}`]; | ||
// If there are "chartsheets" in the file, rel.Target will | ||
@@ -163,0 +165,0 @@ // come out as chartsheets/sheet1.xml or similar here, and |
@@ -38,4 +38,22 @@ const BaseXform = require('../base-xform'); | ||
} | ||
parseOpen(node) { | ||
switch (node.name) { | ||
case this.tag: | ||
this.text = ''; | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
parseText(text) { | ||
this.text = text; | ||
} | ||
parseClose() { | ||
return false; | ||
} | ||
} | ||
module.exports = VmlAnchorXform; |
const XmlStream = require('../../../utils/xml-stream'); | ||
const BaseXform = require('../base-xform'); | ||
const VmlNoteXform = require('./vml-note-xform'); | ||
const VmlShapeXform = require('./vml-shape-xform'); | ||
@@ -9,2 +9,9 @@ // This class is (currently) single purposed to insert the triangle | ||
class VmlNotesXform extends BaseXform { | ||
constructor() { | ||
super(); | ||
this.map = { | ||
'v:shape': new VmlShapeXform(), | ||
}; | ||
} | ||
get tag() { | ||
@@ -28,3 +35,3 @@ return 'xml'; | ||
model.comments.forEach((item, index) => { | ||
VmlNotesXform.vmlCommentXform.render(xmlStream, item, index); | ||
this.map['v:shape'].render(xmlStream, item, index); | ||
}); | ||
@@ -44,3 +51,3 @@ | ||
this.model = { | ||
anchors: [], | ||
comments: [], | ||
}; | ||
@@ -67,3 +74,3 @@ break; | ||
if (!this.parser.parseClose(name)) { | ||
this.model.anchors.push(this.parser.model); | ||
this.model.comments.push(this.parser.model); | ||
this.parser = undefined; | ||
@@ -99,4 +106,2 @@ } | ||
VmlNotesXform.vmlCommentXform = new VmlNoteXform(); | ||
module.exports = VmlNotesXform; |
@@ -1,2 +0,2 @@ | ||
const uuid = require('uuid'); | ||
const {v4: uuidv4} = require('uuid'); | ||
const BaseXform = require('../../base-xform'); | ||
@@ -43,3 +43,3 @@ const CompositeXform = require('../../composite-xform'); | ||
if (CfRuleExtXform.isExt(model)) { | ||
model.x14Id = `{${uuid.v4()}}`.toUpperCase(); | ||
model.x14Id = `{${uuidv4()}}`.toUpperCase(); | ||
} | ||
@@ -78,3 +78,3 @@ } | ||
priority: model.priority, | ||
id: model.x14Id || `{${uuid.v4()}}`, | ||
id: model.x14Id || `{${uuidv4()}}`, | ||
}); | ||
@@ -81,0 +81,0 @@ |
@@ -51,3 +51,3 @@ const BaseXform = require('../base-xform'); | ||
} | ||
if (node.attributes.hidden) { | ||
if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') { | ||
model.hidden = true; | ||
@@ -54,0 +54,0 @@ } |
@@ -165,3 +165,3 @@ const _ = require('../../../utils/under-dash'); | ||
this._address = node.attributes.sqref; | ||
const dataValidation = node.attributes.type ? {type: node.attributes.type, formulae: []} : {type: 'any'}; | ||
const dataValidation = {type: node.attributes.type || 'any', formulae: []}; | ||
@@ -168,0 +168,0 @@ if (node.attributes.type) { |
@@ -80,3 +80,3 @@ const BaseXform = require('../base-xform'); | ||
} | ||
if (node.attributes.hidden) { | ||
if (node.attributes.hidden === true || node.attributes.hidden === 'true' || node.attributes.hidden === 1 || node.attributes.hidden === '1') { | ||
model.hidden = true; | ||
@@ -83,0 +83,0 @@ } |
@@ -382,3 +382,3 @@ const _ = require('../../../utils/under-dash'); | ||
case 'worksheet': { | ||
const properties = this.map.sheetFormatPr.model; | ||
const properties = this.map.sheetFormatPr.model || {}; | ||
if (this.map.sheetPr.model && this.map.sheetPr.model.tabColor) { | ||
@@ -388,3 +388,3 @@ properties.tabColor = this.map.sheetPr.model.tabColor; | ||
if (this.map.sheetPr.model && this.map.sheetPr.model.outlineProperties) { | ||
properties.outlineProperties = this.map.sheetPr.model.outlinePropertiesx; | ||
properties.outlineProperties = this.map.sheetPr.model.outlineProperties; | ||
} | ||
@@ -441,2 +441,8 @@ const sheetProperties = { | ||
} | ||
if (rel.Type === RelType.VmlDrawing && model.comments && model.comments.length) { | ||
const vmlComment = options.vmlDrawings[rel.Target].comments; | ||
model.comments.forEach((comment, index) => { | ||
comment.note = Object.assign({}, comment.note, vmlComment[index]); | ||
}); | ||
} | ||
return h; | ||
@@ -443,0 +449,0 @@ }, {}); |
@@ -34,6 +34,9 @@ const TextXform = require('./text-xform'); | ||
if (model && model.hasOwnProperty('richText') && model.richText) { | ||
const {r} = this.map; | ||
model.richText.forEach(text => { | ||
r.render(xmlStream, text); | ||
}); | ||
if (model.richText.length) { | ||
model.richText.forEach(text => { | ||
this.map.r.render(xmlStream, text); | ||
}); | ||
} else { | ||
this.map.t.render(xmlStream, ''); | ||
} | ||
} else if (model !== undefined && model !== null) { | ||
@@ -40,0 +43,0 @@ this.map.t.render(xmlStream, model); |
@@ -13,4 +13,4 @@ const XmlStream = require('../../../utils/xml-stream'); | ||
}; | ||
this.hash = {}; | ||
this.rich = {}; | ||
this.hash = Object.create(null); | ||
this.rich = Object.create(null); | ||
} | ||
@@ -17,0 +17,0 @@ |
@@ -125,2 +125,3 @@ const fs = require('fs'); | ||
tables: model.tables, | ||
vmlDrawings: model.vmlDrawings, | ||
}; | ||
@@ -143,2 +144,3 @@ model.worksheets.forEach(worksheet => { | ||
delete model.drawingRels; | ||
delete model.vmlDrawings; | ||
} | ||
@@ -212,2 +214,8 @@ | ||
async _processVmlDrawingEntry(entry, model, name) { | ||
const xform = new VmlNotesXform(); | ||
const vmlDrawing = await xform.parseStream(entry); | ||
model.vmlDrawings[`../drawings/${name}.vml`] = vmlDrawing; | ||
} | ||
async _processThemeEntry(entry, model, name) { | ||
@@ -247,2 +255,3 @@ await new Promise((resolve, reject) => { | ||
tables: {}, | ||
vmlDrawings: {}, | ||
}; | ||
@@ -348,2 +357,7 @@ | ||
} | ||
match = entry.path.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/); | ||
if (match) { | ||
await this._processVmlDrawingEntry(entry, model, match[1]); | ||
break; | ||
} | ||
@@ -350,0 +364,0 @@ entry.autodrain(); |
{ | ||
"name": "exceljs", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"description": "Excel Workbook Manager - Read and Write xlsx and csv Files.", | ||
@@ -54,2 +54,3 @@ "private": false, | ||
"build": "grunt build", | ||
"install-build": "npm install && grunt build", | ||
"preversion": "npm run clean && npm run build && npm run test:version", | ||
@@ -96,12 +97,12 @@ "postversion": "git push --no-verify && git push --tags --no-verify" | ||
"dependencies": { | ||
"archiver": "^3.0.0", | ||
"dayjs": "^1.8.23", | ||
"fast-csv": "^3.4.0", | ||
"jszip": "^3.1.5", | ||
"archiver": "^4.0.1", | ||
"dayjs": "^1.8.26", | ||
"fast-csv": "^4.1.2", | ||
"jszip": "^3.4.0", | ||
"proxyquire": "^2.1.3", | ||
"readable-stream": "^3.6.0", | ||
"saxes": "^5.0.0", | ||
"tmp": "^0.1.0", | ||
"unzipper": "^0.10.10", | ||
"uuid": "^3.3.3" | ||
"saxes": "^5.0.1", | ||
"tmp": "^0.2.0", | ||
"unzipper": "^0.10.11", | ||
"uuid": "^7.0.3" | ||
}, | ||
@@ -111,20 +112,19 @@ "devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/helper-create-regexp-features-plugin": "^7.8.8", | ||
"@babel/preset-env": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@types/chai": "^4.2.11", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.12.32", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^13.13.2", | ||
"babelify": "^10.0.0", | ||
"browserify": "^16.5.0", | ||
"browserify": "^16.5.1", | ||
"chai": "^4.2.0", | ||
"chai-datetime": "^1.5.0", | ||
"chai-xml": "^0.3.2", | ||
"core-js": "^3.2.1", | ||
"core-js": "^3.6.5", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "^6.5.1", | ||
"eslint-config-airbnb-base": "^14.1.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-friendly-formatter": "^4.0.1", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"express": "^4.16.4", | ||
@@ -139,14 +139,12 @@ "got": "^9.0.0", | ||
"grunt-terser": "^1.0.0", | ||
"husky": "^2.2.0", | ||
"lint-staged": "^8.1.5", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.1.7", | ||
"memorystream": "^0.3.1", | ||
"mocha": "^5.2.0", | ||
"mocha": "^7.1.1", | ||
"prettier-eslint": "^9.0.0", | ||
"prettier-eslint-cli": "^5.0.0", | ||
"regenerator-runtime": "^0.13.5", | ||
"regexpu-core": "^4.7.0", | ||
"semver": "^5.6.0", | ||
"ts-node": "^8.8.1", | ||
"ts-node": "^8.9.0", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
37
501
2842
22094764
78711
+ Added@fast-csv/format@4.3.5(transitive)
+ Added@fast-csv/parse@4.3.6(transitive)
+ Added@types/node@14.18.63(transitive)
+ Addedarchiver@4.0.2(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedcompress-commons@3.0.0(transitive)
+ Addedfast-csv@4.3.6(transitive)
+ Addedtmp@0.2.3(transitive)
+ Addeduuid@7.0.3(transitive)
+ Addedzip-stream@3.0.1(transitive)
- Removed@types/node@12.20.55(transitive)
- Removedarchiver@3.1.1(transitive)
- Removedasync@2.6.4(transitive)
- Removedcompress-commons@2.1.1(transitive)
- Removedfast-csv@3.7.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.isstring@4.0.1(transitive)
- Removedtmp@0.1.0(transitive)
- Removeduuid@3.4.0(transitive)
- Removedzip-stream@2.1.3(transitive)
Updatedarchiver@^4.0.1
Updateddayjs@^1.8.26
Updatedfast-csv@^4.1.2
Updatedjszip@^3.4.0
Updatedsaxes@^5.0.1
Updatedtmp@^0.2.0
Updatedunzipper@^0.10.11
Updateduuid@^7.0.3