Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-barcode-scanner-dialog): added support for custom header and footer slots #10066

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

kgogov
Copy link
Member

@kgogov kgogov commented Oct 21, 2024

Description

This Pull Request introduces support for custom header and footer slots in the ui5-barcode-scanner-dialog component. By adding header and footer slots, developers can now inject custom content into the dialog’s header and footer areas, enhancing flexibility and allowing for more personalized dialog interfaces.

If no custom content is provided, the dialog will use its default header and footer layout, ensuring backward compatibility.

Usage

To utilize custom header and footer content, provide elements with the slot attribute set to header and/or footer:

<ui5-barcode-scanner-dialog id="dlgScanCustom">
  <div slot="header" class="custom-dialog-header">
    <ui5-title level="H2">My Custom Header</ui5-title>
  </div>
  <div slot="footer" class="custom-dialog-footer">
    <ui5-button id="btnCloseDialogCustom" design="Emphasized">My Custom Close Button</ui5-button>
  </div>
</ui5-barcode-scanner-dialog>

Important Note

When you provide custom content for the footer slot, the default close button is not rendered. This means you need to include your own mechanism within the custom footer to close the dialog. Typically, this involves adding a button and attaching an event listener that closes the dialog:

const dialog = document.getElementById('dlgScanCustom');
const closeButton = document.getElementById('btnCloseDialogCustom');

closeButton.addEventListener('click', () => {
  dialog.open = false; // Closes the dialog
});

If you do not provide a custom footer, the dialog will include the default footer with a close button, allowing users to close the dialog without any additional implementation.

Related: #8919

… footer slots

This update introduces two new slot attributes for
`ui5-barcode-scanner-dialog`, allowing developers to customize the header
and footer of the dialog. If no custom content is provided, the dialog
will use its default layout. The new slots enhance flexibility for
developers, enabling the addition of custom titles, buttons, and any
other elements in the header and footer areas.

Related: #8919
@kgogov kgogov force-pushed the feat-barcode-scanner-dialog-custom branch from 56c252c to 352c24b Compare October 22, 2024 07:24
Copy link
Contributor

@xtatica xtatica left a comment

Choose a reason for hiding this comment

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

Added one suggestion.

packages/fiori/src/BarcodeScannerDialog.ts Outdated Show resolved Hide resolved
@kgogov kgogov merged commit 4d06b2e into main Oct 22, 2024
10 checks passed
@kgogov kgogov deleted the feat-barcode-scanner-dialog-custom branch October 22, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants