Project

General

Profile

« Previous | Next » 

Revision 52770

Search Pages: change Filter title on the left, in filters view more modal add keyword filter and sort functionalities, changes in the selected filters under the form

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.html
44 44
                  <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="minus" ratio="1"><rect height="3" width="18" y="9" x="1"></rect></svg></span>
45 45
                </span>
46 46
              </td>
47
              <td *ngIf="i == selectedFields.length-1 " class=" "><span type="button" class="uk-icon-button" (click)="addField()">
48
                  <span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="3" height="17"></rect><rect x="1" y="9" width="17" height="3"></rect></svg></span>
47
              <td *ngIf="i == selectedFields.length-1 " class=" "><span type="button" class="uk-icon-button   icon-button-small" (click)="addField()">
48
                 <span class="uk-icon">
49
                   <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="0.8"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg>
50
                 </span>
49 51
              </span></td>
50 52
        </tr>
51 53
        </table>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchPage.component.html
4 4
      <div class="">
5 5

  
6 6
        <div   [class]="'uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle uk- light '+searchFormClass" >
7

  
7 8
          <div   class="uk-width-1-1">
8 9
            <div   class="uk-width-1-1">
9 10
              <search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)" [placeholderText]="formPlaceholderText"></search-form>
10 11
            </div>
11 12
            <div   class="uk-width-1-1  ">
12
              <!--link to advanced search -->
13
              <a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right   uk-disabled uk-link-muted uk-light ':'uk-float-right  uk-light'" [routerLink]=advancedSearchLink [queryParams]=advancedSearchParameters >More search options <span class="uk-icon">
14
                  <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
15
                  </span>
16
              </a>
17
              <div *ngIf="isFiltered()" class = "uk-container uk-width-1-2@m uk-width-1-2@s uk-align-center uk-text-center uk-text-small">
18
                <span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span><a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span class="uk-icon">
19
                  <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
13

  
14
              <div *ngIf="countFilters()>0" class = "uk-container uk-width-1-2@m uk-width-1-2@s uk-align-center uk-text-center uk-text-small whiteText uk-padding-small">
15
                <a  *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-button uk-button-default uk-margin-small-right'">
16
                 Clear All
17
                </a>
18
                <span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span>
19
                <a (click) = "clearKeywords() " title="Remove keywords" [class]="(disableForms)?'uk-icon-button icon-button-small   uk-margin-small-right uk-disabled':'uk-icon-button icon-button-small   uk-margin-small-right'"><span class=" clickable " aria-hidden="true"><span class="uk-icon ">
20
                  <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
20 21
                  </span></span></a>
21 22
                </span>
22 23
                <span *ngFor="let filter of filters " >
23
                  <span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
24
                    <span *ngFor="let value of getSelectedValues(filter); let i = index;  let end = last; " ><span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" title="value.name"></span><a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
25
                      <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
24
                  <span *ngIf = "filter.countSelectedValues > 0"> <span class="uk-text-bold">{{filter.title}}:</span>
25
                    <span *ngFor="let value of getSelectedValues(filter); let i = index;  let end = last; " ><span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span>
