select2-component
Advanced tools
Comparing version 5.3.0 to 5.4.0
@@ -48,2 +48,3 @@ import * as tslib_1 from "tslib"; | ||
function getScrollUpIndex(data, value) { | ||
var e_1, _a; | ||
var index = 0; | ||
@@ -56,19 +57,8 @@ try { | ||
index++; | ||
try { | ||
for (var options_1 = tslib_1.__values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) { | ||
var option = options_1_1.value; | ||
if (option.value === value) { | ||
return index; | ||
} | ||
else { | ||
index++; | ||
} | ||
} | ||
var valueIndex = options.findIndex(function (op) { return op.value === value; }); | ||
if (valueIndex !== -1) { | ||
return index + valueIndex; | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
else { | ||
index += options.length; | ||
} | ||
@@ -86,13 +76,13 @@ } | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (data_1_1 && !data_1_1.done && (_b = data_1.return)) _b.call(data_1); | ||
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return 0; | ||
var e_2, _b, e_1, _a; | ||
} | ||
export function getOptionByValue(data, value) { | ||
var e_2, _a, e_3, _b; | ||
try { | ||
@@ -104,4 +94,4 @@ for (var data_2 = tslib_1.__values(data), data_2_1 = data_2.next(); !data_2_1.done; data_2_1 = data_2.next()) { | ||
try { | ||
for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) { | ||
var option = options_2_1.value; | ||
for (var options_1 = tslib_1.__values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) { | ||
var option = options_1_1.value; | ||
if (option.value === value) { | ||
@@ -115,3 +105,3 @@ return option; | ||
try { | ||
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2); | ||
if (options_1_1 && !options_1_1.done && (_b = options_1.return)) _b.call(options_1); | ||
} | ||
@@ -128,13 +118,13 @@ finally { if (e_3) throw e_3.error; } | ||
} | ||
catch (e_4_1) { e_4 = { error: e_4_1 }; } | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (data_2_1 && !data_2_1.done && (_b = data_2.return)) _b.call(data_2); | ||
if (data_2_1 && !data_2_1.done && (_a = data_2.return)) _a.call(data_2); | ||
} | ||
finally { if (e_4) throw e_4.error; } | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return null; | ||
var e_4, _b, e_3, _a; | ||
} | ||
export function getOptionsByValue(data, value, multiple) { | ||
var e_4, _a; | ||
if (multiple) { | ||
@@ -152,3 +142,3 @@ var values = Array.isArray(value) ? value : []; | ||
} | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
catch (e_4_1) { e_4 = { error: e_4_1 }; } | ||
finally { | ||
@@ -158,3 +148,3 @@ try { | ||
} | ||
finally { if (e_5) throw e_5.error; } | ||
finally { if (e_4) throw e_4.error; } | ||
} | ||
@@ -164,5 +154,5 @@ return result; | ||
return getOptionByValue(data, value); | ||
var e_5, _a; | ||
} | ||
export function getFirstAvailableOption(data) { | ||
var e_5, _a, e_6, _b; | ||
try { | ||
@@ -174,4 +164,4 @@ for (var data_3 = tslib_1.__values(data), data_3_1 = data_3.next(); !data_3_1.done; data_3_1 = data_3.next()) { | ||
try { | ||
for (var options_3 = tslib_1.__values(options), options_3_1 = options_3.next(); !options_3_1.done; options_3_1 = options_3.next()) { | ||
var option = options_3_1.value; | ||
for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) { | ||
var option = options_2_1.value; | ||
if (!option.disabled) { | ||
@@ -185,3 +175,3 @@ return option.value; | ||
try { | ||
if (options_3_1 && !options_3_1.done && (_a = options_3.return)) _a.call(options_3); | ||
if (options_2_1 && !options_2_1.done && (_b = options_2.return)) _b.call(options_2); | ||
} | ||
@@ -199,13 +189,13 @@ finally { if (e_6) throw e_6.error; } | ||
} | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
finally { | ||
try { | ||
if (data_3_1 && !data_3_1.done && (_b = data_3.return)) _b.call(data_3); | ||
if (data_3_1 && !data_3_1.done && (_a = data_3.return)) _a.call(data_3); | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
finally { if (e_5) throw e_5.error; } | ||
} | ||
return null; | ||
var e_7, _b, e_6, _a; | ||
} | ||
function getOptionsCount(data) { | ||
var e_7, _a; | ||
var count = 0; | ||
@@ -224,3 +214,3 @@ try { | ||
} | ||
catch (e_8_1) { e_8 = { error: e_8_1 }; } | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
@@ -230,9 +220,9 @@ try { | ||
} | ||
finally { if (e_8) throw e_8.error; } | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
return count; | ||
var e_8, _a; | ||
} | ||
export function valueIsNotInFilteredData(filteredData, value) { | ||
if (value === null || value === undefined) { | ||
var e_8, _a, e_9, _b; | ||
if (isNullOrUndefined(value)) { | ||
return true; | ||
@@ -246,4 +236,4 @@ } | ||
try { | ||
for (var options_4 = tslib_1.__values(options), options_4_1 = options_4.next(); !options_4_1.done; options_4_1 = options_4.next()) { | ||
var option = options_4_1.value; | ||
for (var options_3 = tslib_1.__values(options), options_3_1 = options_3.next(); !options_3_1.done; options_3_1 = options_3.next()) { | ||
var option = options_3_1.value; | ||
if (option.value === value) { | ||
@@ -257,3 +247,3 @@ return false; | ||
try { | ||
if (options_4_1 && !options_4_1.done && (_a = options_4.return)) _a.call(options_4); | ||
if (options_3_1 && !options_3_1.done && (_b = options_3.return)) _b.call(options_3); | ||
} | ||
@@ -270,14 +260,14 @@ finally { if (e_9) throw e_9.error; } | ||
} | ||
catch (e_10_1) { e_10 = { error: e_10_1 }; } | ||
catch (e_8_1) { e_8 = { error: e_8_1 }; } | ||
finally { | ||
try { | ||
if (filteredData_1_1 && !filteredData_1_1.done && (_b = filteredData_1.return)) _b.call(filteredData_1); | ||
if (filteredData_1_1 && !filteredData_1_1.done && (_a = filteredData_1.return)) _a.call(filteredData_1); | ||
} | ||
finally { if (e_10) throw e_10.error; } | ||
finally { if (e_8) throw e_8.error; } | ||
} | ||
return true; | ||
var e_10, _b, e_9, _a; | ||
} | ||
// tslint:disable-next-line:cognitive-complexity | ||
export function getPreviousOption(filteredData, hoveringValue) { | ||
var findIt = hoveringValue === null || hoveringValue === undefined; | ||
var findIt = isNullOrUndefined(hoveringValue); | ||
for (var i = filteredData.length - 1; i >= 0; i--) { | ||
@@ -309,4 +299,6 @@ var groupOrOption = filteredData[i]; | ||
} | ||
// tslint:disable-next-line:cognitive-complexity | ||
export function getNextOption(filteredData, hoveringValue) { | ||
var findIt = hoveringValue === null || hoveringValue === undefined; | ||
var e_10, _a, e_11, _b; | ||
var findIt = isNullOrUndefined(hoveringValue); | ||
try { | ||
@@ -318,4 +310,4 @@ for (var filteredData_2 = tslib_1.__values(filteredData), filteredData_2_1 = filteredData_2.next(); !filteredData_2_1.done; filteredData_2_1 = filteredData_2.next()) { | ||
try { | ||
for (var options_5 = tslib_1.__values(options), options_5_1 = options_5.next(); !options_5_1.done; options_5_1 = options_5.next()) { | ||
var option = options_5_1.value; | ||
for (var options_4 = tslib_1.__values(options), options_4_1 = options_4.next(); !options_4_1.done; options_4_1 = options_4.next()) { | ||
var option = options_4_1.value; | ||
if (findIt) { | ||
@@ -334,3 +326,3 @@ if (!option.disabled) { | ||
try { | ||
if (options_5_1 && !options_5_1.done && (_a = options_5.return)) _a.call(options_5); | ||
if (options_4_1 && !options_4_1.done && (_b = options_4.return)) _b.call(options_4); | ||
} | ||
@@ -353,14 +345,16 @@ finally { if (e_11) throw e_11.error; } | ||
} | ||
catch (e_12_1) { e_12 = { error: e_12_1 }; } | ||
catch (e_10_1) { e_10 = { error: e_10_1 }; } | ||
finally { | ||
try { | ||
if (filteredData_2_1 && !filteredData_2_1.done && (_b = filteredData_2.return)) _b.call(filteredData_2); | ||
if (filteredData_2_1 && !filteredData_2_1.done && (_a = filteredData_2.return)) _a.call(filteredData_2); | ||
} | ||
finally { if (e_12) throw e_12.error; } | ||
finally { if (e_10) throw e_10.error; } | ||
} | ||
return findIt ? hoveringValue : null; | ||
var e_12, _b, e_11, _a; | ||
} | ||
function isNullOrUndefined(value) { | ||
return value === null || value === undefined; | ||
} | ||
export function getLastScrollTopIndex(hoveringValue, results, filteredData, lastScrollTopIndex) { | ||
if (hoveringValue === null || hoveringValue === undefined) { | ||
if (isNullOrUndefined(hoveringValue)) { | ||
results.scrollTop = 0; | ||
@@ -399,2 +393,3 @@ return 0; | ||
function formatSansUnicode(str) { | ||
var e_12, _a; | ||
try { | ||
@@ -406,3 +401,3 @@ for (var unicodePatterns_1 = tslib_1.__values(unicodePatterns), unicodePatterns_1_1 = unicodePatterns_1.next(); !unicodePatterns_1_1.done; unicodePatterns_1_1 = unicodePatterns_1.next()) { | ||
} | ||
catch (e_13_1) { e_13 = { error: e_13_1 }; } | ||
catch (e_12_1) { e_12 = { error: e_12_1 }; } | ||
finally { | ||
@@ -412,6 +407,5 @@ try { | ||
} | ||
finally { if (e_13) throw e_13.error; } | ||
finally { if (e_12) throw e_12.error; } | ||
} | ||
return str; | ||
var e_13, _a; | ||
} | ||
@@ -426,2 +420,3 @@ function formatPattern(str, editPattern) { | ||
export function getFilteredData(data, searchText, editPattern) { | ||
var e_13, _a; | ||
if (searchText) { | ||
@@ -447,3 +442,3 @@ var result = []; | ||
} | ||
catch (e_14_1) { e_14 = { error: e_14_1 }; } | ||
catch (e_13_1) { e_13 = { error: e_13_1 }; } | ||
finally { | ||
@@ -453,3 +448,3 @@ try { | ||
} | ||
finally { if (e_14) throw e_14.error; } | ||
finally { if (e_13) throw e_13.error; } | ||
} | ||
@@ -461,3 +456,2 @@ return result; | ||
} | ||
var e_14, _a; | ||
} | ||
@@ -464,0 +458,0 @@ export function getOptionStyle(value, hoveringValue) { |
{ | ||
"name": "select2-component", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"description": "A vuejs, reactjs and angular select component core.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
59690
995