ng2-completer
Advanced tools
Comparing version 0.3.3 to 0.4.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## 0.4.0 | ||
### Implemented enhancements: | ||
- reorder of the folder structure | ||
- Apply class to child input for styling purposes #40 | ||
- Annoying flickering when clearing data #82 | ||
- Open dropdown programmatically. #84 | ||
### Fixed bugs: | ||
- Problem with OnPush change detection strategy #69 | ||
- AutoMatch doesn't remove binded value if nothing match (angucomplete-alt does) #101 | ||
## 0.3.3 | ||
@@ -14,3 +25,3 @@ ### Fixed bugs: | ||
## 0.3.0 | ||
### Implemented enhancments | ||
### Implemented enhancements | ||
- Change deployment method now using ngc and rollup for the package and webpack for dev and demo | ||
@@ -25,3 +36,3 @@ - AOT support #60 | ||
## 0.2.3 | ||
### Implemented enhancments | ||
### Implemented enhancements | ||
- Clear selection when search changes #45 | ||
@@ -33,3 +44,3 @@ | ||
## 0.2.2 | ||
### Implemented enhancments | ||
### Implemented enhancements | ||
- Added support for async local data | ||
@@ -42,3 +53,3 @@ | ||
## 0.2.1 (2016-10-05) | ||
### Implemented enhancments | ||
### Implemented enhancements | ||
- Added material2 component to demo | ||
@@ -52,3 +63,3 @@ | ||
This is a rewrite of the completer component using directives that implement most of the functionality. | ||
### Implemented enhancments | ||
### Implemented enhancements | ||
- Support for custom HTML and CSS #13 #21 | ||
@@ -55,0 +66,0 @@ |
import { EventEmitter, OnInit } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
export interface CompleterList { | ||
@@ -19,2 +19,3 @@ search(term: string): void; | ||
private _hasHighlited; | ||
private hasSelected; | ||
constructor(); | ||
@@ -21,0 +22,0 @@ ngOnInit(): void; |
@@ -1,12 +0,3 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
import { Directive, EventEmitter, Output } from "@angular/core"; | ||
var CtrCompleter = (function () { | ||
export var CtrCompleter = (function () { | ||
function CtrCompleter() { | ||
@@ -16,2 +7,3 @@ this.selected = new EventEmitter(); | ||
this._hasHighlited = false; | ||
this.hasSelected = false; | ||
} | ||
@@ -33,5 +25,10 @@ CtrCompleter.prototype.ngOnInit = function () { | ||
this.selected.emit(item); | ||
this.hasSelected = true; | ||
this.clear(); | ||
}; | ||
CtrCompleter.prototype.search = function (term) { | ||
if (this.hasSelected) { | ||
this.selected.emit(null); | ||
this.hasSelected = false; | ||
} | ||
if (this.list) { | ||
@@ -68,19 +65,15 @@ this.list.search(term); | ||
}; | ||
CtrCompleter.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: "[ctrCompleter]", | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
CtrCompleter.ctorParameters = function () { return []; }; | ||
CtrCompleter.propDecorators = { | ||
'selected': [{ type: Output },], | ||
'highlighted': [{ type: Output },], | ||
}; | ||
return CtrCompleter; | ||
}()); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", Object) | ||
], CtrCompleter.prototype, "selected", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", Object) | ||
], CtrCompleter.prototype, "highlighted", void 0); | ||
CtrCompleter = __decorate([ | ||
Directive({ | ||
selector: "[ctrCompleter]", | ||
}), | ||
__metadata("design:paramtypes", []) | ||
], CtrCompleter); | ||
export { CtrCompleter }; | ||
//# sourceMappingURL=ctr-completer.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrCompleter":{"__symbolic":"error","message":"Reference to a local symbol","line":22,"character":13,"context":{"name":"CtrCompleter"}}}},{"__symbolic":"module","version":1,"metadata":{"CtrCompleter":{"__symbolic":"error","message":"Reference to a local symbol","line":22,"character":13,"context":{"name":"CtrCompleter"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrCompleter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrCompleter]"}]}],"members":{"selected":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"highlighted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"registerList":[{"__symbolic":"method"}],"registerDropdown":[{"__symbolic":"method"}],"onHighlighted":[{"__symbolic":"method"}],"onSelected":[{"__symbolic":"method"}],"search":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"selectCurrent":[{"__symbolic":"method"}],"nextRow":[{"__symbolic":"method"}],"prevRow":[{"__symbolic":"method"}],"hasHighlited":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"CtrCompleter":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrCompleter]"}]}],"members":{"selected":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"highlighted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"ngOnInit":[{"__symbolic":"method"}],"registerList":[{"__symbolic":"method"}],"registerDropdown":[{"__symbolic":"method"}],"onHighlighted":[{"__symbolic":"method"}],"onSelected":[{"__symbolic":"method"}],"search":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"selectCurrent":[{"__symbolic":"method"}],"nextRow":[{"__symbolic":"method"}],"prevRow":[{"__symbolic":"method"}],"hasHighlited":[{"__symbolic":"method"}]}}}}] |
import { ElementRef, OnDestroy, OnInit } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { CtrCompleter, CompleterDropdown } from "./ctr-completer"; | ||
@@ -4,0 +4,0 @@ export interface CtrRowElement { |
@@ -1,16 +0,4 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
import { Directive, ElementRef, Host } from "@angular/core"; | ||
import { CtrCompleter } from "./ctr-completer"; | ||
var CtrRowItem = (function () { | ||
export var CtrRowItem = (function () { | ||
function CtrRowItem(row, index) { | ||
@@ -22,4 +10,3 @@ this.row = row; | ||
}()); | ||
export { CtrRowItem }; | ||
var CtrDropdown = (function () { | ||
export var CtrDropdown = (function () { | ||
function CtrDropdown(completer, el) { | ||
@@ -117,12 +104,14 @@ this.completer = completer; | ||
}; | ||
CtrDropdown.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: "[ctrDropdown]", | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
CtrDropdown.ctorParameters = function () { return [ | ||
{ type: CtrCompleter, decorators: [{ type: Host },] }, | ||
{ type: ElementRef, }, | ||
]; }; | ||
return CtrDropdown; | ||
}()); | ||
CtrDropdown = __decorate([ | ||
Directive({ | ||
selector: "[ctrDropdown]", | ||
}), | ||
__param(0, Host()), | ||
__metadata("design:paramtypes", [CtrCompleter, ElementRef]) | ||
], CtrDropdown); | ||
export { CtrDropdown }; | ||
//# sourceMappingURL=ctr-dropdown.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrRowItem":{"__symbolic":"error","message":"Reference to a local symbol","line":12,"character":13,"context":{"name":"CtrRowItem"}},"CtrDropdown":{"__symbolic":"error","message":"Reference to a local symbol","line":19,"character":13,"context":{"name":"CtrDropdown"}}}},{"__symbolic":"module","version":1,"metadata":{"CtrRowItem":{"__symbolic":"error","message":"Reference to a local symbol","line":12,"character":13,"context":{"name":"CtrRowItem"}},"CtrDropdown":{"__symbolic":"error","message":"Reference to a local symbol","line":19,"character":13,"context":{"name":"CtrDropdown"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrRowItem":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":28,"context":{"typeName":"CtrRowElement"}},{"__symbolic":"reference","name":"number"}]}]}},"CtrDropdown":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrDropdown]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],null],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"registerRow":[{"__symbolic":"method"}],"highlightRow":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"onSelected":[{"__symbolic":"method"}],"selectCurrent":[{"__symbolic":"method"}],"nextRow":[{"__symbolic":"method"}],"prevRow":[{"__symbolic":"method"}],"dropdownScrollTopTo":[{"__symbolic":"method"}],"dropdownRowTop":[{"__symbolic":"method"}],"dropdownHeight":[{"__symbolic":"method"}],"dropdownRowOffsetHeight":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"CtrRowItem":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":28,"context":{"typeName":"CtrRowElement"}},{"__symbolic":"reference","name":"number"}]}]}},"CtrDropdown":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrDropdown]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],null],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"registerRow":[{"__symbolic":"method"}],"highlightRow":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"onSelected":[{"__symbolic":"method"}],"selectCurrent":[{"__symbolic":"method"}],"nextRow":[{"__symbolic":"method"}],"prevRow":[{"__symbolic":"method"}],"dropdownScrollTopTo":[{"__symbolic":"method"}],"dropdownRowTop":[{"__symbolic":"method"}],"dropdownHeight":[{"__symbolic":"method"}],"dropdownRowOffsetHeight":[{"__symbolic":"method"}]}}}}] |
@@ -1,13 +0,1 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
import { Directive, EventEmitter, Host, HostListener, Input, Output } from "@angular/core"; | ||
@@ -23,3 +11,3 @@ import { CtrCompleter } from "./ctr-completer"; | ||
var KEY_TAB = 9; | ||
var CtrInput = (function () { | ||
export var CtrInput = (function () { | ||
function CtrInput(completer) { | ||
@@ -128,48 +116,22 @@ var _this = this; | ||
}); | ||
CtrInput.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: "[ctrInput]", | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
CtrInput.ctorParameters = function () { return [ | ||
{ type: CtrCompleter, decorators: [{ type: Host },] }, | ||
]; }; | ||
CtrInput.propDecorators = { | ||
'clearSelected': [{ type: Input, args: ["clearSelected",] },], | ||
'overrideSuggested': [{ type: Input, args: ["overrideSuggested",] },], | ||
'ngModelChange': [{ type: Output },], | ||
'onInputChange': [{ type: HostListener, args: ["input", ["$event"],] },], | ||
'keyupHandler': [{ type: HostListener, args: ["keyup", ["$event"],] },], | ||
'keydownHandler': [{ type: HostListener, args: ["keydown", ["$event"],] },], | ||
'onBlur': [{ type: HostListener, args: ["blur", ["$event"],] },], | ||
}; | ||
return CtrInput; | ||
}()); | ||
__decorate([ | ||
Input("clearSelected"), | ||
__metadata("design:type", Object) | ||
], CtrInput.prototype, "clearSelected", void 0); | ||
__decorate([ | ||
Input("overrideSuggested"), | ||
__metadata("design:type", Object) | ||
], CtrInput.prototype, "overrideSuggested", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", EventEmitter) | ||
], CtrInput.prototype, "ngModelChange", void 0); | ||
__decorate([ | ||
HostListener("input", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrInput.prototype, "onInputChange", null); | ||
__decorate([ | ||
HostListener("keyup", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrInput.prototype, "keyupHandler", null); | ||
__decorate([ | ||
HostListener("keydown", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrInput.prototype, "keydownHandler", null); | ||
__decorate([ | ||
HostListener("blur", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrInput.prototype, "onBlur", null); | ||
CtrInput = __decorate([ | ||
Directive({ | ||
selector: "[ctrInput]", | ||
}), | ||
__param(0, Host()), | ||
__metadata("design:paramtypes", [CtrCompleter]) | ||
], CtrInput); | ||
export { CtrInput }; | ||
//# sourceMappingURL=ctr-input.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrInput":{"__symbolic":"error","message":"Reference to a local symbol","line":18,"character":13,"context":{"name":"CtrInput"}}}},{"__symbolic":"module","version":1,"metadata":{"CtrInput":{"__symbolic":"error","message":"Reference to a local symbol","line":18,"character":13,"context":{"name":"CtrInput"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrInput":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrInput]"}]}],"members":{"clearSelected":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["clearSelected"]}]}],"overrideSuggested":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["overrideSuggested"]}]}],"ngModelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"}]}],"onInputChange":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["input",["$event"]]}]}],"keyupHandler":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["keyup",["$event"]]}]}],"keydownHandler":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["keydown",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["blur",["$event"]]}]}]}}}},{"__symbolic":"module","version":1,"metadata":{"CtrInput":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrInput]"}]}],"members":{"clearSelected":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["clearSelected"]}]}],"overrideSuggested":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["overrideSuggested"]}]}],"ngModelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"}]}],"onInputChange":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["input",["$event"]]}]}],"keyupHandler":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["keyup",["$event"]]}]}],"keydownHandler":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["keydown",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["blur",["$event"]]}]}]}}}}] |
@@ -1,5 +0,5 @@ | ||
import { OnInit, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { ChangeDetectorRef, OnInit, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { CtrCompleter, CompleterList } from "./ctr-completer"; | ||
import { CompleterData } from "../components/ng2-completer/services/completer-data"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterData } from "../services/completer-data"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
export declare class CtrListContext { | ||
@@ -15,2 +15,3 @@ results: CompleterItem[]; | ||
private viewContainer; | ||
private cd; | ||
ctrListMinSearchLength: number; | ||
@@ -22,4 +23,6 @@ ctrListPause: number; | ||
private searchTimer; | ||
private clearTimer; | ||
private ctx; | ||
constructor(completer: CtrCompleter, templateRef: TemplateRef<CtrListContext>, viewContainer: ViewContainerRef); | ||
private static hasTerm(term); | ||
constructor(completer: CtrCompleter, templateRef: TemplateRef<CtrListContext>, viewContainer: ViewContainerRef, cd: ChangeDetectorRef); | ||
ngOnInit(): void; | ||
@@ -29,2 +32,3 @@ dataService: CompleterData; | ||
clear(): void; | ||
private _clear(); | ||
private searchTimerComplete(term); | ||
@@ -31,0 +35,0 @@ private handleError(error); |
@@ -1,18 +0,6 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
import { Directive, Host, Input, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { ChangeDetectorRef, Directive, Host, Input, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { Observable } from "rxjs/Rx"; | ||
import { CtrCompleter } from "./ctr-completer"; | ||
import { MIN_SEARCH_LENGTH, PAUSE } from "../globals"; | ||
var CtrListContext = (function () { | ||
import { MIN_SEARCH_LENGTH, PAUSE, CLEAR_TIMEOUT } from "../globals"; | ||
export var CtrListContext = (function () { | ||
function CtrListContext(results, searching, searchInitialized) { | ||
@@ -25,8 +13,8 @@ this.results = results; | ||
}()); | ||
export { CtrListContext }; | ||
var CtrList = (function () { | ||
function CtrList(completer, templateRef, viewContainer) { | ||
export var CtrList = (function () { | ||
function CtrList(completer, templateRef, viewContainer, cd) { | ||
this.completer = completer; | ||
this.templateRef = templateRef; | ||
this.viewContainer = viewContainer; | ||
this.cd = cd; | ||
this.ctrListMinSearchLength = MIN_SEARCH_LENGTH; | ||
@@ -39,4 +27,8 @@ this.ctrListPause = PAUSE; | ||
this.searchTimer = null; | ||
this.clearTimer = null; | ||
this.ctx = new CtrListContext([], false, false); | ||
} | ||
CtrList.hasTerm = function (term) { | ||
return term || term === ""; | ||
}; | ||
CtrList.prototype.ngOnInit = function () { | ||
@@ -57,3 +49,3 @@ this.completer.registerList(this); | ||
_this.ctx.results = results; | ||
if (_this.ctrListAutoMatch && results.length === 1 && results[0].title && _this.term && | ||
if (_this.ctrListAutoMatch && results.length === 1 && results[0].title && CtrList.hasTerm(_this.term) && | ||
results[0].title.toLocaleLowerCase() === _this.term.toLocaleLowerCase()) { | ||
@@ -76,3 +68,3 @@ // Do automatch | ||
} | ||
if (term && term.length >= this.ctrListMinSearchLength && this.term !== term) { | ||
if (CtrList.hasTerm(term) && term.length >= this.ctrListMinSearchLength && this.term !== term) { | ||
if (this.searchTimer) { | ||
@@ -88,2 +80,5 @@ this.searchTimer.unsubscribe(); | ||
} | ||
if (this.clearTimer) { | ||
this.clearTimer.unsubscribe(); | ||
} | ||
this.searchTimer = Observable.timer(this.ctrListPause).subscribe(function () { | ||
@@ -95,4 +90,13 @@ _this.searchTimerComplete(term); | ||
CtrList.prototype.clear = function () { | ||
var _this = this; | ||
if (this.searchTimer) { | ||
this.searchTimer.unsubscribe(); | ||
} | ||
this.clearTimer = Observable.timer(CLEAR_TIMEOUT).subscribe(function () { | ||
_this._clear(); | ||
}); | ||
}; | ||
CtrList.prototype._clear = function () { | ||
if (this.searchTimer) { | ||
this.searchTimer.unsubscribe(); | ||
this.searchTimer = null; | ||
@@ -110,3 +114,3 @@ } | ||
// Begin the search | ||
if (!term || term.length < this.ctrListMinSearchLength) { | ||
if (!CtrList.hasTerm(term) || term.length < this.ctrListMinSearchLength) { | ||
this.ctx.searching = false; | ||
@@ -120,4 +124,7 @@ return; | ||
this.ctx.searching = false; | ||
var errMsg = (error.message) ? error.message : | ||
error.status ? error.status + " - " + error.statusText : "Server error"; | ||
var errMsg = "search error"; | ||
if (error) { | ||
errMsg = (error.message) ? error.message : | ||
error.status ? error.status + " - " + error.statusText : "Server error"; | ||
} | ||
if (console && console.error) { | ||
@@ -133,32 +140,24 @@ console.error(errMsg); // log to console | ||
this.viewContainer.createEmbeddedView(this.templateRef, this.ctx); | ||
this.cd.markForCheck(); | ||
}; | ||
CtrList.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: "[ctrList]", | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
CtrList.ctorParameters = function () { return [ | ||
{ type: CtrCompleter, decorators: [{ type: Host },] }, | ||
{ type: TemplateRef, }, | ||
{ type: ViewContainerRef, }, | ||
{ type: ChangeDetectorRef, }, | ||
]; }; | ||
CtrList.propDecorators = { | ||
'ctrListMinSearchLength': [{ type: Input },], | ||
'ctrListPause': [{ type: Input },], | ||
'ctrListAutoMatch': [{ type: Input },], | ||
'dataService': [{ type: Input, args: ["ctrList",] },], | ||
}; | ||
return CtrList; | ||
}()); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], CtrList.prototype, "ctrListMinSearchLength", void 0); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], CtrList.prototype, "ctrListPause", void 0); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], CtrList.prototype, "ctrListAutoMatch", void 0); | ||
__decorate([ | ||
Input("ctrList"), | ||
__metadata("design:type", Object), | ||
__metadata("design:paramtypes", [Object]) | ||
], CtrList.prototype, "dataService", null); | ||
CtrList = __decorate([ | ||
Directive({ | ||
selector: "[ctrList]", | ||
}), | ||
__param(0, Host()), | ||
__metadata("design:paramtypes", [CtrCompleter, | ||
TemplateRef, | ||
ViewContainerRef]) | ||
], CtrList); | ||
export { CtrList }; | ||
//# sourceMappingURL=ctr-list.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrListContext":{"__symbolic":"error","message":"Reference to a local symbol","line":10,"character":13,"context":{"name":"CtrListContext"}},"CtrList":{"__symbolic":"error","message":"Reference to a local symbol","line":21,"character":13,"context":{"name":"CtrList"}}}},{"__symbolic":"module","version":1,"metadata":{"CtrListContext":{"__symbolic":"error","message":"Reference to a local symbol","line":10,"character":13,"context":{"name":"CtrListContext"}},"CtrList":{"__symbolic":"error","message":"Reference to a local symbol","line":21,"character":13,"context":{"name":"CtrList"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrListContext":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../components/completer-item","name":"CompleterItem"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"}]}]}},"CtrList":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrList]"}]}],"members":{"ctrListMinSearchLength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ctrListPause":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ctrListAutoMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],null,null,null],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","arguments":[{"__symbolic":"reference","name":"CtrListContext"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"dataService":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ctrList"]}]}],"search":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"_clear":[{"__symbolic":"method"}],"searchTimerComplete":[{"__symbolic":"method"}],"handleError":[{"__symbolic":"method"}],"refreshTemplate":[{"__symbolic":"method"}]},"statics":{"hasTerm":{"__symbolic":"function","parameters":["term"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"term"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"term"},"right":""}}}}}}},{"__symbolic":"module","version":1,"metadata":{"CtrListContext":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../components/completer-item","name":"CompleterItem"}]},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"}]}]}},"CtrList":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrList]"}]}],"members":{"ctrListMinSearchLength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ctrListPause":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ctrListAutoMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],null,null,null],"parameters":[{"__symbolic":"reference","module":"./ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"@angular/core","name":"TemplateRef","arguments":[{"__symbolic":"reference","name":"CtrListContext"}]},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"dataService":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ctrList"]}]}],"search":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"_clear":[{"__symbolic":"method"}],"searchTimerComplete":[{"__symbolic":"method"}],"handleError":[{"__symbolic":"method"}],"refreshTemplate":[{"__symbolic":"method"}]},"statics":{"hasTerm":{"__symbolic":"function","parameters":["term"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"term"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"term"},"right":""}}}}}}}] |
import { ElementRef, Renderer, OnInit } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { CtrDropdown, CtrRowElement } from "./ctr-dropdown"; | ||
@@ -4,0 +4,0 @@ export declare class CtrRow implements CtrRowElement, OnInit { |
@@ -1,16 +0,4 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
import { Directive, ElementRef, Host, HostListener, Input, Renderer } from "@angular/core"; | ||
import { CtrDropdown, CtrRowItem } from "./ctr-dropdown"; | ||
var CtrRow = (function () { | ||
export var CtrRow = (function () { | ||
function CtrRow(el, renderer, dropdown) { | ||
@@ -55,34 +43,21 @@ this.el = el; | ||
}; | ||
CtrRow.decorators = [ | ||
{ type: Directive, args: [{ | ||
selector: "[ctrRow]", | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
CtrRow.ctorParameters = function () { return [ | ||
{ type: ElementRef, }, | ||
{ type: Renderer, }, | ||
{ type: CtrDropdown, decorators: [{ type: Host },] }, | ||
]; }; | ||
CtrRow.propDecorators = { | ||
'ctrRow': [{ type: Input },], | ||
'dataItem': [{ type: Input },], | ||
'onClick': [{ type: HostListener, args: ["click", ["$event"],] },], | ||
'onMouseEnter': [{ type: HostListener, args: ["mouseenter", ["$event"],] },], | ||
}; | ||
return CtrRow; | ||
}()); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Number), | ||
__metadata("design:paramtypes", [Number]) | ||
], CtrRow.prototype, "ctrRow", null); | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object), | ||
__metadata("design:paramtypes", [Object]) | ||
], CtrRow.prototype, "dataItem", null); | ||
__decorate([ | ||
HostListener("click", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrRow.prototype, "onClick", null); | ||
__decorate([ | ||
HostListener("mouseenter", ["$event"]), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CtrRow.prototype, "onMouseEnter", null); | ||
CtrRow = __decorate([ | ||
Directive({ | ||
selector: "[ctrRow]", | ||
}), | ||
__param(2, Host()), | ||
__metadata("design:paramtypes", [ElementRef, Renderer, CtrDropdown]) | ||
], CtrRow); | ||
export { CtrRow }; | ||
//# sourceMappingURL=ctr-row.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrRow":{"__symbolic":"error","message":"Reference to a local symbol","line":8,"character":13,"context":{"name":"CtrRow"}}}},{"__symbolic":"module","version":1,"metadata":{"CtrRow":{"__symbolic":"error","message":"Reference to a local symbol","line":8,"character":13,"context":{"name":"CtrRow"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"CtrRow":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrRow]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","module":"./ctr-dropdown","name":"CtrDropdown"}]}],"ngOnInit":[{"__symbolic":"method"}],"ctrRow":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"dataItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"onClick":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["click",["$event"]]}]}],"onMouseEnter":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["mouseenter",["$event"]]}]}],"setHighlited":[{"__symbolic":"method"}],"getNativeElement":[{"__symbolic":"method"}],"getDataItem":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"CtrRow":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ctrRow]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","module":"./ctr-dropdown","name":"CtrDropdown"}]}],"ngOnInit":[{"__symbolic":"method"}],"ctrRow":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"dataItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"onClick":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["click",["$event"]]}]}],"onMouseEnter":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["mouseenter",["$event"]]}]}],"setHighlited":[{"__symbolic":"method"}],"getNativeElement":[{"__symbolic":"method"}],"getDataItem":[{"__symbolic":"method"}]}}}}] |
@@ -1,5 +0,6 @@ | ||
export declare const MAX_CHARS = 524288; | ||
export declare const MIN_SEARCH_LENGTH = 3; | ||
export declare const PAUSE = 250; | ||
export declare const TEXT_SEARCHING = "Searching..."; | ||
export declare const TEXT_NORESULTS = "No results found"; | ||
export declare const MAX_CHARS: number; | ||
export declare const MIN_SEARCH_LENGTH: number; | ||
export declare const PAUSE: number; | ||
export declare const TEXT_SEARCHING: string; | ||
export declare const TEXT_NORESULTS: string; | ||
export declare const CLEAR_TIMEOUT: number; |
export var MAX_CHARS = 524288; // the default max length per the html maxlength attribute | ||
// the default max length per the html maxlength attribute | ||
export var MIN_SEARCH_LENGTH = 3; | ||
@@ -7,2 +6,3 @@ export var PAUSE = 250; | ||
export var TEXT_NORESULTS = "No results found"; | ||
export var CLEAR_TIMEOUT = 100; | ||
//# sourceMappingURL=globals.js.map |
export { Ng2CompleterModule } from "./ng2-completer.module"; | ||
export { CompleterService } from "./components/ng2-completer/services/completer-service"; | ||
export { CompleterData } from "./components/ng2-completer/services/completer-data"; | ||
export { CompleterItem } from "./components/ng2-completer/completer-item"; | ||
export { LocalData } from "./components/ng2-completer/services/local-data"; | ||
export { RemoteData } from "./components/ng2-completer/services/remote-data"; | ||
export { CompleterBaseData } from "./components/ng2-completer/services/completer-base-data"; | ||
export { CompleterCmp } from "./components/completer-cmp"; | ||
export { CompleterService } from "./services/completer-service"; | ||
export { CompleterData } from "./services/completer-data"; | ||
export { CompleterItem } from "./components/completer-item"; | ||
export { LocalData } from "./services/local-data"; | ||
export { RemoteData } from "./services/remote-data"; | ||
export { CompleterBaseData } from "./services/completer-base-data"; | ||
export { CtrCompleter } from "./directives/ctr-completer"; | ||
@@ -9,0 +10,0 @@ export { CtrDropdown } from "./directives/ctr-dropdown"; |
export { Ng2CompleterModule } from "./ng2-completer.module"; | ||
export { CompleterService } from "./components/ng2-completer/services/completer-service"; | ||
export { LocalData } from "./components/ng2-completer/services/local-data"; | ||
export { RemoteData } from "./components/ng2-completer/services/remote-data"; | ||
export { CompleterBaseData } from "./components/ng2-completer/services/completer-base-data"; | ||
export { CompleterCmp } from "./components/completer-cmp"; | ||
export { CompleterService } from "./services/completer-service"; | ||
export { LocalData } from "./services/local-data"; | ||
export { RemoteData } from "./services/remote-data"; | ||
export { CompleterBaseData } from "./services/completer-base-data"; | ||
export { CtrCompleter } from "./directives/ctr-completer"; | ||
@@ -7,0 +8,0 @@ export { CtrDropdown } from "./directives/ctr-dropdown"; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./ng2-completer.module","export":["Ng2CompleterModule"]},{"from":"./components/ng2-completer/services/completer-service","export":["CompleterService"]},{"from":"./components/ng2-completer/services/local-data","export":["LocalData"]},{"from":"./components/ng2-completer/services/remote-data","export":["RemoteData"]},{"from":"./components/ng2-completer/services/completer-base-data","export":["CompleterBaseData"]},{"from":"./directives/ctr-completer","export":["CtrCompleter"]},{"from":"./directives/ctr-dropdown","export":["CtrDropdown"]},{"from":"./directives/ctr-input","export":["CtrInput"]},{"from":"./directives/ctr-list","export":["CtrList"]},{"from":"./directives/ctr-row","export":["CtrRow"]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./ng2-completer.module","export":["Ng2CompleterModule"]},{"from":"./components/ng2-completer/services/completer-service","export":["CompleterService"]},{"from":"./components/ng2-completer/services/local-data","export":["LocalData"]},{"from":"./components/ng2-completer/services/remote-data","export":["RemoteData"]},{"from":"./components/ng2-completer/services/completer-base-data","export":["CompleterBaseData"]},{"from":"./directives/ctr-completer","export":["CtrCompleter"]},{"from":"./directives/ctr-dropdown","export":["CtrDropdown"]},{"from":"./directives/ctr-input","export":["CtrInput"]},{"from":"./directives/ctr-list","export":["CtrList"]},{"from":"./directives/ctr-row","export":["CtrRow"]}]}] | ||
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./ng2-completer.module","export":["Ng2CompleterModule"]},{"from":"./components/completer-cmp","export":["CompleterCmp"]},{"from":"./services/completer-service","export":["CompleterService"]},{"from":"./services/completer-data","export":["CompleterData"]},{"from":"./components/completer-item","export":["CompleterItem"]},{"from":"./services/local-data","export":["LocalData"]},{"from":"./services/remote-data","export":["RemoteData"]},{"from":"./services/completer-base-data","export":["CompleterBaseData"]},{"from":"./directives/ctr-completer","export":["CtrCompleter"]},{"from":"./directives/ctr-dropdown","export":["CtrDropdown"]},{"from":"./directives/ctr-input","export":["CtrInput"]},{"from":"./directives/ctr-list","export":["CtrList"]},{"from":"./directives/ctr-row","export":["CtrRow"]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./ng2-completer.module","export":["Ng2CompleterModule"]},{"from":"./components/completer-cmp","export":["CompleterCmp"]},{"from":"./services/completer-service","export":["CompleterService"]},{"from":"./services/completer-data","export":["CompleterData"]},{"from":"./components/completer-item","export":["CompleterItem"]},{"from":"./services/local-data","export":["LocalData"]},{"from":"./services/remote-data","export":["RemoteData"]},{"from":"./services/completer-base-data","export":["CompleterBaseData"]},{"from":"./directives/ctr-completer","export":["CtrCompleter"]},{"from":"./directives/ctr-dropdown","export":["CtrDropdown"]},{"from":"./directives/ctr-input","export":["CtrInput"]},{"from":"./directives/ctr-list","export":["CtrList"]},{"from":"./directives/ctr-row","export":["CtrRow"]}]}] |
@@ -1,17 +0,8 @@ | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
import { NgModule } from "@angular/core"; | ||
import { FormsModule } from "@angular/forms"; | ||
import { HttpModule } from "@angular/http"; | ||
import { CompleterCmp } from "./components/ng2-completer/completer-cmp"; | ||
import { CompleterListItemCmp } from "./components/ng2-completer/completer-list-item-cmp"; | ||
import { CompleterService } from "./components/ng2-completer/services/completer-service"; | ||
import { LocalDataFactoryProvider, RemoteDataFactoryProvider } from "./components/ng2-completer/services/completer-data-factory"; | ||
import { CompleterCmp } from "./components/completer-cmp"; | ||
import { CompleterListItemCmp } from "./components/completer-list-item-cmp"; | ||
import { CompleterService } from "./services/completer-service"; | ||
import { LocalDataFactoryProvider, RemoteDataFactoryProvider } from "./services/completer-data-factory"; | ||
import { CtrCompleter } from "./directives/ctr-completer"; | ||
@@ -23,41 +14,41 @@ import { CtrDropdown } from "./directives/ctr-dropdown"; | ||
import { CommonModule } from "@angular/common"; | ||
var Ng2CompleterModule = (function () { | ||
export var Ng2CompleterModule = (function () { | ||
function Ng2CompleterModule() { | ||
} | ||
Ng2CompleterModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
HttpModule | ||
], | ||
declarations: [ | ||
CompleterListItemCmp, | ||
CtrCompleter, | ||
CtrDropdown, | ||
CtrInput, | ||
CtrList, | ||
CtrRow, | ||
CompleterCmp | ||
], | ||
exports: [ | ||
CompleterCmp, | ||
CompleterListItemCmp, | ||
CtrCompleter, | ||
CtrDropdown, | ||
CtrInput, | ||
CtrList, | ||
CtrRow | ||
], | ||
providers: [ | ||
CompleterService, | ||
LocalDataFactoryProvider, | ||
RemoteDataFactoryProvider | ||
] | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
Ng2CompleterModule.ctorParameters = function () { return []; }; | ||
return Ng2CompleterModule; | ||
}()); | ||
Ng2CompleterModule = __decorate([ | ||
NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
HttpModule | ||
], | ||
declarations: [ | ||
CompleterListItemCmp, | ||
CtrCompleter, | ||
CtrDropdown, | ||
CtrInput, | ||
CtrList, | ||
CtrRow, | ||
CompleterCmp | ||
], | ||
exports: [ | ||
CompleterCmp, | ||
CompleterListItemCmp, | ||
CtrCompleter, | ||
CtrDropdown, | ||
CtrInput, | ||
CtrList, | ||
CtrRow | ||
], | ||
providers: [ | ||
CompleterService, | ||
LocalDataFactoryProvider, | ||
RemoteDataFactoryProvider | ||
] | ||
}), | ||
__metadata("design:paramtypes", []) | ||
], Ng2CompleterModule); | ||
export { Ng2CompleterModule }; | ||
//# sourceMappingURL=ng2-completer.module.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"Ng2CompleterModule":{"__symbolic":"error","message":"Reference to a local symbol","line":44,"character":13,"context":{"name":"Ng2CompleterModule"}}}},{"__symbolic":"module","version":1,"metadata":{"Ng2CompleterModule":{"__symbolic":"error","message":"Reference to a local symbol","line":44,"character":13,"context":{"name":"Ng2CompleterModule"}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"Ng2CompleterModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"@angular/http","name":"HttpModule"}],"declarations":[{"__symbolic":"reference","module":"./components/completer-list-item-cmp","name":"CompleterListItemCmp"},{"__symbolic":"reference","module":"./directives/ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"./directives/ctr-dropdown","name":"CtrDropdown"},{"__symbolic":"reference","module":"./directives/ctr-input","name":"CtrInput"},{"__symbolic":"reference","module":"./directives/ctr-list","name":"CtrList"},{"__symbolic":"reference","module":"./directives/ctr-row","name":"CtrRow"},{"__symbolic":"reference","module":"./components/completer-cmp","name":"CompleterCmp"}],"exports":[{"__symbolic":"reference","module":"./components/completer-cmp","name":"CompleterCmp"},{"__symbolic":"reference","module":"./components/completer-list-item-cmp","name":"CompleterListItemCmp"},{"__symbolic":"reference","module":"./directives/ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"./directives/ctr-dropdown","name":"CtrDropdown"},{"__symbolic":"reference","module":"./directives/ctr-input","name":"CtrInput"},{"__symbolic":"reference","module":"./directives/ctr-list","name":"CtrList"},{"__symbolic":"reference","module":"./directives/ctr-row","name":"CtrRow"}],"providers":[{"__symbolic":"reference","module":"./services/completer-service","name":"CompleterService"},{"__symbolic":"reference","module":"./services/completer-data-factory","name":"LocalDataFactoryProvider"},{"__symbolic":"reference","module":"./services/completer-data-factory","name":"RemoteDataFactoryProvider"}]}]}]}}},{"__symbolic":"module","version":1,"metadata":{"Ng2CompleterModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"@angular/http","name":"HttpModule"}],"declarations":[{"__symbolic":"reference","module":"./components/completer-list-item-cmp","name":"CompleterListItemCmp"},{"__symbolic":"reference","module":"./directives/ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"./directives/ctr-dropdown","name":"CtrDropdown"},{"__symbolic":"reference","module":"./directives/ctr-input","name":"CtrInput"},{"__symbolic":"reference","module":"./directives/ctr-list","name":"CtrList"},{"__symbolic":"reference","module":"./directives/ctr-row","name":"CtrRow"},{"__symbolic":"reference","module":"./components/completer-cmp","name":"CompleterCmp"}],"exports":[{"__symbolic":"reference","module":"./components/completer-cmp","name":"CompleterCmp"},{"__symbolic":"reference","module":"./components/completer-list-item-cmp","name":"CompleterListItemCmp"},{"__symbolic":"reference","module":"./directives/ctr-completer","name":"CtrCompleter"},{"__symbolic":"reference","module":"./directives/ctr-dropdown","name":"CtrDropdown"},{"__symbolic":"reference","module":"./directives/ctr-input","name":"CtrInput"},{"__symbolic":"reference","module":"./directives/ctr-list","name":"CtrList"},{"__symbolic":"reference","module":"./directives/ctr-row","name":"CtrRow"}],"providers":[{"__symbolic":"reference","module":"./services/completer-service","name":"CompleterService"},{"__symbolic":"reference","module":"./services/completer-data-factory","name":"LocalDataFactoryProvider"},{"__symbolic":"reference","module":"./services/completer-data-factory","name":"RemoteDataFactoryProvider"}]}]}]}}}] |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/http"),require("rxjs/add/operator/catch"),require("rxjs/Observable"),require("rxjs/Subject"),require("rxjs/add/operator/map"),require("rxjs/Rx"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/http","rxjs/add/operator/catch","rxjs/Observable","rxjs/Subject","rxjs/add/operator/map","rxjs/Rx","@angular/common"],e):e(t.ng2Completer=t.ng2Completer||{},t.ng.core,t._angular_forms,t._angular_http,t.rxjs_add_operator_catch,t.Rx,t.Rx,t.rxjs_add_operator_map,t.Rx,t.ng.common)}(this,function(t,e,r,i,o,n,s,c,a,l){"use strict";function p(){return function(){return new t.LocalData}}function h(t){return function(){return new T(t)}}var u=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.CtrCompleter=function(){function t(){this.selected=new e.EventEmitter,this.highlighted=new e.EventEmitter,this._hasHighlited=!1}return t.prototype.ngOnInit=function(){},t.prototype.registerList=function(t){this.list=t},t.prototype.registerDropdown=function(t){this.dropdown=t},t.prototype.onHighlighted=function(t){this.highlighted.emit(t),this._hasHighlited=!0},t.prototype.onSelected=function(t){this.selected.emit(t),this.clear()},t.prototype.search=function(t){this.list&&this.list.search(t)},t.prototype.clear=function(){this.dropdown&&this.dropdown.clear(),this.list&&this.list.clear(),this._hasHighlited=!1},t.prototype.selectCurrent=function(){this.dropdown&&this.dropdown.selectCurrent()},t.prototype.nextRow=function(){this.dropdown&&this.dropdown.nextRow()},t.prototype.prevRow=function(){this.dropdown&&this.dropdown.prevRow()},t.prototype.hasHighlited=function(){return this._hasHighlited},t}(),u([e.Output(),d("design:type",Object)],t.CtrCompleter.prototype,"selected",void 0),u([e.Output(),d("design:type",Object)],t.CtrCompleter.prototype,"highlighted",void 0),t.CtrCompleter=u([e.Directive({selector:"[ctrCompleter]"}),d("design:paramtypes",[])],t.CtrCompleter);var f=524288,g=3,m=250,y="Searching...",v="No results found",b=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},C=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},w=function(){},R={provide:r.NG_VALUE_ACCESSOR,useExisting:e.forwardRef(function(){return S}),multi:!0},S=function(){function t(){this.inputName="",this.pause=m,this.minSearchLength=g,this.maxChars=f,this.overrideSuggested=!1,this.clearSelected=!1,this.placeholder="",this.textSearching=y,this.textNoResults=v,this.autoMatch=!1,this.disableInput=!1,this.selected=new e.EventEmitter,this.highlighted=new e.EventEmitter,this.blur=new e.EventEmitter,this.searchStr="",this.displaySearching=!0,this._onTouchedCallback=w,this._onChangeCallback=w}return Object.defineProperty(t.prototype,"value",{get:function(){return this.searchStr},set:function(t){t!==this.searchStr&&(this.searchStr=t,this._onChangeCallback(t))},enumerable:!0,configurable:!0}),t.prototype.onTouched=function(){this._onTouchedCallback()},t.prototype.writeValue=function(t){this.searchStr=t},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.ngOnInit=function(){var t=this;this.completer.selected.subscribe(function(e){var r=e?e.title:"";t.selected.emit(e),t._onChangeCallback(r)}),this.completer.highlighted.subscribe(function(e){t.highlighted.emit(e)}),"false"===this.textSearching&&(this.displaySearching=!1)},t.prototype.onBlur=function(){this.blur.emit(),this.onTouched()},t}();b([e.Input(),C("design:type",Object)],S.prototype,"dataService",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"inputName",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"pause",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"minSearchLength",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"maxChars",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"overrideSuggested",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"clearSelected",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"placeholder",void 0),b([e.Input(),C("design:type",String)],S.prototype,"matchClass",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"textSearching",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"textNoResults",void 0),b([e.Input(),C("design:type",Number)],S.prototype,"fieldTabindex",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"autoMatch",void 0),b([e.Input(),C("design:type",Object)],S.prototype,"disableInput",void 0),b([e.Output(),C("design:type",Object)],S.prototype,"selected",void 0),b([e.Output(),C("design:type",Object)],S.prototype,"highlighted",void 0),b([e.Output(),C("design:type",Object)],S.prototype,"blur",void 0),b([e.ViewChild(t.CtrCompleter),C("design:type",t.CtrCompleter)],S.prototype,"completer",void 0),S=b([e.Component({selector:"ng2-completer",template:'\n <div class="completer-holder" ctrCompleter>\n <input class="completer-input" ctrInput [(ngModel)]="searchStr" [attr.name]="inputName" [placeholder]="placeholder" [attr.maxlength]="maxChars"\n [tabindex]="fieldTabindex" [disabled]="disableInput" [clearSelected]="clearSelected" [overrideSuggested]="overrideSuggested" (blur)="onBlur()"\n autocomplete="off" autocorrect="off" autocapitalize="off" />\n\n <div class="completer-dropdown-holder" *ctrList="dataService; minSearchLength: minSearchLength; pause: pause; autoMatch: autoMatch; let items = results; let searchActive = searching; let isInitialized = searchInitialized;">\n <div class="completer-dropdown" ctrDropdown *ngIf="isInitialized">\n <div *ngIf="searchActive && displaySearching" class="completer-searching">{{textSearching}}</div>\n <div *ngIf="!searchActive && (!items || items.length === 0)" class="completer-no-results">{{textNoResults}}</div>\n <div class="completer-row-wrapper" *ngFor="let item of items; let rowIndex=index">\n <div class="completer-row" [ctrRow]="rowIndex" [dataItem]="item">\n <div *ngIf="item.image || item.image === \'\'" class="completer-image-holder">\n <img *ngIf="item.image != \'\'" src="{{item.image}}" class="completer-image" />\n <div *ngIf="item.image === \'\'" class="completer-image-default"></div>\n </div>\n <div class="completer-item-text" [ngClass]="{\'completer-item-text-image\': item.image || item.image === \'\' }">\n <completer-list-item class="completer-title" [text]="item.title" [matchClass]="matchClass" [searchStr]="searchStr" [type]="\'title\'"></completer-list-item>\n <completer-list-item *ngIf="item.description && item.description != \'\'" class="completer-description" [text]="item.description"\n [matchClass]="matchClass" [searchStr]="searchStr" [type]="\'description\'">\n </completer-list-item>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',styles:['\n .completer-dropdown {\n border-color: #ececec;\n border-width: 1px;\n border-style: solid;\n border-radius: 2px;\n width: 250px;\n padding: 6px;\n cursor: pointer;\n z-index: 9999;\n position: absolute;\n margin-top: -6px;\n background-color: #ffffff;\n }\n\n .completer-row {\n padding: 5px;\n color: #000000;\n margin-bottom: 4px;\n clear: both;\n display: inline-block;\n width: 103%;\n }\n\n .completer-selected-row {\n background-color: lightblue;\n color: #ffffff;\n }\n\n .completer-description {\n font-size: 14px;\n }\n\n .completer-image-default {\n width: 16px; \n height: 16px;\n background-image: url("demo/res/img/default.png");\n }\n\n .completer-image-holder {\n float: left;\n width: 10%;\n }\n .completer-item-text-image {\n float: right;\n width: 90%;\n }\n '],providers:[R]}),C("design:paramtypes",[])],S);var x=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},j=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},O=function(){function t(){this.parts=[]}return t.prototype.ngOnInit=function(){for(var t=this.text.toLowerCase(),e=t.indexOf(this.searchStr.toLowerCase()),r=0;e>=0;){var i=this.text.slice(e,e+this.searchStr.length);if(0===e)this.parts.push({isMatch:!0,text:i}),r+=this.searchStr.length;else if(e>0){var o=this.text.slice(r,e);this.parts.push({isMatch:!1,text:o}),this.parts.push({isMatch:!0,text:i}),r+=this.searchStr.length+o.length}e=t.indexOf(this.searchStr.toLowerCase(),r)}r<this.text.length&&this.parts.push({isMatch:!1,text:this.text.slice(r,this.text.length)})},t}();x([e.Input(),j("design:type",String)],O.prototype,"text",void 0),x([e.Input(),j("design:type",String)],O.prototype,"searchStr",void 0),x([e.Input(),j("design:type",String)],O.prototype,"matchClass",void 0),x([e.Input(),j("design:type",String)],O.prototype,"type",void 0),O=x([e.Component({selector:"completer-list-item",template:'\n <span class="completer-list-item-holder" [ngClass]="{\'completer-title\': type === \'title\', \'completer-description\': type === \'description\'}" >\n <span class="completer-list-item" *ngFor="let part of parts" [ngClass]="part.isMatch ? matchClass : null">{{part.text}}</span>\n </span>\n '}),j("design:paramtypes",[])],O);var I=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},_=function(t){function e(){return t.call(this)||this}return I(e,t),e.prototype.cancel=function(){},e.prototype.searchFieldss=function(t){return this._searchFields=t,this},e.prototype.titleField=function(t){return this._titleField=t,this},e.prototype.descriptionField=function(t){return this._descriptionField=t,this},e.prototype.imageField=function(t){return this._imageField=t,this},e.prototype.extractMatches=function(t,e){var r=[];if(this._searchFields&&""!=this._searchFields)for(var i=this._searchFields.split(","),o=0;o<t.length;o++){for(var n=!1,s=0;s<i.length;s++){var c=this.extractValue(t[o],i[s])||"";n=n||c.toString().toLowerCase().indexOf(e.toString().toLowerCase())>=0}n&&(r[r.length]=t[o])}else r=t;return r},e.prototype.extractTitle=function(t){var e=this;return this._titleField.split(",").map(function(r){return e.extractValue(t,r)}).join(" ")},e.prototype.extractValue=function(t,e){var r,i;if(e){r=e.split("."),i=t;for(var o=0;o<r.length;o++)i&&(i=i[r[o]])}else i=t;return i},e.prototype.processResults=function(t,e){var r,i,o,n,s,c,a=[];if(t&&t.length>0)for(r=0;r<t.length;r++)this.titleField&&""!==this._titleField&&(n=s=this.extractTitle(t[r])),i="",this._descriptionField&&(i=c=this.extractValue(t[r],this._descriptionField)),o=null,this._imageField&&(o=this.extractValue(t[r],this._imageField)),a.push({title:s,description:c,image:o,originalObject:t[r]});return a},e}(s.Subject),H=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},L=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.LocalData=function(t){function e(){return t.call(this)||this}return H(e,t),e.prototype.data=function(t){var e=this;return t instanceof n.Observable?t.subscribe(function(t){e._data=t,e.savedTerm&&e.search(e.savedTerm)}):this._data=t,this},e.prototype.search=function(t){if(this._data){this.savedTerm=null;var e=this.extractMatches(this._data,t);this.next(this.processResults(e,t))}else this.savedTerm=t},e}(_),t.LocalData=L([e.Injectable(),D("design:paramtypes",[])],t.LocalData);var F=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},T=function(t){function e(e){var r=t.call(this)||this;return r.http=e,r._urlFormater=null,r._dataField=null,r}return F(e,t),e.prototype.remoteUrl=function(t){return this._remoteUrl=t,this},e.prototype.urlFormater=function(t){this._urlFormater=t},e.prototype.dataField=function(t){this._dataField=t},e.prototype.headers=function(t){this._headers=t},e.prototype.search=function(t){var e=this;this.cancel();var r="";r=this._urlFormater?this._urlFormater(t):this._remoteUrl+encodeURIComponent(t),this.remoteSearch=this.http.get(r,{headers:this._headers||new i.Headers}).map(function(t){return t.json()}).map(function(r){var i=e.extractValue(r,e._dataField);return e.extractMatches(i,t)}).map(function(r){var i=e.processResults(r,t);return e.next(i),i}).catch(function(t){return e.error(t),null}).subscribe()},e.prototype.cancel=function(){this.remoteSearch&&this.remoteSearch.unsubscribe()},e}(_),E=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},M=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},k=function(t,e){return function(r,i){e(r,i,t)}};t.CompleterService=function(){function t(t,e){this.localDataFactory=t,this.remoteDataFactory=e}return t.prototype.local=function(t,e,r){var i=this.localDataFactory();return i.data(t).searchFieldss(e).titleField(r)},t.prototype.remote=function(t,e,r){var i=this.remoteDataFactory();return i.remoteUrl(t).searchFieldss(e).titleField(r)},t}(),t.CompleterService=E([e.Injectable(),k(0,e.Inject(t.LocalData)),k(1,e.Inject(T)),M("design:paramtypes",[Object,Object])],t.CompleterService);var P={provide:t.LocalData,useFactory:p},N={provide:T,useFactory:h,deps:[i.Http]},V=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},B=function(t,e){return function(r,i){e(r,i,t)}},q=function(){function t(t,e){this.row=t,this.index=e}return t}();t.CtrDropdown=function(){function t(t,e){this.completer=t,this.el=e,this.rows=[],this.completer.registerDropdown(this)}return t.prototype.ngOnInit=function(){var t=getComputedStyle(this.el.nativeElement);this.isScrollOn=t.maxHeight&&"auto"===t.overflowY},t.prototype.ngOnDestroy=function(){this.completer.registerDropdown(null)},t.prototype.registerRow=function(t){this.rows.push(t)},t.prototype.highlightRow=function(t){var e=this.rows.find(function(e){return e.index===t});return t<0?(this.currHighlited&&this.currHighlited.row.setHighlited(!1),void(this.currHighlited=void 0)):void(e&&(this.currHighlited&&this.currHighlited.row.setHighlited(!1),this.currHighlited=e,this.currHighlited.row.setHighlited(!0),this.completer.onHighlighted(this.currHighlited.row.getDataItem())))},t.prototype.clear=function(){this.rows=[]},t.prototype.onSelected=function(t){this.completer.onSelected(t)},t.prototype.selectCurrent=function(){this.currHighlited?this.onSelected(this.currHighlited.row.getDataItem()):this.rows.length>0&&this.onSelected(this.rows[0].row.getDataItem())},t.prototype.nextRow=function(){var t=0;if(this.currHighlited&&(t=this.currHighlited.index+1),this.highlightRow(t),this.isScrollOn&&this.currHighlited){var e=this.currHighlited.row.getNativeElement();this.dropdownHeight()<e.getBoundingClientRect().bottom&&this.dropdownScrollTopTo(this.dropdownRowOffsetHeight(e))}},t.prototype.prevRow=function(){var t=-1;if(this.currHighlited&&(t=this.currHighlited.index-1),this.highlightRow(t),this.isScrollOn&&this.currHighlited){var e=this.dropdownRowTop();e<0&&this.dropdownScrollTopTo(e-1)}},t.prototype.dropdownScrollTopTo=function(t){this.el.nativeElement.scrollTop=this.el.nativeElement.scrollTop+t},t.prototype.dropdownRowTop=function(){return this.currHighlited.row.getNativeElement().getBoundingClientRect().top-(this.el.nativeElement.getBoundingClientRect().top+parseInt(getComputedStyle(this.el.nativeElement).paddingTop,10))},t.prototype.dropdownHeight=function(){return this.el.nativeElement.getBoundingClientRect().top+parseInt(getComputedStyle(this.el.nativeElement).maxHeight,10)},t.prototype.dropdownRowOffsetHeight=function(t){var e=getComputedStyle(t);return t.offsetHeight+parseInt(e.marginTop,10)+parseInt(e.marginBottom,10)},t}(),t.CtrDropdown=V([e.Directive({selector:"[ctrDropdown]"}),B(0,e.Host()),z("design:paramtypes",[t.CtrCompleter,e.ElementRef])],t.CtrDropdown);var A=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},U=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$=function(t,e){return function(r,i){e(r,i,t)}},G=40,Y=39,J=38,K=37,Q=27,W=13,X=9;t.CtrInput=function(){function t(t){var r=this;this.completer=t,this.clearSelected=!1,this.overrideSuggested=!1,this.ngModelChange=new e.EventEmitter,this._searchStr="",this._displayStr="",this._selectedItem=null,this.completer.selected.subscribe(function(t){r._selectedItem=t,t&&(r.clearSelected?r.searchStr="":r.searchStr=t.title,r.ngModelChange.emit(r.searchStr))}),this.completer.highlighted.subscribe(function(t){r._displayStr=t.title,r.ngModelChange.emit(t.title)})}return t.prototype.onInputChange=function(t){this.searchStr=t.target.value},t.prototype.keyupHandler=function(t){if(t.keyCode!==K&&t.keyCode!==Y&&t.keyCode!==X)if(t.keyCode===J||t.keyCode===W)t.preventDefault();else if(t.keyCode===G)t.preventDefault(),this.completer.search(this.searchStr);else if(t.keyCode===Q)this._searchStr=this._displayStr,this.completer.clear();else{if(!this.searchStr)return void this.completer.clear();this.completer.search(this.searchStr)}},t.prototype.keydownHandler=function(t){t.keyCode===W?(this.completer.hasHighlited()&&t.preventDefault(),this.completer.selectCurrent()):t.keyCode===G?(t.preventDefault(),this.completer.nextRow()):t.keyCode===J?(t.preventDefault(),this.completer.prevRow()):t.keyCode===X?this.overrideSuggested&&this._selectedItem?this.completer.onSelected({title:this.searchStr,originalObject:null}):this.completer.selectCurrent():t.keyCode===Q&&t.preventDefault()},t.prototype.onBlur=function(t){var e=this;setTimeout(function(){e.overrideSuggested&&e.completer.onSelected({title:e.searchStr,originalObject:null}),e.completer.clear()},200)},Object.defineProperty(t.prototype,"searchStr",{get:function(){return this._searchStr},set:function(t){this._searchStr=t,this._displayStr=t},enumerable:!0,configurable:!0}),t}(),A([e.Input("clearSelected"),U("design:type",Object)],t.CtrInput.prototype,"clearSelected",void 0),A([e.Input("overrideSuggested"),U("design:type",Object)],t.CtrInput.prototype,"overrideSuggested",void 0),A([e.Output(),U("design:type",e.EventEmitter)],t.CtrInput.prototype,"ngModelChange",void 0),A([e.HostListener("input",["$event"]),U("design:type",Function),U("design:paramtypes",[Object]),U("design:returntype",void 0)],t.CtrInput.prototype,"onInputChange",null),A([e.HostListener("keyup",["$event"]),U("design:type",Function),U("design:paramtypes",[Object]),U("design:returntype",void 0)],t.CtrInput.prototype,"keyupHandler",null),A([e.HostListener("keydown",["$event"]),U("design:type",Function),U("design:paramtypes",[Object]),U("design:returntype",void 0)],t.CtrInput.prototype,"keydownHandler",null),A([e.HostListener("blur",["$event"]),U("design:type",Function),U("design:paramtypes",[Object]),U("design:returntype",void 0)],t.CtrInput.prototype,"onBlur",null),t.CtrInput=A([e.Directive({selector:"[ctrInput]"}),$(0,e.Host()),U("design:paramtypes",[t.CtrCompleter])],t.CtrInput);var Z=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},tt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},et=function(t,e){return function(r,i){e(r,i,t)}},rt=function(){function t(t,e,r){this.results=t,this.searching=e,this.searchInitialized=r}return t}();t.CtrList=function(){function t(t,e,r){this.completer=t,this.templateRef=e,this.viewContainer=r,this.ctrListMinSearchLength=g,this.ctrListPause=m,this.ctrListAutoMatch=!1,this.term=null,this.searchTimer=null,this.ctx=new rt([],!1,!1)}return t.prototype.ngOnInit=function(){this.completer.registerList(this),this.viewContainer.createEmbeddedView(this.templateRef,new rt([],!1,!1))},Object.defineProperty(t.prototype,"dataService",{set:function(t){var e=this;this._dataService=t,this._dataService&&this._dataService.catch(function(t){return e.handleError(t)}).subscribe(function(t){e.ctx.searchInitialized=!0,e.ctx.searching=!1,e.ctx.results=t,e.ctrListAutoMatch&&1===t.length&&t[0].title&&e.term&&t[0].title.toLocaleLowerCase()===e.term.toLocaleLowerCase()&&e.completer.onSelected(t[0]),e.refreshTemplate()})},enumerable:!0,configurable:!0}),t.prototype.search=function(t){var e=this;this.term!=t&&this.completer.clear(),t&&t.length>=this.ctrListMinSearchLength&&this.term!==t&&(this.searchTimer&&(this.searchTimer.unsubscribe(),this.searchTimer=null),this.ctx.searching||(this.ctx.results=[],this.ctx.searching=!0,this.ctx.searchInitialized=!0,this.refreshTemplate()),this.searchTimer=a.Observable.timer(this.ctrListPause).subscribe(function(){e.searchTimerComplete(t)}))},t.prototype.clear=function(){this.searchTimer&&(this.searchTimer.unsubscribe(),this.searchTimer=null),this.dataService&&this.dataService.cancel(),this.ctx.results=[],this.ctx.searchInitialized=!1,this.term=null,this.viewContainer.clear()},t.prototype.searchTimerComplete=function(t){return!t||t.length<this.ctrListMinSearchLength?void(this.ctx.searching=!1):(this.term=t,void this._dataService.search(t))},t.prototype.handleError=function(t){this.ctx.searching=!1;var e=t.message?t.message:t.status?t.status+" - "+t.statusText:"Server error";return console&&console.error&&console.error(e),this.refreshTemplate(),a.Observable.throw(e)},t.prototype.refreshTemplate=function(){this.viewContainer.clear(),this.viewContainer.createEmbeddedView(this.templateRef,this.ctx)},t}(),Z([e.Input(),tt("design:type",Object)],t.CtrList.prototype,"ctrListMinSearchLength",void 0),Z([e.Input(),tt("design:type",Object)],t.CtrList.prototype,"ctrListPause",void 0),Z([e.Input(),tt("design:type",Object)],t.CtrList.prototype,"ctrListAutoMatch",void 0),Z([e.Input("ctrList"),tt("design:type",Object),tt("design:paramtypes",[Object])],t.CtrList.prototype,"dataService",null),t.CtrList=Z([e.Directive({selector:"[ctrList]"}),et(0,e.Host()),tt("design:paramtypes",[t.CtrCompleter,e.TemplateRef,e.ViewContainerRef])],t.CtrList);var it=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},ot=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nt=function(t,e){return function(r,i){e(r,i,t)}};t.CtrRow=function(){function t(t,e,r){this.el=t,this.renderer=e,this.dropdown=r,this.selected=!1}return t.prototype.ngOnInit=function(){this.dropdown.registerRow(new q(this,this._rowIndex))},Object.defineProperty(t.prototype,"ctrRow",{set:function(t){this._rowIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataItem",{set:function(t){this._item=t},enumerable:!0,configurable:!0}),t.prototype.onClick=function(t){this.dropdown.onSelected(this._item)},t.prototype.onMouseEnter=function(t){this.dropdown.highlightRow(this._rowIndex)},t.prototype.setHighlited=function(t){this.selected=t,this.renderer.setElementClass(this.el.nativeElement,"completer-selected-row",this.selected)},t.prototype.getNativeElement=function(){return this.el.nativeElement},t.prototype.getDataItem=function(){return this._item},t}(),it([e.Input(),ot("design:type",Number),ot("design:paramtypes",[Number])],t.CtrRow.prototype,"ctrRow",null),it([e.Input(),ot("design:type",Object),ot("design:paramtypes",[Object])],t.CtrRow.prototype,"dataItem",null),it([e.HostListener("click",["$event"]),ot("design:type",Function),ot("design:paramtypes",[Object]),ot("design:returntype",void 0)],t.CtrRow.prototype,"onClick",null),it([e.HostListener("mouseenter",["$event"]),ot("design:type",Function),ot("design:paramtypes",[Object]),ot("design:returntype",void 0)],t.CtrRow.prototype,"onMouseEnter",null),t.CtrRow=it([e.Directive({selector:"[ctrRow]"}),nt(2,e.Host()),ot("design:paramtypes",[e.ElementRef,e.Renderer,t.CtrDropdown])],t.CtrRow);var st=function(t,e,r,i){var o,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s},ct=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.Ng2CompleterModule=function(){function t(){}return t}(),t.Ng2CompleterModule=st([e.NgModule({imports:[l.CommonModule,r.FormsModule,i.HttpModule],declarations:[O,t.CtrCompleter,t.CtrDropdown,t.CtrInput,t.CtrList,t.CtrRow,S],exports:[S,O,t.CtrCompleter,t.CtrDropdown,t.CtrInput,t.CtrList,t.CtrRow],providers:[t.CompleterService,P,N]}),ct("design:paramtypes",[])],t.Ng2CompleterModule),t.RemoteData=T,t.CompleterBaseData=_,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/http"),require("rxjs/add/operator/catch"),require("rxjs/Observable"),require("rxjs/Subject"),require("rxjs/add/operator/map"),require("rxjs/Rx"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/http","rxjs/add/operator/catch","rxjs/Observable","rxjs/Subject","rxjs/add/operator/map","rxjs/Rx","@angular/common"],e):e(t.ng2Completer=t.ng2Completer||{},t.ng.core,t._angular_forms,t._angular_http,t.rxjs_add_operator_catch,t.Rx,t.Rx,t.rxjs_add_operator_map,t.Rx,t.ng.common)}(this,function(t,e,r,i,o,n,s,c,a,h){"use strict";function l(){return function(){return new H}}function p(t){return function(){return new R(t)}}var u=function(){function t(){this.selected=new e.EventEmitter,this.highlighted=new e.EventEmitter,this._hasHighlited=!1,this.hasSelected=!1}return t.prototype.ngOnInit=function(){},t.prototype.registerList=function(t){this.list=t},t.prototype.registerDropdown=function(t){this.dropdown=t},t.prototype.onHighlighted=function(t){this.highlighted.emit(t),this._hasHighlited=!0},t.prototype.onSelected=function(t){this.selected.emit(t),this.hasSelected=!0,this.clear()},t.prototype.search=function(t){this.hasSelected&&(this.selected.emit(null),this.hasSelected=!1),this.list&&this.list.search(t)},t.prototype.clear=function(){this.dropdown&&this.dropdown.clear(),this.list&&this.list.clear(),this._hasHighlited=!1},t.prototype.selectCurrent=function(){this.dropdown&&this.dropdown.selectCurrent()},t.prototype.nextRow=function(){this.dropdown&&this.dropdown.nextRow()},t.prototype.prevRow=function(){this.dropdown&&this.dropdown.prevRow()},t.prototype.hasHighlited=function(){return this._hasHighlited},t.decorators=[{type:e.Directive,args:[{selector:"[ctrCompleter]"}]}],t.ctorParameters=function(){return[]},t.propDecorators={selected:[{type:e.Output}],highlighted:[{type:e.Output}]},t}(),d=524288,m=3,g=250,f="Searching...",y="No results found",v=100,w=function(){},S={provide:r.NG_VALUE_ACCESSOR,useExisting:e.forwardRef(function(){return x}),multi:!0},x=function(){function t(){this.inputName="",this.pause=g,this.minSearchLength=m,this.maxChars=d,this.overrideSuggested=!1,this.clearSelected=!1,this.placeholder="",this.textSearching=f,this.textNoResults=y,this.autoMatch=!1,this.disableInput=!1,this.selected=new e.EventEmitter,this.highlighted=new e.EventEmitter,this.blur=new e.EventEmitter,this.searchStr="",this.displaySearching=!0,this._onTouchedCallback=w,this._onChangeCallback=w}return Object.defineProperty(t.prototype,"value",{get:function(){return this.searchStr},set:function(t){t!==this.searchStr&&(this.searchStr=t,this._onChangeCallback(t))},enumerable:!0,configurable:!0}),t.prototype.onTouched=function(){this._onTouchedCallback()},t.prototype.writeValue=function(t){this.searchStr=t},t.prototype.registerOnChange=function(t){this._onChangeCallback=t},t.prototype.registerOnTouched=function(t){this._onTouchedCallback=t},t.prototype.ngOnInit=function(){var t=this;this.completer.selected.subscribe(function(e){var r=e?e.title:"";t.selected.emit(e),t._onChangeCallback(r)}),this.completer.highlighted.subscribe(function(e){t.highlighted.emit(e)}),"false"===this.textSearching&&(this.displaySearching=!1)},t.prototype.onBlur=function(){this.blur.emit(),this.onTouched()},t.prototype.open=function(t){void 0===t&&(t=""),this.completer.search(t)},t.prototype.close=function(){this.completer.clear()},t.decorators=[{type:e.Component,args:[{selector:"ng2-completer",template:'\n <div class="completer-holder" ctrCompleter>\n <input class="completer-input" ctrInput [ngClass]="inputClass" [(ngModel)]="searchStr" [attr.name]="inputName" [placeholder]="placeholder" [attr.maxlength]="maxChars"\n [tabindex]="fieldTabindex" [disabled]="disableInput" [clearSelected]="clearSelected" [overrideSuggested]="overrideSuggested" (blur)="onBlur()"\n autocomplete="off" autocorrect="off" autocapitalize="off" />\n\n <div class="completer-dropdown-holder" *ctrList="dataService; minSearchLength: minSearchLength; pause: pause; autoMatch: autoMatch; let items = results; let searchActive = searching; let isInitialized = searchInitialized;">\n <div class="completer-dropdown" ctrDropdown *ngIf="isInitialized">\n <div *ngIf="searchActive && displaySearching" class="completer-searching">{{textSearching}}</div>\n <div *ngIf="!searchActive && (!items || items.length === 0)" class="completer-no-results">{{textNoResults}}</div>\n <div class="completer-row-wrapper" *ngFor="let item of items; let rowIndex=index">\n <div class="completer-row" [ctrRow]="rowIndex" [dataItem]="item">\n <div *ngIf="item.image || item.image === \'\'" class="completer-image-holder">\n <img *ngIf="item.image != \'\'" src="{{item.image}}" class="completer-image" />\n <div *ngIf="item.image === \'\'" class="completer-image-default"></div>\n </div>\n <div class="completer-item-text" [ngClass]="{\'completer-item-text-image\': item.image || item.image === \'\' }">\n <completer-list-item class="completer-title" [text]="item.title" [matchClass]="matchClass" [searchStr]="searchStr" [type]="\'title\'"></completer-list-item>\n <completer-list-item *ngIf="item.description && item.description != \'\'" class="completer-description" [text]="item.description"\n [matchClass]="matchClass" [searchStr]="searchStr" [type]="\'description\'">\n </completer-list-item>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',styles:['\n .completer-dropdown {\n border-color: #ececec;\n border-width: 1px;\n border-style: solid;\n border-radius: 2px;\n width: 250px;\n padding: 6px;\n cursor: pointer;\n z-index: 9999;\n position: absolute;\n margin-top: -6px;\n background-color: #ffffff;\n }\n\n .completer-row {\n padding: 5px;\n color: #000000;\n margin-bottom: 4px;\n clear: both;\n display: inline-block;\n width: 103%;\n }\n\n .completer-selected-row {\n background-color: lightblue;\n color: #ffffff;\n }\n\n .completer-description {\n font-size: 14px;\n }\n\n .completer-image-default {\n width: 16px; \n height: 16px;\n background-image: url("demo/res/img/default.png");\n }\n\n .completer-image-holder {\n float: left;\n width: 10%;\n }\n .completer-item-text-image {\n float: right;\n width: 90%;\n }\n '],providers:[S]}]}],t.ctorParameters=function(){return[]},t.propDecorators={dataService:[{type:e.Input}],inputName:[{type:e.Input}],pause:[{type:e.Input}],minSearchLength:[{type:e.Input}],maxChars:[{type:e.Input}],overrideSuggested:[{type:e.Input}],clearSelected:[{type:e.Input}],placeholder:[{type:e.Input}],matchClass:[{type:e.Input}],textSearching:[{type:e.Input}],textNoResults:[{type:e.Input}],fieldTabindex:[{type:e.Input}],autoMatch:[{type:e.Input}],disableInput:[{type:e.Input}],inputClass:[{type:e.Input}],selected:[{type:e.Output}],highlighted:[{type:e.Output}],blur:[{type:e.Output}],completer:[{type:e.ViewChild,args:[u]}]},t}(),b=function(){function t(){this.parts=[]}return t.prototype.ngOnInit=function(){if(!this.searchStr)return void this.parts.push({isMatch:!1,text:this.text});for(var t=this.text.toLowerCase(),e=t.indexOf(this.searchStr.toLowerCase()),r=0;e>=0;){var i=this.text.slice(e,e+this.searchStr.length);if(0===e)this.parts.push({isMatch:!0,text:i}),r+=this.searchStr.length;else if(e>0){var o=this.text.slice(r,e);this.parts.push({isMatch:!1,text:o}),this.parts.push({isMatch:!0,text:i}),r+=this.searchStr.length+o.length}e=t.indexOf(this.searchStr.toLowerCase(),r)}r<this.text.length&&this.parts.push({isMatch:!1,text:this.text.slice(r,this.text.length)})},t.decorators=[{type:e.Component,args:[{selector:"completer-list-item",template:'\n <span class="completer-list-item-holder" [ngClass]="{\'completer-title\': type === \'title\', \'completer-description\': type === \'description\'}" >\n <span class="completer-list-item" *ngFor="let part of parts" [ngClass]="part.isMatch ? matchClass : null">{{part.text}}</span>\n </span>\n '}]}],t.ctorParameters=function(){return[]},t.propDecorators={text:[{type:e.Input}],searchStr:[{type:e.Input}],matchClass:[{type:e.Input}],type:[{type:e.Input}]},t}(),C=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},I=function(t){function e(){t.call(this)}return C(e,t),e.prototype.cancel=function(){},e.prototype.searchFieldss=function(t){return this._searchFields=t,this},e.prototype.titleField=function(t){return this._titleField=t,this},e.prototype.descriptionField=function(t){return this._descriptionField=t,this},e.prototype.imageField=function(t){return this._imageField=t,this},e.prototype.extractMatches=function(t,e){var r=[];if(this._searchFields&&""!=this._searchFields&&""!=e)for(var i=this._searchFields.split(","),o=0;o<t.length;o++){for(var n=!1,s=0;s<i.length&&!n;s++){var c=this.extractValue(t[o],i[s])||"";n=c.toString().toLowerCase().indexOf(e.toString().toLowerCase())>=0}n&&r.push(t[o])}else r=t;return r},e.prototype.extractTitle=function(t){var e=this;return this._titleField.split(",").map(function(r){return e.extractValue(t,r)}).join(" ")},e.prototype.extractValue=function(t,e){var r,i;if(e){r=e.split("."),i=t;for(var o=0;o<r.length;o++)i&&(i=i[r[o]])}else i=t;return i},e.prototype.processResults=function(t){var e,r,i,o,n,s,c=[];if(t&&t.length>0)for(e=0;e<t.length;e++)this.titleField&&""!==this._titleField&&(o=n=this.extractTitle(t[e])),r="",this._descriptionField&&(r=s=this.extractValue(t[e],this._descriptionField)),i=null,this._imageField&&(i=this.extractValue(t[e],this._imageField)),c.push({title:n,description:s,image:i,originalObject:t[e]});return c},e}(s.Subject),_=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},H=function(t){function r(){t.call(this)}return _(r,t),r.prototype.data=function(t){var e=this;return t instanceof n.Observable?t.subscribe(function(t){e._data=t,e.savedTerm&&e.search(e.savedTerm)}):this._data=t,this},r.prototype.search=function(t){if(this._data){this.savedTerm=null;var e=this.extractMatches(this._data,t);this.next(this.processResults(e))}else this.savedTerm=t},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]},r}(I),T=function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},R=function(t){function e(e){t.call(this),this.http=e,this._urlFormater=null,this._dataField=null}return T(e,t),e.prototype.remoteUrl=function(t){return this._remoteUrl=t,this},e.prototype.urlFormater=function(t){this._urlFormater=t},e.prototype.dataField=function(t){this._dataField=t},e.prototype.headers=function(t){this._headers=t},e.prototype.search=function(t){var e=this;this.cancel();var r="";r=this._urlFormater?this._urlFormater(t):this._remoteUrl+encodeURIComponent(t),this.remoteSearch=this.http.get(r,{headers:this._headers||new i.Headers}).map(function(t){return t.json()}).map(function(r){var i=e.extractValue(r,e._dataField);return e.extractMatches(i,t)}).map(function(t){var r=e.processResults(t);return e.next(r),r}).catch(function(t){return e.error(t),null}).subscribe()},e.prototype.cancel=function(){this.remoteSearch&&this.remoteSearch.unsubscribe()},e}(I),O=function(){function t(t,e){this.localDataFactory=t,this.remoteDataFactory=e}return t.prototype.local=function(t,e,r){var i=this.localDataFactory();return i.data(t).searchFieldss(e).titleField(r)},t.prototype.remote=function(t,e,r){var i=this.remoteDataFactory();return i.remoteUrl(t).searchFieldss(e).titleField(r)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[H]}]},{type:void 0,decorators:[{type:e.Inject,args:[R]}]}]},t}(),F={provide:H,useFactory:l},L={provide:R,useFactory:p,deps:[i.Http]},D=function(){function t(t,e){this.row=t,this.index=e}return t}(),E=function(){function t(t,e){this.completer=t,this.el=e,this.rows=[],this.completer.registerDropdown(this)}return t.prototype.ngOnInit=function(){var t=getComputedStyle(this.el.nativeElement);this.isScrollOn=t.maxHeight&&"auto"===t.overflowY},t.prototype.ngOnDestroy=function(){this.completer.registerDropdown(null)},t.prototype.registerRow=function(t){this.rows.push(t)},t.prototype.highlightRow=function(t){var e=this.rows.find(function(e){return e.index===t});return t<0?(this.currHighlited&&this.currHighlited.row.setHighlited(!1),void(this.currHighlited=void 0)):void(e&&(this.currHighlited&&this.currHighlited.row.setHighlited(!1),this.currHighlited=e,this.currHighlited.row.setHighlited(!0),this.completer.onHighlighted(this.currHighlited.row.getDataItem())))},t.prototype.clear=function(){this.rows=[]},t.prototype.onSelected=function(t){this.completer.onSelected(t)},t.prototype.selectCurrent=function(){this.currHighlited?this.onSelected(this.currHighlited.row.getDataItem()):this.rows.length>0&&this.onSelected(this.rows[0].row.getDataItem())},t.prototype.nextRow=function(){var t=0;if(this.currHighlited&&(t=this.currHighlited.index+1),this.highlightRow(t),this.isScrollOn&&this.currHighlited){var e=this.currHighlited.row.getNativeElement();this.dropdownHeight()<e.getBoundingClientRect().bottom&&this.dropdownScrollTopTo(this.dropdownRowOffsetHeight(e))}},t.prototype.prevRow=function(){var t=-1;if(this.currHighlited&&(t=this.currHighlited.index-1),this.highlightRow(t),this.isScrollOn&&this.currHighlited){var e=this.dropdownRowTop();e<0&&this.dropdownScrollTopTo(e-1)}},t.prototype.dropdownScrollTopTo=function(t){this.el.nativeElement.scrollTop=this.el.nativeElement.scrollTop+t},t.prototype.dropdownRowTop=function(){return this.currHighlited.row.getNativeElement().getBoundingClientRect().top-(this.el.nativeElement.getBoundingClientRect().top+parseInt(getComputedStyle(this.el.nativeElement).paddingTop,10))},t.prototype.dropdownHeight=function(){return this.el.nativeElement.getBoundingClientRect().top+parseInt(getComputedStyle(this.el.nativeElement).maxHeight,10)},t.prototype.dropdownRowOffsetHeight=function(t){var e=getComputedStyle(t);return t.offsetHeight+parseInt(e.marginTop,10)+parseInt(e.marginBottom,10)},t.decorators=[{type:e.Directive,args:[{selector:"[ctrDropdown]"}]}],t.ctorParameters=function(){return[{type:u,decorators:[{type:e.Host}]},{type:e.ElementRef}]},t}(),j=40,k=39,M=38,P=37,N=27,V=13,z=9,B=function(){function t(t){var r=this;this.completer=t,this.clearSelected=!1,this.overrideSuggested=!1,this.ngModelChange=new e.EventEmitter,this._searchStr="",this._displayStr="",this._selectedItem=null,this.completer.selected.subscribe(function(t){r._selectedItem=t,t&&(r.clearSelected?r.searchStr="":r.searchStr=t.title,r.ngModelChange.emit(r.searchStr))}),this.completer.highlighted.subscribe(function(t){r._displayStr=t.title,r.ngModelChange.emit(t.title)})}return t.prototype.onInputChange=function(t){this.searchStr=t.target.value},t.prototype.keyupHandler=function(t){if(t.keyCode!==P&&t.keyCode!==k&&t.keyCode!==z)if(t.keyCode===M||t.keyCode===V)t.preventDefault();else if(t.keyCode===j)t.preventDefault(),this.completer.search(this.searchStr);else if(t.keyCode===N)this._searchStr=this._displayStr,this.completer.clear();else{if(!this.searchStr)return void this.completer.clear();this.completer.search(this.searchStr)}},t.prototype.keydownHandler=function(t){t.keyCode===V?(this.completer.hasHighlited()&&t.preventDefault(),this.completer.selectCurrent()):t.keyCode===j?(t.preventDefault(),this.completer.nextRow()):t.keyCode===M?(t.preventDefault(),this.completer.prevRow()):t.keyCode===z?this.overrideSuggested&&this._selectedItem?this.completer.onSelected({title:this.searchStr,originalObject:null}):this.completer.selectCurrent():t.keyCode===N&&t.preventDefault()},t.prototype.onBlur=function(t){var e=this;setTimeout(function(){e.overrideSuggested&&e.completer.onSelected({title:e.searchStr,originalObject:null}),e.completer.clear()},200)},Object.defineProperty(t.prototype,"searchStr",{get:function(){return this._searchStr},set:function(t){this._searchStr=t,this._displayStr=t},enumerable:!0,configurable:!0}),t.decorators=[{type:e.Directive,args:[{selector:"[ctrInput]"}]}],t.ctorParameters=function(){return[{type:u,decorators:[{type:e.Host}]}]},t.propDecorators={clearSelected:[{type:e.Input,args:["clearSelected"]}],overrideSuggested:[{type:e.Input,args:["overrideSuggested"]}],ngModelChange:[{type:e.Output}],onInputChange:[{type:e.HostListener,args:["input",["$event"]]}],keyupHandler:[{type:e.HostListener,args:["keyup",["$event"]]}],keydownHandler:[{type:e.HostListener,args:["keydown",["$event"]]}],onBlur:[{type:e.HostListener,args:["blur",["$event"]]}]},t}(),q=function(){function t(t,e,r){this.results=t,this.searching=e,this.searchInitialized=r}return t}(),A=function(){function t(t,e,r,i){this.completer=t,this.templateRef=e,this.viewContainer=r,this.cd=i,this.ctrListMinSearchLength=m,this.ctrListPause=g,this.ctrListAutoMatch=!1,this.term=null,this.searchTimer=null,this.clearTimer=null,this.ctx=new q([],!1,!1)}return t.hasTerm=function(t){return t||""===t},t.prototype.ngOnInit=function(){this.completer.registerList(this),this.viewContainer.createEmbeddedView(this.templateRef,new q([],!1,!1))},Object.defineProperty(t.prototype,"dataService",{set:function(e){var r=this;this._dataService=e,this._dataService&&this._dataService.catch(function(t){return r.handleError(t)}).subscribe(function(e){r.ctx.searchInitialized=!0,r.ctx.searching=!1,r.ctx.results=e,r.ctrListAutoMatch&&1===e.length&&e[0].title&&t.hasTerm(r.term)&&e[0].title.toLocaleLowerCase()===r.term.toLocaleLowerCase()&&r.completer.onSelected(e[0]),r.refreshTemplate()})},enumerable:!0,configurable:!0}),t.prototype.search=function(e){var r=this;this.term!=e&&this.completer.clear(),t.hasTerm(e)&&e.length>=this.ctrListMinSearchLength&&this.term!==e&&(this.searchTimer&&(this.searchTimer.unsubscribe(),this.searchTimer=null),this.ctx.searching||(this.ctx.results=[],this.ctx.searching=!0,this.ctx.searchInitialized=!0,this.refreshTemplate()),this.clearTimer&&this.clearTimer.unsubscribe(),this.searchTimer=a.Observable.timer(this.ctrListPause).subscribe(function(){r.searchTimerComplete(e)}))},t.prototype.clear=function(){var t=this;this.searchTimer&&this.searchTimer.unsubscribe(),this.clearTimer=a.Observable.timer(v).subscribe(function(){t._clear()})},t.prototype._clear=function(){this.searchTimer&&(this.searchTimer.unsubscribe(),this.searchTimer=null),this.dataService&&this.dataService.cancel(),this.ctx.results=[],this.ctx.searchInitialized=!1,this.term=null,this.viewContainer.clear()},t.prototype.searchTimerComplete=function(e){return!t.hasTerm(e)||e.length<this.ctrListMinSearchLength?void(this.ctx.searching=!1):(this.term=e,void this._dataService.search(e))},t.prototype.handleError=function(t){this.ctx.searching=!1;var e="search error";return t&&(e=t.message?t.message:t.status?t.status+" - "+t.statusText:"Server error"),console&&console.error&&console.error(e),this.refreshTemplate(),a.Observable.throw(e)},t.prototype.refreshTemplate=function(){this.viewContainer.clear(),this.viewContainer.createEmbeddedView(this.templateRef,this.ctx),this.cd.markForCheck()},t.decorators=[{type:e.Directive,args:[{selector:"[ctrList]"}]}],t.ctorParameters=function(){return[{type:u,decorators:[{type:e.Host}]},{type:e.TemplateRef},{type:e.ViewContainerRef},{type:e.ChangeDetectorRef}]},t.propDecorators={ctrListMinSearchLength:[{type:e.Input}],ctrListPause:[{type:e.Input}],ctrListAutoMatch:[{type:e.Input}],dataService:[{type:e.Input,args:["ctrList"]}]},t}(),U=function(){function t(t,e,r){this.el=t,this.renderer=e,this.dropdown=r,this.selected=!1}return t.prototype.ngOnInit=function(){this.dropdown.registerRow(new D(this,this._rowIndex))},Object.defineProperty(t.prototype,"ctrRow",{set:function(t){this._rowIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataItem",{set:function(t){this._item=t},enumerable:!0,configurable:!0}),t.prototype.onClick=function(t){this.dropdown.onSelected(this._item)},t.prototype.onMouseEnter=function(t){this.dropdown.highlightRow(this._rowIndex)},t.prototype.setHighlited=function(t){this.selected=t,this.renderer.setElementClass(this.el.nativeElement,"completer-selected-row",this.selected)},t.prototype.getNativeElement=function(){return this.el.nativeElement},t.prototype.getDataItem=function(){return this._item},t.decorators=[{type:e.Directive,args:[{selector:"[ctrRow]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer},{type:E,decorators:[{type:e.Host}]}]},t.propDecorators={ctrRow:[{type:e.Input}],dataItem:[{type:e.Input}],onClick:[{type:e.HostListener,args:["click",["$event"]]}],onMouseEnter:[{type:e.HostListener,args:["mouseenter",["$event"]]}]},t}(),$=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[h.CommonModule,r.FormsModule,i.HttpModule],declarations:[b,u,E,B,A,U,x],exports:[x,b,u,E,B,A,U],providers:[O,F,L]}]}],t.ctorParameters=function(){return[]},t}();t.Ng2CompleterModule=$,t.CompleterCmp=x,t.CompleterService=O,t.LocalData=H,t.RemoteData=R,t.CompleterBaseData=I,t.CtrCompleter=u,t.CtrDropdown=E,t.CtrInput=B,t.CtrList=A,t.CtrRow=U,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ng2-completer.umd.js.map |
{ | ||
"name": "ng2-completer", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "ng2 autocomplete/typeahead component", | ||
@@ -5,0 +5,0 @@ "main": "ng2-completer.umd.js", |
@@ -101,2 +101,3 @@ # ng2-completer | ||
|inputName|`name` attribute of the input element.|string|No|| | ||
|inputClass| `class` attribute of the input element.|string|No|| | ||
|matchClass|CSS class to apply for matching part of the title and description.|string|No|| | ||
@@ -113,3 +114,9 @@ |maxChars|Maximal number of characters that the user can type in the component.|number|No|524288| | ||
### ng2-completer methods | ||
|Method|Description|Parameters| | ||
|:--- |:--- |:--- | | ||
|Open(searchValue: string)|Open the dropdown and do search on a value|searchValue - string to search for default is ""| | ||
|Close()|Close the dropdown| | | ||
### Local data | ||
@@ -116,0 +123,0 @@ |
@@ -6,3 +6,3 @@ import { Directive, EventEmitter, OnInit, Output } from "@angular/core"; | ||
// import { CompleterData } from "../components/ng2-completer/services/completer-data"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
@@ -31,2 +31,3 @@ export interface CompleterList { | ||
private _hasHighlited = false; | ||
private hasSelected = false; | ||
@@ -54,2 +55,3 @@ constructor() { } | ||
this.selected.emit(item); | ||
this.hasSelected = true; | ||
this.clear(); | ||
@@ -59,2 +61,6 @@ } | ||
public search(term: string) { | ||
if (this.hasSelected) { | ||
this.selected.emit(null); | ||
this.hasSelected = false; | ||
} | ||
if (this.list) { | ||
@@ -61,0 +67,0 @@ this.list.search(term); |
import { Directive, ElementRef, Host, OnDestroy, OnInit } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { CtrCompleter, CompleterDropdown } from "./ctr-completer"; | ||
@@ -5,0 +5,0 @@ |
import { Directive, EventEmitter, Host, HostListener, Input, Output } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { CtrCompleter } from "./ctr-completer"; | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Directive, Host, Input, OnInit, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { ChangeDetectorRef, Directive, Host, Input, OnInit, TemplateRef, ViewContainerRef } from "@angular/core"; | ||
import { Observable, Subscription } from "rxjs/Rx"; | ||
@@ -6,5 +6,5 @@ | ||
import { CtrCompleter, CompleterList } from "./ctr-completer"; | ||
import { CompleterData } from "../components/ng2-completer/services/completer-data"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { MIN_SEARCH_LENGTH, PAUSE } from "../globals"; | ||
import { CompleterData } from "../services/completer-data"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { MIN_SEARCH_LENGTH, PAUSE, CLEAR_TIMEOUT } from "../globals"; | ||
@@ -33,8 +33,14 @@ | ||
private searchTimer: Subscription = null; | ||
private clearTimer: Subscription = null; | ||
private ctx = new CtrListContext([], false, false); | ||
private static hasTerm(term: string) { | ||
return term || term === ""; | ||
} | ||
constructor( | ||
@Host() private completer: CtrCompleter, | ||
private templateRef: TemplateRef<CtrListContext>, | ||
private viewContainer: ViewContainerRef) { } | ||
private viewContainer: ViewContainerRef, | ||
private cd: ChangeDetectorRef) { } | ||
@@ -59,3 +65,3 @@ public ngOnInit() { | ||
this.ctx.results = results; | ||
if (this.ctrListAutoMatch && results.length === 1 && results[0].title && this.term && | ||
if (this.ctrListAutoMatch && results.length === 1 && results[0].title && CtrList.hasTerm(this.term) && | ||
results[0].title.toLocaleLowerCase() === this.term.toLocaleLowerCase()) { | ||
@@ -75,3 +81,3 @@ // Do automatch | ||
} | ||
if (term && term.length >= this.ctrListMinSearchLength && this.term !== term) { | ||
if (CtrList.hasTerm(term) && term.length >= this.ctrListMinSearchLength && this.term !== term) { | ||
if (this.searchTimer) { | ||
@@ -88,2 +94,5 @@ this.searchTimer.unsubscribe(); | ||
if (this.clearTimer) { | ||
this.clearTimer.unsubscribe(); | ||
} | ||
this.searchTimer = Observable.timer(this.ctrListPause).subscribe(() => { | ||
@@ -98,2 +107,13 @@ this.searchTimerComplete(term); | ||
this.searchTimer.unsubscribe(); | ||
} | ||
this.clearTimer = Observable.timer(CLEAR_TIMEOUT).subscribe(() => { | ||
this._clear(); | ||
}); | ||
} | ||
private _clear() { | ||
if (this.searchTimer) { | ||
this.searchTimer.unsubscribe(); | ||
this.searchTimer = null; | ||
@@ -112,3 +132,3 @@ } | ||
// Begin the search | ||
if (!term || term.length < this.ctrListMinSearchLength) { | ||
if (!CtrList.hasTerm(term) || term.length < this.ctrListMinSearchLength) { | ||
this.ctx.searching = false; | ||
@@ -123,4 +143,8 @@ return; | ||
this.ctx.searching = false; | ||
let errMsg = (error.message) ? error.message : | ||
error.status ? `${error.status} - ${error.statusText}` : "Server error"; | ||
let errMsg: string = "search error"; | ||
if (error) { | ||
errMsg = (error.message) ? error.message : | ||
error.status ? `${error.status} - ${error.statusText}` : "Server error"; | ||
} | ||
if (console && console.error) { | ||
@@ -141,4 +165,5 @@ console.error(errMsg); // log to console | ||
); | ||
this.cd.markForCheck(); | ||
} | ||
} |
import { Directive, ElementRef, Host, HostListener, Input, Renderer, OnInit } from "@angular/core"; | ||
import { CompleterItem } from "../components/ng2-completer/completer-item"; | ||
import { CompleterItem } from "../components/completer-item"; | ||
import { CtrDropdown, CtrRowElement, CtrRowItem } from "./ctr-dropdown"; | ||
@@ -5,0 +5,0 @@ |
@@ -7,1 +7,2 @@ | ||
export const TEXT_NORESULTS = "No results found"; | ||
export const CLEAR_TIMEOUT = 100; |
export {Ng2CompleterModule} from "./ng2-completer.module"; | ||
export {CompleterService} from "./components/ng2-completer/services/completer-service"; | ||
export {CompleterData} from "./components/ng2-completer/services/completer-data"; | ||
export {CompleterItem} from "./components/ng2-completer/completer-item"; | ||
export {LocalData} from "./components/ng2-completer/services/local-data"; | ||
export {RemoteData} from "./components/ng2-completer/services/remote-data"; | ||
export {CompleterBaseData} from "./components/ng2-completer/services/completer-base-data"; | ||
export {CompleterCmp} from "./components/completer-cmp"; | ||
export {CompleterService} from "./services/completer-service"; | ||
export {CompleterData} from "./services/completer-data"; | ||
export {CompleterItem} from "./components/completer-item"; | ||
export {LocalData} from "./services/local-data"; | ||
export {RemoteData} from "./services/remote-data"; | ||
export {CompleterBaseData} from "./services/completer-base-data"; | ||
export {CtrCompleter} from "./directives/ctr-completer"; | ||
@@ -10,0 +11,0 @@ export {CtrDropdown} from "./directives/ctr-dropdown"; |
import { NgModule } from "@angular/core"; | ||
import { FormsModule } from "@angular/forms"; | ||
import { HttpModule } from "@angular/http"; | ||
import { CompleterCmp } from "./components/ng2-completer/completer-cmp"; | ||
import { CompleterListItemCmp } from "./components/ng2-completer/completer-list-item-cmp"; | ||
import { CompleterService } from "./components/ng2-completer/services/completer-service"; | ||
import { LocalDataFactoryProvider, RemoteDataFactoryProvider } from "./components/ng2-completer/services/completer-data-factory"; | ||
import { CompleterCmp } from "./components/completer-cmp"; | ||
import { CompleterListItemCmp } from "./components/completer-list-item-cmp"; | ||
import { CompleterService } from "./services/completer-service"; | ||
import { LocalDataFactoryProvider, RemoteDataFactoryProvider } from "./services/completer-data-factory"; | ||
import { CtrCompleter } from "./directives/ctr-completer"; | ||
@@ -9,0 +9,0 @@ import { CtrDropdown } from "./directives/ctr-dropdown"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
271067
177
2456