1.0.4 • Published 5 years ago

openui5-qrcode v1.0.4

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
5 years ago

openui5-qrcode

openui5-qrcode is a SAPUI5 Custom Control that allow you to generate and easily embed QR Code inside your SAPUI5 Application

QRCode preview

Demo

You can checkout a demo with different configuration parameter here: https://stermi.github.io/openui5-qrcode/test/demo/

Usage

Configure manifest.json

Add the library to sap.ui5 dependencies list and configure the resourceRoots to point where you uploaded the custom library.

"sap.ui5": {
    ...
	"dependencies": {
		"minUI5Version": "1.30.0",
		"libs": {
    		...
			"it.designfuture.qrcode": {}
		}
	},
	"resourceRoots": {
		"it.designfuture.qrcode": "./thirdparty/it/designfuture/qrcode/"
	}
}

Add the custom control inside an XML View

First of all add the namespace to the View

xmlns:df="it.designfuture.qrcode"

And than you can simply add the QRCode custom control

<df:QRCode
	text="OpenUI5 Rocks!"
	width="256"
	height="256"
	colorDark="#000000"
	colorLight="#ffffff"
	correctLevel="2"
/>

Parameters

NameTypeDefaultDescription
textstring""Text embedded in the QRCode
widthint256QRCode's width
heightint256QRCode's height
colorDarkstring"#000000"HTML color (black/#ffffff) of the dark part of the QRCode
colorLightstring"#ffffff"HTML color (white/#ffffff) of the dark part of the QRCode
correctLevelint2Text embedded in the QRCode

Methods

NameDescription
reDrawDraw the QRCode. If the QR Code does not exist it creates a new one, if it already exist it just refresh it
clearClear the QR Code
getTextReturn the text of the QR Code
setTextSet a new text of the QR Code
getWidthReturn the width of the QR Code
setWidthSet the width of the QR Code
getHeightReturn the text of the QR Code
setHeightSet the height of the QR Code
getColorDarkReturn the RGB dark color of the QR Code
setColorDarkSet the RGB dark color of the QR Code
getTextReturn the text of the QR Code
getColorLightReturn the RGB light color of the QR Code
setColorLightSet the RGB light color of the QR Code
getCorrectLevelReturn the Error Correction Level of the QR Code
setCorrectLevelSet the Error Correction Level of the QR Code

Build

If you would like to extend and customize the control, you can easily do that but re-building the code with just a simple Grunt command:

npm install
grunt build

Credits

Emanuele Ricci

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details