ngneat / dialog

👻 A simple to use, highly customizable, and powerful modal for Angular Applications
https://ngneat.github.io/dialog/
MIT License
394 stars 38 forks source link

feat(config): split up backdrop+escape enableClose #109

Closed jemand771 closed 1 year ago

jemand771 commented 1 year ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] 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?

The config option enableClose applies to both closing using the escape key and clicking on the backdrop

Issue Number: #34

What is the new behavior?

This allows you to only close the dialog on escape press but not backdrop click, or vice versa.

{
  enableClose: {
    backdrop: false,
    escape: true,
  }
}

This implementation is backwards compatible, old values are treated just like before.

{
  enableClose: false
}
// equivalent
{
  enableClose: {
    backdrop: false,
    escape: false,
  }
}

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Currently, for the "object syntax", all (both) keys are required because that seemed reasonable to me. the other option would have been to make them default to true, like the old enableClose does. let me know what you think!

I haven't adjusted the tests yet because I've never done any testing with angular / jasmine / ... I'd imagine we want a kind of matrix test on top of the existing ones.

I'll try to look into that, but feel free comment on the feature/code change already - no need to think about tests if this is not an implementation you would merge :b

closes #34

jemand771 commented 1 year ago

I'm really not sure about the testing part, I tried my best ;) - lmk what you think