Skip to content

Commit

Permalink
Compile JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
Xon committed Aug 30, 2024
1 parent b58a686 commit 240f359
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 72 deletions.
17 changes: 6 additions & 11 deletions public/assets/scripts/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,6 @@
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1167,6 +1162,7 @@
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -3971,7 +3967,7 @@
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -3989,7 +3985,7 @@
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -5081,12 +5077,11 @@
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions public/assets/scripts/choices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,11 +1054,6 @@ function choices(s, action, context) {
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1161,6 +1156,7 @@ var Store = /** @class */ (function () {
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -3965,7 +3961,7 @@ var Choices = /** @class */ (function () {
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -3983,7 +3979,7 @@ var Choices = /** @class */ (function () {
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -5075,12 +5071,11 @@ var Choices = /** @class */ (function () {
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
17 changes: 6 additions & 11 deletions public/assets/scripts/choices.search-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,6 @@
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1167,6 +1162,7 @@
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -3489,7 +3485,7 @@
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -3507,7 +3503,7 @@
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -4599,12 +4595,11 @@
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.search-basic.min.js

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions public/assets/scripts/choices.search-basic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,11 +1054,6 @@ function choices(s, action, context) {
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1161,6 +1156,7 @@ var Store = /** @class */ (function () {
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -3483,7 +3479,7 @@ var Choices = /** @class */ (function () {
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -3501,7 +3497,7 @@ var Choices = /** @class */ (function () {
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -4593,12 +4589,11 @@ var Choices = /** @class */ (function () {
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
17 changes: 6 additions & 11 deletions public/assets/scripts/choices.search-prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,11 +1051,6 @@
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1158,6 +1153,7 @@
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -2331,7 +2327,7 @@
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -2349,7 +2345,7 @@
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -3441,12 +3437,11 @@
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.search-prefix.min.js

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions public/assets/scripts/choices.search-prefix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,11 +1045,6 @@ function choices(s, action, context) {
var update = true;
switch (action.type) {
case ActionType.ADD_CHOICE: {
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
state.push(action.choice);
break;
}
Expand Down Expand Up @@ -1152,6 +1147,7 @@ var Store = /** @class */ (function () {
};
Store.prototype.subscribe = function (onChange) {
this._listeners.push(onChange);
return this;
};
Store.prototype.dispatch = function (action) {
var _this = this;
Expand Down Expand Up @@ -2325,7 +2321,7 @@ var Choices = /** @class */ (function () {
return !choice.placeholder && (isSearching ? !!choice.rank : config.renderSelectedChoices || !choice.selected);
});
};
var selectableChoices = this._isSelectOneElement;
var selectableChoices = false;
var renderChoices = function (choices, withinGroup, groupLabel) {
if (isSearching) {
// sortByRank is used to ensure stable sorting, as scores are non-unique
Expand All @@ -2343,7 +2339,7 @@ var Choices = /** @class */ (function () {
var dropdownItem = choice.choiceEl || _this._templates.choice(config, choice, config.itemSelectText, groupLabel);
choice.choiceEl = dropdownItem;
fragment.appendChild(dropdownItem);
if (isSearching || !choice.selected) {
if (!choice.disabled && (isSearching || !choice.selected)) {
selectableChoices = true;
}
return index < choiceLimit;
Expand Down Expand Up @@ -3435,12 +3431,11 @@ var Choices = /** @class */ (function () {
};
Choices.prototype._initStore = function () {
var _this = this;
this._store.subscribe(this._render);
this._store.withTxn(function () {
this._store.subscribe(this._render).withTxn(function () {
_this._addPredefinedChoices(_this._presetChoices, _this._isSelectOneElement && !_this._hasNonChoicePlaceholder, false);
});
if (this._isSelectOneElement && this._hasNonChoicePlaceholder) {
this._render({ choices: false, groups: false, items: true });
if (!this._store.choices.length || (this._isSelectOneElement && this._hasNonChoicePlaceholder)) {
this._render();
}
};
Choices.prototype._addPredefinedChoices = function (choices, selectFirstOption, withEvents) {
Expand Down
4 changes: 2 additions & 2 deletions public/types/src/scripts/interfaces/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ export interface Options {
*/
noResultsText: string | Types.StringFunction;
/**
* The text that is shown when a user has selected all possible choices. Optionally pass a function returning a string.
* The text that is shown when a user has selected all possible choices, or no choices exist. Optionally pass a function returning a string.
*
* **Input types affected:** select-multiple
* **Input types affected:** select-multiple, select-one
*
* @default 'No choices to choose from'
*/
Expand Down
2 changes: 1 addition & 1 deletion public/types/src/scripts/store/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Store<T> implements IStore {
get defaultState(): State;
changeSet(init: boolean): StateChangeSet;
reset(): void;
subscribe(onChange: StoreListener): void;
subscribe(onChange: StoreListener): this;
dispatch(action: AnyAction): void;
withTxn(func: () => void): void;
/**
Expand Down

0 comments on commit 240f359

Please sign in to comment.