select2-component
Advanced tools
Comparing version 5.1.2 to 5.1.3
@@ -1,57 +0,76 @@ | ||
"use strict"; | ||
import * as tslib_1 from "tslib"; | ||
export var timeout = 200; | ||
var unicodePatterns = [ | ||
{ l: "a", s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi }, | ||
{ l: "aa", s: /ꜳ/gi }, | ||
{ l: "ae", s: /[æǽǣ]/gi }, | ||
{ l: "ao", s: /ꜵ/gi }, | ||
{ l: "au", s: /ꜷ/gi }, | ||
{ l: "av", s: /[ꜹꜻ]/gi }, | ||
{ l: "ay", s: /ꜽ/gi }, | ||
{ l: "b", s: /[ⓑbḃḅḇƀƃɓ]/gi }, | ||
{ l: "c", s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi }, | ||
{ l: "d", s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi }, | ||
{ l: "dz", s: /[dzdž]/gi }, | ||
{ l: "e", s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi }, | ||
{ l: "f", s: /[ⓕfḟƒꝼ]/gi }, | ||
{ l: "g", s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi }, | ||
{ l: "h", s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi }, | ||
{ l: "hv", s: /ƕ/gi }, | ||
{ l: "i", s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi }, | ||
{ l: "j", s: /[ⓙjĵǰɉ]/gi }, | ||
{ l: "k", s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi }, | ||
{ l: "l", s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi }, | ||
{ l: "lj", s: /lj/gi }, | ||
{ l: "m", s: /[ⓜmḿṁṃɱɯ]/gi }, | ||
{ l: "n", s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi }, | ||
{ l: "nj", s: /nj/gi }, | ||
{ l: "o", s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi }, | ||
{ l: "oi", s: /ƣ/gi }, | ||
{ l: "oe", s: /œ/gi }, | ||
{ l: "oo", s: /ꝏ/gi }, | ||
{ l: "ou", s: /ȣ/gi }, | ||
{ l: "p", s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi }, | ||
{ l: "q", s: /[ⓠqɋꝗꝙ]/gi }, | ||
{ l: "r", s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi }, | ||
{ l: "s", s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi }, | ||
{ l: "t", s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi }, | ||
{ l: "tz", s: /ꜩ/gi }, | ||
{ l: "u", s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi }, | ||
{ l: "v", s: /[ⓥvṽṿʋꝟʌ]/gi }, | ||
{ l: "vy", s: /ꝡ/gi }, | ||
{ l: "w", s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi }, | ||
{ l: "x", s: /[ⓧxẋẍ]/gi }, | ||
{ l: "y", s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi }, | ||
{ l: "z", s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi }, | ||
{ l: 'a', s: /[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi }, | ||
{ l: 'aa', s: /ꜳ/gi }, | ||
{ l: 'ae', s: /[æǽǣ]/gi }, | ||
{ l: 'ao', s: /ꜵ/gi }, | ||
{ l: 'au', s: /ꜷ/gi }, | ||
{ l: 'av', s: /[ꜹꜻ]/gi }, | ||
{ l: 'ay', s: /ꜽ/gi }, | ||
{ l: 'b', s: /[ⓑbḃḅḇƀƃɓ]/gi }, | ||
{ l: 'c', s: /[ⓒcćĉċčçḉƈȼꜿↄ]/gi }, | ||
{ l: 'd', s: /[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi }, | ||
{ l: 'dz', s: /[dzdž]/gi }, | ||
{ l: 'e', s: /[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi }, | ||
{ l: 'f', s: /[ⓕfḟƒꝼ]/gi }, | ||
{ l: 'g', s: /[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi }, | ||
{ l: 'h', s: /[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi }, | ||
{ l: 'hv', s: /ƕ/gi }, | ||
{ l: 'i', s: /[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi }, | ||
{ l: 'j', s: /[ⓙjĵǰɉ]/gi }, | ||
{ l: 'k', s: /[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi }, | ||
{ l: 'l', s: /[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi }, | ||
{ l: 'lj', s: /lj/gi }, | ||
{ l: 'm', s: /[ⓜmḿṁṃɱɯ]/gi }, | ||
{ l: 'n', s: /[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi }, | ||
{ l: 'nj', s: /nj/gi }, | ||
{ l: 'o', s: /[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi }, | ||
{ l: 'oi', s: /ƣ/gi }, | ||
{ l: 'oe', s: /œ/gi }, | ||
{ l: 'oo', s: /ꝏ/gi }, | ||
{ l: 'ou', s: /ȣ/gi }, | ||
{ l: 'p', s: /[ⓟpṕṗƥᵽꝑꝓꝕ]/gi }, | ||
{ l: 'q', s: /[ⓠqɋꝗꝙ]/gi }, | ||
{ l: 'r', s: /[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi }, | ||
{ l: 's', s: /[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi }, | ||
{ l: 't', s: /[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi }, | ||
{ l: 'tz', s: /ꜩ/gi }, | ||
{ l: 'u', s: /[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi }, | ||
{ l: 'v', s: /[ⓥvṽṿʋꝟʌ]/gi }, | ||
{ l: 'vy', s: /ꝡ/gi }, | ||
{ l: 'w', s: /[ⓦwẁẃŵẇẅẘẉⱳ]/gi }, | ||
{ l: 'x', s: /[ⓧxẋẍ]/gi }, | ||
{ l: 'y', s: /[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi }, | ||
{ l: 'z', s: /[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi } | ||
]; | ||
function getScrollUpIndex(data, value) { | ||
var index = 0; | ||
for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { | ||
var groupOrOption = data_1[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
index++; | ||
for (var _a = 0, options_1 = options; _a < options_1.length; _a++) { | ||
var option = options_1[_a]; | ||
if (option.value === value) { | ||
try { | ||
for (var data_1 = tslib_1.__values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) { | ||
var groupOrOption = data_1_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
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++; | ||
} | ||
} | ||
} | ||
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 { | ||
if (groupOrOption.value === value) { | ||
return index; | ||
@@ -64,32 +83,51 @@ } | ||
} | ||
else { | ||
if (groupOrOption.value === value) { | ||
return index; | ||
} | ||
else { | ||
index++; | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (data_1_1 && !data_1_1.done && (_b = data_1.return)) _b.call(data_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return 0; | ||
var e_2, _b, e_1, _a; | ||
} | ||
export function getOptionByValue(data, value) { | ||
for (var _i = 0, data_2 = data; _i < data_2.length; _i++) { | ||
var groupOrOption = data_2[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
for (var _a = 0, options_2 = options; _a < options_2.length; _a++) { | ||
var option = options_2[_a]; | ||
if (option.value === value) { | ||
return option; | ||
try { | ||
for (var data_2 = tslib_1.__values(data), data_2_1 = data_2.next(); !data_2_1.done; data_2_1 = data_2.next()) { | ||
var groupOrOption = data_2_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
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; | ||
if (option.value === value) { | ||
return option; | ||
} | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
} | ||
} | ||
else { | ||
if (groupOrOption.value === value) { | ||
return groupOrOption; | ||
else { | ||
if (groupOrOption.value === value) { | ||
return groupOrOption; | ||
} | ||
} | ||
} | ||
} | ||
catch (e_4_1) { e_4 = { error: e_4_1 }; } | ||
finally { | ||
try { | ||
if (data_2_1 && !data_2_1.done && (_b = data_2.return)) _b.call(data_2); | ||
} | ||
finally { if (e_4) throw e_4.error; } | ||
} | ||
return null; | ||
var e_4, _b, e_3, _a; | ||
} | ||
@@ -100,20 +138,47 @@ export function getOptionsByValue(data, value, multiple) { | ||
var result = []; | ||
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { | ||
var v = values_1[_i]; | ||
var option = getOptionByValue(data, v); | ||
if (option) { | ||
result.push(option); | ||
try { | ||
for (var values_1 = tslib_1.__values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) { | ||
var v = values_1_1.value; | ||
var option = getOptionByValue(data, v); | ||
if (option) { | ||
result.push(option); | ||
} | ||
} | ||
} | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
finally { | ||
try { | ||
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1); | ||
} | ||
finally { if (e_5) throw e_5.error; } | ||
} | ||
return result; | ||
} | ||
return getOptionByValue(data, value); | ||
var e_5, _a; | ||
} | ||
export function getFirstAvailableOption(data) { | ||
for (var _i = 0, data_3 = data; _i < data_3.length; _i++) { | ||
var groupOrOption = data_3[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
for (var _a = 0, options_3 = options; _a < options_3.length; _a++) { | ||
var option = options_3[_a]; | ||
try { | ||
for (var data_3 = tslib_1.__values(data), data_3_1 = data_3.next(); !data_3_1.done; data_3_1 = data_3.next()) { | ||
var groupOrOption = data_3_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
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; | ||
if (!option.disabled) { | ||
return option.value; | ||
} | ||
} | ||
} | ||
catch (e_6_1) { e_6 = { error: e_6_1 }; } | ||
finally { | ||
try { | ||
if (options_3_1 && !options_3_1.done && (_a = options_3.return)) _a.call(options_3); | ||
} | ||
finally { if (e_6) throw e_6.error; } | ||
} | ||
} | ||
else { | ||
var option = groupOrOption; | ||
if (!option.disabled) { | ||
@@ -124,24 +189,36 @@ return option.value; | ||
} | ||
else { | ||
var option = groupOrOption; | ||
if (!option.disabled) { | ||
return option.value; | ||
} | ||
} | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
try { | ||
if (data_3_1 && !data_3_1.done && (_b = data_3.return)) _b.call(data_3); | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
return null; | ||
var e_7, _b, e_6, _a; | ||
} | ||
function getOptionsCount(data) { | ||
var count = 0; | ||
for (var _i = 0, data_4 = data; _i < data_4.length; _i++) { | ||
var groupOrOption = data_4[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
count += options.length; | ||
try { | ||
for (var data_4 = tslib_1.__values(data), data_4_1 = data_4.next(); !data_4_1.done; data_4_1 = data_4.next()) { | ||
var groupOrOption = data_4_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
count += options.length; | ||
} | ||
else { | ||
count++; | ||
} | ||
} | ||
else { | ||
count++; | ||
} | ||
catch (e_8_1) { e_8 = { error: e_8_1 }; } | ||
finally { | ||
try { | ||
if (data_4_1 && !data_4_1.done && (_a = data_4.return)) _a.call(data_4); | ||
} | ||
finally { if (e_8) throw e_8.error; } | ||
} | ||
return count; | ||
var e_8, _a; | ||
} | ||
@@ -152,9 +229,25 @@ export function valueIsNotInFilteredData(filteredData, value) { | ||
} | ||
for (var _i = 0, filteredData_1 = filteredData; _i < filteredData_1.length; _i++) { | ||
var groupOrOption = filteredData_1[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
for (var _a = 0, options_4 = options; _a < options_4.length; _a++) { | ||
var option = options_4[_a]; | ||
if (option.value === value) { | ||
try { | ||
for (var filteredData_1 = tslib_1.__values(filteredData), filteredData_1_1 = filteredData_1.next(); !filteredData_1_1.done; filteredData_1_1 = filteredData_1.next()) { | ||
var groupOrOption = filteredData_1_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
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; | ||
if (option.value === value) { | ||
return false; | ||
} | ||
} | ||
} | ||
catch (e_9_1) { e_9 = { error: e_9_1 }; } | ||
finally { | ||
try { | ||
if (options_4_1 && !options_4_1.done && (_a = options_4.return)) _a.call(options_4); | ||
} | ||
finally { if (e_9) throw e_9.error; } | ||
} | ||
} | ||
else { | ||
if (groupOrOption.value === value) { | ||
return false; | ||
@@ -164,9 +257,12 @@ } | ||
} | ||
else { | ||
if (groupOrOption.value === value) { | ||
return false; | ||
} | ||
} | ||
catch (e_10_1) { e_10 = { error: e_10_1 }; } | ||
finally { | ||
try { | ||
if (filteredData_1_1 && !filteredData_1_1.done && (_b = filteredData_1.return)) _b.call(filteredData_1); | ||
} | ||
finally { if (e_10) throw e_10.error; } | ||
} | ||
return true; | ||
var e_10, _b, e_9, _a; | ||
} | ||
@@ -203,8 +299,30 @@ export function getPreviousOption(filteredData, hoveringValue) { | ||
var findIt = hoveringValue === null || hoveringValue === undefined; | ||
for (var _i = 0, filteredData_2 = filteredData; _i < filteredData_2.length; _i++) { | ||
var groupOrOption = filteredData_2[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
for (var _a = 0, options_5 = options; _a < options_5.length; _a++) { | ||
var option = options_5[_a]; | ||
try { | ||
for (var filteredData_2 = tslib_1.__values(filteredData), filteredData_2_1 = filteredData_2.next(); !filteredData_2_1.done; filteredData_2_1 = filteredData_2.next()) { | ||
var groupOrOption = filteredData_2_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
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; | ||
if (findIt) { | ||
if (!option.disabled) { | ||
return option.value; | ||
} | ||
} | ||
else { | ||
findIt = option.value === hoveringValue; | ||
} | ||
} | ||
} | ||
catch (e_11_1) { e_11 = { error: e_11_1 }; } | ||
finally { | ||
try { | ||
if (options_5_1 && !options_5_1.done && (_a = options_5.return)) _a.call(options_5); | ||
} | ||
finally { if (e_11) throw e_11.error; } | ||
} | ||
} | ||
else { | ||
var option = groupOrOption; | ||
if (findIt) { | ||
@@ -220,15 +338,12 @@ if (!option.disabled) { | ||
} | ||
else { | ||
var option = groupOrOption; | ||
if (findIt) { | ||
if (!option.disabled) { | ||
return option.value; | ||
} | ||
} | ||
else { | ||
findIt = option.value === hoveringValue; | ||
} | ||
} | ||
catch (e_12_1) { e_12 = { error: e_12_1 }; } | ||
finally { | ||
try { | ||
if (filteredData_2_1 && !filteredData_2_1.done && (_b = filteredData_2.return)) _b.call(filteredData_2); | ||
} | ||
finally { if (e_12) throw e_12.error; } | ||
} | ||
return findIt ? hoveringValue : null; | ||
var e_12, _b, e_11, _a; | ||
} | ||
@@ -244,3 +359,3 @@ export function getLastScrollTopIndex(hoveringValue, results, filteredData, lastScrollTopIndex) { | ||
lastScrollTopIndex += scrollTop - lastScrollTopIndex - 5; | ||
var item = results.querySelectorAll("li").item(scrollTop); | ||
var item = results.querySelectorAll('li').item(scrollTop); | ||
if (item) { | ||
@@ -253,3 +368,3 @@ results.scrollTop = item.offsetTop - results.offsetHeight; | ||
lastScrollTopIndex -= lastScrollTopIndex - scrollTop; | ||
var item = results.querySelectorAll("li").item(lastScrollTopIndex - 1); | ||
var item = results.querySelectorAll('li').item(lastScrollTopIndex - 1); | ||
if (item) { | ||
@@ -265,18 +380,28 @@ results.scrollTop = item.offsetTop; | ||
return searchText | ||
? formatSansUnicode(label).match(new RegExp(formatPattern(searchText, editPattern), "i")) !== null | ||
? formatSansUnicode(label).match(new RegExp(formatPattern(searchText, editPattern), 'i')) !== null | ||
: true; | ||
} | ||
function protectPattern(str) { | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | ||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); | ||
} | ||
function formatSansUnicode(str) { | ||
for (var _i = 0, unicodePatterns_1 = unicodePatterns; _i < unicodePatterns_1.length; _i++) { | ||
var unicodePattern = unicodePatterns_1[_i]; | ||
str = str.replace(unicodePattern.s, unicodePattern.l); | ||
try { | ||
for (var unicodePatterns_1 = tslib_1.__values(unicodePatterns), unicodePatterns_1_1 = unicodePatterns_1.next(); !unicodePatterns_1_1.done; unicodePatterns_1_1 = unicodePatterns_1.next()) { | ||
var unicodePattern = unicodePatterns_1_1.value; | ||
str = str.replace(unicodePattern.s, unicodePattern.l); | ||
} | ||
} | ||
catch (e_13_1) { e_13 = { error: e_13_1 }; } | ||
finally { | ||
try { | ||
if (unicodePatterns_1_1 && !unicodePatterns_1_1.done && (_a = unicodePatterns_1.return)) _a.call(unicodePatterns_1); | ||
} | ||
finally { if (e_13) throw e_13.error; } | ||
} | ||
return str; | ||
var e_13, _a; | ||
} | ||
function formatPattern(str, editPattern) { | ||
str = formatSansUnicode(protectPattern(str)); | ||
if (editPattern && typeof editPattern === "function") { | ||
if (editPattern && typeof editPattern === 'function') { | ||
str = editPattern(str); | ||
@@ -289,17 +414,26 @@ } | ||
var result = []; | ||
for (var _i = 0, data_5 = data; _i < data_5.length; _i++) { | ||
var groupOrOption = data_5[_i]; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
if (options.some(function (group) { return containSearchText(group.label, searchText, editPattern); })) { | ||
var filteredOptions = options.filter(function (group) { return containSearchText(group.label, searchText, editPattern); }); | ||
result.push({ | ||
label: groupOrOption.label, | ||
options: filteredOptions, | ||
}); | ||
try { | ||
for (var data_5 = tslib_1.__values(data), data_5_1 = data_5.next(); !data_5_1.done; data_5_1 = data_5.next()) { | ||
var groupOrOption = data_5_1.value; | ||
var options = groupOrOption.options; | ||
if (options) { | ||
if (options.some(function (group) { return containSearchText(group.label, searchText, editPattern); })) { | ||
var filteredOptions = options.filter(function (group) { return containSearchText(group.label, searchText, editPattern); }); | ||
result.push({ | ||
label: groupOrOption.label, | ||
options: filteredOptions | ||
}); | ||
} | ||
} | ||
else if (containSearchText(groupOrOption.label, searchText, editPattern)) { | ||
result.push(groupOrOption); | ||
} | ||
} | ||
else if (containSearchText(groupOrOption.label, searchText, editPattern)) { | ||
result.push(groupOrOption); | ||
} | ||
catch (e_14_1) { e_14 = { error: e_14_1 }; } | ||
finally { | ||
try { | ||
if (data_5_1 && !data_5_1.done && (_a = data_5.return)) _a.call(data_5); | ||
} | ||
finally { if (e_14) throw e_14.error; } | ||
} | ||
@@ -311,23 +445,24 @@ return result; | ||
} | ||
var e_14, _a; | ||
} | ||
export function getOptionStyle(value, hoveringValue) { | ||
return value === hoveringValue | ||
? "select2-results__option select2-results__option--highlighted" | ||
: "select2-results__option"; | ||
? 'select2-results__option select2-results__option--highlighted' | ||
: 'select2-results__option'; | ||
} | ||
export function getDropdownStyle(isOpen) { | ||
return isOpen | ||
? "select2-container select2-container--default select2-container-dropdown select2-container--open" | ||
: "select2-container select2-container--default select2-container-dropdown"; | ||
? 'select2-container select2-container--default select2-container-dropdown select2-container--open' | ||
: 'select2-container select2-container--default select2-container-dropdown'; | ||
} | ||
export function getContainerStyle(disabled, isOpen) { | ||
return "select2 select2-container select2-container--default " + (disabled ? "select2-container--disabled" : "") + " " | ||
+ ((isOpen ? "select2-container--open" : "") + " select2-container--below select2-container--focus"); | ||
return "select2 select2-container select2-container--default " + (disabled ? 'select2-container--disabled' : '') + " " | ||
+ ((isOpen ? 'select2-container--open' : '') + " select2-container--below select2-container--focus"); | ||
} | ||
export function getSelectionStyle(multiple) { | ||
return "select2-selection select2-selection--" + (multiple ? "multiple" : "single"); | ||
return "select2-selection select2-selection--" + (multiple ? 'multiple' : 'single'); | ||
} | ||
var defaultMinCountForSearch = 6; | ||
export function isSearchboxHiddex(data, minCountForSearch) { | ||
if (typeof minCountForSearch !== "number") { | ||
if (typeof minCountForSearch !== 'number') { | ||
minCountForSearch = defaultMinCountForSearch; | ||
@@ -340,11 +475,11 @@ } | ||
return isHidden | ||
? "select2-search select2-search--dropdown select2-search--hide" | ||
: "select2-search select2-search--dropdown"; | ||
? 'select2-search select2-search--dropdown select2-search--hide' | ||
: 'select2-search select2-search--dropdown'; | ||
} | ||
export function isSelected(options, option, multiple) { | ||
if (multiple) { | ||
return options && options.some(function (op) { return op.value === option.value; }) ? "true" : "false"; | ||
return options && options.some(function (op) { return op.value === option.value; }) ? 'true' : 'false'; | ||
} | ||
else { | ||
return options && option.value === options.value ? "true" : "false"; | ||
return options && option.value === options.value ? 'true' : 'false'; | ||
} | ||
@@ -351,0 +486,0 @@ } |
{ | ||
"name": "select2-component", | ||
"version": "5.1.2", | ||
"version": "5.1.3", | ||
"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
60069
1001