@wizishop/angular-components 0.0.74 → 0.0.77

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 [
@@ -3777,14 +3769,14 @@
3777
3769
  TreeComponent.decorators = [
3778
3770
  { type: i0.Component, args: [{
3779
3771
  selector: 'wac-tree',
3780
- template: "<div *ngFor=\"let item of items; index as i\" [ngClass]=\"['treeDepth-' + treeDepth]\">\n <ul>\n <li>\n\n <ng-template #defaultItem>\n {{ item?.treeLabel }}\n </ng-template>\n\n <ng-container\n [ngTemplateOutlet]=\"optionTemplateRef || defaultItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item, index: i }\"\n >\n </ng-container>\n\n <wac-tree [items]=\"item.treeChildren\" *ngIf=\"item.treeChildren?.length\">\n <!-- Todo maybe pass child template -->\n </wac-tree>\n </li>\n </ul>\n</div>"
3772
+ template: "<div *ngFor=\"let item of items; index as i\" [ngClass]=\"['treeDepth-' + treeDepth]\">\n <ul>\n <li>\n\n <ng-template #defaultItem>\n {{ item?.treeLabel }}\n </ng-template>\n\n <ng-container\n [ngTemplateOutlet]=\"optionTemplate || defaultItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item, index: i }\"\n >\n </ng-container>\n\n <wac-tree [optionTemplate]=\"optionTemplate\" [items]=\"item.treeChildren\" *ngIf=\"item.treeChildren?.length\" [treeDepth]=\"treeDepth + 1\">\n <!-- Todo maybe pass child template -->\n\n </wac-tree>\n </li>\n </ul>\n</div>"
3781
3773
  },] }
3782
3774
  ];
3783
3775
  TreeComponent.ctorParameters = function () { return []; };
3784
3776
  TreeComponent.propDecorators = {
3785
3777
  items: [{ type: i0.Input }],
3786
3778
  treeDepth: [{ type: i0.Input }],
3787
- optionTemplateRef: [{ type: i0.ContentChild, args: ["optionTemplate", { static: false },] }]
3779
+ optionTemplate: [{ type: i0.Input, args: ["optionTemplate",] }]
3788
3780
  };
3789
3781
 
3790
3782
  var FormatObjectToRecursifTreePipe = /** @class */ (function () {
@@ -3803,13 +3795,13 @@
3803
3795
  try {
3804
3796
  for (var _b = __values(this.childrenProperties), _c = _b.next(); !_c.done; _c = _b.next()) {
3805
3797
  var childrenProperty = _c.value;
3806
- object.hasTreeChrildren = true;
3798
+ object.hasTreeChildren = true;
3807
3799
  if (!object.hasOwnProperty(childrenProperty)) {
3808
3800
  // No more chrildren
3809
3801
  object.hasTreeChrildren = false;
3810
3802
  continue;
3811
3803
  }
3812
- if (Array.isArray(object[childrenProperty])) {
3804
+ if (!Array.isArray(object[childrenProperty])) {
3813
3805
  throw "Property : \"" + childrenProperty + "\", is not an array. it could not be transform to a recursive list.";
3814
3806
  }
3815
3807
  // Add treeChildren property filled with name children property
@@ -3864,7 +3856,7 @@
3864
3856
  object.hasTreeChrildren = false;
3865
3857
  continue;
3866
3858
  }
3867
- if (Array.isArray(object[property])) {
3859
+ if (!Array.isArray(object[property])) {
3868
3860
  throw "Property : \"" + property + "\", is not an array. it could not be transform to a recursive list.";
3869
3861
  }
3870
3862
  // Add treeChildren property filled with name children property
@@ -3882,7 +3874,27 @@
3882
3874
  },] }
3883
3875
  ];
3884
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
+
3885
3894
  var exportedPipes = [FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe];
3895
+ var pipes$1 = [
3896
+ SelectFiltersPipe
3897
+ ];
3886
3898
  var SharedPipes = /** @class */ (function () {
3887
3899
  function SharedPipes() {
3888
3900
  }
@@ -3891,8 +3903,8 @@
3891
3903
  SharedPipes.decorators = [
3892
3904
  { type: i0.NgModule, args: [{
3893
3905
  imports: [common.CommonModule, forms.FormsModule],
3894
- declarations: exportedPipes,
3895
- exports: exportedPipes
3906
+ declarations: __spread(exportedPipes, pipes$1),
3907
+ exports: __spread(exportedPipes, pipes$1)
3896
3908
  },] }
3897
3909
  ];
3898
3910
 
@@ -3986,6 +3998,7 @@
3986
3998
  core.TranslateModule.forChild(),
3987
3999
  forms.ReactiveFormsModule,
3988
4000
  SharedDirectives,
4001
+ SharedPipes,
3989
4002
  table.CdkTableModule,
3990
4003
  ngxChips.TagInputModule,
3991
4004
  PaginationModule,
@@ -4075,6 +4088,7 @@
4075
4088
  exports.RadioComponent = RadioComponent;
4076
4089
  exports.SearchComponent = SearchComponent;
4077
4090
  exports.SelectComponent = SelectComponent;
4091
+ exports.SelectFiltersPipe = SelectFiltersPipe;
4078
4092
  exports.SelectInTextComponent = SelectInTextComponent;
4079
4093
  exports.SelectedListComponent = SelectedListComponent;
4080
4094
  exports.SeparatorComponent = SeparatorComponent;