@wizishop/angular-components 0.0.58 → 0.0.59

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.
@@ -912,13 +912,24 @@
912
912
  this.animation = false;
913
913
  this.animationRight = false;
914
914
  this.animationText = '';
915
+ this.confirmDelete = false;
916
+ this.confirmDeleteText = '';
917
+ this.confirmDeletePosition = 'right';
915
918
  this.click = new i0.EventEmitter();
916
919
  this.isLoading = false;
917
920
  this.interval = null;
921
+ this.waitForConfirmDelete = false;
918
922
  this.buttonMaxWidth = '0px';
919
923
  this.buttonWidth = '0px';
924
+ this.buttonMaxWidthDelete = '0px';
925
+ this.buttonWidthDelete = '0px';
920
926
  this.currentLoading = 0;
921
927
  }
928
+ ButtonComponent.prototype.ngOnInit = function () {
929
+ if (this.confirmDelete) {
930
+ this.waitForConfirmDelete = true;
931
+ }
932
+ };
922
933
  ButtonComponent.prototype.launchLoading = function () {
923
934
  var _this = this;
924
935
  if (this.isLoading || this.interval !== null) {
@@ -945,13 +956,29 @@
945
956
  ButtonComponent.prototype.resetMaxWidth = function () {
946
957
  this.buttonMaxWidth = '0px';
947
958
  };
959
+ ButtonComponent.prototype.addMaxWidthDelete = function () {
960
+ this.buttonMaxWidthDelete = this.buttonWidthDelete + 'px';
961
+ console.log('here', this.buttonMaxWidthDelete);
962
+ };
963
+ ButtonComponent.prototype.resetMaxWidthDelete = function () {
964
+ this.buttonMaxWidthDelete = '0px';
965
+ this.waitForConfirmDelete = true;
966
+ };
948
967
  ButtonComponent.prototype.onButtonClick = function (event) {
949
968
  event.stopPropagation();
950
969
  if (!this.disabled) {
951
970
  if (this.hasLoader) {
952
971
  this.launchLoading();
953
972
  }
954
- this.click.emit(event);
973
+ if (!this.waitForConfirmDelete) {
974
+ this.click.emit(event);
975
+ if (this.confirmDelete) {
976
+ this.resetMaxWidthDelete();
977
+ }
978
+ }
979
+ else {
980
+ this.waitForConfirmDelete = false;
981
+ }
955
982
  }
956
983
  };
957
984
  ButtonComponent.prototype.ngAfterViewInit = function () {
@@ -960,6 +987,10 @@
960
987
  if (_this.animation) {
961
988
  _this.buttonWidth = _this.calculWidth.nativeElement.offsetWidth;
962
989
  }
990
+ if (_this.confirmDelete) {
991
+ _this.buttonWidthDelete = _this.calculWidthDelete.nativeElement.offsetWidth;
992
+ console.log('here2', _this.buttonWidthDelete);
993
+ }
963
994
  }, 1000);
964
995
  };
965
996
  return ButtonComponent;
@@ -967,7 +998,7 @@
967
998
  ButtonComponent.decorators = [
968
999
  { type: i0.Component, args: [{
969
1000
  selector: 'wac-button',
970
- template: "<a\n [class]=\"'wac-button ' + extraClasses\"\n (click)=\"onButtonClick($event)\"\n (mouseleave)=\"animation ? resetMaxWidth() : ''\"\n (mouseenter)=\"animation ? addMaxWidth() : ''\"\n [ngClass]=\"[label === '' ? 'alone' : '',animationRight ? 'animation-right' : '', animation ? 'animationText' : '', isLoading ? 'is-loading' : '', opacity ? 'opacity' : '', disabled ? 'disabled' : '', widthAuto ? 'width-auto' : '', whiteSpaceNowrap ? 'white-space-no-wrap' : '']\"\n>\n <span class=\"wac-button__wrapper\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n <span class=\"wac-button__animation\" [style.maxWidth]=\"buttonMaxWidth\" [style.width]=\"buttonWidth + 'px'\">\n <span #calculWidth class=\"wac-button__animation__text\" [innerHTML]=\"animationText\"></span>\n </span>\n <span\n class=\"wac-button__loader\"\n [ngClass]=\"extraClasses.includes('is-outlined') ? 'outlined' : ''\"\n *ngIf=\"isLoading || interval !== null\"\n [style.width]=\"currentLoading + '%'\"\n >\n <span *ngIf=\"extraClasses.includes('is-outlined')\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n\n </span>\n</a>\n"
1001
+ template: "<a\n [class]=\"'wac-button ' + extraClasses\"\n (click)=\"confirmDelete && waitForConfirmDelete ? addMaxWidthDelete() : '';onButtonClick($event);\"\n (mouseleave)=\"animation ? resetMaxWidth() : '';\"\n (mouseenter)=\"animation ? addMaxWidth() : '';\"\n wzAutoHide (clickOutside)=\"confirmDelete && !waitForConfirmDelete ? resetMaxWidthDelete() : ''\"\n [ngClass]=\"[label === '' ? 'alone' : '',animationRight ? 'animation-right' : '', animation ? 'animationText' : '', isLoading ? 'is-loading' : '', opacity ? 'opacity' : '', disabled ? 'disabled' : '', widthAuto ? 'width-auto' : '', whiteSpaceNowrap ? 'white-space-no-wrap' : '', !waitForConfirmDelete && confirmDelete ? 'step-delete' : '', confirmDelete ? 'deletePosition-' + confirmDeletePosition : '']\"\n>\n <span class=\"wac-button__wrapper\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n <span class=\"wac-button__animation\" [style.maxWidth]=\"buttonMaxWidth\" [style.width]=\"buttonWidth + 'px'\">\n <span #calculWidth class=\"wac-button__animation__text\" [innerHTML]=\"animationText\"></span>\n </span>\n <span class=\"wac-button__confirmDelete\" [style.maxWidth]=\"buttonMaxWidthDelete\" [style.width]=\"buttonWidthDelete + 'px'\">\n <span #calculWidthDelete class=\"wac-button__confirmDelete__text\" [innerHTML]=\"confirmDeleteText\"></span>\n </span>\n <span\n class=\"wac-button__loader\"\n [ngClass]=\"extraClasses.includes('is-outlined') ? 'outlined' : ''\"\n *ngIf=\"isLoading || interval !== null\"\n [style.width]=\"currentLoading + '%'\"\n >\n <span *ngIf=\"extraClasses.includes('is-outlined')\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n\n </span>\n</a>\n"
971
1002
  },] }
972
1003
  ];
973
1004
  ButtonComponent.ctorParameters = function () { return []; };
@@ -985,8 +1016,12 @@
985
1016
  animation: [{ type: i0.Input }],
986
1017
  animationRight: [{ type: i0.Input }],
987
1018
  animationText: [{ type: i0.Input }],
1019
+ confirmDelete: [{ type: i0.Input }],
1020
+ confirmDeleteText: [{ type: i0.Input }],
1021
+ confirmDeletePosition: [{ type: i0.Input }],
988
1022
  click: [{ type: i0.Output }],
989
- calculWidth: [{ type: i0.ViewChild, args: ['calculWidth',] }]
1023
+ calculWidth: [{ type: i0.ViewChild, args: ['calculWidth',] }],
1024
+ calculWidthDelete: [{ type: i0.ViewChild, args: ['calculWidthDelete',] }]
990
1025
  };
991
1026
 
992
1027
  var InfoComponent = /** @class */ (function () {