Advertisement
Guest User

multiselectFacet.ts

a guest
Jun 2nd, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. namespace incode.search.facets
  3. {
  4.  
  5.     export class MultiselectFacetController
  6.     {
  7.         public filterExpanded: boolean;
  8.         public facet: IFacet;
  9.  
  10.         public clearAction: (facet: IFacet) => void;
  11.         public applyAction: (facet: IFacet) => void;
  12.  
  13.         constructor() {
  14.             console.log("made a multiselect facet");
  15.             if (!this.facet || this.facet.Type != FacetType.Multiselect)
  16.             {
  17.                 return;
  18.             }
  19.         }
  20.  
  21.         clearFilter()
  22.         {
  23.             if (this.clearAction)
  24.             {
  25.                 this.clearAction(this.facet);
  26.             }
  27.         }
  28.  
  29.         applyFilter()
  30.         {
  31.             if (this.applyAction)
  32.             {
  33.                 this.applyAction(this.facet);
  34.             }
  35.         }
  36.        
  37.         SelectedCount(): number {
  38.             return (this.facet.Buckets && this.facet.Buckets.length) ? this.facet.Buckets.filter(x => x.Selected).length : 0;
  39.         }
  40.        
  41.         FacetCount(): number {
  42.             return (this.facet.Buckets && this.facet.Buckets.length) ? this.facet.Buckets.length : 0;
  43.         }
  44.     }
  45.  
  46.     export class MultiselectFacetComponent implements ng.IComponentOptions
  47.     {
  48.         public templateUrl: string;
  49.         public controller: any;
  50.         public controllerAs: string = "facetController";
  51.         public transclude: boolean = true;
  52.         bindings: { [binding: string]: string };
  53.  
  54.         constructor()
  55.         {
  56.             this.templateUrl = "../../library/incode/components/search/facets/multiselectFacet.tmpl.html";
  57.             this.controller = MultiselectFacetController;
  58.             this.bindings = {
  59.                 facet: "=",
  60.                 clearAction: "&",
  61.                 applyAction: "&",
  62.             }
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement