@wizishop/angular-components 0.0.111 → 0.0.114

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.
@@ -596,7 +596,44 @@
596
596
  isActive: [{ type: i0.Input, args: ['zIndexToggle',] }]
597
597
  };
598
598
 
599
- var directives = [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective];
599
+ var VarDirective = /** @class */ (function () {
600
+ function VarDirective(templateRef, vcRef) {
601
+ this.templateRef = templateRef;
602
+ this.vcRef = vcRef;
603
+ this.context = {
604
+ $implicit: null,
605
+ ngVar: null,
606
+ };
607
+ this.hasView = false;
608
+ }
609
+ Object.defineProperty(VarDirective.prototype, "ngVar", {
610
+ // https://stackoverflow.com/questions/38582293/how-to-declare-a-variable-in-a-template-in-angular
611
+ set: function (context) {
612
+ this.context.$implicit = this.context.ngVar = context;
613
+ if (!this.hasView) {
614
+ this.vcRef.createEmbeddedView(this.templateRef, this.context);
615
+ this.hasView = true;
616
+ }
617
+ },
618
+ enumerable: false,
619
+ configurable: true
620
+ });
621
+ return VarDirective;
622
+ }());
623
+ VarDirective.decorators = [
624
+ { type: i0.Directive, args: [{
625
+ selector: '[ngVar]',
626
+ },] }
627
+ ];
628
+ VarDirective.ctorParameters = function () { return [
629
+ { type: i0.TemplateRef },
630
+ { type: i0.ViewContainerRef }
631
+ ]; };
632
+ VarDirective.propDecorators = {
633
+ ngVar: [{ type: i0.Input }]
634
+ };
635
+
636
+ var directives = [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective];
600
637
  var SharedDirectives = /** @class */ (function () {
601
638
  function SharedDirectives() {
602
639
  }
@@ -942,11 +979,9 @@
942
979
  return this._isLoading;
943
980
  },
944
981
  set: function (isLoading) {
945
- if (isLoading) {
946
- this.launchLoading();
947
- }
948
982
  this._isLoading = isLoading;
949
983
  this.isLoadingChange.next(isLoading);
984
+ this.toggleLoading();
950
985
  },
951
986
  enumerable: false,
952
987
  configurable: true
@@ -956,25 +991,14 @@
956
991
  this.waitForConfirmDelete = true;
957
992
  }
958
993
  };
959
- ButtonComponent.prototype.launchLoading = function () {
994
+ ButtonComponent.prototype.toggleLoading = function () {
960
995
  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 () {
996
+ this.currentLoading = this.isLoading ? 10 : 100;
997
+ rxjs.interval(200).pipe(operators.takeWhile(function (time) { return _this.isLoading; })).subscribe(function () {
967
998
  if (_this.currentLoading < 85) {
968
999
  _this.currentLoading += Math.floor(Math.random() * 15);
969
1000
  }
970
- if (!_this.isLoading) {
971
- _this.currentLoading = 100;
972
- setTimeout(function () {
973
- clearInterval(_this.interval);
974
- _this.interval = null;
975
- }, 100);
976
- }
977
- }, 200);
1001
+ });
978
1002
  };
979
1003
  ButtonComponent.prototype.addMaxWidth = function () {
980
1004
  this.buttonMaxWidth = this.buttonWidth + 'px';
@@ -990,12 +1014,16 @@
990
1014
  this.waitForConfirmDelete = true;
991
1015
  };