26
                    <a [title]="'Remove '+value.name"(click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button icon-button-small   uk-margin-small-right uk-disabled':'uk-icon-button icon-button-small   uk-margin-small-right'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
27
                      <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
26 28
                      </span></span></a>
27
                      <span *ngIf="!end">, </span>
29
                      <!--span *ngIf="!end" class=" uk-margin-small-right ">, </span-->
28 30
                    </span>
29 31
                  </span>
30 32
                </span>
31 33

  
32
                <a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
33
                 Clear All
34
                </a>
34

  
35 35
              </div>
36 36
              <div *ngIf= "showUnknownFilters"  class = " uk-text-center ">
37 37
                <a (click) = "clearFilters() " >Try new Query</a>
38 38
              </div>
39
              <!--link to advanced search -->
40
              <a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="((disableForms)?'uk-float-right   uk-disabled uk-link-muted uk-light ':'uk-float-right  uk-light') +' whiteText uk-padding-small uk-button-text'" [routerLink]=advancedSearchLink [queryParams]=advancedSearchParameters >
41
                <span class="uk-padding-small">More search options</span>
42
              </a>
39 43
            </div>
40 44

  
41 45
          </div>
......
51 55
                <div class="uk-offcanvas-bar">
52 56
                  <button class="uk-offcanvas-close" type="button" uk-close></button>
53 57
                  <div class="uk-text-large">Filter By:</div>
54
                  <search-filter  *ngFor="let filter of filters "  [addShowMore]=false [isDisabled]="disableForms" [filter]="filter"  [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)" [(connectCommunityId)]=connectCommunityId></search-filter>
58
                  <search-filter  *ngFor="let filter of filters "  [addShowMore]=false [isDisabled]="disableForms" [filter]="filter"  [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)"  [(connectCommunityId)]=connectCommunityId></search-filter>
55 59
                </div>
56 60
              </div>
57 61

  
......
62 66
          <div  class="uk-grid uk-width-1-1">
63 67
            <div  *ngIf="showRefine" class="helper-left-right search-filters uk-visible@m">
64 68
               <helper position="left" before="true"></helper>
65
               <search-filter  *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter"  [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)" [(connectCommunityId)]=connectCommunityId></search-filter>
69
               <search-filter  *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter"  [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)"  [(connectCommunityId)]=connectCommunityId></search-filter>
66 70
               <helper position="left" before="false"></helper>
67 71
            </div>
68 72
            <helper *ngIf="!showRefine" class="helper-left-right uk-visible@m" position="left"></helper>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.html
1 1

  
2 2
<ul *ngIf= "filter.values.length >0" class="uk-list">
3 3
<li class="uk-open">
4
    <h5  class="uk-margin-bottom-remove">{{_formatTitle(filter.title,filter.values.length)}}
4
    <h5  class="uk-margin-bottom-remove sideInfoTitle">{{_formatTitle(filter.title,filter.values.length)}}
5 5
    </h5>
6 6
    <div  aria-expanded="false">
7 7
      <div class="searchFilterBoxValues ">
8
        <div *ngFor = "let value of getSelectedValues(filter)"  class = "uk-animation-fade filterItem">
9

  
10

  
11
           <!--span *ngIf="!connectCommunityId || !(connectCommunityId && connectCommunityId == value.id)"-->
8
        <div *ngFor = "let value of getSelectedValues(filter,'num')"  class = "uk-animation-fade filterItem">
12 9
           <span class="filterName"><div title = "{{value.name}}">
13 10
           <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
14 11
           {{_formatName(value)}} </div></span>
15 12
           <span class="filterNumber" *ngIf = "showResultCount === true" >  ({{value.number|number}})</span>
16
         <!--/span-->
17 13
        </div>
18
        <!--div class="uk-grid-divider uk-margin-remove"></div-->
19
        <hr *ngIf="getSelectedValues(filter).length > 0 && getNotSelectedValues(filter).length > 0 " class="uk-grid-divider uk-margin-remove">
20
        <div *ngFor = "let value of getNotSelectedValues(filter).slice(0,(!addShowMore?getNotSelectedValues(filter).length:5-getSelectedValues(filter).length))" class = "uk-animation-fade filterItem">
14
        <hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small">
15
        <div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:5-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem">
21 16

  
22
          <!--span *ngIf="!connectCommunityId || !(connectCommunityId && connectCommunityId == value.id)"-->
23 17
           <span class="filterName"><div title = "{{value.name}}"> <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
24 18
           {{_formatName(value)}} </div></span>
25 19
           <span class="filterNumber" *ngIf = "showResultCount === true" >  ({{value.number|number}})</span>
26
         <!--/span-->
27 20
        </div>
28 21

  
29
        <!--a *ngIf="(getSelectedValues(filter).length + getNotSelectedValues(filter).length) > 5" (click)="toggle()" [class]="(isDisabled)?'uk-disabled uk-link-muted':''">Show More</a-->
30

  
31
        <!--button *ngIf="(getSelectedValues(filter).length + getNotSelectedValues(filter).length) > 5"
32
                class="uk-button uk-button-link" (click)="toggle()" [disabled]="isDisabled">
33
                Show More
34
        </button-->
35

  
36
        <a *ngIf=" addShowMore && (getSelectedValues(filter).length + getNotSelectedValues(filter).length) > 5" (click)="open()" [class]="(isDisabled)?'uk-disabled uk-link-muted uk-button uk-button-text uk-text-secondary':'uk-button uk-button-text uk-text-secondary'">View more
37
          <!--span class="uk-icon">
38
        <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="triangle-right" ratio="1"><polygon points="8 5 13 10 8 15"></polygon></svg>
39
        </span-->
22
        <a *ngIf=" addShowMore && (filter.values.length) > 5" (click)="open()"
23
          [class]="(isDisabled)?'uk-disabled uk-link-muted uk-button uk-button-text uk-text-secondary':'uk-button uk-button-text uk-text-secondary'">View more
40 24
        </a>
41 25

  
42 26

  
......
44 28
          <div class="filtersModal uk-modal-dialog uk-small-1-2 uk-width-medium-1-3 uk-width-1-3 uk-padding-small uk-padding-remove-top uk-padding-remove-horizontal">
45 29

  
46 30
            <button type="button" class="uk-modal-close-default" uk-close (click)="close()"></button>
47
            <h5  class="uk-margin-remove uk-padding uk-padding-remove-bottom">
31
            <h5  class="uk-margin-remove uk-padding uk-padding-remove-bottom uk-text-center">
48 32
              {{filter.title}}
49 33
            </h5>
50
            <span *ngIf="filter.values.length >= 99" class="uk-article-meta uk-text-center">Showing top {{filter.values.length}} values. </span>
51 34

  
35
            <div *ngIf="filter.values.length >= 99" class="uk-alert uk-alert-primary   uk-text-center uk-margin-right uk-margin-left">Showing top {{filter.values.length}} values. </div>
36
            <div class="uk-grid uk-margin-left uk-margin-right">
37
              <input   class="uk-input   uk-margin-small-bottom uk-width-1-2  " name="filter-keyword"  placeholder="Search for {{filter.title}}" type="text" [(ngModel)]="keyword">
38
              <select [(ngModel)]="sortBy"      class="uk-select  uk-margin-small-bottom uk-width-1-2 uk-padding-remove"  name="select_order"  (ngModelChange)="sortByChanged = true;" >
39
                <option  value="num"  >Sort by results number</option>
40
                <option  value="name"  >Sort by name</option>
41
              </select>
42
            </div>
52 43
            <div class="uk-modal-body uk-overflow-auto uk-height-medium uk-padding-remove
53 44
                        uk-margin-medium-left uk-margin-medium-right uk-margin-small-top uk-margin-bottom">
54
              <div *ngFor = "let value of getSelectedValues(filter)"  class = "uk-animation-fade filterItem">
55
                <!--span *ngIf="!connectCommunityId || !(connectCommunityId && connectCommunityId == value.id)"==>
45
              <ng-container *ngFor = "let value of getSelectedValues(filter, sortBy)">
46
                <div *ngIf="filterKeywords(value.name)"  class = "uk-animation-fade filterItem">
56 47
                   <span class="filterName"><div title = "{{value.name}}">
57 48
                   <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
58 49
                   {{_formatName(value)}} </div></span>
59 50
                   <span class="filterNumber" *ngIf = "showResultCount === true" >  ({{value.number}})</span>
60
                 <!--/span-->
61
              </div>
62
              <hr *ngIf="getSelectedValues(filter).length > 0 && getNotSelectedValues(filter).length > 0" class="uk-grid-divider uk-margin-remove">
63
              <div *ngFor = "let value of getNotSelectedValues(filter)" class = "uk-animation-fade filterItem">
64
                <!--span *ngIf="!connectCommunityId || !(connectCommunityId && connectCommunityId == value.id)"-->
65
                   <span class="filterName"><div title = "{{value.name}}"> <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
51
                 </div>
52
              </ng-container>
53
              <hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small">
54
              <ng-container *ngFor = "let value of getNotSelectedValues(filter, sortBy)">
55
                <div *ngIf="filterKeywords(value.name)"  class = "uk-animation-fade filterItem">
56
                   <span class="filterName"><div title = "{{value.name}}">
57
                      <input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
66 58
                   {{_formatName(value)}} </div></span>
67 59
                   <span class="filterNumber" *ngIf = "showResultCount === true" >  ({{value.number|number}})</span>
68
                 <!--/span-->
69
              </div>
60
               </div>
61
             </ng-container>
70 62
            </div>
71 63
          </div>
72 64
        </div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchPage.component.ts
57 57
  private queryParameters: Map<string, string>  = new Map<string,string>();
58 58
  private baseURLWithParameters:string = '';
59 59
  private sub: any; piwiksub: any;
60
  public countFilters= 0;
60
  // public countFilters= 0;
61 61
  public parameterNames:string[] =[];
62 62
  public parameterValues:string[] =[];
63 63
  public showUnknownFilters:boolean = false; // when a filter exists in query but has no results, so no filters returned from the query
64 64
  //@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
65
  public currentFilter: Filter;
65
  // public currentFilter: Filter;
66 66
  public csvLimit: number = 0;
67 67
  public pagingLimit: number = 0;
68 68
  public resultsPerPage: number = 0;
......
111 111
      this.piwiksub.unsubscribe();
112 112
    }
