mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-02 14:02:46 +02:00
Minor tweaks
This commit is contained in:
parent
25309c91fc
commit
478df0fac1
839
src/scripts/dist/choices.js
vendored
839
src/scripts/dist/choices.js
vendored
File diff suppressed because it is too large
Load diff
2
src/scripts/dist/choices.js.map
vendored
2
src/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
2
src/scripts/dist/choices.min.js
vendored
Normal file
2
src/scripts/dist/choices.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -104,10 +104,8 @@ class Choices {
|
|||
);
|
||||
}
|
||||
|
||||
// Set unique base Id
|
||||
this._baseId = generateId(this.passedElement.element, 'choices-');
|
||||
|
||||
this.idNames = {
|
||||
this._idNames = {
|
||||
itemChoice: 'item-choice',
|
||||
};
|
||||
|
||||
|
@ -1900,7 +1898,7 @@ class Choices {
|
|||
const choices = this._store.choices;
|
||||
const choiceLabel = label || value;
|
||||
const choiceId = choices ? choices.length + 1 : 1;
|
||||
const choiceElementId = `${this._baseId}-${this.idNames.itemChoice}-${choiceId}`;
|
||||
const choiceElementId = `${this._baseId}-${this._idNames.itemChoice}-${choiceId}`;
|
||||
|
||||
this._store.dispatch(
|
||||
addChoice(
|
||||
|
@ -2001,8 +1999,10 @@ class Choices {
|
|||
if (!template) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const templates = this.config.templates;
|
||||
const globalClasses = this.config.classNames;
|
||||
|
||||
return templates[template].call(this, globalClasses, ...args);
|
||||
}
|
||||
|
||||
|
@ -2012,11 +2012,11 @@ class Choices {
|
|||
* @private
|
||||
*/
|
||||
_createTemplates() {
|
||||
// User's custom templates
|
||||
const callbackTemplate = this.config.callbackOnCreateTemplates;
|
||||
const { callbackOnCreateTemplates } = this.config;
|
||||
let userTemplates = {};
|
||||
if (callbackTemplate && isType('Function', callbackTemplate)) {
|
||||
userTemplates = callbackTemplate.call(this, strToEl);
|
||||
|
||||
if (callbackOnCreateTemplates && isType('Function', callbackOnCreateTemplates)) {
|
||||
userTemplates = callbackOnCreateTemplates.call(this, strToEl);
|
||||
}
|
||||
|
||||
this.config.templates = extend(TEMPLATES, userTemplates);
|
||||
|
|
Loading…
Reference in a new issue