Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ example.setChoices(

**Input types affected:** `select-one`, `select-multiple`

**Usage:** Clear all choices from select. Does **not** reset the search state.
**Usage:** Clear all choices from select including any selected items. Does **not** reset the search state.

### getValue(valueOnly?: boolean): string[] | EventChoice[] | EventChoice | string;

Expand Down
4 changes: 2 additions & 2 deletions public/assets/scripts/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,7 @@
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -3935,7 +3935,6 @@
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -3945,6 +3944,7 @@
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/assets/scripts/choices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3918,7 +3918,7 @@ var Choices = /** @class */ (function () {
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -3929,7 +3929,6 @@ var Choices = /** @class */ (function () {
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -3939,6 +3938,7 @@ var Choices = /** @class */ (function () {
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
4 changes: 2 additions & 2 deletions public/assets/scripts/choices.search-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3442,7 +3442,7 @@
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -3453,7 +3453,6 @@
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -3463,6 +3462,7 @@
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.search-basic.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/assets/scripts/choices.search-basic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3436,7 +3436,7 @@ var Choices = /** @class */ (function () {
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -3447,7 +3447,6 @@ var Choices = /** @class */ (function () {
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -3457,6 +3456,7 @@ var Choices = /** @class */ (function () {
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
4 changes: 2 additions & 2 deletions public/assets/scripts/choices.search-prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -2284,7 +2284,7 @@
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -2295,7 +2295,6 @@
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -2305,6 +2304,7 @@
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.search-prefix.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/assets/scripts/choices.search-prefix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ var Choices = /** @class */ (function () {
var _this = this;
this._store.withTxn(function () {
_this._store.choices.forEach(function (choice) {
if (!choice.selected) {
if (!choice.placeholder) {
_this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -2289,7 +2289,6 @@ var Choices = /** @class */ (function () {
};
Choices.prototype.clearStore = function (clearOptions) {
if (clearOptions === void 0) { clearOptions = true; }
this._stopSearch();
if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -2299,6 +2298,7 @@ var Choices = /** @class */ (function () {
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();
return this;
Expand Down
5 changes: 2 additions & 3 deletions src/scripts/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ class Choices {
clearChoices(): this {
this._store.withTxn(() => {
this._store.choices.forEach((choice) => {
if (!choice.selected) {
if (!choice.placeholder) {
this._store.dispatch(removeChoice(choice));
}
});
Expand All @@ -863,8 +863,6 @@ class Choices {
}

clearStore(clearOptions: boolean = true): this {
this._stopSearch();

if (clearOptions) {
this.passedElement.element.replaceChildren('');
}
Expand All @@ -874,6 +872,7 @@ class Choices {
this._store.reset();
this._lastAddedChoiceId = 0;
this._lastAddedGroupId = 0;
this._stopSearch();
// @todo integrate with Store
this._searcher.reset();

Expand Down