-
Notifications
You must be signed in to change notification settings - Fork 389
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
Introduce reusable number input field with delta support #18531
base: master
Are you sure you want to change the base?
Conversation
@CarlosFdez I believe you're the right person to ping on this. It is a draft intended to show a possible solution for #18472. I'm proposing to extend the |
} | ||
|
||
if (triggerChange) { | ||
$(input).trigger("change"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trigger does not appear to be anywhere else in the system, but the base Item sheet does programmatically dispatch a change event (here). I want to clarify that it needs to be done this way - or a standard Event with bubbling enabled - because of the way jQuery is internally (in the Foundry form application) setup to catch the data submission and actually apply the value changes to the data model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a sheet helpers you could probably stick this in, but if this is possible with a regular event ideally use that instead, we're trying to get off jquery (core will eventually do so as well).
I'm wondering how well throttling the change would work, so that repeated hits down submit immediately and it behaves "smoother". Maybe a future consideration.
@@ -34,7 +34,7 @@ | |||
</div> | |||
<div class="exp-data"> | |||
<div class="exp-input"> | |||
<input name="system.details.xp.value" type="text" value="{{data.details.xp.value}}" data-dtype="Number" data-allow-delta placeholder="0" size="4" /> | |||
<input name="system.details.xp.value" type="text" value="{{data.details.xp.value}}" data-dtype="Number" data-allow-delta data-min="0" data-max="{{data.details.xp.max}}" placeholder="0" size="4" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure but there is probably a valid use case in not having a max, due to spillover.
Repurposing data-allow-delta sounds fine to me |
Expands on the existing
input[data-allow-delta]
to support keyboard delta (ArrowUp/Down) and (eventually) mousewheel support, specifically for editable character sheet fields such as XP, special resources, and HP.