992
1016
  ButtonComponent.prototype.onButtonClick = function (event) {
1017
+ var _this = this;
993
1018
  event.stopPropagation();
994
1019
  if (this.disabled) {
995
1020
  return;
996
1021
  }
997
1022
  if (this.hasLoader) {
998
- this.launchLoading();
1023
+ this.isLoading = false;
1024
+ setTimeout(function () {
1025
+ _this.isLoading = true;
1026
+ }, 0);
999
1027
  }
1000
1028
  if (!this.waitForConfirmDelete) {
1001
1029
  this.click.emit(event);
@@ -1023,7 +1051,7 @@
1023
1051
  ButtonComponent.decorators = [
1024
1052
  { type: i0.Component, args: [{
1025
1053
  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"
1054
+ 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
1055
  },] }
1028
1056
  ];
1029
1057
  ButtonComponent.ctorParameters = function () { return []; };
@@ -3746,60 +3774,42 @@
3746
3774
 
3747
3775
  var SelectedListComponent = /** @class */ (function () {
3748
3776
  function SelectedListComponent() {
3777
+ this.options = [];
3749
3778
  this.enableSelectAll = true;
3750
3779
  this.selectedItemsIndex = new i0.EventEmitter();
3751
3780
  this.selectedItemsAll = new i0.EventEmitter();
3752
3781
  this.unSelectedItemsAll = new i0.EventEmitter();
3753
3782
  this.selectedOptionIndex = [];
3754
- this.switchSelectAll = false;
3755
3783
  }
3756
3784
  SelectedListComponent.prototype.ngOnInit = function () {
3757
- if (typeof this.options !== typeof undefined) {
3758
- this.checkSelectedItem();
3759
- if (this.selectedOptionIndex.length === this.options.length) {
3760
- this.switchSelectAll = true;
3761
- }
3762
- }
3763
3785
  };
3764
- SelectedListComponent.prototype.selectAll = function () {
3765
- var _this = this;
3766
- this.selectedOptionIndex = [];
3767
- this.options.forEach(function (eln, i) {
3768
- _this.options[i].checked = true;
3769
- _this.selectedOptionIndex.push(i);
3786
+ SelectedListComponent.prototype.onSelectAll = function () {
3787
+ this.selectedOptionIndex = this.options.map(function (option, index) {
3788
+ option.checked = true;
3789
+ return index;
3770
3790
  });
3771
- this.switchSelectAll = true;
3772
3791
  this.selectedItemsAll.emit(this.selectedOptionIndex);
3773
3792
  };
3774
- SelectedListComponent.prototype.checkSelectedItem = function () {
3775
- var _this = this;
3776
- this.selectedOptionIndex = [];
3777
- this.options.forEach(function (eln, i) {
3778
- if (eln.checked) {
3779
- _this.selectedOptionIndex.push(i);
3780
- }
3781
- });
3782
- };
3783
- SelectedListComponent.prototype.unSelectAll = function () {
3784
- var _this = this;
3785
- this.selectedOptionIndex = [];
3786
- this.options.forEach(function (eln, i) {
3787
- _this.options[i].checked = false;
3793
+ SelectedListComponent.prototype.onUnSelectAll = function () {
3794
+ this.selectedOptionIndex = this.options.map(function (option, index) {
3795
+ option.checked = false;
3796
+ return index;
3788
3797
  });
3789
- this.switchSelectAll = false;
3790
3798
  this.unSelectedItemsAll.emit(this.selectedOptionIndex);
3791
3799
  };
3792
- SelectedListComponent.prototype.selectItem = function (i) {
3793
- this.options[i].checked = !this.options[i].checked;
3794
- this.checkSelectedItem();
3795
- this.selectedItemsIndex.emit(i);
3800
+ SelectedListComponent.prototype.onSelectItem = function (index) {
3801
+ this.options[index].checked = !this.options[index].checked;
3802
+ this.selectedItemsIndex.emit(index);
3803
+ };
3804
+ SelectedListComponent.prototype.areAllOptionsChecked = function () {
3805
+ return !this.options.some(function (option) { return !option.checked; });
3796
3806
  };
3797
3807
  return SelectedListComponent;
3798
3808
  }());
3799
3809
  SelectedListComponent.decorators = [
3800
3810
  { type: i0.Component, args: [{
3801
3811
  selector: 'wac-selected-list',
3802
- 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"
3812
+ 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 <ng-container *ngVar=\"(options | areAllOptionsSelected) as areAllOptionsSelected\">\n <span *ngIf=\"textSelectAll && !areAllOptionsSelected\" [innerHTML]=\"textSelectAll\" (click)=\"onSelectAll()\"></span>\n <span *ngIf=\"textUnSelectAll && areAllOptionsSelected\" [innerHTML]=\"textUnSelectAll\" (click)=\"onUnSelectAll()\"></span>\n </ng-container>\n\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"
3803
3813
  },] }
3804
3814
  ];
3805
3815
  SelectedListComponent.propDecorators = {
@@ -3945,9 +3955,25 @@
3945
3955
  },] }
3946
3956
  ];
3947
3957
 
3958
+ var AreAllOptionsSelectedPipe = /** @class */ (function () {
3959
+ function AreAllOptionsSelectedPipe() {
3960
+ }
3961
+ AreAllOptionsSelectedPipe.prototype.transform = function (options) {
3962
+ return !options.some(function (option) { return !option.checked; });
3963
+ };
3964
+ return AreAllOptionsSelectedPipe;
3965
+ }());
3966
+ AreAllOptionsSelectedPipe.decorators = [
3967
+ { type: i0.Pipe, args: [{
3968
+ name: 'areAllOptionsSelected',
3969
+ pure: false
3970
+ },] }
3971
+ ];
3972
+
3948
3973
  var exportedPipes = [FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe];
3949
3974
  var pipes$1 = [
3950
- SelectFiltersPipe
3975
+ SelectFiltersPipe,
3976
+ AreAllOptionsSelectedPipe
3951
3977
  ];
3952
3978
  var SharedPipes = /** @class */ (function () {
3953
3979
  function SharedPipes() {
@@ -4186,19 +4212,21 @@
4186
4212
  exports.WzEditInPlaceComponent = WzEditInPlaceComponent;
4187
4213
  exports.ZindexToggleDirective = ZindexToggleDirective;
4188
4214
  exports.ɵa = DomService;
4189
- exports.ɵb = PaginationModule;
4190
- exports.ɵc = PagniationArrayTotalPages;
4191
- exports.ɵd = PagniationIsLastPage;
4192
- exports.ɵe = PagniationText;
4193
- exports.ɵf = TableModule;
4194
- exports.ɵg = InputSearchModule;
4195
- exports.ɵh = InputModule;
4196
- exports.ɵi = TooltipModule;
4197
- exports.ɵj = ProgressBarModule;
4198
- exports.ɵk = LoaderModule;
4199
- exports.ɵl = CheckboxModule;
4200
- exports.ɵm = inOutY;
4201
- exports.ɵn = inOutX;
4215
+ exports.ɵb = VarDirective;
4216
+ exports.ɵc = AreAllOptionsSelectedPipe;
4217
+ exports.ɵd = PaginationModule;
4218
+ exports.ɵe = PagniationArrayTotalPages;
4219
+ exports.ɵf = PagniationIsLastPage;
4220
+ exports.ɵg = PagniationText;
4221
+ exports.ɵh = TableModule;
4222
+ exports.ɵi = InputSearchModule;
4223
+ exports.ɵj = InputModule;
4224
+ exports.ɵk = TooltipModule;
4225
+ exports.ɵl = ProgressBarModule;
4226
+ exports.ɵm = LoaderModule;
4227
+ exports.ɵn = CheckboxModule;
4228
+ exports.ɵo = inOutY;
4229
+ exports.ɵp = inOutX;
4202
4230
 
4203
4231
  Object.defineProperty(exports, '__esModule', { value: true });
4204
4232