113 113
  }
114
  toggleModal($event) {
115
    this.currentFilter = $event.value;
116
    //this.searchFilterModal.open();
117
  }
114
  // toggleModal($event) {
115
  //   this.currentFilter = $event.value;
116
  //   //this.searchFilterModal.open();
117
  // }
118 118

  
119 119
  updateDescription(description:string) {
120 120
    this._meta.updateTag({content:description},"name='description'");
......
444 444
    return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
445 445

  
446 446
  }
447
  public isFiltered(){
448
    var filtered=false;
447
  public countFilters():number{
448
    var filters=0;
449 449
    this.showUnknownFilters = false;
450 450
    for (let filter of this.filters){
451 451
       if(filter.countSelectedValues > 0){
452
           filtered = true;
453
           break;
452
           filters+=filter.countSelectedValues;
454 453
       }
455 454
     }
456 455
    if(this.searchUtils.keyword.length > 0 ){
457
      filtered = true;
456
      filters++;
458 457
    }
459 458
    var errorCodes:ErrorCodes = new ErrorCodes();
460 459
    if(this.queryParameters.keys() && this.searchUtils.totalResults == 0 && this.searchUtils.status !=errorCodes.LOADING ){
461 460
      this.showUnknownFilters = true;
462 461
    }
463
    return filtered;
462
    return filters;
464 463
  }
465 464
  private clearKeywords(){
466 465
    if(this.searchUtils.keyword.length > 0 ){
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchPage.component.html
6 6
          {{pageTitle}}
7 7
        </div>
8 8
        <div>
9
          <a  *ngIf = "simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active" [routerLink]=simpleSearchLink
9
          <a  *ngIf = "simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active" [routerLink]=simpleSearchLink style="z-index:1;"
10 10
             [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted uk-button uk-button-text uk-text-secondary uk-margin-right uk-margin-top':'uk-float-right uk-button uk-button-text uk-text-secondary uk-margin-right uk-margin-top'" >Simple search
11 11
            <!--span class="uk-icon">
12 12
            <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.ts
22 22
    @Output() toggleModal = new EventEmitter();
23 23

  
24 24
    @Output() modalChange = new EventEmitter();
25
    @Output() onFilterChange = new EventEmitter();
26
    keyword = "";
27
    sortBy = "num";
25 28

  
26 29

  
27 30
    public isOpen:boolean=false;
28 31

  
29
    filterModalChange() {
30
      console.info("Modal Changed");
31
      this.modalChange.emit({
32
        value: true
33
      });
34
      //this.close();
35
    }
32
    // filterModalChange() {
33
    //   console.info("Modal Changed");
34
    //   this.modalChange.emit({
35
    //     value: true
36
    //   });
37
    //   //this.close();
38
    // }
36 39

  
37 40
    constructor () {
38 41
    }
......
46 49
    private _formatName(value){
47 50
      return value.name;//(((value.name+" ("+value.number+")").length >this._maxCharacters)?(value.name.substring(0,(this._maxCharacters - (" ("+value.number+")").length - ('...').length))+"..."):value.name)
48 51
    }
49
    toggleShowAll(){
50
        this.showAll = !this.showAll;
51
        if(this.showAll == false) {
52
            this.reorderFilterValues();
52
    // toggleShowAll(){
53
    //     this.showAll = !this.showAll;
54
    //     if(this.showAll == false) {
55
    //         this.reorderFilterValues();
56
    //     }
57
    // }
58

  
59

  
60
    filterKeywords(value){
61
      if(this.keyword.length > 0){
62
        if(value.toLowerCase().indexOf(this.keyword.toLowerCase()) ==-1){
63
          return false;
53 64
        }
65
      }
66
      return true;
54 67
    }
55

  
56 68
    filterChange(selected:boolean){
57 69
      console.info("filter change: "+selected);
58 70
        if(selected){
......
62 74
            this.filter.countSelectedValues--;
63 75
            // this.reorderFilterValues();
64 76
        }
77
        this.onFilterChange.emit({
78
            value: this.filter
79
          });
65 80
    }
66
    getSelectedValues(filter):any{
81
    getSelectedValues(filter, sortBy:string = "num"):any{
67 82
      var selected = [];
68 83
      if(filter.countSelectedValues >0){
69 84
        for (var i=0; i < filter.values.length; i++){
......
72 87
          }
73 88
        }
74 89
      }
90
      if(sortBy == "name"){
91

  
92
        selected.sort((n1,n2)=> {
93
          if (n1.name > n2.name) {
94
              return 1;
95
          }
96

  
97
          if (n1.name < n2.name) {
98
              return -1;
99
          }
100

  
101
          return 0;
102
        });
103
      }
75 104
      return selected;
76 105

  
77 106
    }
78
    getNotSelectedValues(filter):any{
107
    getNotSelectedValues(filter, sortBy):any{
79 108
      var notSselected = [];
80 109
      if(filter.countSelectedValues >0){
81 110
        for (var i=0; i < filter.values.length; i++){
......
86 115
      }else {
87 116
        notSselected = filter.values;
88 117
      }
118

  
119
      if(sortBy == "name"){
120

  
121
        notSselected.sort((n1,n2)=> {
122
          if (n1.name > n2.name) {
123
              return 1;
124
          }
125

  
126
          if (n1.name < n2.name) {
127
              return -1;
128
          }
129

  
130
          return 0;
131
        });
132
      }
89 133
      return notSselected;
90 134
    }
91
    reorderFilterValues() {
92
        for(let value of this.filter.values) {
93
            if(value.selected) {
94
                let index: number = this.filter.values.indexOf(value);
95
                let selectedValue:Value = this.filter.values[index];
96

  
97
                this.filter.values.splice(index, 1);
98
                this.filter.values.splice(0, 0, selectedValue);
99
            }
100
        }
101
    }
135
    // reorderFilterValues() {
136
    //     for(let value of this.filter.values) {
137
    //         if(value.selected) {
138
    //             let index: number = this.filter.values.indexOf(value);
139
    //             let selectedValue:Value = this.filter.values[index];
140
    //
141
    //             this.filter.values.splice(index, 1);
142
    //             this.filter.values.splice(0, 0, selectedValue);
143
    //         }
144
    //     }
145
    // }
102 146
//     sliceSelected() {
103 147
//         let values: Value[] = [];
104 148
//
......
113 157
//         }
114 158

  
115 159

  
116
  toggle() {
117
    this.toggleModal.emit({
118
      value: this.filter
119
    });
120
  }
160
  // toggle() {
161
  //   this.toggleModal.emit({
162
  //     value: this.filter
163
  //   });
164
  // }
121 165

  
122 166

  
123 167
  open() {
......
128 172
    this.isOpen = false;
129 173
  }
130 174

  
131
  filterChange2(selected:boolean){
175
  // filterChange2(selected:boolean){
176
  //
177
  //   console.info("filter change2");
178
  //     if(selected){
179
  //         this.filter.countSelectedValues++;
180
  //         // this.reorderFilterValues();
181
  //     }else{
182
  //         this.filter.countSelectedValues--;
183
  //         // this.reorderFilterValues();
184
  //     }
185
  //     this.close();
186
  // }
132 187

  
133
    console.info("filter change2");
134
      if(selected){
135
          this.filter.countSelectedValues++;
136
          // this.reorderFilterValues();
137
      }else{
138
          this.filter.countSelectedValues--;
139
          // this.reorderFilterValues();
140
      }
141
      this.close();
142
  }
143

  
144 188
}

Also available in: Unified diff