mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-10 09:52:18 +02:00
Minor tweaks
This commit is contained in:
parent
25309c91fc
commit
478df0fac1
837
src/scripts/dist/choices.js
vendored
837
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._baseId = generateId(this.passedElement.element, 'choices-');
|
||||||
|
this._idNames = {
|
||||||
this.idNames = {
|
|
||||||
itemChoice: 'item-choice',
|
itemChoice: 'item-choice',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1900,7 +1898,7 @@ class Choices {
|
||||||
const choices = this._store.choices;
|
const choices = this._store.choices;
|
||||||
const choiceLabel = label || value;
|
const choiceLabel = label || value;
|
||||||
const choiceId = choices ? choices.length + 1 : 1;
|
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(
|
this._store.dispatch(
|
||||||
addChoice(
|
addChoice(
|
||||||
|
@ -2001,8 +1999,10 @@ class Choices {
|
||||||
if (!template) {
|
if (!template) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const templates = this.config.templates;
|
const templates = this.config.templates;
|
||||||
const globalClasses = this.config.classNames;
|
const globalClasses = this.config.classNames;
|
||||||
|
|
||||||
return templates[template].call(this, globalClasses, ...args);
|
return templates[template].call(this, globalClasses, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2012,11 +2012,11 @@ class Choices {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_createTemplates() {
|
_createTemplates() {
|
||||||
// User's custom templates
|
const { callbackOnCreateTemplates } = this.config;
|
||||||
const callbackTemplate = this.config.callbackOnCreateTemplates;
|
|
||||||
let userTemplates = {};
|
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);
|
this.config.templates = extend(TEMPLATES, userTemplates);
|
||||||
|
|
Loading…
Reference in a new issue