Comparing version 3.4.0 to 3.5.0
@@ -118,2 +118,3 @@ "use strict"; | ||
this.tables = {}; | ||
this.conditionalFormattings = []; | ||
} | ||
@@ -622,2 +623,20 @@ | ||
} // =========================================================================== | ||
// Conditional Formatting | ||
}, { | ||
key: "addConditionalFormatting", | ||
value: function addConditionalFormatting(cf) { | ||
this.conditionalFormattings.push(cf); | ||
} | ||
}, { | ||
key: "removeConditionalFormatting", | ||
value: function removeConditionalFormatting(filter) { | ||
if (typeof filter === 'number') { | ||
this.conditionalFormattings.splice(filter, 1); | ||
} else if (filter instanceof Function) { | ||
this.conditionalFormattings = this.conditionalFormattings.filter(filter); | ||
} else { | ||
this.conditionalFormattings = []; | ||
} | ||
} // =========================================================================== | ||
// Deprecated | ||
@@ -804,3 +823,4 @@ | ||
return table.model; | ||
}) | ||
}), | ||
conditionalFormattings: this.conditionalFormattings | ||
}; // ================================================= | ||
@@ -860,2 +880,3 @@ // columns | ||
}, {}); | ||
this.conditionalFormattings = value.conditionalFormattings; | ||
} | ||
@@ -862,0 +883,0 @@ }]); |
@@ -86,3 +86,5 @@ "use strict"; | ||
pushAttribute(this._xml, name, value); | ||
if (value !== undefined) { | ||
pushAttribute(this._xml, name, value); | ||
} | ||
} | ||
@@ -170,2 +172,4 @@ }, { | ||
}); | ||
return this.cursor; | ||
} | ||
@@ -199,2 +203,8 @@ }, { | ||
}, { | ||
key: "cursor", | ||
get: function get() { | ||
// handy way to track whether anything has been added | ||
return this._xml.length; | ||
} | ||
}, { | ||
key: "xml", | ||
@@ -201,0 +211,0 @@ get: function get() { |
@@ -72,7 +72,9 @@ "use strict"; | ||
if (this.map) { | ||
var keys = Object.keys(this.map); | ||
for (var i = 0; i < keys.length; i++) { | ||
this.map[keys[i]].reset(); | ||
} | ||
Object.values(this.map).forEach(function (xform) { | ||
if (xform instanceof BaseXform) { | ||
xform.reset(); | ||
} else if (xform.xform) { | ||
xform.xform.reset(); | ||
} | ||
}); | ||
} | ||
@@ -146,3 +148,5 @@ } | ||
return xmlStream.xml; | ||
} | ||
} // ============================================================ | ||
// Useful Utilities | ||
}, { | ||
@@ -155,2 +159,59 @@ key: "xml", | ||
} | ||
}], [{ | ||
key: "toAttribute", | ||
value: function toAttribute(value, dflt) { | ||
if (value !== undefined && value !== dflt) { | ||
return value.toString(); | ||
} | ||
return undefined; | ||
} | ||
}, { | ||
key: "toStringAttribute", | ||
value: function toStringAttribute(value, dflt) { | ||
if (value !== dflt) { | ||
return value; | ||
} | ||
return undefined; | ||
} | ||
}, { | ||
key: "toStringValue", | ||
value: function toStringValue(attr, dflt) { | ||
return attr === undefined ? dflt : attr; | ||
} | ||
}, { | ||
key: "toBoolAttribute", | ||
value: function toBoolAttribute(value, dflt) { | ||
if (value !== undefined && value !== dflt) { | ||
return value ? '1' : '0'; | ||
} | ||
return undefined; | ||
} | ||
}, { | ||
key: "toBoolValue", | ||
value: function toBoolValue(attr, dflt) { | ||
return attr === undefined ? dflt : attr === '1'; | ||
} | ||
}, { | ||
key: "toIntAttribute", | ||
value: function toIntAttribute(value, dflt) { | ||
return BaseXform.toAttribute(value, dflt); | ||
} | ||
}, { | ||
key: "toIntValue", | ||
value: function toIntValue(attr, dflt) { | ||
return attr === undefined ? dflt : parseInt(attr, 10); | ||
} | ||
}, { | ||
key: "toFloatAttribute", | ||
value: function toFloatAttribute(value, dflt) { | ||
return BaseXform.toAttribute(value, dflt); | ||
} | ||
}, { | ||
key: "toFloatValue", | ||
value: function toFloatValue(attr, dflt) { | ||
return attr === undefined ? dflt : parseFloat(attr); | ||
} | ||
}]); | ||
@@ -157,0 +218,0 @@ |
@@ -276,3 +276,5 @@ "use strict"; | ||
value: function parseText(text) { | ||
this._formula.push(text); | ||
if (this._formula) { | ||
this._formula.push(text); | ||
} | ||
} | ||
@@ -330,2 +332,3 @@ }, { | ||
this._formula = undefined; | ||
return true; | ||
@@ -332,0 +335,0 @@ } |
@@ -73,2 +73,4 @@ "use strict"; | ||
var ConditionalFormattingsXform = require('./cf/conditional-formattings-xform'); | ||
var WorkSheetXform = | ||
@@ -137,3 +139,4 @@ /*#__PURE__*/ | ||
childXform: new TablePartXform() | ||
}) | ||
}), | ||
conditionalFormatting: new ConditionalFormattingsXform() | ||
}; | ||
@@ -153,2 +156,3 @@ return _this; | ||
this.map.sheetData.prepare(model.rows, options); | ||
this.map.conditionalFormatting.prepare(model.conditionalFormattings, options); | ||
model.mergeCells = options.merges.mergeCells; // prepare relationships | ||
@@ -308,2 +312,3 @@ | ||
this.map.hyperlinks.render(xmlStream, model.hyperlinks); | ||
this.map.conditionalFormatting.render(xmlStream, model.conditionalFormattings); | ||
this.map.pageMargins.render(xmlStream, pageMarginsModel); | ||
@@ -406,3 +411,4 @@ this.map.printOptions.render(xmlStream, printOptionsModel); | ||
drawing: this.map.drawing.model, | ||
tables: this.map.tableParts.model | ||
tables: this.map.tableParts.model, | ||
conditionalFormattings: this.map.conditionalFormatting.model | ||
}; | ||
@@ -462,2 +468,3 @@ | ||
this.map.sheetData.reconcile(model.rows, options); | ||
this.map.conditionalFormatting.reconcile(model.conditionalFormattings, options); | ||
model.media = []; | ||
@@ -464,0 +471,0 @@ |
@@ -104,2 +104,4 @@ "use strict"; | ||
case this.tag: | ||
// this node is often repeated. Need to reset children | ||
this.reset(); | ||
return true; | ||
@@ -106,0 +108,0 @@ |
@@ -118,2 +118,4 @@ const _ = require('../utils/under-dash'); | ||
this.tables = {}; | ||
this.conditionalFormattings = []; | ||
} | ||
@@ -639,2 +641,18 @@ | ||
// =========================================================================== | ||
// Conditional Formatting | ||
addConditionalFormatting(cf) { | ||
this.conditionalFormattings.push(cf); | ||
} | ||
removeConditionalFormatting(filter) { | ||
if (typeof filter === 'number') { | ||
this.conditionalFormattings.splice(filter, 1); | ||
} else if (filter instanceof Function) { | ||
this.conditionalFormattings = this.conditionalFormattings.filter(filter); | ||
} else { | ||
this.conditionalFormattings = []; | ||
} | ||
} | ||
// =========================================================================== | ||
// Deprecated | ||
@@ -671,2 +689,3 @@ get tabColor() { | ||
tables: Object.values(this.tables).map(table => table.model), | ||
conditionalFormattings: this.conditionalFormattings, | ||
}; | ||
@@ -735,2 +754,3 @@ | ||
}, {}); | ||
this.conditionalFormattings = value.conditionalFormattings; | ||
} | ||
@@ -737,0 +757,0 @@ } |
@@ -42,2 +42,7 @@ const _ = require('./under-dash'); | ||
get cursor() { | ||
// handy way to track whether anything has been added | ||
return this._xml.length; | ||
} | ||
openXml(docAttributes) { | ||
@@ -72,3 +77,5 @@ const xml = this._xml; | ||
} | ||
pushAttribute(this._xml, name, value); | ||
if (value !== undefined) { | ||
pushAttribute(this._xml, name, value); | ||
} | ||
} | ||
@@ -138,2 +145,3 @@ | ||
}); | ||
return this.cursor; | ||
} | ||
@@ -140,0 +148,0 @@ |
@@ -45,6 +45,9 @@ const Sax = require('sax'); | ||
if (this.map) { | ||
const keys = Object.keys(this.map); | ||
for (let i = 0; i < keys.length; i++) { | ||
this.map[keys[i]].reset(); | ||
} | ||
Object.values(this.map).forEach(xform => { | ||
if (xform instanceof BaseXform) { | ||
xform.reset(); | ||
} else if (xform.xform) { | ||
xform.xform.reset(); | ||
} | ||
}); | ||
} | ||
@@ -119,4 +122,54 @@ } | ||
} | ||
// ============================================================ | ||
// Useful Utilities | ||
static toAttribute(value, dflt) { | ||
if ((value !== undefined) && (value !== dflt)) { | ||
return value.toString(); | ||
} | ||
return undefined; | ||
} | ||
static toStringAttribute(value, dflt) { | ||
if (value !== dflt) { | ||
return value; | ||
} | ||
return undefined; | ||
} | ||
static toStringValue(attr, dflt) { | ||
return (attr === undefined) ? dflt : attr; | ||
} | ||
static toBoolAttribute(value, dflt) { | ||
if ((value !== undefined) && (value !== dflt)) { | ||
return value ? '1' : '0'; | ||
} | ||
return undefined; | ||
} | ||
static toBoolValue(attr, dflt) { | ||
return (attr === undefined) ? dflt : (attr === '1'); | ||
} | ||
static toIntAttribute(value, dflt) { | ||
return BaseXform.toAttribute(value, dflt); | ||
} | ||
static toIntValue(attr, dflt) { | ||
return (attr === undefined) ? dflt : parseInt(attr, 10); | ||
} | ||
static toFloatAttribute(value, dflt) { | ||
return BaseXform.toAttribute(value, dflt); | ||
} | ||
static toFloatValue(attr, dflt) { | ||
return (attr === undefined) ? dflt : parseFloat(attr); | ||
} | ||
} | ||
module.exports = BaseXform; |
@@ -207,3 +207,5 @@ const _ = require('../../../utils/under-dash'); | ||
parseText(text) { | ||
this._formula.push(text); | ||
if (this._formula) { | ||
this._formula.push(text); | ||
} | ||
} | ||
@@ -248,2 +250,3 @@ | ||
this._dataValidation.formulae.push(formula); | ||
this._formula = undefined; | ||
return true; | ||
@@ -250,0 +253,0 @@ } |
@@ -31,2 +31,3 @@ const _ = require('../../../utils/under-dash'); | ||
const HeaderFooterXform = require('./header-footer-xform'); | ||
const ConditionalFormattingsXform = require('./cf/conditional-formattings-xform'); | ||
@@ -64,2 +65,3 @@ class WorkSheetXform extends BaseXform { | ||
tableParts: new ListXform({tag: 'tableParts', count: true, childXform: new TablePartXform()}), | ||
conditionalFormatting: new ConditionalFormattingsXform(), | ||
}; | ||
@@ -77,2 +79,3 @@ } | ||
this.map.sheetData.prepare(model.rows, options); | ||
this.map.conditionalFormatting.prepare(model.conditionalFormattings, options); | ||
@@ -241,2 +244,3 @@ model.mergeCells = options.merges.mergeCells; | ||
this.map.conditionalFormatting.render(xmlStream, model.conditionalFormattings); | ||
this.map.pageMargins.render(xmlStream, pageMarginsModel); | ||
@@ -324,2 +328,3 @@ this.map.printOptions.render(xmlStream, printOptionsModel); | ||
tables: this.map.tableParts.model, | ||
conditionalFormattings: this.map.conditionalFormatting.model, | ||
}; | ||
@@ -333,3 +338,3 @@ | ||
} | ||
return false; | ||
@@ -376,2 +381,3 @@ } | ||
this.map.sheetData.reconcile(model.rows, options); | ||
this.map.conditionalFormatting.reconcile(model.conditionalFormattings, options); | ||
@@ -378,0 +384,0 @@ model.media = []; |
@@ -69,2 +69,4 @@ const BaseXform = require('../base-xform'); | ||
case this.tag: | ||
// this node is often repeated. Need to reset children | ||
this.reset(); | ||
return true; | ||
@@ -71,0 +73,0 @@ default: |
{ | ||
"name": "exceljs", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Excel Workbook Manager - Read and Write xlsx and csv Files.", | ||
@@ -96,3 +96,4 @@ "private": false, | ||
"tmp": "^0.1.0", | ||
"unzipper": "^0.9.12" | ||
"unzipper": "^0.9.12", | ||
"uuid": "^3.3.3" | ||
}, | ||
@@ -99,0 +100,0 @@ "devDependencies": { |
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 too big to display
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify 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
9438301
449
177649
2590
8
3
20
7
+ Addeduuid@^3.3.3
+ Addeduuid@3.4.0(transitive)