angular-barcode
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "angular-barcode", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "An angular directive for lindell's JsBarcode", | ||
@@ -5,0 +5,0 @@ "main": "dist/barcode.js", |
@@ -23,2 +23,23 @@ 'use strict'; | ||
constructor() { | ||
this.defaults = { | ||
format: 'CODE128', | ||
lineColor: '#000000', | ||
width: 2, | ||
height: 100, | ||
displayValue: false, | ||
fontOptions: '', | ||
font: 'monospace', | ||
textAlign: 'center', | ||
textPosition: 'bottom', | ||
textMargin: 2, | ||
fontSize: 20, | ||
background: '#ffffff', | ||
margin: 10, | ||
marginTop: undefined, | ||
marginBottom: undefined, | ||
marginLeft: undefined, | ||
marginRight: undefined, | ||
valid: function(valid){} | ||
}; | ||
@@ -57,44 +78,24 @@ // Directive config | ||
let defaults = { | ||
format: 'CODE128', | ||
lineColor: '#000000', | ||
width: 2, | ||
height: 100, | ||
displayValue: true, | ||
fontOptions: '', | ||
font: 'monospace', | ||
textAlign: 'center', | ||
textPosition: 'bottom', | ||
textMargin: 2, | ||
fontSize: 20, | ||
background: '#ffffff', | ||
margin: 10, | ||
marginTop: undefined, | ||
marginBottom: undefined, | ||
marginLeft: undefined, | ||
marginRight: undefined, | ||
valid: function(valid){} | ||
}; | ||
scope.$watch(() => { | ||
attributes.$observe('bcText', () => { | ||
if(scope.bcText !== undefined && scope.bcText.length > 0) { | ||
JsBarcode(element[0], scope.bcText, { | ||
format: scope.bcFormat || defaults.format, | ||
lineColor: scope.bcLineColor || defaults.lineColor, | ||
width: parseInt(scope.bcWidth, 10) || defaults.width, | ||
height: parseInt(scope.bcHeight, 10) || defaults.height, | ||
displayValue: (scope.bcDisplayValue === 'true') || defaults.displayValue, | ||
fontOptions: scope.bcFontOptions || defaults.fontOptions, | ||
font: scope.bcFont || defaults.font, | ||
textAlign: scope.bcTextAlign || defaults.textAlign, | ||
textPosition: scope.bcTextPosition || defaults.textPosition, | ||
textMargin: parseInt(scope.bcTextMargin, 10) || defaults.textMargin, | ||
fontSize: parseInt(scope.bcFontSize, 10) || defaults.fontSize, | ||
background: scope.bcBackground || defaults.background, | ||
margin: parseInt(scope.bcMargin, 10) || defaults.margin, | ||
marginTop: parseInt(scope.bcMarginTop, 10) || defaults.marginTop, | ||
marginBottom: parseInt(scope.bcMarginBottom, 10) || defaults.marginBottom, | ||
marginLeft: parseInt(scope.bcMarginLeft, 10) || defaults.marginLeft, | ||
marginRight: parseInt(scope.bcMarginRight, 10) || defaults.marginRight, | ||
valid: scope.bcValid || defaults.valid | ||
format: scope.bcFormat || this.defaults.format, | ||
lineColor: scope.bcLineColor || this.defaults.lineColor, | ||
width: parseInt(scope.bcWidth, 10) || this.defaults.width, | ||
height: parseInt(scope.bcHeight, 10) || this.defaults.height, | ||
displayValue: (scope.bcDisplayValue === 'true') || this.defaults.displayValue, | ||
fontOptions: scope.bcFontOptions || this.defaults.fontOptions, | ||
font: scope.bcFont || this.defaults.font, | ||
textAlign: scope.bcTextAlign || this.defaults.textAlign, | ||
textPosition: scope.bcTextPosition || this.defaults.textPosition, | ||
textMargin: parseInt(scope.bcTextMargin, 10) || this.defaults.textMargin, | ||
fontSize: parseInt(scope.bcFontSize, 10) || this.defaults.fontSize, | ||
background: scope.bcBackground || this.defaults.background, | ||
margin: parseInt(scope.bcMargin, 10) || this.defaults.margin, | ||
marginTop: parseInt(scope.bcMarginTop, 10) || this.defaults.marginTop, | ||
marginBottom: parseInt(scope.bcMarginBottom, 10) || this.defaults.marginBottom, | ||
marginLeft: parseInt(scope.bcMarginLeft, 10) || this.defaults.marginLeft, | ||
marginRight: parseInt(scope.bcMarginRight, 10) || this.defaults.marginRight, | ||
valid: scope.bcValid || this.defaults.valid | ||
}) | ||
@@ -101,0 +102,0 @@ } |
Sorry, the diff of this file is too big to display
104138