mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-08 03:39:20 +02:00
- add podcast sidebar navigation - add podcast dashboard with latest episodes - add pagination to podcast episodes - add components helper to reuse ui components (button, data_table, etc.) - enhance podcast and episode forms by splitting them into form sections - add hint tooltips to podcast and episode forms - transform radio inputs as buttons for better ux - replace explicit field by parental_advisory - replace author field by publisher - add podcasts_categories table to set multiple categories - use choices.js to enhance multiselect fields - update Language files - update js dependencies to latest versions closes #31, #9
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import Choices from "choices.js";
|
|
|
|
const MultiSelect = (): void => {
|
|
// Pass single element
|
|
const multiSelects: NodeListOf<HTMLSelectElement> = document.querySelectorAll(
|
|
"select[multiple]"
|
|
);
|
|
|
|
for (let i = 0; i < multiSelects.length; i++) {
|
|
const multiSelect = multiSelects[i];
|
|
|
|
new Choices(multiSelect, {
|
|
maxItemCount: parseInt(multiSelect.dataset.maxItemCount || "-1"),
|
|
itemSelectText: multiSelect.dataset.selectText,
|
|
maxItemText: multiSelect.dataset.maxItemText,
|
|
removeItemButton: true,
|
|
classNames: {
|
|
containerOuter:
|
|
"multiselect" +
|
|
(multiSelect.dataset.class ? ` ${multiSelect.dataset.class}` : ""),
|
|
containerInner: "multiselect__inner",
|
|
input: "multiselect__input",
|
|
inputCloned: "multiselect__input--cloned",
|
|
list: "multiselect__list",
|
|
listItems: "multiselect__list--multiple",
|
|
listDropdown: "multiselect__list--dropdown",
|
|
item: "multiselect__item",
|
|
itemSelectable: "multiselect__item--selectable",
|
|
itemDisabled: "multiselect__item--disabled",
|
|
itemChoice: "multiselect__item--choice",
|
|
placeholder: "multiselect__placeholder",
|
|
group: "multiselect__group",
|
|
groupHeading: "multiselect__heading",
|
|
button: "multiselect__button",
|
|
},
|
|
});
|
|
}
|
|
};
|
|
|
|
export default MultiSelect;
|