select2-component
Advanced tools
Comparing version 4.0.4 to 4.0.5
{ | ||
"name": "select2-component", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "A vuejs, reactjs and angular select component.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -32,3 +32,2 @@ /// <reference types="react" /> | ||
private readonly dropdownStyle; | ||
private readonly filteredData; | ||
private readonly containerStyle; | ||
@@ -39,2 +38,3 @@ private readonly selectionStyle; | ||
render(): JSX.Element; | ||
private getFilteredData(canSetState); | ||
private getOptionStyle(value); | ||
@@ -41,0 +41,0 @@ private mouseenter(option); |
56
react.js
@@ -45,23 +45,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(Select2.prototype, "filteredData", { | ||
get: function () { | ||
var result = this.props.customSearchEnabled | ||
? this.props.data | ||
: common.getFilteredData(this.props.data, this.searchText); | ||
if (common.valueIsNotInFilteredData(result, this.hoveringValue)) { | ||
this.hoveringValue = common.getFirstAvailableOption(result); | ||
this.setState({ hoveringValue: this.hoveringValue }); | ||
if (this.resultsElement) { | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, result, this.lastScrollTopIndex); | ||
if (lastScrollTopIndex !== null) { | ||
this.lastScrollTopIndex = lastScrollTopIndex; | ||
this.setState({ lastScrollTopIndex: this.lastScrollTopIndex }); | ||
} | ||
} | ||
} | ||
return result; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Select2.prototype, "containerStyle", { | ||
@@ -102,3 +81,3 @@ get: function () { | ||
var _this = this; | ||
var results = this.filteredData.map(function (groupOrOption, i) { | ||
var results = this.getFilteredData(false).map(function (groupOrOption, i) { | ||
var options = groupOrOption.options; | ||
@@ -137,4 +116,4 @@ if (options) { | ||
selection = [ | ||
React.createElement("span", { className: "select2-selection__rendered", title: option ? option.label : "" }, label), | ||
React.createElement("span", { className: "select2-selection__arrow", role: "presentation" }, | ||
React.createElement("span", { key: "label", className: "select2-selection__rendered", title: option ? option.label : "" }, label), | ||
React.createElement("span", { key: "arrow", className: "select2-selection__arrow", role: "presentation" }, | ||
React.createElement("b", { role: "presentation" })), | ||
@@ -153,2 +132,23 @@ ]; | ||
}; | ||
Select2.prototype.getFilteredData = function (canSetState) { | ||
var result = this.props.customSearchEnabled | ||
? this.props.data | ||
: common.getFilteredData(this.props.data, this.searchText); | ||
if (common.valueIsNotInFilteredData(result, this.hoveringValue)) { | ||
this.hoveringValue = common.getFirstAvailableOption(result); | ||
if (canSetState) { | ||
this.setState({ hoveringValue: this.hoveringValue }); | ||
} | ||
if (this.resultsElement) { | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, result, this.lastScrollTopIndex); | ||
if (lastScrollTopIndex !== null) { | ||
this.lastScrollTopIndex = lastScrollTopIndex; | ||
if (canSetState) { | ||
this.setState({ lastScrollTopIndex: this.lastScrollTopIndex }); | ||
} | ||
} | ||
} | ||
} | ||
return result; | ||
}; | ||
Select2.prototype.getOptionStyle = function (value) { | ||
@@ -215,6 +215,6 @@ return common.getOptionStyle(value, this.hoveringValue); | ||
Select2.prototype.moveUp = function () { | ||
this.hoveringValue = common.getPreviousOption(this.filteredData, this.hoveringValue); | ||
this.hoveringValue = common.getPreviousOption(this.getFilteredData(true), this.hoveringValue); | ||
this.setState({ hoveringValue: this.hoveringValue }); | ||
if (this.resultsElement) { | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, this.filteredData, this.lastScrollTopIndex); | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, this.getFilteredData(true), this.lastScrollTopIndex); | ||
if (lastScrollTopIndex !== null) { | ||
@@ -227,6 +227,6 @@ this.lastScrollTopIndex = lastScrollTopIndex; | ||
Select2.prototype.moveDown = function () { | ||
this.hoveringValue = common.getNextOption(this.filteredData, this.hoveringValue); | ||
this.hoveringValue = common.getNextOption(this.getFilteredData(true), this.hoveringValue); | ||
this.setState({ hoveringValue: this.hoveringValue }); | ||
if (this.resultsElement) { | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, this.filteredData, this.lastScrollTopIndex); | ||
var lastScrollTopIndex = common.getLastScrollTopIndex(this.hoveringValue, this.resultsElement, this.getFilteredData(true), this.lastScrollTopIndex); | ||
if (lastScrollTopIndex !== null) { | ||
@@ -233,0 +233,0 @@ this.lastScrollTopIndex = lastScrollTopIndex; |
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
220328