@bnsights/bbsf-controls 1.0.64 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7801,6 +7801,147 @@
7801
7801
  onBlurInput: [{ type: i0.Output }]
7802
7802
  };
7803
7803
 
7804
+ var RecaptchaModel = /** @class */ (function () {
7805
+ function RecaptchaModel() {
7806
+ this.ImageJpeg = [];
7807
+ }
7808
+ return RecaptchaModel;
7809
+ }());
7810
+
7811
+ var CaptchaStyle = /** @class */ (function () {
7812
+ function CaptchaStyle() {
7813
+ }
7814
+ return CaptchaStyle;
7815
+ }());
7816
+
7817
+ var RecaptchaComponent = /** @class */ (function () {
7818
+ function RecaptchaComponent(controlUtility, requestHandlerService, recaptchaControlHost, UtilityService, controlValidationService, globalSettings) {
7819
+ var _this = this;
7820
+ this.controlUtility = controlUtility;
7821
+ this.requestHandlerService = requestHandlerService;
7822
+ this.recaptchaControlHost = recaptchaControlHost;
7823
+ this.UtilityService = UtilityService;
7824
+ this.controlValidationService = controlValidationService;
7825
+ this.globalSettings = globalSettings;
7826
+ this.OnChange = new i0.EventEmitter();
7827
+ this.validationRules = [];
7828
+ this.validationRulesAsync = [];
7829
+ this.recaptchaModel = new RecaptchaModel();
7830
+ this.resetError = function () {
7831
+ _this.controlValidationService.RemoveGlobalError();
7832
+ };
7833
+ //External Method
7834
+ this.RemoveRequiredValidation = function () {
7835
+ _this.controlUtility.RemoveRequiredValidation(_this.ReCaptchaFormControl, _this.validationRules, _this.options);
7836
+ };
7837
+ //External Method
7838
+ this.AddRequiredValidation = function () {
7839
+ _this.controlUtility.AddRequiredValidation(_this.ReCaptchaFormControl, _this.validationRules, _this.options);
7840
+ };
7841
+ //External Method
7842
+ this.RemoveCustomValidation = function (CustomValidation) {
7843
+ _this.controlUtility.RemoveCustomValidation(_this.ReCaptchaFormControl, _this.validationRules, CustomValidation);
7844
+ };
7845
+ //External Method
7846
+ this.AddCustomValidation = function (CustomValidation) {
7847
+ _this.controlUtility.AddCustomValidation(_this.ReCaptchaFormControl, _this.validationRules, CustomValidation);
7848
+ };
7849
+ //External Method
7850
+ this.IsValid = function () {
7851
+ _this.controlUtility.IsValid(_this.ReCaptchaFormControl);
7852
+ };
7853
+ }
7854
+ RecaptchaComponent.prototype.ngOnInit = function () {
7855
+ var _this = this;
7856
+ this.controlValidationService.isCreatedBefor = false;
7857
+ this.loadImage();
7858
+ if (!this.options.ViewType)
7859
+ this.options.ViewType = this.globalSettings.ViewType;
7860
+ this.group.addControl(this.options.Name, new forms.FormControl(''));
7861
+ this.ReCaptchaFormControl = this.group.controls[this.options.Name]; // new FormControl('',validationRules);
7862
+ if (this.options.LabelKey != null && this.options.LabelKey != "")
7863
+ this.options.LabelValue = this.UtilityService.getResourceValue(this.options.LabelKey);
7864
+ if (this.options.IsRequired) {
7865
+ this.validationRules.push(forms.Validators.required);
7866
+ }
7867
+ if (this.options.CustomValidation.length > 0) {
7868
+ var Validations = this.options.CustomValidation;
7869
+ for (var index = 0; index < Validations.length; index++) {
7870
+ var Validation = Validations[index];
7871
+ this.validationRules.push(Validation.functionBody);
7872
+ }
7873
+ }
7874
+ this.ReCaptchaFormControl.setValidators(this.validationRules);
7875
+ this.ReCaptchaFormControl.setAsyncValidators(this.validationRulesAsync);
7876
+ if (this.options.IsDisabled) {
7877
+ this.ReCaptchaFormControl.disable();
7878
+ }
7879
+ this.recaptchaControlHost.ngSubmit.subscribe(function (value) {
7880
+ _this.group.markAllAsTouched();
7881
+ _this.markAllAsTouched = true;
7882
+ });
7883
+ };
7884
+ RecaptchaComponent.prototype.loadImage = function () {
7885
+ var _this = this;
7886
+ var style = new CaptchaStyle();
7887
+ style.BackgroundColorPrimary = this.options.BackgroundColorPrimary;
7888
+ style.BackgroundColorSecondary = this.options.BackgroundColorSecondary;
7889
+ style.TextColorPrimary = this.options.TextColorPrimary;
7890
+ style.TextColorSecondary = this.options.TextColorSecondary;
7891
+ style.FontSize = this.options.FontSize;
7892
+ var requestOptionsModel = new bbsfUtilities.RequestOptionsModel();
7893
+ requestOptionsModel.disableBlockUI = true;
7894
+ requestOptionsModel.disableSuccessNotification = true;
7895
+ this.requestHandlerService.post(this.options.ActionURL, style, null, null, requestOptionsModel).subscribe(function (res) {
7896
+ var model = res;
7897
+ _this.recaptchaModel.ID = model.id;
7898
+ _this.recaptchaModel.EncryptedText = model.encryptedText;
7899
+ _this.recaptchaModel.ImageJpeg = model.imageJpeg;
7900
+ _this.image = 'data:image/jpeg;base64,' + _this.recaptchaModel.ImageJpeg;
7901
+ });
7902
+ };
7903
+ RecaptchaComponent.prototype.ngAfterViewInit = function () {
7904
+ this.controlUtility.setAttributeForControl(this.options);
7905
+ };
7906
+ RecaptchaComponent.prototype.showGlobalError = function () {
7907
+ this.controlUtility.showGlobalError();
7908
+ };
7909
+ RecaptchaComponent.prototype.getErrorValidation = function (ErrorList) {
7910
+ if (this.markAllAsTouched && this.group.invalid) {
7911
+ this.showGlobalError();
7912
+ this.markAllAsTouched = false;
7913
+ }
7914
+ return this.controlUtility.getErrorValidationMassage(ErrorList, this.group, this.options);
7915
+ };
7916
+ RecaptchaComponent.prototype.onTextChange = function (valueText) {
7917
+ var value = valueText.target.value;
7918
+ this.recaptchaModel.Text = value;
7919
+ this.group.get(this.options.Name).setValue(this.recaptchaModel);
7920
+ this.options.Value = this.recaptchaModel;
7921
+ this.OnChange.emit(this.ReCaptchaFormControl.value);
7922
+ };
7923
+ return RecaptchaComponent;
7924
+ }());
7925
+ RecaptchaComponent.decorators = [
7926
+ { type: i0.Component, args: [{
7927
+ selector: 'BBSF-Recaptcha',
7928
+ template: "<div class=\"b-control b-recaptcha\">\r\n <img class=\"h-100 w-100 mb-3\" [src]=\"image\" />\r\n <button class=\"btn btn-sm btn-icon\" type=\"button\" ngbTooltip=\"{{UtilityService.getResourceValue('ReloadCaptcha')}}\" (click)=\"loadImage()\">\r\n <i class=\"fas fa-refresh\"></i>\r\n </button>\r\n\r\n <div class=\"form-group row validate is-invalid\" [formGroup]=\"group\" [ngClass]=\"(options.NoMargin==true)?'':'NoMargin'\">\r\n <label class=\"b-label col-form-label col-sm-12 {{options.LabelExtraClasses}} \" [ngClass]=\"(options.ViewType==1)?'col-md-12':'col-md-3'\" *ngIf=\"!options.HideLabel\">\r\n {{options.LabelValue}}\r\n <span *ngIf=\"(options.ShowAsterisk&&options.IsRequired)||(options.IsRequired)\" class=\"text-danger Required-text\"\r\n aria-required=\"true\">*</span>\r\n </label>\r\n\r\n <div class=\"col-sm-12\" [ngClass]=\"(options.ViewType==1)?'': ((options.HideLabel)?'col-md-12':'col-md-9')\">\r\n <div class=\"input-group align-items-center\" >\r\n <input class=\"form-control bnsights-control {{options.ExtraClasses}} \"\r\n dir=\"{{options.ForceDirection==2?'rtl':''}}\"\r\n aria-describedby=\"email-error\" value=\"{{options.Value.Text}}\"\r\n aria-invalid=\"true\" formControlName=\"{{options.Name}}\" type=\"text\" \r\n [class.is-invalid]=\"ReCaptchaFormControl.invalid && ReCaptchaFormControl.touched\"\r\n placeholder=\"{{options.Placeholder}}\" id=\"{{options.Name}}\" autocomplete=\"{{options.AutoComplete}}\"\r\n (change)=\"onTextChange($event)\" [readonly]=\"options.IsReadonly\"/>\r\n </div>\r\n <div class=\"text-danger Required-text\" dir=\"{{options.ForceDirection==2?'rtl':''}}\"\r\n *ngIf=\"(ReCaptchaFormControl.invalid && ReCaptchaFormControl.touched)\">\r\n {{getErrorValidation(ReCaptchaFormControl.errors|keyvalue)}}\r\n </div>\r\n <div class=\"control-desc\" *ngIf=\"options.LabelDescription!=null\">{{options.LabelDescription}}</div>\r\n <div *ngIf=\"(group.valid&&group.dirty&&group.touched )||(group.untouched&&group.invalid&&group.dirty) \">{{resetError()}}</div>\r\n </div>\r\n </div>\r\n</div>\r\n"
7929
+ },] }
7930
+ ];
7931
+ RecaptchaComponent.ctorParameters = function () { return [
7932
+ { type: ControlUtility },
7933
+ { type: bbsfUtilities.RequestHandlerService },
7934
+ { type: forms.FormGroupDirective },
7935
+ { type: bbsfUtilities.UtilityService },
7936
+ { type: bbsfUtilities.ControlValidationService },
7937
+ { type: GlobalSettings }
7938
+ ]; };
7939
+ RecaptchaComponent.propDecorators = {
7940
+ group: [{ type: i0.Input }],
7941
+ options: [{ type: i0.Input }],
7942
+ OnChange: [{ type: i0.Output }]
7943
+ };
7944
+
7804
7945
  var options;
