@wizishop/angular-components 0.0.75 → 0.0.78

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.
@@ -1 +1 @@
1
- {"wac.input.progressbar.information.good":"Very good","wac.input.progressbar.information.too.long":"Too long","wac.input.progressbar.information.too.short":"Too short","wac.PaginationComponent.on":"{{low}}-{{high}} of {{total}}","wac.PaginationComponent.page":"Go to page","wac.simpleSearchComponent.error":"The search field is compulsory"}
1
+ {"wac.datatable.noresult":"There are no results for this search","wac.input.progressbar.information.good":"Very good","wac.input.progressbar.information.too.long":"Too long","wac.input.progressbar.information.too.short":"Too short","wac.PaginationComponent.on":"{{low}}-{{high}} of {{total}}","wac.PaginationComponent.page":"Go to page","wac.simpleSearchComponent.error":"The search field is compulsory"}
@@ -1 +1 @@
1
- {"wac.input.progressbar.information.good":"Très bien","wac.input.progressbar.information.too.long":"Trop long","wac.input.progressbar.information.too.short":"Trop court","wac.PaginationComponent.on":"{{low}}-{{high}} sur {{total}}","wac.PaginationComponent.page":"Aller à la page","wac.simpleSearchComponent.error":"Le champ de recherche est obligatoire"}
1
+ {"wac.datatable.noresult":"Il n'y a aucun résultat pour cette recherche","wac.input.progressbar.information.good":"Très bien","wac.input.progressbar.information.too.long":"Trop long","wac.input.progressbar.information.too.short":"Trop court","wac.PaginationComponent.on":"{{low}}-{{high}} sur {{total}}","wac.PaginationComponent.page":"Aller à la page","wac.simpleSearchComponent.error":"Le champ de recherche est obligatoire"}
@@ -2912,21 +2912,13 @@
2912
2912
  this.clickOnCallToAction = new i0.EventEmitter();
2913
2913
  this.openCategories = false;
2914
2914
  this.searchValue = '';
2915
- this.currentLabel = '';
2916
- this.currentLabelIcon = '';
2915
+ this.indexItemSelected = -1;
2916
+ // ControlValueAccessor methods
2917
+ this.onChange = function () { };
2918
+ this.onTouch = function () { };
2917
2919
  }
2918
2920
  SelectComponent.prototype.ngOnInit = function () {
2919
- this.currentLabel = this.placeholder;
2920
- this.emptyResult = this.translateService.instant('datatable.noresult ');
2921
- this.setInitialValues();
2922
- };
2923
- SelectComponent.prototype.setInitialValues = function () {
2924
- if (!this.items.length) {
2925
- return;
2926
- }
2927
- this.triggerValueSelect = this.items;
2928
- var itemSelected = this.getItemSelected();
2929
- this.setCurrentItem(itemSelected);
2921
+ this.indexItemSelected = this.items.findIndex(function (item) { return item.selected; });
2930
2922
  };
2931
2923
  SelectComponent.prototype.onClose = function () {
2932
2924
  this.openCategories = false;
@@ -2934,25 +2926,20 @@
2934
2926
  SelectComponent.prototype.customTB = function (item, index) {
2935
2927
  return item.id + "-" + index;
2936
2928
  };
2937
- SelectComponent.prototype.onSelectItem = function (index) {
2929
+ SelectComponent.prototype.onSelectItem = function (id) {
2938
2930
  this.unselectAll();
2939
- var itemSelected = this.items[index];
2940
- this.setCurrentItem(itemSelected);
2941
- this.selectValue.emit(index);
2931
+ this.setIndexItemSelected(id);
2932
+ var itemSelected = this.getItemSelected();
2933
+ itemSelected.selected = true;
2934
+ this.selectValue.emit(this.indexItemSelected);
2935
+ this.onChange(itemSelected);
2942
2936
  };
2943
2937
  SelectComponent.prototype.onClickCallToAction = function () {
2944
2938
  this.onClose();
2945
2939
  this.clickOnCallToAction.emit(this.callToAction.value);
2946
2940
  };
2947
2941
  SelectComponent.prototype.getItemSelected = function () {
2948
- var itemSelected = null;
2949
- this.items.forEach(function (item) {
2950
- if (!item.selected) {
2951
- return;
2952
- }
2953
- itemSelected = item;
2954
- });
2955
- return itemSelected;
2942
+ return this.items[this.indexItemSelected];
2956
2943
  };
2957
2944
  SelectComponent.prototype.showCategories = function () {
2958
2945
  var _this = this;
@@ -2961,28 +2948,33 @@
2961
2948
  _this.searchElement.nativeElement.focus();
2962
2949
  }, 0);
2963
2950
  };
