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

Add MDL Dialog #44

Closed
mseemann opened this issue Aug 28, 2016 · 6 comments
Closed

Add MDL Dialog #44

mseemann opened this issue Aug 28, 2016 · 6 comments
Assignees

Comments

@mseemann
Copy link
Owner

No description provided.

@elvisbegovic
Copy link

+1, it's must have feature :)

@david-lehmann
Copy link

+1. I really need the Dialog for my project...

@crain
Copy link

crain commented Sep 14, 2016

Are there already plans to implement this feature or design thoughts?

I started with a very basic implementation which you can find here:

http://plnkr.co/edit/okxSWbE7JdFNzoNSaTuS?p=preview

I am using a directive to attach it to the dialog tag(placed within body which is requirement by the polyfill I used) and a singleton service to show/hide a component within a dialog.

Issues I came accross:

  • modal stop working as soon as you navigate away, come back and try to open the modal again(throws: Failed to execute 'showModal' on 'HTMLDialogElement': The element is not in a Document)
  • components are created dynamically and therefore they need to be specified within entryComponents to have them available within the component factory. Since the wrapper component has to be at the body level it needs to be declared in the top module. Therefore all components I want to display in the dialog needs to be declared in declarations/entrycomponents within the top module. Although I would like to declare them only in the module where I would need them
  • since the service is a singleton you can't implement like close callbacks as you can't control which dialog you are subscribing to

The solution does not feel 100% right to me but it works.

@mseemann
Copy link
Owner Author

Hi, thx for your work!

There are plans for the dialog but i didn't start working on it. Also there is no design document but some requirements i have in mind (don't know if they all are feasible):

  • the user of the dialog should set a ViewContainerRef like it is done in the MdlSnackbarService to set the html parent element of the dialog.
  • there should be an easy to use api for simple dialogs (scratch version of an api):
dislogServcie.showDialog({
   message: string;
  actions?: [{
    handler: () => void;
    text: string;
   isClosingAction: boolean;
  }];
  vcRef?: ViewContainerRef;
  isModal: boolean = true;
}): Promise<MdlDialogComponent>;
  • it should be possible to provide a component instead of the message (will be the dialog content)
  • it should be possible to provide a component for the full dialog (content, actions, ...)
  • it should be possible to open more than one dialog (the last dialog stays on top)
  • if possible it should not be necessary to include a 3rd party polyfill - or the polyfill should be part of this package (to make the usage as easy as possible)
  • it should not add any css that must be themed - because i want this package to work with the original mdl css (like https://code.getmdl.io/1.2.1/material.indigo-pink.min.css). Using the scss form the sources should be an option but not a requirement.
  • ...

I'm always happy to include pull requests. They don't need to be perfect but well tested. we can mark the DialogService as @experimental and play around a little bit with the dialogService and see what other users think about our solution!

@mseemann mseemann self-assigned this Sep 22, 2016
@mseemann mseemann added the WIP label Sep 22, 2016
@sunilkumar707
Copy link

+1 Why is this feature missing?

@mseemann
Copy link
Owner Author

will be part of the next release. already in the master...

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

No branches or pull requests

5 participants