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

Fixed #1027 - Knob: Allow a label function for greater flexibility #5569

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

dispatchrabbi
Copy link
Contributor

@dispatchrabbi dispatchrabbi commented Apr 11, 2024

Background

Though #1027 is closed, I had a use case for more flexible labeling and decided to see if I could make this happen. My use case is that I am using the Knob component to show progress toward a goal; the data is kept in minutes, but the display should format it to show hours and minutes. There's no way to do that with a template string, so I hope that this PR gets accepted soon.

Approach

To be honest, this PR isn't doing much that isn't already implemented in https://github.com/kramer99/vue-knob-control/blob/master/src/KnobControl.vue. I retained the ability to pass a template string for backward compatibility. I also specifically checked to make sure that reactivity still works when a function was passed, since that was the original reason to reject #1027.

I also added tests for both a string template and passing a function. Those tests pass, but it looks like InputNumber has a couple of failing tests (which were failing before I started work on this - I didn't want to delve into fixing those because it seemed irrelevant to this PR).

I also modified the docs, though the doc structure is a bit confusing and there are no contributing docs or other instructions I could find, so I apologize in advance if I've missed something. Happy to make any changes needed or take any feedback.

Thank you for your hard work! I've been enjoying using PrimeVue to power my app TrackBear.

Copy link

vercel bot commented Apr 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 10:04pm
primevue-v4 ⬜️ Ignored (Inspect) Visit Preview Apr 11, 2024 10:04pm

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

Successfully merging this pull request may close these issues.

None yet

2 participants