2964
- SelectComponent.prototype.setCurrentItem = function (itemSelected) {
2965
- if (!itemSelected) {
2951
+ SelectComponent.prototype.unselectAll = function () {
2952
+ this.items.forEach(function (item) { return item.selected = false; });
2953
+ };
2954
+ SelectComponent.prototype.setIndexItemSelected = function (id) {
2955
+ this.indexItemSelected = this.items.findIndex(function (item) { return item.id === id; });
2956
+ };
2957
+ SelectComponent.prototype.writeValue = function (selectItem) {
2958
+ if (!selectItem) {
2966
2959
  return;
2967
2960
  }
2968
- itemSelected.selected = true;
2969
- this.currentLabel = itemSelected.name;
2970
- this.currentLabelIcon = itemSelected.icon;
2961
+ this.unselectAll();
2962
+ selectItem.selected = true;
2963
+ this.setIndexItemSelected(selectItem.id);
2971
2964
  };
2972
- SelectComponent.prototype.searchInSelect = function () {
2973
- var _this = this;
2974
- console.log(this.searchValue);
2975
- this.triggerValueSelect = this.items.filter(function (item) { return item.name.indexOf(_this.searchValue) >= 0; });
2965
+ SelectComponent.prototype.registerOnChange = function (fn) {
2966
+ this.onChange = fn;
2976
2967
  };
2977
- SelectComponent.prototype.unselectAll = function () {
2978
- this.items.forEach(function (item) { return item.selected = false; });
2968
+ SelectComponent.prototype.registerOnTouched = function (fn) {
2969
+ this.onTouch = fn;
2979
2970
  };
2980
2971
  return SelectComponent;
2981
2972
  }());
2982
2973
  SelectComponent.decorators = [
2983
2974
  { type: i0.Component, args: [{
2984
2975
  selector: 'wac-select',
2985
- template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"currentLabelIcon\" class=\"icon\" [innerHTML]=\"currentLabelIcon\"></span><span [innerHTML]=\"currentLabel\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" (keyup)=\"searchInSelect()\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"currentLabelIcon && !openCategories\" class=\"icon\" [innerHTML]=\"currentLabelIcon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"currentLabel\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"triggerValueSelect.length > 0\">\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n <div (click)=\"onClose()\" class=\"wac-select__content__item\" *ngFor=\"let item of triggerValueSelect; trackBy: customTB; let index = index;\">\n <div [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(index)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name }}\n </div>\n </div>\n </perfect-scrollbar>\n <div class=\"wac-select__content__empty\" *ngIf=\"triggerValueSelect.length === 0\">\n <span *ngIf=\"emptyResult\">{{emptyResult}}</span>\n </div>\n </div>\n</div>\n"
2976
+ template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name }}\n </div>\n </div>\n\n </perfect-scrollbar>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>",
2977
+ providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }]
2986
2978
  },] }
2987
2979
  ];
