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

Fix issue #15 #30

Merged
merged 11 commits into from
Dec 10, 2024
Merged

Fix issue #15 #30

merged 11 commits into from
Dec 10, 2024

Conversation

shhdharmen
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md#commit
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #15

What is the new behavior?

  • Fixes grouping
  • Introduces new builder pattern to achieve pre-grouping
    const parentBuilder = new HotToastBuilder(ngTemplateGroup, toast)
    .setOptions({
      position: 'top-right',
      autoClose: false,
      className: 'hot-toast-custom-class',
      group: {
        className: 'hot-toast-custom-class'
      }
    });
    
    // Create child toasts
    const children = childNotifications(ngTemplateGroupItem).map((child) => {
      return new HotToastBuilder(child.options.message, toast)
        .setOptions(child.options);
    });
    
    // Add children to parent
    children.forEach((child) => parentBuilder.addChild(child));
    
    // Create the toast with all children (but don't show yet)
    const parentRef = parentBuilder.create();
    
    // Once all refs are attached, show the parent toast
    parentRef.afterGroupRefsAttached.subscribe(() => {
      parentRef.show();
    });

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

shhdharmen and others added 11 commits December 6, 2024 19:36
`// Create parent toastconst parent = new HotToastBuilder(template, toast)  .setOptions({
position: 'top-right',    className: 'custom-class'  });// Add childrennotifications.map(n =>   new
HotToastBuilder(n.message, toast)    .setOptions(n.options)).forEach(child =>
parent.addChild(child));// Create and show when readyconst ref =
parent.create();ref.afterGroupRefsAttached.subscribe(() => ref.show());`

fix #9
# [3.1.0-beta.1](v3.0.2...v3.1.0-beta.1) (2024-12-07)

### Bug Fixes

* filter undefined refs from group, add test cases ([af1ed00](af1ed00)), closes [#9](#9)

### Features

* add new builder pattern to handle pre-grouping ([8b59a9a](8b59a9a)), closes [#9](#9)
# [3.1.0-beta.2](v3.1.0-beta.1...v3.1.0-beta.2) (2024-12-10)

### Bug Fixes

* assign statically increasing ids to toasts ([c3ec7a1](c3ec7a1)), closes [#15](#15)
* revert toastref.groupref assignment ([a99204a](a99204a))
@shhdharmen shhdharmen merged commit 8507365 into main Dec 10, 2024
2 checks passed
@shhdharmen shhdharmen deleted the beta branch December 10, 2024 06:42
Copy link

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@shhdharmen
Copy link
Contributor Author

🎉 This PR is included in version 3.1.0-beta.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants