@wizishop/angular-components 0.0.111 → 0.0.112

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.
@@ -942,11 +942,9 @@
942
942
  return this._isLoading;
943
943
  },
944
944
  set: function (isLoading) {
945
- if (isLoading) {
946
- this.launchLoading();
947
- }
948
945
  this._isLoading = isLoading;
949
946
  this.isLoadingChange.next(isLoading);
947
+ this.toggleLoading();
950
948
  },
951
949
  enumerable: false,
952
950
  configurable: true
@@ -956,25 +954,28 @@
956
954
  this.waitForConfirmDelete = true;
957
955
  }
958
956
  };
959
- ButtonComponent.prototype.launchLoading = function () {
957
+ ButtonComponent.prototype.toggleLoading = function () {
960
958
  var _this = this;
961
- if (this.isLoading || this.interval !== null) {
962
- return;
963
- }
964
- this.isLoading = true;
965
- this.currentLoading = 10;
966
- this.interval = setInterval(function () {
959
+ this.currentLoading = this.isLoading ? 10 : 100;
960
+ rxjs.interval(200).pipe(operators.takeWhile(function (time) { return _this.isLoading; })).subscribe(function () {
967
961
  if (_this.currentLoading < 85) {
968
962
  _this.currentLoading += Math.floor(Math.random() * 15);
969
963
  }
970
- if (!_this.isLoading) {
971
- _this.currentLoading = 100;
972
- setTimeout(function () {
973
- clearInterval(_this.interval);
974
- _this.interval = null;
975
- }, 100);
976
- }
977
- }, 200);
964
+ });
965
+ /* this.interval = setInterval(() => {
966
+
967
+ if (this.currentLoading < 85) {
968
+ this.currentLoading += Math.floor(Math.random() * 15);
969
+ }
970
+
971
+ if (!this.isLoading) {
972
+ this.currentLoading = 100;
973
+
974
+ setTimeout(() => {
975
+ clearInterval(this.interval);
976
+ }, 100);
977
+ }
978
+ }, 200); */
978
979
  };
979
980
  ButtonComponent.prototype.addMaxWidth = function () {
980
981
  this.buttonMaxWidth = this.buttonWidth + 'px';
@@ -990,12 +991,16 @@
990
991
  this.waitForConfirmDelete = true;
991
992
  };
992
993
  ButtonComponent.prototype.onButtonClick = function (event) {
994
+ var _this = this;
993
995
  event.stopPropagation();
994
996
  if (this.disabled) {
995
997
  return;
996
998
  }
997
999
  if (this.hasLoader) {
998
- this.launchLoading();
1000
+ this.isLoading = false;
1001
+ setTimeout(function () {
1002
+ _this.isLoading = true;
1003
+ }, 0);
999
1004
  }
1000
1005
  if (!this.waitForConfirmDelete) {
1001
1006
  this.click.emit(event);
@@ -1023,7 +1028,7 @@
1023
1028
  ButtonComponent.decorators = [
1024
1029
  { type: i0.Component, args: [{
1025
1030
  selector: 'wac-button',
1026
- 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]=\"[\n label === '' ? 'alone' : '',\n animationRight ? 'animation-right' : '',\n animation ? 'animationText' : '',\n isLoading ? 'is-loading' : '',\n opacity ? 'opacity' : '',\n disabled ? 'disabled' : '',\n widthAuto ? 'width-auto' : '',\n whiteSpaceNowrap ? 'white-space-no-wrap' : '',\n !waitForConfirmDelete && confirmDelete ? 'step-delete' : '',\n confirmDelete ? 'deletePosition-' + confirmDeletePosition : ''\n ]\"\n [ngStyle]=\"{\n 'text-align': contentHorizontalPosition\n }\"\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"
1031
+ 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]=\"[\n label === '' ? 'alone' : '',\n animationRight ? 'animation-right' : '',\n animation ? 'animationText' : '',\n isLoading ? 'is-loading' : '',\n opacity ? 'opacity' : '',\n disabled ? 'disabled' : '',\n widthAuto ? 'width-auto' : '',\n whiteSpaceNowrap ? 'white-space-no-wrap' : '',\n !waitForConfirmDelete && confirmDelete ? 'step-delete' : '',\n confirmDelete ? 'deletePosition-' + confirmDeletePosition : ''\n ]\"\n [ngStyle]=\"{\n 'text-align': contentHorizontalPosition\n }\"\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\"\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"
1027
1032
  },] }
1028
1033
  ];
1029
1034
  ButtonComponent.ctorParameters = function () { return []; };