@wizishop/angular-components 0.0.110 → 0.0.113

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.
@@ -941,9 +941,10 @@
941
941
  get: function () {
942
942
  return this._isLoading;
943
943
  },
944
- set: function (value) {
945
- this._isLoading = value;
946
- this.isLoadingChange.next(value);
944
+ set: function (isLoading) {
945
+ this._isLoading = isLoading;
946
+ this.isLoadingChange.next(isLoading);
947
+ this.toggleLoading();
947
948
  },
948
949
  enumerable: false,
949
950
  configurable: true
@@ -953,25 +954,14 @@
953
954
  this.waitForConfirmDelete = true;
954
955
  }
955
956
  };
956
- ButtonComponent.prototype.launchLoading = function () {
957
+ ButtonComponent.prototype.toggleLoading = function () {
957
958
  var _this = this;
958
- if (this.isLoading || this.interval !== null) {
959
- return;
960
- }
961
- this.isLoading = true;
962
- this.currentLoading = 10;
963
- 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 () {
964
961
  if (_this.currentLoading < 85) {
965
962
  _this.currentLoading += Math.floor(Math.random() * 15);
966
963
  }
967
- if (!_this.isLoading) {
968
- _this.currentLoading = 100;
969
- setTimeout(function () {
970
- clearInterval(_this.interval);
971
- _this.interval = null;
972
- }, 100);
973
- }
974
- }, 200);
964
+ });
975
965
  };
976
966
  ButtonComponent.prototype.addMaxWidth = function () {
977
967
  this.buttonMaxWidth = this.buttonWidth + 'px';
@@ -987,21 +977,26 @@
987
977
  this.waitForConfirmDelete = true;
988
978
  };
