@wizishop/angular-components 0.0.75 → 0.0.76

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,12 @@
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);
2930
2921
  };
2931
2922
  SelectComponent.prototype.onClose = function () {
2932
2923
  this.openCategories = false;
@@ -2934,25 +2925,20 @@
2934
2925
  SelectComponent.prototype.customTB = function (item, index) {
2935
2926
  return item.id + "-" + index;
2936
2927
  };
2937
- SelectComponent.prototype.onSelectItem = function (index) {
2928
+ SelectComponent.prototype.onSelectItem = function (id) {
2938
2929
  this.unselectAll();
2939
- var itemSelected = this.items[index];
2940
- this.setCurrentItem(itemSelected);
2941
- this.selectValue.emit(index);
2930
+ this.setIndexItemSelected(id);
2931
+ var itemSelected = this.getItemSelected();
2932
+ itemSelected.selected = true;
2933
+ this.selectValue.emit(this.indexItemSelected);
2934
+ this.onChange(itemSelected);
2942
2935
  };
2943
2936
  SelectComponent.prototype.onClickCallToAction = function () {
2944
2937
  this.onClose();
2945
2938
  this.clickOnCallToAction.emit(this.callToAction.value);
2946
2939
  };
2947
2940
  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;
2941
+ return this.items[this.indexItemSelected];
2956
2942
  };
2957
2943
  SelectComponent.prototype.showCategories = function () {
2958
2944
  var _this = this;
@@ -2961,28 +2947,33 @@
2961
2947
  _this.searchElement.nativeElement.focus();
2962
2948
  }, 0);
2963
2949
  };
2964
- SelectComponent.prototype.setCurrentItem = function (itemSelected) {
2965
- if (!itemSelected) {
2950
+ SelectComponent.prototype.unselectAll = function () {
2951
+ this.items.forEach(function (item) { return item.selected = false; });
2952
+ };
2953
+ SelectComponent.prototype.setIndexItemSelected = function (id) {
2954
+ this.indexItemSelected = this.items.findIndex(function (item) { return item.id === id; });
2955
+ };
2956
+ SelectComponent.prototype.writeValue = function (selectItem) {
2957
+ if (!selectItem) {
2966
2958
  return;
2967
2959
  }
2968
- itemSelected.selected = true;
2969
- this.currentLabel = itemSelected.name;
2970
- this.currentLabelIcon = itemSelected.icon;
2960
+ this.unselectAll();
2961
+ selectItem.selected = true;
2962
+ this.setIndexItemSelected(selectItem.id);
2971
2963
  };
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; });
2964
+ SelectComponent.prototype.registerOnChange = function (fn) {
2965
+ this.onChange = fn;
2976
2966
  };
2977
- SelectComponent.prototype.unselectAll = function () {
2978
- this.items.forEach(function (item) { return item.selected = false; });
2967
+ SelectComponent.prototype.registerOnTouched = function (fn) {
2968
+ this.onTouch = fn;
2979
2969
  };
2980
2970
  return SelectComponent;
2981
2971
  }());
2982
2972
  SelectComponent.decorators = [
2983
2973
  { type: i0.Component, args: [{
2984
2974
  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"
2975
+ 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>",
2976
+ providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }]
2986
2977
  },] }
2987
2978
  ];
2988
2979
  SelectComponent.ctorParameters = function () { return [
@@ -3796,8 +3787,6 @@
3796
3787
  this.childrenProperties = childrenProperties;
3797
3788
  var treeDepth = 0;
3798
3789
  objectList.forEach(function (object) { return _this.recursiveFormatObjectToRecursifTree(object, treeDepth); });
3799
- console.log('objectList');
3800
- console.log(objectList);
3801
3790
  return objectList;
3802
3791
  };
3803
3792
  FormatObjectToRecursifTreePipe.prototype.recursiveFormatObjectToRecursifTree = function (object, treeDepth) {
@@ -3805,7 +3794,7 @@
3805
3794
  try {
3806
3795
  for (var _b = __values(this.childrenProperties), _c = _b.next(); !_c.done; _c = _b.next()) {
3807
3796
  var childrenProperty = _c.value;
3808
- object.hasTreeChrildren = true;
3797
+ object.hasTreeChildren = true;
3809
3798
  if (!object.hasOwnProperty(childrenProperty)) {
3810
3799
  // No more chrildren
3811
3800
  object.hasTreeChrildren = false;
@@ -3884,7 +3873,27 @@
3884
3873
  },] }
3885
3874
  ];
3886
3875
 
3876
+ var SelectFiltersPipe = /** @class */ (function () {
3877
+ function SelectFiltersPipe() {
3878
+ }
3879
+ SelectFiltersPipe.prototype.transform = function (items, filterName) {
3880
+ return items.filter(function (item) {
3881
+ var regexp = new RegExp(filterName, 'i');
3882
+ return regexp.test(item.name);
3883
+ });
3884
+ };
3885
+ return SelectFiltersPipe;
3886
+ }());
3887
+ SelectFiltersPipe.decorators = [
3888
+ { type: i0.Pipe, args: [{
3889
+ name: 'selectFilters'
3890
+ },] }
3891
+ ];
3892
+
3887
3893
  var exportedPipes = [FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe];
3894
+ var pipes$1 = [
3895
+ SelectFiltersPipe
3896
+ ];
3888
3897
  var SharedPipes = /** @class */ (function () {
3889
3898
  function SharedPipes() {
3890
3899
  }
@@ -3893,8 +3902,8 @@
3893
3902
  SharedPipes.decorators = [
3894
3903
  { type: i0.NgModule, args: [{
3895
3904
  imports: [common.CommonModule, forms.FormsModule],
3896
- declarations: exportedPipes,
3897
- exports: exportedPipes
3905
+ declarations: __spread(exportedPipes, pipes$1),
3906
+ exports: __spread(exportedPipes, pipes$1)
3898
3907
  },] }
3899
3908
  ];
3900
3909
 
@@ -3988,6 +3997,7 @@
3988
3997
  core.TranslateModule.forChild(),
3989
3998
  forms.ReactiveFormsModule,
3990
3999
  SharedDirectives,
4000
+ SharedPipes,
3991
4001
  table.CdkTableModule,
3992
4002
  ngxChips.TagInputModule,
3993
4003
  PaginationModule,
@@ -4077,6 +4087,7 @@
4077
4087
  exports.RadioComponent = RadioComponent;
4078
4088
  exports.SearchComponent = SearchComponent;
4079
4089
  exports.SelectComponent = SelectComponent;
4090
+ exports.SelectFiltersPipe = SelectFiltersPipe;
4080
4091
  exports.SelectInTextComponent = SelectInTextComponent;
4081
4092
  exports.SelectedListComponent = SelectedListComponent;
4082
4093
  exports.SeparatorComponent = SeparatorComponent;