@syncfusion/ej2-barcode-generator
Advanced tools
Comparing version 18.2.44 to 18.2.54
/*! | ||
* filename: index.d.ts | ||
* version : 18.2.44 | ||
* version : 18.2.54 | ||
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-barcode-generator@*", | ||
"_id": "@syncfusion/ej2-barcode-generator@18.1.52", | ||
"_id": "@syncfusion/ej2-barcode-generator@18.2.44", | ||
"_inBundle": false, | ||
"_integrity": "sha512-hwfB/YqD/WWwPBQCf8uMj+IG4fV1LmcxPfm/a9y3OM4Ujbu37wLSOZj+1eiz8dTZc5qrVed3vwyQg83Aenhv2g==", | ||
"_integrity": "sha512-LaiDzwqk+FK5+we/8jVDksAaJkk8nZ6J6IFQTjpT6ondc05Q9LrCCou6ri43gyIlrW242QBtwcYjD+Pu4zKDIA==", | ||
"_location": "/@syncfusion/ej2-barcode-generator", | ||
@@ -26,4 +26,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-barcode-generator/-/ej2-barcode-generator-18.1.52.tgz", | ||
"_shasum": "ce43fa5d82b7597318a8900e737f23634af5040d", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-barcode-generator/-/ej2-barcode-generator-18.2.44.tgz", | ||
"_shasum": "e1cf35a1de30c829059223ba7af84725e71b989e", | ||
"_spec": "@syncfusion/ej2-barcode-generator@*", | ||
@@ -39,4 +39,4 @@ "_where": "/jenkins/workspace/automation_release_18.1.0.1-52JLNOGRCDHXRVQM3W564VPLFCPHWUYDYU3I3DVRABSR7F6AIFYQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~18.2.44", | ||
"@syncfusion/ej2-data": "~18.2.44" | ||
"@syncfusion/ej2-base": "~18.2.54", | ||
"@syncfusion/ej2-data": "~18.2.54" | ||
}, | ||
@@ -65,4 +65,4 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "18.2.44", | ||
"version": "18.2.54", | ||
"sideEffects": false | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Component, Property, L10n, ModuleDeclaration } from '@syncfusion/ej2-base';import { INotifyPropertyChanged, Complex, Event, EmitType } from '@syncfusion/ej2-base';import { RenderingMode, BarcodeType, BarcodeEvent, } from './enum/enum';import { BarcodeRenderer } from './rendering/renderer';import { BarcodeCanvasRenderer } from './rendering/canvas-renderer';import { Code128B } from './one-dimension/code128B';import { Code128C } from './one-dimension/code128C';import { DisplayTextModel } from './primitives/displaytext-model';import { MarginModel } from './primitives/margin-model';import { DisplayText } from './primitives/displaytext';import { Margin } from './primitives/margin';import { Code39 } from './one-dimension/code39';import { CodaBar } from './one-dimension/codabar';import { Code128A } from './one-dimension/code128A';import { Code128 } from './one-dimension/code128';import { Ean8 } from './one-dimension/ean8';import { Ean13 } from './one-dimension/ean13';import { UpcE } from './one-dimension/upcE';import { UpcA } from './one-dimension/upcA';import { Code11 } from './one-dimension/code11';import { Code93 } from './one-dimension/code93';import { Code93Extension } from './one-dimension/code93Extension';import { ValidateEvent } from './rendering/canvas-interface';import { Code32 } from './one-dimension/code32';import { Code39Extension } from './one-dimension/code39Extension';import { removeChildElements } from './utility/barcode-util'; | ||
import { Component, Property, L10n, ModuleDeclaration } from '@syncfusion/ej2-base';import { INotifyPropertyChanged, Complex, Event, EmitType } from '@syncfusion/ej2-base';import { RenderingMode, BarcodeType, BarcodeEvent, BarcodeExportType} from './enum/enum';import { BarcodeRenderer } from './rendering/renderer';import { BarcodeCanvasRenderer } from './rendering/canvas-renderer';import { Code128B } from './one-dimension/code128B';import { Code128C } from './one-dimension/code128C';import { DisplayTextModel } from './primitives/displaytext-model';import { MarginModel } from './primitives/margin-model';import { DisplayText } from './primitives/displaytext';import { Margin } from './primitives/margin';import { Code39 } from './one-dimension/code39';import { CodaBar } from './one-dimension/codabar';import { Code128A } from './one-dimension/code128A';import { Code128 } from './one-dimension/code128';import { Ean8 } from './one-dimension/ean8';import { Ean13 } from './one-dimension/ean13';import { UpcE } from './one-dimension/upcE';import { UpcA } from './one-dimension/upcA';import { Code11 } from './one-dimension/code11';import { Code93 } from './one-dimension/code93';import { Code93Extension } from './one-dimension/code93Extension';import { ValidateEvent } from './rendering/canvas-interface';import { Code32 } from './one-dimension/code32';import { Code39Extension } from './one-dimension/code39Extension';import { removeChildElements, exportAsImage } from './utility/barcode-util'; | ||
import {ComponentModel} from '@syncfusion/ej2-base'; | ||
@@ -3,0 +3,0 @@ |
import { Component, L10n, ModuleDeclaration } from '@syncfusion/ej2-base'; | ||
import { INotifyPropertyChanged, EmitType } from '@syncfusion/ej2-base'; | ||
import { RenderingMode, BarcodeType } from './enum/enum'; | ||
import { RenderingMode, BarcodeType, BarcodeExportType } from './enum/enum'; | ||
import { BarcodeGeneratorModel } from './barcode-model'; | ||
@@ -105,2 +105,13 @@ import { DisplayTextModel } from './primitives/displaytext-model'; | ||
private initialize; | ||
/** | ||
* Export the barcode as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the barcode image to be download. | ||
* @param {BarcodeExportType} exportType - Defines the format of the barcode to be exported | ||
*/ | ||
exportImage(filename: string, exportType: BarcodeExportType): void; | ||
/** | ||
* Export the barcode as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the barcode to be exported | ||
*/ | ||
exportAsBase64Image(exportType: BarcodeExportType): Promise<string>; | ||
private renderElements; | ||
@@ -107,0 +118,0 @@ private refreshCanvasBarcode; |
@@ -22,3 +22,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import { Complex, Event } from '@syncfusion/ej2-base'; | ||
import { BarcodeEvent, } from './enum/enum'; | ||
import { BarcodeEvent } from './enum/enum'; | ||
import { BarcodeRenderer } from './rendering/renderer'; | ||
@@ -43,3 +43,3 @@ import { BarcodeCanvasRenderer } from './rendering/canvas-renderer'; | ||
import { Code39Extension } from './one-dimension/code39Extension'; | ||
import { removeChildElements } from './utility/barcode-util'; | ||
import { removeChildElements, exportAsImage } from './utility/barcode-util'; | ||
/** | ||
@@ -105,10 +105,26 @@ * Represents the Barcode control | ||
this.element.style.width = this.getElementSize(this.width); | ||
var svgMode = this.mode; | ||
var height = this.mode === 'SVG' ? this.element.offsetHeight : this.element.offsetHeight * 1.5; | ||
var width = this.mode === 'SVG' ? this.element.offsetWidth : this.element.offsetWidth * 1.5; | ||
this.barcodeCanvas = this.barcodeRenderer.renderRootElement({ | ||
id: this.element.id + 'content', | ||
height: svgMode === 'SVG' ? this.element.offsetHeight : this.element.offsetHeight * 1.5, | ||
width: svgMode === 'SVG' ? this.element.offsetWidth : this.element.offsetWidth * 1.5 | ||
}, this.backgroundColor, this.element.offsetWidth, this.element.offsetHeight); | ||
height: height, width: width | ||
}, this.backgroundColor, width, height); | ||
this.element.appendChild(this.barcodeCanvas); | ||
}; | ||
/** | ||
* Export the barcode as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the barcode image to be download. | ||
* @param {BarcodeExportType} exportType - Defines the format of the barcode to be exported | ||
*/ | ||
BarcodeGenerator.prototype.exportImage = function (filename, exportType) { | ||
exportAsImage(exportType, filename, this.element, false, this); | ||
}; | ||
/** | ||
* Export the barcode as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the barcode to be exported | ||
*/ | ||
BarcodeGenerator.prototype.exportAsBase64Image = function (exportType) { | ||
var returnValue = exportAsImage(exportType, '', this.element, true, this); | ||
return returnValue; | ||
}; | ||
BarcodeGenerator.prototype.renderElements = function () { | ||
@@ -115,0 +131,0 @@ var barCode; |
@@ -533,1 +533,12 @@ /** | ||
} | ||
/** | ||
* Defines the format of the barcode to be exported | ||
* JPG - Barcode will be exported as JPG file. | ||
* PNG - Barcode will be exported as PNG file. | ||
* @IgnoreSingular | ||
*/ | ||
export declare type BarcodeExportType = | ||
/** Barcode will be exported as JPG file. */ | ||
'JPG' | | ||
/** Barcode will be exported as PNG file */ | ||
'PNG'; |
@@ -11,2 +11,3 @@ /** | ||
import { BaseAttributes } from './../../barcode/rendering/canvas-interface'; | ||
import { BarcodeGenerator } from '../barcode'; | ||
/** @private */ | ||
@@ -20,1 +21,7 @@ export declare function removeChildElements(newProp: QRCodeGeneratorModel | DataMatrixGeneratorModel, barcodeCanvas: HTMLElement, mode: RenderingMode, id: string): BarcodeRenderer; | ||
export declare function refreshCanvasBarcode(qrCodeGenerator: QRCodeGenerator | DataMatrixGenerator, barcodeCanvas: HTMLCanvasElement): void; | ||
/** @private */ | ||
export declare function triggerDownload(type: string, fileName: string, url: string): void; | ||
/** @private */ | ||
export declare function exportAsImage(exportType: string, fileName: string, element: Element, isReturnBase64: boolean, code: BarcodeGenerator | QRCodeGenerator | DataMatrixGenerator): Promise<string>; | ||
/** @private */ | ||
export declare function imageExport(type: string, fileName: string, element: Element, isReturnBase64: boolean, code: BarcodeGenerator | QRCodeGenerator | DataMatrixGenerator): Promise<string>; |
@@ -37,1 +37,55 @@ /** | ||
} | ||
/** @private */ | ||
export function triggerDownload(type, fileName, url) { | ||
var anchorElement = document.createElement('a'); | ||
anchorElement.download = fileName + '.' + type.toLocaleLowerCase(); | ||
anchorElement.href = url; | ||
anchorElement.click(); | ||
} | ||
/** @private */ | ||
export function exportAsImage(exportType, fileName, element, isReturnBase64, code) { | ||
var returnValue = this.imageExport(exportType, fileName, element, isReturnBase64, code); | ||
if (returnValue instanceof Promise) { | ||
returnValue.then(function (data) { | ||
return data; | ||
}); | ||
} | ||
return returnValue; | ||
} | ||
/** @private */ | ||
export function imageExport(type, fileName, element, isReturnBase64, code) { | ||
var _this = this; | ||
/* tslint:disable */ | ||
var promise = new Promise(function (resolve, reject) { | ||
var canvas = element.children[0]; | ||
/* tslint:enable */ | ||
var serializer = 'XMLSerializer'; | ||
var canvasElement = document.createElement('canvas'); | ||
canvasElement.height = element.clientHeight; | ||
canvasElement.width = element.clientWidth; | ||
var context = canvasElement.getContext('2d'); | ||
var image = new Image(); | ||
image.onload = function () { | ||
context.drawImage(image, 0, 0); | ||
if (!isReturnBase64) { | ||
_this.triggerDownload(type, fileName, canvasElement.toDataURL('image/png').replace('image/png', 'image/octet-stream')); | ||
resolve(null); | ||
} | ||
else { | ||
var base64String = (type === 'JPG') ? canvasElement.toDataURL('image/jpg') : | ||
canvasElement.toDataURL('image/png'); | ||
resolve(base64String); | ||
} | ||
}; | ||
if (code.mode === 'Canvas') { | ||
image.src = (type === 'JPG') ? canvas.toDataURL('image/jpg') : canvas.toDataURL('image/png'); | ||
canvasElement.height = element.clientHeight * 1.5; | ||
canvasElement.width = element.clientWidth * 1.5; | ||
context.scale(2 / 3, 2 / 3); | ||
} | ||
else { | ||
image.src = window.URL.createObjectURL(new Blob([new window[serializer]().serializeToString(element.children[0])], { type: 'image/svg+xml' })); | ||
} | ||
}); | ||
return promise; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Component, Property, L10n } from '@syncfusion/ej2-base';import { INotifyPropertyChanged, Complex, Event, EmitType } from '@syncfusion/ej2-base';import { RenderingMode, BarcodeEvent, DataMatrixEncoding, DataMatrixSize } from '../barcode/enum/enum';import { ValidateEvent } from '../barcode/rendering/canvas-interface';import { DisplayTextModel } from '../barcode/primitives/displaytext-model';import { MarginModel } from '../barcode/primitives/margin-model';import { DisplayText } from '../barcode/primitives/displaytext';import { Margin } from '../barcode/primitives/margin';import { BarcodeRenderer } from '../barcode/rendering/renderer';import { removeChildElements, refreshCanvasBarcode } from '../barcode/utility/barcode-util';import { DataMatrix } from './datamatrix-util'; | ||
import { Component, Property, L10n } from '@syncfusion/ej2-base';import { INotifyPropertyChanged, Complex, Event, EmitType } from '@syncfusion/ej2-base';import { RenderingMode, BarcodeEvent, DataMatrixEncoding, DataMatrixSize, BarcodeExportType } from '../barcode/enum/enum';import { ValidateEvent } from '../barcode/rendering/canvas-interface';import { DisplayTextModel } from '../barcode/primitives/displaytext-model';import { MarginModel } from '../barcode/primitives/margin-model';import { DisplayText } from '../barcode/primitives/displaytext';import { Margin } from '../barcode/primitives/margin';import { BarcodeRenderer } from '../barcode/rendering/renderer';import { removeChildElements, refreshCanvasBarcode, exportAsImage } from '../barcode/utility/barcode-util';import { DataMatrix } from './datamatrix-util'; | ||
import {ComponentModel} from '@syncfusion/ej2-base'; | ||
@@ -3,0 +3,0 @@ |
import { Component, L10n } from '@syncfusion/ej2-base'; | ||
import { INotifyPropertyChanged, EmitType } from '@syncfusion/ej2-base'; | ||
import { RenderingMode, DataMatrixEncoding, DataMatrixSize } from '../barcode/enum/enum'; | ||
import { RenderingMode, DataMatrixEncoding, DataMatrixSize, BarcodeExportType } from '../barcode/enum/enum'; | ||
import { DisplayTextModel } from '../barcode/primitives/displaytext-model'; | ||
@@ -105,2 +105,13 @@ import { MarginModel } from '../barcode/primitives/margin-model'; | ||
private checkdata; | ||
/** | ||
* Export the datamatrix as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the datamatrix image to be download. | ||
* @param {BarcodeExportType} exportType - Defines the format of the datamatrix to be exported | ||
*/ | ||
exportImage(fileName: string, exportType: BarcodeExportType): void; | ||
/** | ||
* Export the datamatrix as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the datamatrix to be exported | ||
*/ | ||
exportAsBase64Image(barcodeExportType: BarcodeExportType): Promise<string>; | ||
private renderElements; | ||
@@ -107,0 +118,0 @@ /** |
@@ -26,3 +26,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import { BarcodeRenderer } from '../barcode/rendering/renderer'; | ||
import { removeChildElements, refreshCanvasBarcode } from '../barcode/utility/barcode-util'; | ||
import { removeChildElements, refreshCanvasBarcode, exportAsImage } from '../barcode/utility/barcode-util'; | ||
import { DataMatrix } from './datamatrix-util'; | ||
@@ -84,9 +84,10 @@ /** | ||
this.element.style.height = this.getElementSize(this.height); | ||
var mode = this.mode; | ||
//set height and width of the canvas element | ||
var height = this.mode === 'SVG' ? this.element.offsetHeight : this.element.offsetHeight * 1.5; | ||
var width = this.mode === 'SVG' ? this.element.offsetWidth : this.element.offsetWidth * 1.5; | ||
//initialize the canvas element | ||
this.barcodeCanvas = this.barcodeRenderer.renderRootElement({ | ||
id: this.element.id + 'content', | ||
height: mode === 'SVG' ? this.element.offsetHeight : this.element.offsetHeight * 1.5, | ||
width: mode === 'SVG' ? this.element.offsetWidth : this.element.offsetWidth * 1.5 | ||
}, this.backgroundColor, this.element.offsetWidth, this.element.offsetHeight); | ||
height: height, width: width | ||
}, this.backgroundColor, width, height); | ||
this.element.appendChild(this.barcodeCanvas); | ||
@@ -158,2 +159,18 @@ }; | ||
}; | ||
/** | ||
* Export the datamatrix as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the datamatrix image to be download. | ||
* @param {BarcodeExportType} exportType - Defines the format of the datamatrix to be exported | ||
*/ | ||
DataMatrixGenerator.prototype.exportImage = function (fileName, exportType) { | ||
exportAsImage(exportType, fileName, this.element, false, this); | ||
}; | ||
/** | ||
* Export the datamatrix as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the datamatrix to be exported | ||
*/ | ||
DataMatrixGenerator.prototype.exportAsBase64Image = function (barcodeExportType) { | ||
var returnValue = exportAsImage(barcodeExportType, '', this.element, true, this); | ||
return returnValue; | ||
}; | ||
DataMatrixGenerator.prototype.renderElements = function () { | ||
@@ -160,0 +177,0 @@ var dataMatrix = new DataMatrix(); |
@@ -1,2 +0,2 @@ | ||
import { removeChildElements, refreshCanvasBarcode } from '../barcode/utility/barcode-util';import { Complex, Property, Component, INotifyPropertyChanged, L10n, Event, EmitType } from '@syncfusion/ej2-base';import { ErrorCorrectionLevel, QRCodeVersion, RenderingMode, BarcodeEvent } from '../barcode/enum/enum';import { DisplayTextModel } from '../barcode/primitives/displaytext-model';import { MarginModel } from '../barcode/primitives/margin-model';import { DisplayText } from '../barcode/primitives/displaytext';import { Margin } from '../barcode/primitives/margin';import { BarcodeRenderer } from '../barcode/rendering/renderer';import { QRCode } from './qr-code-util';import { ValidateEvent } from '../barcode'; | ||
import { removeChildElements, refreshCanvasBarcode, exportAsImage } from '../barcode/utility/barcode-util';import { Complex, Property, Component, INotifyPropertyChanged, L10n, Event, EmitType } from '@syncfusion/ej2-base';import { ErrorCorrectionLevel, QRCodeVersion, RenderingMode, BarcodeEvent, BarcodeExportType } from '../barcode/enum/enum';import { DisplayTextModel } from '../barcode/primitives/displaytext-model';import { MarginModel } from '../barcode/primitives/margin-model';import { DisplayText } from '../barcode/primitives/displaytext';import { Margin } from '../barcode/primitives/margin';import { BarcodeRenderer } from '../barcode/rendering/renderer';import { QRCode } from './qr-code-util';import { ValidateEvent } from '../barcode'; | ||
import {ComponentModel} from '@syncfusion/ej2-base'; | ||
@@ -3,0 +3,0 @@ |
import { Component, INotifyPropertyChanged, L10n, EmitType } from '@syncfusion/ej2-base'; | ||
import { ErrorCorrectionLevel, QRCodeVersion, RenderingMode } from '../barcode/enum/enum'; | ||
import { ErrorCorrectionLevel, QRCodeVersion, RenderingMode, BarcodeExportType } from '../barcode/enum/enum'; | ||
import { DisplayTextModel } from '../barcode/primitives/displaytext-model'; | ||
@@ -117,3 +117,14 @@ import { MarginModel } from '../barcode/primitives/margin-model'; | ||
private initializePrivateVariables; | ||
/** | ||
* Export the qrcode as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the qrcode image to be download. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the qrcode to be exported | ||
*/ | ||
exportImage(filename: string, barcodeExportType: BarcodeExportType): void; | ||
/** | ||
* Export the qrcode as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the qrcode to be exported | ||
*/ | ||
exportAsBase64Image(barcodeExportType: BarcodeExportType): Promise<string>; | ||
onPropertyChanged(newProp: QRCodeGeneratorModel, oldProp: QRCodeGeneratorModel): void; | ||
} |
@@ -20,3 +20,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { removeChildElements, refreshCanvasBarcode } from '../barcode/utility/barcode-util'; | ||
import { removeChildElements, refreshCanvasBarcode, exportAsImage } from '../barcode/utility/barcode-util'; | ||
import { Complex, Property, Component, L10n, Event } from '@syncfusion/ej2-base'; | ||
@@ -142,2 +142,18 @@ import { ErrorCorrectionLevel, BarcodeEvent } from '../barcode/enum/enum'; | ||
}; | ||
/** | ||
* Export the qrcode as an image in the specified image type and downloads it in the browser. | ||
* @param {string} fileName - Specifies the filename of the qrcode image to be download. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the qrcode to be exported | ||
*/ | ||
QRCodeGenerator.prototype.exportImage = function (filename, barcodeExportType) { | ||
exportAsImage(barcodeExportType, filename, this.element, false, this); | ||
}; | ||
/** | ||
* Export the qrcode as an image in the specified image type and returns it as base64 string. | ||
* @param {BarcodeExportType} barcodeExportType - Defines the format of the qrcode to be exported | ||
*/ | ||
QRCodeGenerator.prototype.exportAsBase64Image = function (barcodeExportType) { | ||
var returnValue = exportAsImage(barcodeExportType, '', this.element, true, this); | ||
return returnValue; | ||
}; | ||
QRCodeGenerator.prototype.onPropertyChanged = function (newProp, oldProp) { | ||
@@ -144,0 +160,0 @@ var width; |
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
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
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
3702780
28846