@websy/websy-designs 1.11.11 → 1.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2014,7 +2014,12 @@ class WebsyDropdown {
|
|
|
2014
2014
|
labelEl.innerHTML = item.label
|
|
2015
2015
|
labelEl.setAttribute('data-info', item.label)
|
|
2016
2016
|
inputEl.value = item.value
|
|
2017
|
-
}
|
|
2017
|
+
}
|
|
2018
|
+
else if (this.selectedItems[0]) {
|
|
2019
|
+
labelEl.innerHTML = dataToUse[this.selectedItems[0]].label
|
|
2020
|
+
labelEl.setAttribute('data-info', dataToUse[this.selectedItems[0]].label)
|
|
2021
|
+
inputEl.value = dataToUse[this.selectedItems[0]].value
|
|
2022
|
+
}
|
|
2018
2023
|
}
|
|
2019
2024
|
else if (this.selectedItems.length > 1) {
|
|
2020
2025
|
if (this.options.showCompleteSelectedList === true) {
|
|
@@ -2043,10 +2048,12 @@ class WebsyDropdown {
|
|
|
2043
2048
|
if (this.options.onSearch) {
|
|
2044
2049
|
dataToUse = this.options.items
|
|
2045
2050
|
}
|
|
2051
|
+
let item
|
|
2046
2052
|
if (typeof index !== 'undefined' && index !== null) {
|
|
2047
2053
|
let pos = this.selectedItems.indexOf(index)
|
|
2048
2054
|
if (this.options.multiSelect === false) {
|
|
2049
2055
|
this.selectedItems = [index]
|
|
2056
|
+
item = dataToUse[index]
|
|
2050
2057
|
}
|
|
2051
2058
|
else {
|
|
2052
2059
|
if (pos !== -1) {
|
|
@@ -2054,11 +2061,10 @@ class WebsyDropdown {
|
|
|
2054
2061
|
}
|
|
2055
2062
|
else {
|
|
2056
2063
|
this.selectedItems.push(index)
|
|
2064
|
+
item = dataToUse[index]
|
|
2057
2065
|
}
|
|
2058
2066
|
}
|
|
2059
|
-
}
|
|
2060
|
-
// const item = this.options.items[index]
|
|
2061
|
-
const item = dataToUse[index]
|
|
2067
|
+
}
|
|
2062
2068
|
this.updateHeader(item)
|
|
2063
2069
|
if (item && this.options.onItemSelected) {
|
|
2064
2070
|
this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options)
|
package/dist/websy-designs.js
CHANGED
|
@@ -1964,6 +1964,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1964
1964
|
labelEl.innerHTML = item.label;
|
|
1965
1965
|
labelEl.setAttribute('data-info', item.label);
|
|
1966
1966
|
inputEl.value = item.value;
|
|
1967
|
+
} else if (this.selectedItems[0]) {
|
|
1968
|
+
labelEl.innerHTML = dataToUse[this.selectedItems[0]].label;
|
|
1969
|
+
labelEl.setAttribute('data-info', dataToUse[this.selectedItems[0]].label);
|
|
1970
|
+
inputEl.value = dataToUse[this.selectedItems[0]].value;
|
|
1967
1971
|
}
|
|
1968
1972
|
} else if (this.selectedItems.length > 1) {
|
|
1969
1973
|
if (this.options.showCompleteSelectedList === true) {
|
|
@@ -1998,20 +2002,21 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1998
2002
|
if (this.options.onSearch) {
|
|
1999
2003
|
dataToUse = this.options.items;
|
|
2000
2004
|
}
|
|
2005
|
+
var item;
|
|
2001
2006
|
if (typeof index !== 'undefined' && index !== null) {
|
|
2002
2007
|
var pos = this.selectedItems.indexOf(index);
|
|
2003
2008
|
if (this.options.multiSelect === false) {
|
|
2004
2009
|
this.selectedItems = [index];
|
|
2010
|
+
item = dataToUse[index];
|
|
2005
2011
|
} else {
|
|
2006
2012
|
if (pos !== -1) {
|
|
2007
2013
|
this.selectedItems.splice(pos, 1);
|
|
2008
2014
|
} else {
|
|
2009
2015
|
this.selectedItems.push(index);
|
|
2016
|
+
item = dataToUse[index];
|
|
2010
2017
|
}
|
|
2011
2018
|
}
|
|
2012
2019
|
}
|
|
2013
|
-
// const item = this.options.items[index]
|
|
2014
|
-
var item = dataToUse[index];
|
|
2015
2020
|
this.updateHeader(item);
|
|
2016
2021
|
if (item && this.options.onItemSelected) {
|
|
2017
2022
|
this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
|