2988
2980
  SelectComponent.ctorParameters = function () { return [
@@ -3796,8 +3788,6 @@
3796
3788
  this.childrenProperties = childrenProperties;
3797
3789
  var treeDepth = 0;
3798
3790
  objectList.forEach(function (object) { return _this.recursiveFormatObjectToRecursifTree(object, treeDepth); });
3799
- console.log('objectList');
3800
- console.log(objectList);
3801
3791
  return objectList;
3802
3792
  };
3803
3793
  FormatObjectToRecursifTreePipe.prototype.recursiveFormatObjectToRecursifTree = function (object, treeDepth) {
@@ -3805,10 +3795,10 @@
3805
3795
  try {
3806
3796
  for (var _b = __values(this.childrenProperties), _c = _b.next(); !_c.done; _c = _b.next()) {
3807
3797
  var childrenProperty = _c.value;
3808
- object.hasTreeChrildren = true;
3798
+ object.hasTreeChildren = true;
3809
3799
  if (!object.hasOwnProperty(childrenProperty)) {
3810
3800
  // No more chrildren
3811
- object.hasTreeChrildren = false;
3801
+ object.hasTreeChildren = false;
3812
3802
  continue;
3813
3803
  }
3814
3804
  if (!Array.isArray(object[childrenProperty])) {
@@ -3860,10 +3850,10 @@
3860
3850
  object.treeLabel = object[property];
3861
3851
  continue;
3862
3852
  }
3863
- object.hasTreeChrildren = true;
3853
+ object.hasTreeChildren = true;
3864
3854
  if (!this.childrenProperties.includes(property)) {
3865
3855
  // No more chrildren
3866
- object.hasTreeChrildren = false;
3856
+ object.hasTreeChildren = false;
3867
3857
  continue;
3868
3858
  }
3869
3859
  if (!Array.isArray(object[property])) {
@@ -3884,7 +3874,27 @@
3884
3874
  },] }
3885
3875
  ];
3886
3876
 
3877
+ var SelectFiltersPipe = /** @class */ (function () {
3878
+ function SelectFiltersPipe() {
3879
+ }
3880
+ SelectFiltersPipe.prototype.transform = function (items, filterName) {
3881
+ return items.filter(function (item) {
3882
+ var regexp = new RegExp(filterName, 'i');
3883
+ return regexp.test(item.name);
3884
+ });
3885
+ };
3886
+ return SelectFiltersPipe;
3887
+ }());
3888
+ SelectFiltersPipe.decorators = [
3889
+ { type: i0.Pipe, args: [{
3890
+ name: 'selectFilters'
3891
+ },] }
3892
+ ];
3893
+
3887
3894
  var exportedPipes = [FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe];
3895
+ var pipes$1 = [
3896
+ SelectFiltersPipe
3897
+ ];
3888
3898
  var SharedPipes = /** @class */ (function () {
3889
3899
  function SharedPipes() {
3890
3900
  }
@@ -3893,8 +3903,8 @@
3893
3903
  SharedPipes.decorators = [
3894
3904
  { type: i0.NgModule, args: [{
3895
3905
  imports: [common.CommonModule, forms.FormsModule],
3896
- declarations: exportedPipes,
3897
- exports: exportedPipes
3906
+ declarations: __spread(exportedPipes, pipes$1),
3907
+ exports: __spread(exportedPipes, pipes$1)
3898
3908
  },] }
3899
3909
  ];
3900
3910
 
@@ -3988,6 +3998,7 @@
3988
3998
  core.TranslateModule.forChild(),
3989
3999
  forms.ReactiveFormsModule,
3990
4000
  SharedDirectives,
4001
+ SharedPipes,
3991
4002
  table.CdkTableModule,
3992
4003
  ngxChips.TagInputModule,
3993
4004
  PaginationModule,
@@ -4077,6 +4088,7 @@
4077
4088
  exports.RadioComponent = RadioComponent;
4078
4089
  exports.SearchComponent = SearchComponent;
4079
4090
  exports.SelectComponent = SelectComponent;
4091
+ exports.SelectFiltersPipe = SelectFiltersPipe;
4080
4092
  exports.SelectInTextComponent = SelectInTextComponent;
4081
4093
  exports.SelectedListComponent = SelectedListComponent;
4082
4094
  exports.SeparatorComponent = SeparatorComponent;