searchpicker
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -31,2 +31,3 @@ import { EventObject } from "./EventObject"; | ||
removeAutocompleteText(): void; | ||
private escapeRegexp(text); | ||
private setup(); | ||
@@ -33,0 +34,0 @@ private scaleSearchField(); |
@@ -82,4 +82,4 @@ "use strict"; | ||
this.removeAutocompleteText(); | ||
var selStart = this.inputElm.value.length; | ||
if (text.toUpperCase().search(this.inputElm.value.toUpperCase()) === 0) { | ||
var selStart = this.inputElm.value.length, inputValue = this.escapeRegexp(this.inputElm.value); | ||
if (text.toUpperCase().search(inputValue.toUpperCase()) === 0) { | ||
this.inputElm.value = text; | ||
@@ -100,2 +100,5 @@ } | ||
}; | ||
SearchPickerChoices.prototype.escapeRegexp = function (text) { | ||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
}; | ||
SearchPickerChoices.prototype.setup = function () { | ||
@@ -102,0 +105,0 @@ this.applyTemplate(); |
@@ -38,3 +38,3 @@ "use strict"; | ||
return; | ||
this.dropdownElm.style.left = '-9000px'; | ||
this.dropdownElm.style.display = 'none'; | ||
this.isShown = false; | ||
@@ -45,3 +45,3 @@ }; | ||
return; | ||
this.dropdownElm.style.left = '0'; | ||
this.dropdownElm.style.display = 'block'; | ||
this.isShown = true; | ||
@@ -220,3 +220,4 @@ this.invalidateActiveResultByIndex(); | ||
this.resultsElm = this.$template(); | ||
this.dropdownElm.style.left = '-9000px'; | ||
this.dropdownElm.style.left = '0'; | ||
this.dropdownElm.style.display = 'none'; | ||
this.dropdownElm.appendChild(this.resultsElm); | ||
@@ -223,0 +224,0 @@ }; |
{ | ||
"name": "searchpicker", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -10,10 +10,13 @@ "main": "./lib/Index.js", | ||
"start": "webpack-dev-server --config webpack.config.js --progress --profile --watch", | ||
"test": "npm run test:build && protractor ./e2e/conf.js", | ||
"test": "npm run build:test && npm run build:demo && npm run test:run", | ||
"test:run": "npm-run-all -p -r server:ci protractor", | ||
"protractor": "protractor ./e2e/protractor.conf.js", | ||
"build:demo": "rimraf dist/* && webpack --config webpack.config.js --progress --profile", | ||
"test:build": "node ./node_modules/typescript/bin/tsc -p e2e", | ||
"build:test": "tsc -p e2e", | ||
"build:lib": "rimraf lib/* && tsc -p tsconfig.lib.json", | ||
"githubpages": "git subtree push --prefix dist origin gh-pages", | ||
"build:lib": "rimraf lib/* && tsc -p tsconfig.lib.json" | ||
"server:ci": "http-server dist -p 3000 -c-1 --cors" | ||
}, | ||
"license": "MIT", | ||
"repository": "https://github.com/skbkontur/searchpicker-ts.git", | ||
"repository": "https://github.com/skbkontur/searchpicker.git", | ||
"dependencies": {}, | ||
@@ -25,4 +28,6 @@ "devDependencies": { | ||
"html-webpack-plugin": "^2.30.1", | ||
"http-server": "^0.10.0", | ||
"jasmine": "^2.5.41", | ||
"jasmine-reporters": "^2.2.0", | ||
"npm-run-all": "^4.0.2", | ||
"protractor": "^5.1.2", | ||
@@ -29,0 +34,0 @@ "rimraf": "^2.6.1", |
@@ -1,6 +0,6 @@ | ||
# searchpicker | ||
# searchpicker [![Build Status](https://travis-ci.org/skbkontur/searchpicker.svg?branch=master)](https://travis-ci.org/skbkontur/searchpicker) | ||
Searchpicker or combo-box dropdown with multiple choices support, written in typescript. No dependencies. | ||
[Demo page](http://tech.skbkontur.ru/searchpicker-ts/) | ||
[Demo page](http://tech.skbkontur.ru/searchpicker/) | ||
@@ -142,2 +142,2 @@ ## How to install | ||
npm run build:lib | ||
``` | ||
``` |
@@ -11,3 +11,3 @@ import {EventObject} from "./EventObject"; | ||
isActive: boolean = false; | ||
private inputElm: any; | ||
@@ -93,4 +93,6 @@ private inputJsElmWrap: any; | ||
let selStart = this.inputElm.value.length; | ||
if (text.toUpperCase().search(this.inputElm.value.toUpperCase()) === 0) { | ||
let selStart = this.inputElm.value.length, | ||
inputValue = this.escapeRegexp(this.inputElm.value); | ||
if (text.toUpperCase().search(inputValue.toUpperCase()) === 0) { | ||
this.inputElm.value = text; | ||
@@ -113,2 +115,6 @@ } else { | ||
private escapeRegexp(text: string) { | ||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
} | ||
private setup() { | ||
@@ -115,0 +121,0 @@ this.applyTemplate(); |
@@ -31,3 +31,3 @@ import {Utility} from "./Utils"; | ||
if (!this.isShown) return; | ||
this.dropdownElm.style.left = '-9000px'; | ||
this.dropdownElm.style.display = 'none'; | ||
this.isShown = false; | ||
@@ -38,3 +38,3 @@ } | ||
if (this.isShown) return; | ||
this.dropdownElm.style.left = '0'; | ||
this.dropdownElm.style.display = 'block'; | ||
this.isShown = true; | ||
@@ -237,3 +237,4 @@ this.invalidateActiveResultByIndex(); | ||
this.resultsElm = this.$template(); | ||
this.dropdownElm.style.left = '-9000px'; | ||
this.dropdownElm.style.left = '0'; | ||
this.dropdownElm.style.display = 'none'; | ||
this.dropdownElm.appendChild(this.resultsElm); | ||
@@ -240,0 +241,0 @@ } |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
410046
69
9518
143
15
2