mirror of
https://github.com/Choices-js/Choices.git
synced 2026-03-14 14:45:47 +01:00
deploy: a1d6c40612
This commit is contained in:
parent
1a44b0558a
commit
6733a6a69a
10 changed files with 127 additions and 55 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
|
|
@ -3769,13 +3769,14 @@
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -3786,10 +3787,6 @@
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -3799,7 +3796,9 @@
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -3823,6 +3822,16 @@
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -3839,6 +3848,9 @@
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -5206,7 +5218,7 @@
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
4
assets/scripts/choices.min.js
vendored
4
assets/scripts/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
|
@ -3763,13 +3763,14 @@ var Choices = /** @class */ (function () {
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -3780,10 +3781,6 @@ var Choices = /** @class */ (function () {
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -3793,7 +3790,9 @@ var Choices = /** @class */ (function () {
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -3817,6 +3816,16 @@ var Choices = /** @class */ (function () {
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -3833,6 +3842,9 @@ var Choices = /** @class */ (function () {
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -5200,7 +5212,7 @@ var Choices = /** @class */ (function () {
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
|
|
@ -3287,13 +3287,14 @@
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -3304,10 +3305,6 @@
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -3317,7 +3314,9 @@
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -3341,6 +3340,16 @@
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -3357,6 +3366,9 @@
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -4724,7 +4736,7 @@
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
4
assets/scripts/choices.search-basic.min.js
vendored
4
assets/scripts/choices.search-basic.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
|
@ -3281,13 +3281,14 @@ var Choices = /** @class */ (function () {
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -3298,10 +3299,6 @@ var Choices = /** @class */ (function () {
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -3311,7 +3308,9 @@ var Choices = /** @class */ (function () {
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -3335,6 +3334,16 @@ var Choices = /** @class */ (function () {
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -3351,6 +3360,9 @@ var Choices = /** @class */ (function () {
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -4718,7 +4730,7 @@ var Choices = /** @class */ (function () {
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
|
|
@ -2129,13 +2129,14 @@
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -2146,10 +2147,6 @@
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -2159,7 +2156,9 @@
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -2183,6 +2182,16 @@
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -2199,6 +2208,9 @@
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -3566,7 +3578,7 @@
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
4
assets/scripts/choices.search-prefix.min.js
vendored
4
assets/scripts/choices.search-prefix.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
/*! choices.js v11.0.4 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
/*! choices.js v11.0.5 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
|
@ -2123,13 +2123,14 @@ var Choices = /** @class */ (function () {
|
|||
* }], 'value', 'label', false);
|
||||
* ```
|
||||
*/
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag) {
|
||||
Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices, clearSearchFlag, replaceItems) {
|
||||
var _this = this;
|
||||
if (choicesArrayOrFetcher === void 0) { choicesArrayOrFetcher = []; }
|
||||
if (value === void 0) { value = 'value'; }
|
||||
if (label === void 0) { label = 'label'; }
|
||||
if (replaceChoices === void 0) { replaceChoices = false; }
|
||||
if (clearSearchFlag === void 0) { clearSearchFlag = true; }
|
||||
if (replaceItems === void 0) { replaceItems = false; }
|
||||
if (!this.initialisedOK) {
|
||||
this._warnChoicesInitFailed('setChoices');
|
||||
return this;
|
||||
|
|
@ -2140,10 +2141,6 @@ var Choices = /** @class */ (function () {
|
|||
if (typeof value !== 'string' || !value) {
|
||||
throw new TypeError("value parameter must be a name of 'value' field in passed objects");
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
this.clearChoices();
|
||||
}
|
||||
if (typeof choicesArrayOrFetcher === 'function') {
|
||||
// it's a choices fetcher function
|
||||
var fetcher_1 = choicesArrayOrFetcher(this);
|
||||
|
|
@ -2153,7 +2150,9 @@ var Choices = /** @class */ (function () {
|
|||
return new Promise(function (resolve) { return requestAnimationFrame(resolve); })
|
||||
.then(function () { return _this._handleLoadingState(true); })
|
||||
.then(function () { return fetcher_1; })
|
||||
.then(function (data) { return _this.setChoices(data, value, label, replaceChoices); })
|
||||
.then(function (data) {
|
||||
return _this.setChoices(data, value, label, replaceChoices, clearSearchFlag, replaceItems);
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (!_this.config.silent) {
|
||||
console.error(err);
|
||||
|
|
@ -2177,6 +2176,16 @@ var Choices = /** @class */ (function () {
|
|||
if (clearSearchFlag) {
|
||||
_this._isSearching = false;
|
||||
}
|
||||
var items = {};
|
||||
if (!replaceItems) {
|
||||
_this._store.items.forEach(function (item) {
|
||||
items[item.value] = item;
|
||||
});
|
||||
}
|
||||
// Clear choices if needed
|
||||
if (replaceChoices) {
|
||||
_this.clearChoices();
|
||||
}
|
||||
var isDefaultValue = value === 'value';
|
||||
var isDefaultLabel = label === 'label';
|
||||
choicesArrayOrFetcher.forEach(function (groupOrChoice) {
|
||||
|
|
@ -2193,6 +2202,9 @@ var Choices = /** @class */ (function () {
|
|||
choice = __assign(__assign({}, choice), { value: choice[value], label: choice[label] });
|
||||
}
|
||||
var choiceFull = mapInputToChoice(choice, false);
|
||||
if (!replaceItems && choiceFull.value in items) {
|
||||
choiceFull.selected = true;
|
||||
}
|
||||
_this._addChoice(choiceFull);
|
||||
if (choiceFull.placeholder && !_this._hasNonChoicePlaceholder) {
|
||||
_this._placeholderValue = unwrapStringForEscaped(choiceFull.label);
|
||||
|
|
@ -3560,7 +3572,7 @@ var Choices = /** @class */ (function () {
|
|||
throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
|
||||
}
|
||||
};
|
||||
Choices.version = '11.0.4';
|
||||
Choices.version = '11.0.5';
|
||||
return Choices;
|
||||
}());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue