DomUtil.hide(element);
const dropdownToggle = document.createElement("a");
- dropdownToggle.className = "dropdownToggle dropdownIndicator boxFlag box24 inputPrefix";
+ dropdownToggle.className = "dropdownToggle boxFlag box24 inputPrefix";
if (parent.nodeName === "DD") {
dropdownToggle.classList.add("button");
}
select(chooserId, languageId, target);
}
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
+
// add language dropdown items
Object.entries(languages).forEach(([langId, language]) => {
const listItem = document.createElement("li");
if (+langId === languageId) {
dropdownToggle.innerHTML = link.innerHTML;
+ dropdownToggle.append(icon);
}
});
if (languageId === 0) {
dropdownToggle.innerHTML = link.innerHTML;
+ dropdownToggle.append(icon);
}
listItem.addEventListener("click", callbackClick);
const span = document.createElement("span");
span.textContent = Language.get("wcf.global.language.noSelection");
+ span.append(icon);
div.appendChild(span);
}
chooser.dropdownToggle.innerHTML = listItem.children[0].innerHTML;
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
+ chooser.dropdownToggle.append(icon);
+
_choosers.set(chooserId, chooser);
// execute callback
// update label
data.buttonLabel.textContent = label;
- data.buttonLabel.classList[languageId ? "add" : "remove"]("active");
+ data.buttonLabel.querySelector("fa-icon")?.remove();
+ if (languageId) {
+ data.buttonLabel.classList.add("active");
+
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
+ data.buttonLabel.append(icon);
+ } else {
+ data.buttonLabel.classList.remove("active");
+ }
data.languageId = languageId;
}
}
}
+ const span = item.querySelector("span")!;
+ span.querySelector("fa-icon")?.remove();
if (hasMissingValue) {
item.classList.add("missingValue");
+
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("triangle-exclamation");
+ span.append(icon);
} else {
item.classList.remove("missingValue");
}
}
Util_1.default.hide(element);
const dropdownToggle = document.createElement("a");
- dropdownToggle.className = "dropdownToggle dropdownIndicator boxFlag box24 inputPrefix";
+ dropdownToggle.className = "dropdownToggle boxFlag box24 inputPrefix";
if (parent.nodeName === "DD") {
dropdownToggle.classList.add("button");
}
}
select(chooserId, languageId, target);
}
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
// add language dropdown items
Object.entries(languages).forEach(([langId, language]) => {
const listItem = document.createElement("li");
link.appendChild(span);
if (+langId === languageId) {
dropdownToggle.innerHTML = link.innerHTML;
+ dropdownToggle.append(icon);
}
});
// add dropdown item for "no selection"
listItem.appendChild(link);
if (languageId === 0) {
dropdownToggle.innerHTML = link.innerHTML;
+ dropdownToggle.append(icon);
}
listItem.addEventListener("click", callbackClick);
}
div.appendChild(icon);
const span = document.createElement("span");
span.textContent = Language.get("wcf.global.language.noSelection");
+ span.append(icon);
div.appendChild(span);
}
Simple_1.default.init(dropdownToggle);
chooser.element.value = languageId.toString();
Core.triggerEvent(chooser.element, "change");
chooser.dropdownToggle.innerHTML = listItem.children[0].innerHTML;
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
+ chooser.dropdownToggle.append(icon);
_choosers.set(chooserId, chooser);
// execute callback
if (typeof chooser.callback === "function") {
* Selects a language or non-i18n from the dropdown list.
*/
function select(elementId, languageId, isInit) {
+ var _a;
const data = _elements.get(elementId);
const dropdownMenu = Simple_1.default.getDropdownMenu(data.element.closest(".inputAddon").id);
const item = dropdownMenu.querySelector(`[data-language-id="${languageId}"]`);
}
// update label
data.buttonLabel.textContent = label;
- data.buttonLabel.classList[languageId ? "add" : "remove"]("active");
+ (_a = data.buttonLabel.querySelector("fa-icon")) === null || _a === void 0 ? void 0 : _a.remove();
+ if (languageId) {
+ data.buttonLabel.classList.add("active");
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("caret-down", true);
+ data.buttonLabel.append(icon);
+ }
+ else {
+ data.buttonLabel.classList.remove("active");
+ }
data.languageId = languageId;
}
if (!isInit) {
const data = _elements.get(elementId);
const values = _values.get(elementId);
Array.from(dropdownMenu.children).forEach((item) => {
+ var _a;
const languageId = ~~(item.dataset.languageId || "");
if (languageId) {
let hasMissingValue = false;
hasMissingValue = !values.get(languageId);
}
}
+ const span = item.querySelector("span");
+ (_a = span.querySelector("fa-icon")) === null || _a === void 0 ? void 0 : _a.remove();
if (hasMissingValue) {
item.classList.add("missingValue");
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("triangle-exclamation");
+ span.append(icon);
}
else {
item.classList.remove("missingValue");
&.missingValue > span {
padding-right: 40px;
position: relative;
-
- &:after {
- color: $wcfStatusErrorText;
- content: $fa-var-exclamation-triangle;
- font-family: FontAwesome;
- position: absolute;
- right: 20px;
- top: 5px;
- }
}
&.disabled {
&.inputAddon {
> .dropdownToggle {
padding: 4px 7px;
-
- > span.active:after {
- content: $fa-var-caret-down;
- font-family: FontAwesome;
- font-size: 14px;
- margin-left: 7px;
- }
}
}
}
}
-.dropdownIndicator::after {
- content: $fa-var-caret-down;
- font-family: FontAwesome;
- margin-left: 5px;
-}
-
.boxFlag > .box24,
.boxFlag.box24 {
align-items: center;