angular-multiselect3 11.0.4 → 11.0.5
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.
|
@@ -1939,18 +1939,13 @@ class AngularMultiSelect {
|
|
|
1939
1939
|
return item[this.settings.primaryKey];
|
|
1940
1940
|
}
|
|
1941
1941
|
isSelected(clickedItem) {
|
|
1942
|
-
if (clickedItem.disabled
|
|
1942
|
+
if (clickedItem.disabled ||
|
|
1943
|
+
!this.selectedItems ||
|
|
1944
|
+
this.selectedItems.length === 0) {
|
|
1943
1945
|
return false;
|
|
1944
1946
|
}
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
this.selectedItems.forEach((item) => {
|
|
1948
|
-
if (clickedItem[this.settings.primaryKey] ===
|
|
1949
|
-
item[this.settings.primaryKey]) {
|
|
1950
|
-
found = true;
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
1953
|
-
return found;
|
|
1947
|
+
return this.selectedItems.some((item) => clickedItem[this.settings.primaryKey] ===
|
|
1948
|
+
item[this.settings.primaryKey]);
|
|
1954
1949
|
}
|
|
1955
1950
|
addSelected(item) {
|
|
1956
1951
|
if (item.disabled) {
|
|
@@ -1967,13 +1962,13 @@ class AngularMultiSelect {
|
|
|
1967
1962
|
this.onTouchedCallback(this.selectedItems);
|
|
1968
1963
|
}
|
|
1969
1964
|
removeSelected(clickedItem) {
|
|
1970
|
-
this.selectedItems
|
|
1971
|
-
this.selectedItems.
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1965
|
+
if (this.selectedItems) {
|
|
1966
|
+
const position = this.selectedItems.findIndex((item) => clickedItem[this.settings.primaryKey] ===
|
|
1967
|
+
item[this.settings.primaryKey]);
|
|
1968
|
+
if (position !== -1) {
|
|
1969
|
+
this.selectedItems.splice(position, 1);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1977
1972
|
this.onChangeCallback(this.selectedItems);
|
|
1978
1973
|
this.onTouchedCallback(this.selectedItems);
|
|
1979
1974
|
}
|