989
979
  ButtonComponent.prototype.onButtonClick = function (event) {
980
+ var _this = this;
990
981
  event.stopPropagation();
991
- if (!this.disabled) {
992
- if (this.hasLoader) {
993
- this.launchLoading();
994
- }
995
- if (!this.waitForConfirmDelete) {
996
- this.click.emit(event);
997
- if (this.confirmDelete) {
998
- this.resetMaxWidthDelete();
999
- }
1000
- }
1001
- else {
1002
- this.waitForConfirmDelete = false;
982
+ if (this.disabled) {
983
+ return;
984
+ }
985
+ if (this.hasLoader) {
986
+ this.isLoading = false;
987
+ setTimeout(function () {
988
+ _this.isLoading = true;
989
+ }, 0);
990
+ }
991
+ if (!this.waitForConfirmDelete) {
992
+ this.click.emit(event);
993
+ if (this.confirmDelete) {
994
+ this.resetMaxWidthDelete();
1003
995
  }
1004
996
  }
997
+ else {
998
+ this.waitForConfirmDelete = false;
999
+ }
1005
1000
  };
1006
1001
  ButtonComponent.prototype.ngAfterViewInit = function () {
1007
1002
  var _this = this;
@@ -1019,7 +1014,7 @@
1019
1014
  ButtonComponent.decorators = [
1020
1015
  { type: i0.Component, args: [{
1021
1016
  selector: 'wac-button',
1022
- 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"
1017
+ 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"
1023
1018
  },] }
1024
1019
  ];
1025
1020
  ButtonComponent.ctorParameters = function () { return []; };
@@ -3742,6 +3737,7 @@
3742
3737
 
3743
3738
  var SelectedListComponent = /** @class */ (function () {
3744
3739
  function SelectedListComponent() {
3740
+ this._options = [];
3745
3741
  this.enableSelectAll = true;
3746
3742
  this.selectedItemsIndex = new i0.EventEmitter();
3747
3743
  this.selectedItemsAll = new i0.EventEmitter();
@@ -3749,53 +3745,52 @@
3749
3745
  this.selectedOptionIndex = [];
3750
3746
  this.switchSelectAll = false;
3751
3747
  }
3748
+ Object.defineProperty(SelectedListComponent.prototype, "options", {
3749
+ get: function () {
3750
+ return this._options;
3751
+ },
3752
+ set: function (options) {
3753
+ this._options = options;
3754
+ this.handleSwitchSelectAll();
3755
+ },
3756
+ enumerable: false,
3757
+ configurable: true
3758
+ });
3752
3759
  SelectedListComponent.prototype.ngOnInit = function () {
3753
- if (typeof this.options !== typeof undefined) {
3754
- this.checkSelectedItem();
3755
- if (this.selectedOptionIndex.length === this.options.length) {
3756
- this.switchSelectAll = true;
3757
- }
3758
- }
3759
3760
  };
3760
- SelectedListComponent.prototype.selectAll = function () {
3761
- var _this = this;
3762
- this.selectedOptionIndex = [];
3763
- this.options.forEach(function (eln, i) {
3764
- _this.options[i].checked = true;
3765
- _this.selectedOptionIndex.push(i);
3761
+ SelectedListComponent.prototype.onSelectAll = function () {
3762
+ this.selectedOptionIndex = this.options.map(function (option, index) {
3763
+ option.checked = true;
3764
+ return index;
3766
3765
  });
3767
3766
  this.switchSelectAll = true;
3768
3767
  this.selectedItemsAll.emit(this.selectedOptionIndex);
3769
3768
  };
3770
- SelectedListComponent.prototype.checkSelectedItem = function () {
3771
- var _this = this;
3772
- this.selectedOptionIndex = [];
3773
- this.options.forEach(function (eln, i) {
3774
- if (eln.checked) {
3775
- _this.selectedOptionIndex.push(i);
3776
- }
3777
- });
3778
- };
3779
- SelectedListComponent.prototype.unSelectAll = function () {
3780
- var _this = this;
3781
- this.selectedOptionIndex = [];
3782
- this.options.forEach(function (eln, i) {
3783
- _this.options[i].checked = false;
3769
+ SelectedListComponent.prototype.onUnSelectAll = function () {
3770
+ this.selectedOptionIndex = this.options.map(function (option, index) {
3771
+ option.checked = false;
3772
+ return index;
3784
3773
  });
3785
3774
  this.switchSelectAll = false;
3786
3775
  this.unSelectedItemsAll.emit(this.selectedOptionIndex);
3787
3776
  };
3788
- SelectedListComponent.prototype.selectItem = function (i) {
3789
- this.options[i].checked = !this.options[i].checked;
3790
- this.checkSelectedItem();
3791
- this.selectedItemsIndex.emit(i);
3777
+ SelectedListComponent.prototype.onSelectItem = function (index) {
3778
+ this.options[index].checked = !this.options[index].checked;
3779
+ this.handleSwitchSelectAll();
3780
+ this.selectedItemsIndex.emit(index);
3781
+ };
3782
+ SelectedListComponent.prototype.areAllOptionsChecked = function () {
3783
+ return !this.options.some(function (option) { return !option.checked; });
3784
+ };
3785
+ SelectedListComponent.prototype.handleSwitchSelectAll = function () {
3786
+ this.switchSelectAll = this.areAllOptionsChecked();
3792
3787
  };
3793
3788
  return SelectedListComponent;
3794
3789
  }());
3795
3790
  SelectedListComponent.decorators = [
3796
3791
  { type: i0.Component, args: [{
3797
3792
  selector: 'wac-selected-list',
3798
- template: "<div class=\"selected-list\">\n <div class=\"selected-list__wrapper\">\n <div class=\"selected-list__wrapper__head\">\n <p *ngIf=\"label\" [innerHTML]=\"label\"></p>\n <span *ngIf=\"textSelectAll && !switchSelectAll\" [innerHTML]=\"textSelectAll\" (click)=\"selectAll()\"></span>\n <span *ngIf=\"textUnSelectAll && switchSelectAll\" [innerHTML]=\"textUnSelectAll\" (click)=\"unSelectAll()\"></span>\n </div>\n <div class=\"selected-list__wrapper__content\">\n <div class=\"selected-list__wrapper__content__item\" *ngFor=\"let item of options;let i = index;\" [ngClass]=\"{'active': item.checked}\" (click)=\"selectItem(i)\">\n <span [innerHTML]=\"item.label\"></span>\n <i class=\"fas fa-check\"></i>\n </div>\n </div>\n </div>\n</div>\n"
3793
+ template: "<div class=\"selected-list\">\n <div class=\"selected-list__wrapper\">\n <div class=\"selected-list__wrapper__head\">\n <p *ngIf=\"label\" [innerHTML]=\"label\"></p>\n <span *ngIf=\"textSelectAll && !switchSelectAll\" [innerHTML]=\"textSelectAll\" (click)=\"onSelectAll()\"></span>\n <span *ngIf=\"textUnSelectAll && switchSelectAll\" [innerHTML]=\"textUnSelectAll\" (click)=\"onUnSelectAll()\"></span>\n </div>\n <div class=\"selected-list__wrapper__content\">\n <div class=\"selected-list__wrapper__content__item\" *ngFor=\"let item of options;let i = index;\" [ngClass]=\"{'active': item.checked}\" (click)=\"onSelectItem(i)\">\n <span [innerHTML]=\"item.label\"></span>\n <i class=\"fas fa-check\"></i>\n </div>\n </div>\n </div>\n</div>\n"
3799
3794
  },] }
3800
3795
  ];
3801
3796
  SelectedListComponent.propDecorators = {