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

FR: multiSelect or mix and match input and select in multiInput #6

Closed
jcurtis-cc opened this issue Mar 16, 2022 · 5 comments
Closed

Comments

@jcurtis-cc
Copy link

Awesome extension of electron-prompt!

Being able to mix and match select with input in a multiinput would be ideal - or is this already supported?

@Araxeus
Copy link
Owner

Araxeus commented Mar 17, 2022

Sorry but mixing prompt styles is not supported (yet), all prompts have a single purpose right now

If you want, you could try making such an option 🙂

@jcurtis-cc
Copy link
Author

jcurtis-cc commented Mar 17, 2022 via email

@Araxeus
Copy link
Owner

Araxeus commented Mar 18, 2022

Look great to me, just nit style thing in the example you added to readme:

the height param should be removed from this example since 150 is too low and the default is fine

also the "value" attribute needs some more spaces before it, so you could use

prompt({
    title: "credentials",
    label: "Login Info:",
    type: "multiInput",
    multiInputOptions:
        [
            {
                inputAttrs:
                {
                    type: "email",
                    required: true,
                    placeholder: "email"
                }
            },
            {
                inputAttrs:
                {
                    type: "password",
                    placeholder: "password"
                }
            },
            {
                selectOptions: { na: "North America", eu: "Europe", other: "Other" },
				value: "2"
            }
        ],
    resizable: true,
    width: 300,
}, win).then(input => console.log(`input == ${input}`)).catch(console.error)

also in prompt.js replace lines 83-94 with

	if (promptOptions.type !== "multiInput") {
		if (promptOptions.type !== "keybind") {
			dataElement.setAttribute("id", "data");

			if (promptOptions.type !== "counter") {
				dataContainerElement.append(dataElement);
			}

			if (promptOptions.type !== "select") {
				dataElement.select();
			}
		}

		dataElement.focus?.();
	}

or something along this lines to stop the program from trying to select/focus the last element in the multiInput
(which causes an error if the last element is a select element and it tries to select it, all I had to do was reorder the example your provided)

anyhow you're welcome to open a PR, and propose any changes you deem appropriate

@jcurtis-cc
Copy link
Author

jcurtis-cc commented Mar 18, 2022 via email

lysdexic-audio added a commit to lysdexic-audio/custom-electron-prompt that referenced this issue Mar 19, 2022
lysdexic-audio added a commit to lysdexic-audio/custom-electron-prompt that referenced this issue Mar 19, 2022
lysdexic-audio added a commit to lysdexic-audio/custom-electron-prompt that referenced this issue Mar 19, 2022
lysdexic-audio added a commit to lysdexic-audio/custom-electron-prompt that referenced this issue Mar 19, 2022
@Araxeus
Copy link
Owner

Araxeus commented Apr 22, 2022

Added in #7

@Araxeus Araxeus closed this as completed Apr 22, 2022
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

No branches or pull requests

2 participants