renderOptions method private presentation

Last updated: 2026-03-04T23:21:38.428Z

Metrics

LOC: 34 Complexity: 7 Params: 2

Signature

renderOptions( filtered: Array<SelectOption & { groupLabel?: string }>, ): : void

Source Code

  private renderOptions(
    filtered: Array<SelectOption & { groupLabel?: string }>,
  ): void {
    if (!this.dropdown) return;

    if (filtered.length === 0) {
      this.dropdown.innerHTML = `<li class="fa-ss__empty" role="option">Nenhum resultado</li>`;
      return;
    }

    const html: string[] = [];
    let lastGroup: string | undefined = undefined;

    for (const opt of filtered) {
      if (opt.groupLabel !== lastGroup) {
        lastGroup = opt.groupLabel;
        if (opt.groupLabel) {
          html.push(
            `<li class="fa-ss__group" role="presentation">${escHtml(opt.groupLabel)}</li>`,
          );
        }
      }
      const selected = opt.value === this._value;
      html.push(
        `<li class="fa-ss__opt${selected ? " fa-ss__opt--selected" : ""}"
             role="option"
             aria-selected="${selected}"
             data-value="${escHtml(opt.value)}"
         >${escHtml(opt.label)}</li>`,
      );
    }

    this.dropdown.innerHTML = html.join("");
  }

Dependencies (Outgoing)

graph LR renderOptions["renderOptions"] escHtml["escHtml"] renderOptions -->|calls| escHtml style renderOptions fill:#dbeafe,stroke:#2563eb,stroke-width:2px click renderOptions "54a1a560d2655759.html" click escHtml "a8da31674bb8fbd0.html"
TargetType
escHtml calls

No incoming dependencies.