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

select should always use object internally (remove sometimes array logic) #9

Closed
EdJoPaTo opened this issue Feb 4, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@EdJoPaTo
Copy link
Owner

EdJoPaTo commented Feb 4, 2019

Currently options of the .select() can be an Object or an Array (or a Function returning one of them).
This creates multiple cases internally.

Add a text: (key: string): string as additionalArgs. This defaults to key => key. When options is not an object, create one with text. This will simplify following logic.

@EdJoPaTo EdJoPaTo added the enhancement New feature or request label Feb 4, 2019
@EdJoPaTo EdJoPaTo added this to the v4 milestone Feb 4, 2019
@EdJoPaTo
Copy link
Owner Author

EdJoPaTo commented Feb 4, 2019

Alternatively remove Object completely and only allow text and the key[]. This is easy to understand for the user and most cases can be done with this.

Issue I can think of currently: button text is influenced by the whole array. Then the user logic has to check on it every call. This might be time consuming. The object would do this only once. But: Multiple pages of items could only change the current page of button texts.
Possibly helpful with this might me an additional argument for the text function: text: (ctx, key, arr: key[]): string

@EdJoPaTo
Copy link
Owner Author

solution implemented within the typescript rework: textFunc is available while the key array and the Object are still staying.

This allows for more dynamic usage. Internal logic is done with key[] and textFunc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant