UNPKG

primeng

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![Discord](https://img.shields.io/discord/557940238991753

2 lines 2.56 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("primeng/captcha",["exports","@angular/core","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.captcha={}),e.ng.core,e.ng.common)}(this,(function(e,t,n){"use strict";var i=function(){function e(e,n,i){this.el=e,this._zone=n,this.cd=i,this.siteKey=null,this.theme="light",this.type="image",this.size="normal",this.tabindex=0,this.language=null,this.initCallback="initRecaptcha",this.onResponse=new t.EventEmitter,this.onExpire=new t.EventEmitter,this._instance=null}return e.prototype.ngAfterViewInit=function(){var e=this;window.grecaptcha?window.grecaptcha.render?this.init():setTimeout((function(){e.init()}),100):window[this.initCallback]=function(){e.init()}},e.prototype.init=function(){var e=this;this._instance=window.grecaptcha.render(this.el.nativeElement.children[0],{sitekey:this.siteKey,theme:this.theme,type:this.type,size:this.size,tabindex:this.tabindex,hl:this.language,callback:function(t){e._zone.run((function(){return e.recaptchaCallback(t)}))},"expired-callback":function(){e._zone.run((function(){return e.recaptchaExpiredCallback()}))}})},e.prototype.reset=function(){null!==this._instance&&(window.grecaptcha.reset(this._instance),this.cd.markForCheck())},e.prototype.getResponse=function(){return null===this._instance?null:window.grecaptcha.getResponse(this._instance)},e.prototype.recaptchaCallback=function(e){this.onResponse.emit({response:e})},e.prototype.recaptchaExpiredCallback=function(){this.onExpire.emit()},e.prototype.ngOnDestroy=function(){null!=this._instance&&window.grecaptcha.reset(this._instance)},e}();i.decorators=[{type:t.Component,args:[{selector:"p-captcha",template:"<div></div>",changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None}]}],i.ctorParameters=function(){return[{type:t.ElementRef},{type:t.NgZone},{type:t.ChangeDetectorRef}]},i.propDecorators={siteKey:[{type:t.Input}],theme:[{type:t.Input}],type:[{type:t.Input}],size:[{type:t.Input}],tabindex:[{type:t.Input}],language:[{type:t.Input}],initCallback:[{type:t.Input}],onResponse:[{type:t.Output}],onExpire:[{type:t.Output}]};var o=function(){};o.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],exports:[i],declarations:[i]}]}],e.Captcha=i,e.CaptchaModule=o,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=primeng-captcha.umd.min.js.map