Skip to content

feat(context-menu): implementa componente po-context-menu e melhorias em po-menu/po-tabs#2782

Open
anderson-gregorio-totvs wants to merge 4 commits intomasterfrom
context-menu/DTHFUI-12510
Open

feat(context-menu): implementa componente po-context-menu e melhorias em po-menu/po-tabs#2782
anderson-gregorio-totvs wants to merge 4 commits intomasterfrom
context-menu/DTHFUI-12510

Conversation

@anderson-gregorio-totvs
Copy link
Copy Markdown
Contributor

@anderson-gregorio-totvs anderson-gregorio-totvs commented Mar 26, 2026

Summary

Implementa o novo componente po-context-menu e adiciona melhorias nos componentes po-menu e po-tabs. Também refatora o processador de documentação para inferir automaticamente inputs/outputs baseados em signals (input(), output(), model()), removendo a necessidade das tags JSDoc @Input/@Output manuais.

po-context-menu (novo)

  • Componente base com propriedades: contextTitle, title, items, expanded (model), itemSelected (output)
  • Componente principal com template, tooltip handling, seleção de itens e suporte a i18n
  • Interface PoContextMenuItem com label, icon e action
  • Módulo, samples (basic, labs, user) e estilos no portal
  • Testes unitários para base e componente principal (100% coverage)

po-menu

  • Novo output p-expanded via signal (expanded = output<boolean>)
  • Novo output p-toggle via signal (toggleChange = output<boolean>)
  • Método privado setCollapsed() centraliza mudanças de collapsed e emite toggleChange
  • Spec migrado de @Directive para @Component com TestBed

po-tabs

  • Novo método público activateTab(id) para ativar aba programaticamente
  • Novo output p-activated-tab via signal no PoTabBaseComponent
  • id promovido de propriedade interna para @Input('id')
  • Spec migrado de @Directive para @Component com TestBed

Documentação (portal)

  • Processador functions.js agora infere input(), input.required(), output() e model() automaticamente
  • Removidas tags @Input/@Output manuais de ~15 componentes (po-button, po-skeleton, po-popover, po-widget, po-field/*, etc.)
  • Removidos registros Input/Output de configuration.js

Review & Testing Checklist for Human

  • @Input('id') no po-tab-base: Faz shadow do atributo HTML nativo id. Verificar se isso causa efeitos colaterais em templates existentes que já usam id no elemento <po-tab>. Possível breaking change.
  • Processador de documentação: Verificar que a doc do portal gera corretamente após remover as tags @Input/@Output. Rodar npm run build:portal e inspecionar a saída. Signal outputs são tipados como EventEmitter no processador — confirmar que o portal renderiza corretamente.

Plano de teste sugerido:

  1. npm run test:ui — confirmar que todos os ~8688 testes passam
  2. npm run build seguido de npm run build:portal — verificar a geração da documentação
  3. Testar o componente po-context-menu nos samples do portal (basic, labs, user)
  4. Testar activateTab() programaticamente em uma página com po-tabs

Link to Devin session: https://totvs.devinenterprise.com/sessions/6e6fa3fa93d844ebaa94c48a73edfc14
Requested by: @anderson-gregorio-totvs


Open with Devin

App de Exemplo:
DTHFUI-12510.zip

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

@anderson-gregorio-totvs anderson-gregorio-totvs force-pushed the context-menu/DTHFUI-12510 branch 3 times, most recently from d3eebb2 to d91503d Compare March 26, 2026 18:57
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 11 additional findings in Devin Review.

Open in Devin Review

Comment on lines +524 to +530
public activateTab(id: string) {
const tab = this.tabsChildrenArray.find(x => x.id === id);

if (tab) {
this.selectedTab(tab);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 activateTab does not deactivate the previously active tab for non-dropdown tabs

The new activateTab method calls selectedTab, which only invokes onTabActive (responsible for deactivating the previous tab and emitting activatedTab) when the target tab is in the overflow dropdown (po-tabs.component.ts:259-261). For tabs that are already visible (not in the dropdown), onTabActive is never called. This means:

  1. The previously active tab is never deactivated, resulting in two simultaneously active tabs.
  2. The activatedTab output event is never emitted (po-tabs.component.ts:219).

This directly breaks the bidirectional sync in sample-po-context-menu-user, where onItemSelected calls this.tab().activateTab(value.label) and onActivatedTab listens for (p-activated-tab) to sync the context menu selection back.

Suggested change
public activateTab(id: string) {
const tab = this.tabsChildrenArray.find(x => x.id === id);
if (tab) {
this.selectedTab(tab);
}
}
public activateTab(id: string) {
const tab = this.tabsChildrenArray.find(x => x.id === id);
if (tab) {
this.onTabActive(tab);
this.selectedTab(tab);
}
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants