You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm considering adding left/right support using the grid logic for actions in prompt-grid.
Here is what I think it would entail:
if options.grid is not undefined, enable grid support. the option might be set on prompt-base options or prompt-choices, I'm not sure yet. Depending on which, it could either be a boolean or an object of arrays (for actually defining the grid choices)
We can do something in prompt-choices where if options.grid is true, then we handle the choices array in a special way. Since .position on prompt-choices is the position in the choices array, I think we can either keep the choices array flat and add helper methods for doing grid math for moving the position, or we can make the choices array a nested array for row and column elements and make position an object: {row: 0, col: 0} or array: [0,0] for grid points.
I prefer the first choice if we many grid elements on the choices object (since this will just add functionality and still be compatible with other prompt types).
If we want to add a new grid property that handles grids differently than choices, then I think the second option would be the way to go.
After typing it out, I think the first choice (a single choices array and methods for doing grid operations) would be the best way to go. These methods would be similar to what's in prompt-grid like toPosition and toIndex. We may be able to offer transform methods to transform a nested array (grid) into the array of choices and back into a grid so users can populate their question choices more easily.
So yeah, I think it's a good idea to include "grid" methods in prompt-choices and include some default actions that use those methods here.
I'm considering adding left/right support using the grid logic for actions in prompt-grid.
Here is what I think it would entail:
options.grid
is not undefined, enable grid support. the option might be set onprompt-base
options orprompt-choices
, I'm not sure yet. Depending on which, it could either be a boolean or an object of arrays (for actually defining the grid choices)left
,right
,moveLeft
andmoveRight
actions@doowb thoughts?
The text was updated successfully, but these errors were encountered: