ng2-tag-input
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -34,4 +34,3 @@ "use strict"; | ||
items.forEach(function (item) { | ||
var condition = item.toLowerCase().indexOf(lowercaseValue) === 0 && | ||
_this.items.indexOf(item) === -1; | ||
var condition = item.indexOf(lowercaseValue) === 0 && _this.items.indexOf(item) === -1; | ||
if (condition) { | ||
@@ -38,0 +37,0 @@ itemsMatching.push(item); |
import { ElementRef, EventEmitter, Renderer, OnInit } from '@angular/core'; | ||
import { TagInputAccessor } from './accessor'; | ||
export declare class TagInputComponent extends TagInputAccessor implements OnInit { | ||
export declare class TagInput extends TagInputAccessor implements OnInit { | ||
private element; | ||
@@ -5,0 +5,0 @@ private renderer; |
@@ -23,6 +23,7 @@ "use strict"; | ||
var keypress_actions_1 = require('./keypress-actions'); | ||
var icon_1 = require('./icon/icon'); | ||
var input_manager_1 = require('./input-manager'); | ||
var TagInputComponent = (function (_super) { | ||
__extends(TagInputComponent, _super); | ||
function TagInputComponent(element, renderer) { | ||
var TagInput = (function (_super) { | ||
__extends(TagInput, _super); | ||
function TagInput(element, renderer) { | ||
_super.call(this); | ||
@@ -54,3 +55,3 @@ this.element = element; | ||
} | ||
TagInputComponent.prototype.removeItem = function (item) { | ||
TagInput.prototype.removeItem = function (item) { | ||
this.items = this.items.filter(function (_item) { return _item !== item; }).slice(0); | ||
@@ -63,3 +64,3 @@ if (this.selectedTag === item) { | ||
}; | ||
TagInputComponent.prototype.addItem = function (isFromAutocomplete) { | ||
TagInput.prototype.addItem = function (isFromAutocomplete) { | ||
if (isFromAutocomplete === void 0) { isFromAutocomplete = false; } | ||
@@ -81,3 +82,3 @@ if (this.autocomplete && this.dropdown.state.selectedItem && !isFromAutocomplete) { | ||
}; | ||
TagInputComponent.prototype.selectItem = function (item) { | ||
TagInput.prototype.selectItem = function (item) { | ||
if (this.readonly) { | ||
@@ -91,7 +92,7 @@ var el = this.element.nativeElement; | ||
}; | ||
TagInputComponent.prototype.fireEvents = function (eventName, $event) { | ||
TagInput.prototype.fireEvents = function (eventName, $event) { | ||
var _this = this; | ||
this.listeners[eventName].forEach(function (listener) { return listener.call(_this, $event); }); | ||
}; | ||
TagInputComponent.prototype.handleKeydown = function ($event, item) { | ||
TagInput.prototype.handleKeydown = function ($event, item) { | ||
var action = keypress_actions_1.getAction($event.keyCode || $event.which); | ||
@@ -102,12 +103,12 @@ var itemIndex = this.items.indexOf(item); | ||
}; | ||
TagInputComponent.prototype.setInputValue = function (value) { | ||
TagInput.prototype.setInputValue = function (value) { | ||
var item = value ? this.transform(value) : ''; | ||
var control = this.getControl(); | ||
control.setValue(item); | ||
control.updateValue(item); | ||
return item; | ||
}; | ||
TagInputComponent.prototype.getControl = function () { | ||
return this.form.get('item'); | ||
TagInput.prototype.getControl = function () { | ||
return this.form.find('item'); | ||
}; | ||
TagInputComponent.prototype.focus = function () { | ||
TagInput.prototype.focus = function () { | ||
if (this.readonly) { | ||
@@ -118,6 +119,6 @@ return; | ||
}; | ||
TagInputComponent.prototype.blur = function () { | ||
TagInput.prototype.blur = function () { | ||
this.input.blur.call(this); | ||
}; | ||
Object.defineProperty(TagInputComponent.prototype, "maxItemsReached", { | ||
Object.defineProperty(TagInput.prototype, "maxItemsReached", { | ||
get: function () { | ||
@@ -129,3 +130,3 @@ return this.maxItems !== undefined && this.items.length >= this.maxItems; | ||
}); | ||
TagInputComponent.prototype.escapeDropdown = function ($event) { | ||
TagInput.prototype.escapeDropdown = function ($event) { | ||
var isArrowUp = $event.keyCode === 38; | ||
@@ -137,3 +138,3 @@ var isFirstItemsSelected = this.dropdown.menu.items.first.isSelected; | ||
}; | ||
TagInputComponent.prototype.ngOnInit = function () { | ||
TagInput.prototype.ngOnInit = function () { | ||
events_actions_1.addListener.call(this, constants_1.KEYDOWN, events_actions_1.backSpaceListener); | ||
@@ -150,7 +151,7 @@ events_actions_1.addListener.call(this, constants_1.KEYDOWN, events_actions_1.customSeparatorKeys, this.separatorKeys.length > 0); | ||
}; | ||
TagInputComponent.prototype.ngAfterViewChecked = function () { | ||
TagInput.prototype.ngAfterViewChecked = function () { | ||
this.input.element = this.input.element || this.element.nativeElement.querySelector('input'); | ||
this.tagElements = this.element.nativeElement.querySelectorAll('.tag'); | ||
}; | ||
TagInputComponent.prototype.ngAfterViewInit = function () { | ||
TagInput.prototype.ngAfterViewInit = function () { | ||
var vm = this; | ||
@@ -179,62 +180,63 @@ vm.hasTemplate = vm.template && vm.template.nativeElement.childElementCount > 0; | ||
__metadata('design:type', Array) | ||
], TagInputComponent.prototype, "separatorKeys", void 0); | ||
], TagInput.prototype, "separatorKeys", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', String) | ||
], TagInputComponent.prototype, "placeholder", void 0); | ||
], TagInput.prototype, "placeholder", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', String) | ||
], TagInputComponent.prototype, "secondaryPlaceholder", void 0); | ||
], TagInput.prototype, "secondaryPlaceholder", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Number) | ||
], TagInputComponent.prototype, "maxItems", void 0); | ||
], TagInput.prototype, "maxItems", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Boolean) | ||
], TagInputComponent.prototype, "readonly", void 0); | ||
], TagInput.prototype, "readonly", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Function) | ||
], TagInputComponent.prototype, "transform", void 0); | ||
], TagInput.prototype, "transform", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Object) | ||
], TagInputComponent.prototype, "validators", void 0); | ||
], TagInput.prototype, "validators", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Boolean) | ||
], TagInputComponent.prototype, "autocomplete", void 0); | ||
], TagInput.prototype, "autocomplete", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Array) | ||
], TagInputComponent.prototype, "autocompleteItems", void 0); | ||
], TagInput.prototype, "autocompleteItems", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Boolean) | ||
], TagInputComponent.prototype, "onlyFromAutocomplete", void 0); | ||
], TagInput.prototype, "onlyFromAutocomplete", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata('design:type', Object) | ||
], TagInputComponent.prototype, "onAdd", void 0); | ||
], TagInput.prototype, "onAdd", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata('design:type', Object) | ||
], TagInputComponent.prototype, "onRemove", void 0); | ||
], TagInput.prototype, "onRemove", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata('design:type', Object) | ||
], TagInputComponent.prototype, "onSelect", void 0); | ||
], TagInput.prototype, "onSelect", void 0); | ||
__decorate([ | ||
core_1.ViewChild('template'), | ||
__metadata('design:type', core_1.ElementRef) | ||
], TagInputComponent.prototype, "template", void 0); | ||
], TagInput.prototype, "template", void 0); | ||
__decorate([ | ||
core_1.ViewChild(ng2_material_dropdown_1.Ng2Dropdown), | ||
__metadata('design:type', Object) | ||
], TagInputComponent.prototype, "dropdown", void 0); | ||
TagInputComponent = __decorate([ | ||
], TagInput.prototype, "dropdown", void 0); | ||
TagInput = __decorate([ | ||
core_1.Component({ | ||
selector: 'tag-input', | ||
directives: [icon_1.DeleteIcon].concat(ng2_material_dropdown_1.NG2_DROPDOWN_DIRECTIVES, [forms_1.REACTIVE_FORM_DIRECTIVES]), | ||
providers: [{ | ||
@@ -249,6 +251,6 @@ provide: forms_1.NG_VALUE_ACCESSOR, | ||
__metadata('design:paramtypes', [core_1.ElementRef, core_1.Renderer]) | ||
], TagInputComponent); | ||
return TagInputComponent; | ||
], TagInput); | ||
return TagInput; | ||
}(accessor_1.TagInputAccessor)); | ||
exports.TagInputComponent = TagInputComponent; | ||
exports.TagInput = TagInput; | ||
//# sourceMappingURL=tag-input.js.map |
@@ -30,3 +30,8 @@ import { ElementRef, EventEmitter, Renderer, OnInit } from '@angular/core'; | ||
private tagElements; | ||
input: any; | ||
input: { | ||
element: HTMLElement; | ||
isFocused: boolean; | ||
focus: () => void; | ||
blur: () => void; | ||
}; | ||
private listeners; | ||
@@ -40,3 +45,3 @@ private form; | ||
handleKeydown($event: any, item: string): void; | ||
errors: string[]; | ||
readonly errors: string[]; | ||
private setInputValue(value); | ||
@@ -46,3 +51,3 @@ private getControl(); | ||
private blur(); | ||
private maxItemsReached; | ||
private readonly maxItemsReached; | ||
ngOnInit(): void; | ||
@@ -49,0 +54,0 @@ ngAfterViewChecked(): void; |
{ | ||
"name": "ng2-tag-input", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Tag Input component for Angular 2", | ||
"scripts": { | ||
"typings-install": "typings install", | ||
"postinstall": "npm run typings-install", | ||
"prepublish": "npm run build && ./node_modules/.bin/tsc", | ||
@@ -22,2 +20,6 @@ "build": "webpack --inline --colors --progress --display-error-details --display-cached", | ||
"devDependencies": { | ||
"@types/es6-collections": "^0.5.29", | ||
"@types/es6-shim": "0.0.22-alpha", | ||
"@types/jasmine": "^2.2.34", | ||
"@types/node": "^6.0.39", | ||
"@angular/common": "2.0.0", | ||
@@ -31,3 +33,3 @@ "@angular/compiler": "2.0.0", | ||
"autoprefixer": "^6.3.7", | ||
"awesome-typescript-loader": "~0.16.2", | ||
"awesome-typescript-loader": "1.1.1", | ||
"core-js": "^2.4.1", | ||
@@ -58,4 +60,3 @@ "css-loader": "^0.23.1", | ||
"tslint": "^3.13.0", | ||
"typescript": "~1.8.9", | ||
"typings": "~1.0.3", | ||
"typescript": "2.0.2", | ||
"url-loader": "^0.5.7", | ||
@@ -62,0 +63,0 @@ "webpack": "^1.13.1", |
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
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
261642
56
3093
1
131
0
44