7805
7946
  exports.AppInjector = void 0;
7806
7947
  angular.FullCalendarModule.registerPlugins([
@@ -7852,7 +7993,8 @@
7852
7993
  RepeaterTableComponent,
7853
7994
  BBSFDateTimePipe,
7854
7995
  BBSFDatePipe,
7855
- BTagsInputComponent
7996
+ BTagsInputComponent,
7997
+ RecaptchaComponent
7856
7998
  ],
7857
7999
  imports: [
7858
8000
  common.CommonModule,
@@ -7951,7 +8093,8 @@
7951
8093
  RepeaterItemFieldComponent,
7952
8094
  RepeaterTableComponent,
7953
8095
  BBSFDateTimePipe,
7954
- BBSFDatePipe
8096
+ BBSFDatePipe,
8097
+ RecaptchaComponent
7955
8098
  ]
7956
8099
  },] }
7957
8100
  ];
@@ -7972,6 +8115,29 @@
7972
8115
  */
7973
8116
  // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
7974
8117
 
8118
+ var RecaptchaOptions = /** @class */ (function (_super) {
8119
+ __extends(RecaptchaOptions, _super);
8120
+ function RecaptchaOptions() {
8121
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
8122
+ /**To set value to Control */
8123
+ _this.Value = new RecaptchaModel();
8124
+ _this.ForceDirection = null;
8125
+ /**Prevent AutoComplete of control default value is "on" available values "on" and "off"*/
8126
+ _this.AutoComplete = "on";
8127
+ _this.NoMargin = false;
8128
+ /**the url of a remote server that supports jsonp calls */
8129
+ _this.ActionURL = "/api/Home/GetReCaptchaModel";
8130
+ /*Pass hexa-color primary background color*/
8131
+ _this.BackgroundColorPrimary = "";
8132
+ /*Pass hexa-color secondary background color*/
8133
+ _this.BackgroundColorSecondary = "";
8134
+ /*Pass font Size */
8135
+ _this.FontSize = 0;
8136
+ return _this;
8137
+ }
8138
+ return RecaptchaOptions;
8139
+ }(ControlOptionsBase));
8140
+
7975
8141
  var MultilingualControlOptionsBase = /** @class */ (function () {
7976
8142
  function MultilingualControlOptionsBase() {
7977
8143
  /** to set type of view if MultipleLanguageText is Vertical or Horizontal */
@@ -8758,6 +8924,9 @@
8758
8924
  exports.RadioButtonItem = RadioButtonItem;
8759
8925
  exports.RadioButtonOptions = RadioButtonOptions;
8760
8926
  exports.RangeNumber = RangeNumber;
8927
+ exports.RecaptchaComponent = RecaptchaComponent;
8928
+ exports.RecaptchaModel = RecaptchaModel;
8929
+ exports.RecaptchaOptions = RecaptchaOptions;
8761
8930
  exports.RenderComponentService = RenderComponentService;
8762
8931
  exports.RepeaterComponent = RepeaterComponent;
8763
8932
  exports.RepeaterField = RepeaterField;