feat: add ProgressBar element#95
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
ProgressBarelement for displaying determinate and indeterminate progress.The element supports:
Preview
Usage
Determinate progress
Indeterminate progress
Custom value formatting
Configuration API
Titlestring"Progress"Descstring?nilValuenumber | table0{ Min, Max, Default }.Minnumber0Valuetable.Maxnumber100Valuetable.DefaultnumberMinValuetable.IndeterminatebooleanfalseShowValuebooleannot IndeterminateDisplayModestring"Percent""Percent","Value", or"Fraction".Formatfunction?nilAnimatebooleantrueAnimationDurationnumber0.15Speednumber1Widthnumber160ValueWidthnumber44ControlGapnumber16IndeterminateTextstring""ShowValueis enabled.Invalid, infinite, and
NaNnumeric values are ignored. Values are automatically clamped to the configured range, and inverted ranges are normalized.Methods
Set(Value)Updates and clamps the current value.
Get()Returns the current value.
GetPercentage()Returns the normalized percentage between
0and100.SetRange(Min, Max)Updates the complete range and clamps the current value if necessary.
SetMin(Min)Updates the minimum value.
SetMax(Max)Updates the maximum value.
Standard WindUI element methods such as
SetTitle,SetDesc,Highlight, andDestroyremain available.Theme keys
The element introduces the following fallback theme keys:
ProgressBarProgressBarTrackProgressBarTrackTransparencyProgressBarTextExisting themes work automatically through the fallback system.
Testing
All public configuration properties and methods documented above were manually tested, including:
Percent,Value, andFractiondisplay modes.Min,Max,Default} value tables.Set,Get,GetPercentage,SetRange,SetMin, andSetMax.Automated and build verification:
git diff --checkpassed.dist/main.luaandsourcemap.jsonare intentionally excluded from this PR.