From: Alexander Ebert Date: Thu, 28 Sep 2023 22:16:20 +0000 (+0200) Subject: Add the typing for `` X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=43e19267cdd53dc3f5e309745d4624e2cbc78fe6;p=GitHub%2FWoltLab%2FWCF.git Add the typing for `` --- diff --git a/ts/WoltLabSuite/Core/Component/Article/LabelPicker.ts b/ts/WoltLabSuite/Core/Component/Article/LabelPicker.ts index 46e8ea3e40..95cad6e70b 100644 --- a/ts/WoltLabSuite/Core/Component/Article/LabelPicker.ts +++ b/ts/WoltLabSuite/Core/Component/Article/LabelPicker.ts @@ -1,3 +1,12 @@ +/** + * Toggles the visibility of label groups based on the selected category. + * + * @author Alexander Ebert + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle all + */ + type CategoryId = number; type LabelGroupId = number; @@ -6,14 +15,13 @@ function toggleVisibility(showLabelGroupIds: LabelGroupId[] | undefined): void { showLabelGroupIds = []; } - // TODO: Missing typings for `` - document.querySelectorAll("woltlab-core-label-picker").forEach((labelPicker) => { + document.querySelectorAll("woltlab-core-label-picker").forEach((labelPicker) => { const groupId = parseInt(labelPicker.dataset.groupId!); if (showLabelGroupIds!.includes(groupId)) { - (labelPicker as any).disabled = false; + labelPicker.disabled = false; labelPicker.closest("dl")!.hidden = false; } else { - (labelPicker as any).disabled = true; + labelPicker.disabled = true; labelPicker.closest("dl")!.hidden = true; } }); diff --git a/ts/WoltLabSuite/WebComponent/woltlab-core-label-picker.ts b/ts/WoltLabSuite/WebComponent/woltlab-core-label-picker.ts index d1edfabbf8..755f2100f8 100644 --- a/ts/WoltLabSuite/WebComponent/woltlab-core-label-picker.ts +++ b/ts/WoltLabSuite/WebComponent/woltlab-core-label-picker.ts @@ -1,3 +1,13 @@ +/** + * The `` provides an interactive widget to select a + * label out of a label group. + * + * @author Alexander Ebert + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle all + */ + { class WoltlabCoreLabelPickerElement extends HTMLElement { readonly #button: HTMLButtonElement; @@ -142,10 +152,6 @@ get required(): boolean { return this.hasAttribute("required"); } - - get labels(): Map { - return new Map(this.#labels); - } } window.customElements.define("woltlab-core-label-picker", WoltlabCoreLabelPickerElement); diff --git a/ts/global.d.ts b/ts/global.d.ts index 29daeeab06..c7c781eeb6 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -91,6 +91,15 @@ declare global { set date(date: Date); } + interface WoltlabCoreLabelPickerElement extends HTMLElement { + set disabled(disabled: boolean); + get disabled(): boolean; + set selected(selected: number); + get selected(): number | undefined; + set required(required: boolean); + get required(): boolean; + } + interface WoltlabCoreLoadingIndicatorElement extends HTMLElement { get size(): LoadingIndicatorIconSize; set size(size: LoadingIndicatorIconSize); @@ -121,6 +130,7 @@ declare global { "woltlab-core-dialog": WoltlabCoreDialogElement; "woltlab-core-dialog-control": WoltlabCoreDialogControlElement; "woltlab-core-date-time": WoltlabCoreDateTime; + "woltlab-core-label-picker": WoltlabCoreLabelPickerElement; "woltlab-core-loading-indicator": WoltlabCoreLoadingIndicatorElement; "woltlab-core-pagination": WoltlabCorePaginationElement; "woltlab-core-google-maps": WoltlabCoreGoogleMapsElement; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Article/LabelPicker.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Article/LabelPicker.js index 77157244b9..0919d00c0f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Article/LabelPicker.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Article/LabelPicker.js @@ -1,3 +1,11 @@ +/** + * Toggles the visibility of label groups based on the selected category. + * + * @author Alexander Ebert + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle all + */ define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -6,7 +14,6 @@ define(["require", "exports"], function (require, exports) { if (showLabelGroupIds === undefined) { showLabelGroupIds = []; } - // TODO: Missing typings for `` document.querySelectorAll("woltlab-core-label-picker").forEach((labelPicker) => { const groupId = parseInt(labelPicker.dataset.groupId); if (showLabelGroupIds.includes(groupId)) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/WebComponent.min.js b/wcfsetup/install/files/js/WoltLabSuite/WebComponent.min.js index cef37066b1..49f468276d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/WebComponent.min.js +++ b/wcfsetup/install/files/js/WoltLabSuite/WebComponent.min.js @@ -60,7 +60,7 @@ Expecting `+Z.join(", ")+", got '"+(this.terminals_[E]||E)+"'":ae="Parse error o time::after { content: " (" attr(title) ")"; } - }`,L.append(C)}g&&(this.#e.dateTime=p.toISOString(),this.#e.title=b.DateAndTime.format(p));let y;if(this.static)y=this.#e.title;else if(xt?y=this.#t(L,0):p.getTime()>a?y=this.#t(L,-1):y=L.map(W=>W.value).join(""):y=b.DateAndTime.format(p)}else y=b.Date.format(p);y=y.charAt(0).toUpperCase()+y.slice(1),this.#e.textContent=y}#t(g,p){return g.map(y=>y.type==="weekday"?b.TodayOrYesterday.format(p,"day"):y.value).join("")}}window.customElements.define("woltlab-core-date-time",q);let S=()=>{document.querySelectorAll("woltlab-core-date-time").forEach(h=>h.refresh(!1))},z,P=()=>{z=window.setInterval(()=>{i(),S()},6e4)};document.addEventListener("DOMContentLoaded",()=>P(),{once:!0}),document.addEventListener("visibilitychange",()=>{document.hidden?window.clearInterval(z):(S(),P())})}{class e extends HTMLElement{#a;#e;#t=new Map;constructor(){super(),this.#a=document.createElement("button")}connectedCallback(){if(this.hasAttribute("labels")&&(this.#t=new Map(JSON.parse(this.getAttribute("labels"))),this.removeAttribute("labels")),this.#t.size===0)throw new Error("Expected a non empty list of labels.");let l=`${window.WoltLabLanguage.getPhrase("wcf.label.none")}`;this.#a.type="button",this.#a.classList.add("dropdownToggle"),this.#a.innerHTML=l,this.#a.addEventListener("click",a=>{a.preventDefault();let i=new CustomEvent("showPicker");this.dispatchEvent(i)}),this.#a.id=this.id,this.removeAttribute("id"),this.append(this.#a);let c=document.createElement("ul");c.classList.add("scrollableDropdownMenu");for(let[a,i]of this.#t)c.append(this.#s(a,i));if(!this.required){let a=document.createElement("li");a.classList.add("dropdownDivider"),c.append(a,this.#s(0,l))}let t=document.createElement("ul");t.classList.add("dropdownMenu"),t.append(c),this.append(t),this.classList.add("dropdown"),this.closest("form")!==null?(this.#e===void 0&&(this.#e=document.createElement("input"),this.#e.type="hidden",this.#e.name=`labelIDs[${this.dataset.groupId}]`,this.append(this.#e)),this.#e.value=(this.selected||0).toString()):this.#e?.remove(),this.selected&&(this.selected=this.selected)}#s(l,c){let t=document.createElement("button");t.type="button",t.dataset.labelId=l.toString(),t.innerHTML=c,t.addEventListener("click",()=>{this.selected=l});let a=document.createElement("li");return a.append(t),a}set selected(l){this.setAttribute("selected",l.toString()),this.#a.innerHTML=this.#t.get(l)||`${window.WoltLabLanguage.getPhrase("wcf.label.none")}`,this.#e!==void 0&&(this.#e.value=l.toString())}get selected(){let l=parseInt(this.getAttribute("selected"));if(!Number.isNaN(l))return l}set disabled(l){l?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.#a.disabled=l,this.#e&&(this.#e.disabled=l)}get disabled(){return this.hasAttribute("disabled")}set required(l){l?this.setAttribute("required",""):this.removeAttribute("required")}get required(){return this.hasAttribute("required")}get labels(){return new Map(this.#t)}}window.customElements.define("woltlab-core-label-picker",e)}{let r=[24,48,96];class l extends HTMLElement{#a;#e;connectedCallback(){this.#a===void 0&&this.#t()}attributeChangedCallback(t,a,i){if(t==="size"){let d=parseInt(i||"");if(!r.includes(d)){let b=parseInt(a||"");r.includes(b)||(b=24),this.setAttribute(t,b.toString())}}}#t(){this.classList.add("loading-indicator"),this.hasAttribute("size")||this.setAttribute("size",24 .toString()),this.#a=document.createElement("fa-icon"),this.#a.size=this.size,this.#a.setIcon("spinner"),this.#e=document.createElement("span"),this.#e.classList.add("loading-indicator__text"),this.#e.textContent=window.WoltLabLanguage.getPhrase("wcf.global.loading"),this.#e.hidden=this.hideText;let t=document.createElement("div");t.classList.add("loading-indicator__wrapper"),t.append(this.#a,this.#e),this.append(t)}get size(){return parseInt(this.getAttribute("size"))}set size(t){if(!r.includes(t))throw new TypeError(`The size ${t} is unrecognized, permitted values are ${r.join(", ")}.`);this.setAttribute("size",t.toString()),this.#a&&(this.#a.size=t)}get hideText(){return this.hasAttribute("hide-text")}set hideText(t){t?this.setAttribute("hide-text",""):this.removeAttribute("hide-text"),this.#e&&(this.#e.hidden=t)}static get observedAttributes(){return["size"]}}window.customElements.define("woltlab-core-loading-indicator",l)}{let e,r=()=>(e===void 0&&(e=window.matchMedia("(max-width: 544px)")),e);class l extends HTMLElement{#a="pagination";connectedCallback(){this.#e(),r().addEventListener("change",()=>this.#e())}#e(){if(this.innerHTML="",this.count<2)return;this.classList.add(`${this.#a}__wrapper`);let t=this.#t();this.append(t);let a=this.#s();a&&t.append(a);let i=document.createElement("ul");i.classList.add(`${this.#a}__list`),t.append(i),i.append(this.#l(1)),this.page>this.thresholdForEllipsis+1&&i.append(this.#i()),this.#f().forEach(b=>{i.append(b)}),this.count-this.page>this.thresholdForEllipsis&&i.append(this.#i()),i.append(this.#l(this.count));let d=this.#o();d&&t.append(d)}#t(){let t=document.createElement("nav");return t.setAttribute("role","navigation"),t.setAttribute("aria-label",window.WoltLabLanguage.getPhrase("wcf.page.pagination")),t.classList.add(this.#a),t}#s(){if(this.page===1)return;let t=document.createElement("div");t.classList.add(`${this.#a}__prev`);let a=this.#r(this.page-1);a instanceof HTMLAnchorElement&&(a.rel="prev"),a.title=window.WoltLabLanguage.getPhrase("wcf.global.page.previous"),a.classList.add("jsTooltip"),t.append(a);let i=document.createElement("fa-icon");return i.setIcon("arrow-left"),a.append(i),t}#o(){if(this.page===this.count)return;let t=document.createElement("div");t.classList.add(`${this.#a}__next`);let a=this.#r(this.page+1);a instanceof HTMLAnchorElement&&(a.rel="next"),a.title=window.WoltLabLanguage.getPhrase("wcf.global.page.next"),a.classList.add("jsTooltip"),t.append(a);let i=document.createElement("fa-icon");return i.setIcon("arrow-right"),a.append(i),t}#r(t){let a,i=this.getLinkUrl(t);return i?(a=document.createElement("a"),a.href=i):(a=document.createElement("button"),a.type="button",this.page===t?a.disabled=!0:a.addEventListener("click",()=>{this.#n(t)})),a.classList.add(`${this.#a}__link`),a}#l(t){let a=document.createElement("li");a.classList.add(`${this.#a}__item`);let i=this.#r(t);return i.setAttribute("aria-label",window.WoltLabLanguage.getPhrase("wcf.page.pageNo",{pageNo:t})),t===this.page&&(i.setAttribute("aria-current","page"),i.classList.add(`${this.#a}__link--current`)),i.textContent=t.toLocaleString(document.documentElement.lang),a.append(i),a}#f(){let t=[],a,i;r().matches?(a=this.page,i=this.page):(a=this.page-1,a===3&&a--,i=this.page+1,i===this.count-2&&i++);for(let d=a;d<=i;d++)d<=1||d>=this.count||t.push(this.#l(d));return t}#i(){let t=document.createElement("li");t.classList.add(`${this.#a}__item`,`${this.#a}__item--ellipsis`);let a=document.createElement("button");return a.type="button",a.title=window.WoltLabLanguage.getPhrase("wcf.page.jumpTo"),a.classList.add("pagination__link","jsTooltip"),a.innerHTML="⋯",a.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("jumpToPage"))}),t.append(a),t}get thresholdForEllipsis(){return r().matches?1:3}getLinkUrl(t){if(!this.url)return"";let a=new URL(this.url);return a.search+=a.search!==""?"&":"?",a.search+=new URLSearchParams([["pageNo",t.toString()]]).toString(),a.toString()}jumpToPage(t){let a=this.getLinkUrl(t);a?window.location.href=a:this.#n(t)}#n(t){let a=new CustomEvent("switchPage",{cancelable:!0,detail:t});this.dispatchEvent(a),a.defaultPrevented||(this.page=t)}get count(){return this.hasAttribute("count")?parseInt(this.getAttribute("count")):0}set count(t){this.setAttribute("count",t.toString()),this.#e()}get page(){return this.hasAttribute("page")?parseInt(this.getAttribute("page")):1}set page(t){this.setAttribute("page",t.toString()),this.#e()}get url(){return this.getAttribute("url")}set url(t){this.setAttribute("url",t),this.#e()}}window.customElements.define("woltlab-core-pagination",l)}{class e extends HTMLElement{connectedCallback(){this.setData(this.#e(),this.#t())}setData(l,c){this.#a(l,c)}get objectId(){return parseInt(this.getAttribute("object-id"))}get objectType(){return this.getAttribute("object-type")}#a(l,c){if(this.innerHTML="",!l.size)return;let t=document.createElement("button");t.classList.add("reactionSummary","jsTooltip"),t.title=window.WoltLabLanguage.getPhrase("wcf.reactions.summary.listReactions"),t.addEventListener("click",()=>{this.dispatchEvent(new Event("showDetails"))}),this.append(t),l.forEach((a,i)=>{let d=document.createElement("span");d.classList.add("reactionCountButton"),i===c&&d.classList.add("selected");let b=document.createElement("span");b.innerHTML=window.REACTION_TYPES[i].renderedIcon,d.append(b);let k=document.createElement("span");k.classList.add("reactionCount"),k.textContent=a.toString(),d.append(k),t.append(d)})}#e(){let l=JSON.parse(this.getAttribute("data"));return this.removeAttribute("data"),new Map(l)}#t(){return parseInt(this.getAttribute("selected-reaction"))}}window.customElements.define("woltlab-core-reaction-summary",e)}window.WoltLabLanguage=ne;window.WoltLabTemplate=V;window.HTMLParsedElement=pe;})(); + }`,L.append(C)}g&&(this.#e.dateTime=p.toISOString(),this.#e.title=b.DateAndTime.format(p));let y;if(this.static)y=this.#e.title;else if(xt?y=this.#t(L,0):p.getTime()>a?y=this.#t(L,-1):y=L.map(W=>W.value).join(""):y=b.DateAndTime.format(p)}else y=b.Date.format(p);y=y.charAt(0).toUpperCase()+y.slice(1),this.#e.textContent=y}#t(g,p){return g.map(y=>y.type==="weekday"?b.TodayOrYesterday.format(p,"day"):y.value).join("")}}window.customElements.define("woltlab-core-date-time",q);let S=()=>{document.querySelectorAll("woltlab-core-date-time").forEach(h=>h.refresh(!1))},z,P=()=>{z=window.setInterval(()=>{i(),S()},6e4)};document.addEventListener("DOMContentLoaded",()=>P(),{once:!0}),document.addEventListener("visibilitychange",()=>{document.hidden?window.clearInterval(z):(S(),P())})}{class e extends HTMLElement{#a;#e;#t=new Map;constructor(){super(),this.#a=document.createElement("button")}connectedCallback(){if(this.hasAttribute("labels")&&(this.#t=new Map(JSON.parse(this.getAttribute("labels"))),this.removeAttribute("labels")),this.#t.size===0)throw new Error("Expected a non empty list of labels.");let l=`${window.WoltLabLanguage.getPhrase("wcf.label.none")}`;this.#a.type="button",this.#a.classList.add("dropdownToggle"),this.#a.innerHTML=l,this.#a.addEventListener("click",a=>{a.preventDefault();let i=new CustomEvent("showPicker");this.dispatchEvent(i)}),this.#a.id=this.id,this.removeAttribute("id"),this.append(this.#a);let c=document.createElement("ul");c.classList.add("scrollableDropdownMenu");for(let[a,i]of this.#t)c.append(this.#s(a,i));if(!this.required){let a=document.createElement("li");a.classList.add("dropdownDivider"),c.append(a,this.#s(0,l))}let t=document.createElement("ul");t.classList.add("dropdownMenu"),t.append(c),this.append(t),this.classList.add("dropdown"),this.closest("form")!==null?(this.#e===void 0&&(this.#e=document.createElement("input"),this.#e.type="hidden",this.#e.name=`labelIDs[${this.dataset.groupId}]`,this.append(this.#e)),this.#e.value=(this.selected||0).toString()):this.#e?.remove(),this.selected&&(this.selected=this.selected)}#s(l,c){let t=document.createElement("button");t.type="button",t.dataset.labelId=l.toString(),t.innerHTML=c,t.addEventListener("click",()=>{this.selected=l});let a=document.createElement("li");return a.append(t),a}set selected(l){this.setAttribute("selected",l.toString()),this.#a.innerHTML=this.#t.get(l)||`${window.WoltLabLanguage.getPhrase("wcf.label.none")}`,this.#e!==void 0&&(this.#e.value=l.toString())}get selected(){let l=parseInt(this.getAttribute("selected"));if(!Number.isNaN(l))return l}set disabled(l){l?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.#a.disabled=l,this.#e&&(this.#e.disabled=l)}get disabled(){return this.hasAttribute("disabled")}set required(l){l?this.setAttribute("required",""):this.removeAttribute("required")}get required(){return this.hasAttribute("required")}}window.customElements.define("woltlab-core-label-picker",e)}{let r=[24,48,96];class l extends HTMLElement{#a;#e;connectedCallback(){this.#a===void 0&&this.#t()}attributeChangedCallback(t,a,i){if(t==="size"){let d=parseInt(i||"");if(!r.includes(d)){let b=parseInt(a||"");r.includes(b)||(b=24),this.setAttribute(t,b.toString())}}}#t(){this.classList.add("loading-indicator"),this.hasAttribute("size")||this.setAttribute("size",24 .toString()),this.#a=document.createElement("fa-icon"),this.#a.size=this.size,this.#a.setIcon("spinner"),this.#e=document.createElement("span"),this.#e.classList.add("loading-indicator__text"),this.#e.textContent=window.WoltLabLanguage.getPhrase("wcf.global.loading"),this.#e.hidden=this.hideText;let t=document.createElement("div");t.classList.add("loading-indicator__wrapper"),t.append(this.#a,this.#e),this.append(t)}get size(){return parseInt(this.getAttribute("size"))}set size(t){if(!r.includes(t))throw new TypeError(`The size ${t} is unrecognized, permitted values are ${r.join(", ")}.`);this.setAttribute("size",t.toString()),this.#a&&(this.#a.size=t)}get hideText(){return this.hasAttribute("hide-text")}set hideText(t){t?this.setAttribute("hide-text",""):this.removeAttribute("hide-text"),this.#e&&(this.#e.hidden=t)}static get observedAttributes(){return["size"]}}window.customElements.define("woltlab-core-loading-indicator",l)}{let e,r=()=>(e===void 0&&(e=window.matchMedia("(max-width: 544px)")),e);class l extends HTMLElement{#a="pagination";connectedCallback(){this.#e(),r().addEventListener("change",()=>this.#e())}#e(){if(this.innerHTML="",this.count<2)return;this.classList.add(`${this.#a}__wrapper`);let t=this.#t();this.append(t);let a=this.#s();a&&t.append(a);let i=document.createElement("ul");i.classList.add(`${this.#a}__list`),t.append(i),i.append(this.#l(1)),this.page>this.thresholdForEllipsis+1&&i.append(this.#i()),this.#f().forEach(b=>{i.append(b)}),this.count-this.page>this.thresholdForEllipsis&&i.append(this.#i()),i.append(this.#l(this.count));let d=this.#o();d&&t.append(d)}#t(){let t=document.createElement("nav");return t.setAttribute("role","navigation"),t.setAttribute("aria-label",window.WoltLabLanguage.getPhrase("wcf.page.pagination")),t.classList.add(this.#a),t}#s(){if(this.page===1)return;let t=document.createElement("div");t.classList.add(`${this.#a}__prev`);let a=this.#r(this.page-1);a instanceof HTMLAnchorElement&&(a.rel="prev"),a.title=window.WoltLabLanguage.getPhrase("wcf.global.page.previous"),a.classList.add("jsTooltip"),t.append(a);let i=document.createElement("fa-icon");return i.setIcon("arrow-left"),a.append(i),t}#o(){if(this.page===this.count)return;let t=document.createElement("div");t.classList.add(`${this.#a}__next`);let a=this.#r(this.page+1);a instanceof HTMLAnchorElement&&(a.rel="next"),a.title=window.WoltLabLanguage.getPhrase("wcf.global.page.next"),a.classList.add("jsTooltip"),t.append(a);let i=document.createElement("fa-icon");return i.setIcon("arrow-right"),a.append(i),t}#r(t){let a,i=this.getLinkUrl(t);return i?(a=document.createElement("a"),a.href=i):(a=document.createElement("button"),a.type="button",this.page===t?a.disabled=!0:a.addEventListener("click",()=>{this.#n(t)})),a.classList.add(`${this.#a}__link`),a}#l(t){let a=document.createElement("li");a.classList.add(`${this.#a}__item`);let i=this.#r(t);return i.setAttribute("aria-label",window.WoltLabLanguage.getPhrase("wcf.page.pageNo",{pageNo:t})),t===this.page&&(i.setAttribute("aria-current","page"),i.classList.add(`${this.#a}__link--current`)),i.textContent=t.toLocaleString(document.documentElement.lang),a.append(i),a}#f(){let t=[],a,i;r().matches?(a=this.page,i=this.page):(a=this.page-1,a===3&&a--,i=this.page+1,i===this.count-2&&i++);for(let d=a;d<=i;d++)d<=1||d>=this.count||t.push(this.#l(d));return t}#i(){let t=document.createElement("li");t.classList.add(`${this.#a}__item`,`${this.#a}__item--ellipsis`);let a=document.createElement("button");return a.type="button",a.title=window.WoltLabLanguage.getPhrase("wcf.page.jumpTo"),a.classList.add("pagination__link","jsTooltip"),a.innerHTML="⋯",a.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("jumpToPage"))}),t.append(a),t}get thresholdForEllipsis(){return r().matches?1:3}getLinkUrl(t){if(!this.url)return"";let a=new URL(this.url);return a.search+=a.search!==""?"&":"?",a.search+=new URLSearchParams([["pageNo",t.toString()]]).toString(),a.toString()}jumpToPage(t){let a=this.getLinkUrl(t);a?window.location.href=a:this.#n(t)}#n(t){let a=new CustomEvent("switchPage",{cancelable:!0,detail:t});this.dispatchEvent(a),a.defaultPrevented||(this.page=t)}get count(){return this.hasAttribute("count")?parseInt(this.getAttribute("count")):0}set count(t){this.setAttribute("count",t.toString()),this.#e()}get page(){return this.hasAttribute("page")?parseInt(this.getAttribute("page")):1}set page(t){this.setAttribute("page",t.toString()),this.#e()}get url(){return this.getAttribute("url")}set url(t){this.setAttribute("url",t),this.#e()}}window.customElements.define("woltlab-core-pagination",l)}{class e extends HTMLElement{connectedCallback(){this.setData(this.#e(),this.#t())}setData(l,c){this.#a(l,c)}get objectId(){return parseInt(this.getAttribute("object-id"))}get objectType(){return this.getAttribute("object-type")}#a(l,c){if(this.innerHTML="",!l.size)return;let t=document.createElement("button");t.classList.add("reactionSummary","jsTooltip"),t.title=window.WoltLabLanguage.getPhrase("wcf.reactions.summary.listReactions"),t.addEventListener("click",()=>{this.dispatchEvent(new Event("showDetails"))}),this.append(t),l.forEach((a,i)=>{let d=document.createElement("span");d.classList.add("reactionCountButton"),i===c&&d.classList.add("selected");let b=document.createElement("span");b.innerHTML=window.REACTION_TYPES[i].renderedIcon,d.append(b);let k=document.createElement("span");k.classList.add("reactionCount"),k.textContent=a.toString(),d.append(k),t.append(d)})}#e(){let l=JSON.parse(this.getAttribute("data"));return this.removeAttribute("data"),new Map(l)}#t(){return parseInt(this.getAttribute("selected-reaction"))}}window.customElements.define("woltlab-core-reaction-summary",e)}window.WoltLabLanguage=ne;window.WoltLabTemplate=V;window.HTMLParsedElement=pe;})(); /** * Handles the low level management of language items. * @@ -94,6 +94,15 @@ Expecting `+Z.join(", ")+", got '"+(this.terminals_[E]||E)+"'":ae="Parse error o * @license GNU Lesser General Public License * @woltlabExcludeBundle all */ +/** + * The `` provides an interactive widget to select a + * label out of a label group. + * + * @author Alexander Ebert + * @copyright 2001-2023 WoltLab GmbH + * @license GNU Lesser General Public License + * @woltlabExcludeBundle all + */ /** * The `` provides a ready-to-use * widget to indicate the loading status of a component to the user.