@wizishop/angular-components 0.0.61 → 0.0.65

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.
@@ -3610,40 +3610,53 @@
3610
3610
  var SearchComponent = /** @class */ (function () {
3611
3611
  function SearchComponent() {
3612
3612
  this.alwaysOpen = false;
3613
+ this.disableSearchIn = false;
3613
3614
  this.emptyResult = '';
3614
3615
  this.search = '';
3615
3616
  this.openSelect = false;
3616
3617
  this.selectValue = new i0.EventEmitter();
3617
- this.selectValueByIndex = new i0.EventEmitter();
3618
+ this.searchKeyUp = new i0.EventEmitter();
3619
+ this.searchFocusOut = new i0.EventEmitter();
3618
3620
  }
3619
3621
  SearchComponent.prototype.ngOnInit = function () {
3620
3622
  this.triggerOptions = this.options;
3621
3623
  };
3622
- SearchComponent.prototype.customTB = function (item, index) {
3623
- return item.id + "-" + index;
3624
- };
3625
3624
  SearchComponent.prototype.onClose = function () {
3626
3625
  this.openSelect = false;
3627
3626
  };
3628
3627
  SearchComponent.prototype.setSearchValueToQuery = function (value) {
3629
3628
  var _this = this;
3630
3629
  this.search = value.target.value;
3631
- if (this.search.length > 0) {
3632
- this.openSelect = true;
3633
- this.triggerOptions = this.options.filter(function (element) { return element.label.toLowerCase().indexOf(_this.search.toLowerCase()) !== -1; });
3630
+ if (this.disableSearchIn) {
3631
+ this.triggerOptions = this.options;
3634
3632
  }
3635
3633
  else {
3636
- this.triggerOptions = this.options;
3634
+ if (this.search.length > 0) {
3635
+ this.openSelect = true;
3636
+ this.triggerOptions = this.options.filter(function (element) { return element.label.toLowerCase().indexOf(_this.search.toLowerCase()) !== -1; });
3637
+ }
3638
+ else {
3639
+ this.triggerOptions = this.options;
3640
+ }
3637
3641
  }
3642
+ this.searchKeyUp.emit(this.search);
3643
+ };
3644
+ SearchComponent.prototype.sendEventFocusOut = function () {
3645
+ this.searchFocusOut.emit(this.search);
3638
3646
  };
3639
3647
  SearchComponent.prototype.closeSelect = function () {
3640
- // this.openSelect = false;
3648
+ this.openSelect = false;
3641
3649
  };
3642
- SearchComponent.prototype.onSelectItem = function (index) {
3643
- this.selectValueByIndex.emit(index);
3644
- this.selectValue.emit(this.options[index]);
3650
+ SearchComponent.prototype.onSelectItem = function (index, value, label) {
3645
3651
  this.search = '';
3646
3652
  this.openSelect = false;
3653
+ if (this.disableSearchIn) {
3654
+ this.selectValue.emit(index);
3655
+ }
3656
+ else {
3657
+ var findInOption = this.options.findIndex(function (element) { return element.label === label && element.id === value; });
3658
+ this.selectValue.emit(findInOption);
3659
+ }
3647
3660
  };
3648
3661
  SearchComponent.prototype.resetAllVue = function () {
3649
3662
  this.search = '';
@@ -3654,7 +3667,7 @@
3654
3667
  SearchComponent.decorators = [
3655
3668
  { type: i0.Component, args: [{
3656
3669
  selector: 'wac-search',
3657
- template: "<div class=\"wac-search\" [ngClass]=\"{ open: openSelect || alwaysOpen }\" [zIndexToggle]=\"openSelect\" wzAutoHide (clickOutside)=\"closeSelect()\">\n <div class=\"wac-search__wrapper\">\n <button><i class=\"fal fa-search\"></i></button>\n <input [value]=\"search\" type=\"text\" required [placeholder]=\"placeholder\" (focus)=\"openSelect = true;\" (keyup)=\"setSearchValueToQuery($event)\" />\n </div>\n <div class=\"wac-search__absolute\" *ngIf=\"triggerOptions\" [ngClass]=\"{'hidden': !openSelect}\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"triggerOptions.length > 0\">\n <div (click)=\"onClose()\" class=\"wac-select__content__item\" *ngFor=\"let item of triggerOptions; trackBy: customTB; let index = index;\">\n <div [ngClass]=\"{ selected: item.active }\" (click)=\"onSelectItem(index)\">\n {{ item.label }}\n </div>\n </div>\n </perfect-scrollbar>\n <div class=\"wac-select__content__empty\" *ngIf=\"triggerOptions.length === 0\">\n <span *ngIf=\"emptyResult\">{{emptyResult}}</span>\n </div>\n </div>\n</div>\n"
3670
+ template: "<div class=\"wac-search\" [ngClass]=\"{ open: openSelect || alwaysOpen }\" [zIndexToggle]=\"openSelect\" wzAutoHide (clickOutside)=\"closeSelect()\">\n <div class=\"wac-search__wrapper\">\n <button><i class=\"fal fa-search\"></i></button>\n <input [value]=\"search\" type=\"text\" required [placeholder]=\"placeholder\" (focus)=\"openSelect = true;\" (focusout)=\"sendEventFocusOut()\" (keyup)=\"setSearchValueToQuery($event)\" />\n </div>\n <div class=\"wac-search__absolute\" *ngIf=\"triggerOptions\" [ngClass]=\"{'hidden': !openSelect}\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"triggerOptions.length > 0\">\n <div (click)=\"onClose()\" class=\"wac-select__content__item\" *ngFor=\"let item of triggerOptions; let index = index;\">\n <div [ngClass]=\"{ selected: item.checked }\" (click)=\"onSelectItem(index, item.id, item.label)\">\n {{ item.label }}\n </div>\n </div>\n </perfect-scrollbar>\n <div class=\"wac-select__content__empty\" *ngIf=\"triggerOptions.length === 0\">\n <span *ngIf=\"emptyResult\">{{emptyResult}}</span>\n </div>\n </div>\n</div>\n"
3658
3671
  },] }
3659
3672
  ];
3660
3673
  SearchComponent.ctorParameters = function () { return []; };
@@ -3663,9 +3676,80 @@
3663
3676
  alwaysOpen: [{ type: i0.Input }],
3664
3677
  label: [{ type: i0.Input }],
3665
3678
  options: [{ type: i0.Input }],
3679
+ disableSearchIn: [{ type: i0.Input }],
3666
3680
  emptyResult: [{ type: i0.Input }],
3667
3681
  selectValue: [{ type: i0.Output }],
3668
- selectValueByIndex: [{ type: i0.Output }]
3682
+ searchKeyUp: [{ type: i0.Output }],
3683
+ searchFocusOut: [{ type: i0.Output }]
3684
+ };
3685
+
3686
+ var SelectedListComponent = /** @class */ (function () {
3687
+ function SelectedListComponent() {
3688
+ this.enableSelectAll = true;
3689
+ this.selectedItemsIndex = new i0.EventEmitter();
3690
+ this.selectedItemsAll = new i0.EventEmitter();
3691
+ this.unSelectedItemsAll = new i0.EventEmitter();
3692
+ this.selectedOptionIndex = [];
3693
+ this.switchSelectAll = false;
3694
+ }
3695
+ SelectedListComponent.prototype.ngOnInit = function () {
3696
+ if (typeof this.options !== typeof undefined) {
3697
+ this.checkSelectedItem();
3698
+ if (this.selectedOptionIndex.length === this.options.length) {
3699
+ this.switchSelectAll = true;
3700
+ }
3701
+ }
3702
+ };
3703
+ SelectedListComponent.prototype.selectAll = function () {
3704
+ var _this = this;
3705
+ this.selectedOptionIndex = [];
3706
+ this.options.forEach(function (eln, i) {
3707
+ _this.options[i].checked = true;
3708
+ _this.selectedOptionIndex.push(i);
3709
+ });
3710
+ this.switchSelectAll = true;
3711
+ this.selectedItemsAll.emit(this.selectedOptionIndex);
3712
+ };
3713
+ SelectedListComponent.prototype.checkSelectedItem = function () {
3714
+ var _this = this;
3715
+ this.selectedOptionIndex = [];
3716
+ this.options.forEach(function (eln, i) {
3717
+ if (eln.checked) {
3718
+ _this.selectedOptionIndex.push(i);
3719
+ }
3720
+ });
3721
+ };
3722
+ SelectedListComponent.prototype.unSelectAll = function () {
3723
+ var _this = this;
3724
+ this.selectedOptionIndex = [];
3725
+ this.options.forEach(function (eln, i) {
3726
+ _this.options[i].checked = false;
3727
+ });
3728
+ this.switchSelectAll = false;
3729
+ this.unSelectedItemsAll.emit(this.selectedOptionIndex);
3730
+ };
3731
+ SelectedListComponent.prototype.selectItem = function (i) {
3732
+ this.options[i].checked = !this.options[i].checked;
3733
+ this.checkSelectedItem();
3734
+ this.selectedItemsIndex.emit(i);
3735
+ };
3736
+ return SelectedListComponent;
3737
+ }());
3738
+ SelectedListComponent.decorators = [
3739
+ { type: i0.Component, args: [{
3740
+ selector: 'wac-selected-list',
3741
+ 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"
3742
+ },] }
3743
+ ];
3744
+ SelectedListComponent.propDecorators = {
3745
+ options: [{ type: i0.Input }],
3746
+ label: [{ type: i0.Input }],
3747
+ textSelectAll: [{ type: i0.Input }],
3748
+ textUnSelectAll: [{ type: i0.Input }],
3749
+ enableSelectAll: [{ type: i0.Input }],
3750
+ selectedItemsIndex: [{ type: i0.Output }],
3751
+ selectedItemsAll: [{ type: i0.Output }],
3752
+ unSelectedItemsAll: [{ type: i0.Output }]
3669
3753
  };
3670
3754
 
3671
3755
  var components = [
@@ -3708,7 +3792,8 @@
3708
3792
  FiltersComponent,
3709
3793
  WrapperBlocsComponent,
3710
3794
  SnackbarComponent,
3711
- SearchComponent
3795
+ SearchComponent,
3796
+ SelectedListComponent
3712
3797
  ];
3713
3798
  var exportsFromModule = [
3714
3799
  PaginationComponent,
@@ -3824,6 +3909,7 @@
3824
3909
  exports.SearchComponent = SearchComponent;
3825
3910
  exports.SelectComponent = SelectComponent;
3826
3911
  exports.SelectInTextComponent = SelectInTextComponent;
3912
+ exports.SelectedListComponent = SelectedListComponent;
3827
3913
  exports.SeparatorComponent = SeparatorComponent;
3828
3914
  exports.SettingsComponent = SettingsComponent;
3829
3915
  exports.SharedComponentsModule = SharedComponentsModule;