@wizishop/angular-components 0.0.112 → 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.
@@ -962,20 +962,6 @@
962
962
  _this.currentLoading += Math.floor(Math.random() * 15);
963
963
  }
964
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); */
979
965
  };
980
966
  ButtonComponent.prototype.addMaxWidth = function () {
981
967
  this.buttonMaxWidth = this.buttonWidth + 'px';
@@ -3751,6 +3737,7 @@
3751
3737
 
3752
3738
  var SelectedListComponent = /** @class */ (function () {
3753
3739
  function SelectedListComponent() {
3740
+ this._options = [];
3754
3741
  this.enableSelectAll = true;
3755
3742
  this.selectedItemsIndex = new i0.EventEmitter();
3756
3743
  this.selectedItemsAll = new i0.EventEmitter();
@@ -3758,53 +3745,52 @@
3758
3745
  this.selectedOptionIndex = [];
3759
3746
  this.switchSelectAll = false;
3760
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
+ });
3761
3759
  SelectedListComponent.prototype.ngOnInit = function () {
3762
- if (typeof this.options !== typeof undefined) {
3763
- this.checkSelectedItem();
3764
- if (this.selectedOptionIndex.length === this.options.length) {
3765
- this.switchSelectAll = true;
3766
- }
3767
- }
3768
3760
  };
3769
- SelectedListComponent.prototype.selectAll = function () {
3770
- var _this = this;
3771
- this.selectedOptionIndex = [];
3772
- this.options.forEach(function (eln, i) {
3773
- _this.options[i].checked = true;
3774
- _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;
3775
3765
  });
3776
3766
  this.switchSelectAll = true;
3777
3767
  this.selectedItemsAll.emit(this.selectedOptionIndex);
3778
3768
  };
3779
- SelectedListComponent.prototype.checkSelectedItem = function () {
3780
- var _this = this;
3781
- this.selectedOptionIndex = [];
3782
- this.options.forEach(function (eln, i) {
3783
- if (eln.checked) {
3784
- _this.selectedOptionIndex.push(i);
3785
- }
3786
- });
3787
- };
3788
- SelectedListComponent.prototype.unSelectAll = function () {
3789
- var _this = this;
3790
- this.selectedOptionIndex = [];
3791
- this.options.forEach(function (eln, i) {
3792
- _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;
3793
3773
  });
3794
3774
  this.switchSelectAll = false;
3795
3775
  this.unSelectedItemsAll.emit(this.selectedOptionIndex);
3796
3776
  };
3797
- SelectedListComponent.prototype.selectItem = function (i) {
3798
- this.options[i].checked = !this.options[i].checked;
3799
- this.checkSelectedItem();
3800
- 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();
3801
3787
  };
3802
3788
  return SelectedListComponent;
3803
3789
  }());
3804
3790
  SelectedListComponent.decorators = [
3805
3791
  { type: i0.Component, args: [{
3806
3792
  selector: 'wac-selected-list',
3807
- 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"
3808
3794
  },] }
3809
3795
  ];
3810
3796
  SelectedListComponent.propDecorators = {