Godofbrowser / vuejs-dialog

A lightweight, promise based alert, prompt and confirm dialog
MIT License
351 stars 111 forks source link

Feature request: text prompt #41

Closed symonsoft closed 5 years ago

symonsoft commented 6 years ago

I think it will be useful to have ability to prompt for text information in a single (single/multiple line) text field. Is it likely to implement such a feature?

symonsoft commented 6 years ago

Oh I see after some code investigation that it's almost possible with:

let options = {
  message: 'Prompt title',
  verification: '',
  verificationHelp: 'Prompt message'
}

this.$dialog.open('prompt', options)
  .then((dialog) => {
    console.log('Input text: ' + dialog.data)  // always null
  })

But dialog.data is always null.... Then requesting dialog.data for input text and something simplier like:

this.$dialog.prompt('Prompt message')
    .then((dialog) => {
      console.log('Input text: ' + dialog.data)
    })

I think it would be a very useful feature.

jlsjonas commented 5 years ago

that's actually what a "prompt" is in a javascript context... which it claims to have but actually doesn't support

https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt

Godofbrowser commented 5 years ago

Hi, I've been tight on schedule. I'll try to implement this feature this weekend

symonsoft commented 5 years ago

@Godofbrowser Please, don't forget and abandon your thankful users! We still hope for the release.

jlsjonas commented 5 years ago

@symonsoft as he has shown interest in implementing it, but is just too tight on schedule; maybe you could make a PR for it? 😉 (I'm using dialog from Buefy for my purposes, as we were using Bulma styling already anyway)

Godofbrowser commented 5 years ago

So sorry guys, i'm currently adding this feature. I'm hoping an hour would be enough

jlsjonas commented 5 years ago

That also works :)

No problem, we all have lives besides open source code too ;)

Godofbrowser commented 5 years ago

Meaanwhile, this can be done easily with custom view. i have a sample implementation (basic) where i'm using a custom view to show a cropper for photo uploads.

https://snag.gy/OVAHkd.jpg

https://snag.gy/Q3RZjB.jpg

https://snag.gy/O6YMXz.jpg

https://snag.gy/CxVNg9.jpg

Godofbrowser commented 5 years ago

48 Will resolve this