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

issue : #109 #110

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
- Edit[F2] Immutable item in AddTolist/AddtoMaskEditList control
- Fixed bug :
- CTRL-V (paste data) does not show input in some controls
- Fixed bug :
- Refinement of Unicode symbol rendering in all controls (Corret render)

## Features
[**Top**](#table-of-contents)
Expand Down
13 changes: 12 additions & 1 deletion Samples/CalendarSamples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
PromptPlus.WriteLine($"You input is {cld.Value}");
}

var typelayout = Enum.GetValues(typeof(CalendarLayout));
foreach (var type in typelayout)
{
PromptPlus.DoubleDash($"Control:Calendar ({cult.Name}) - layout {type}");
PromptPlus
.Calendar("Date", "Select date")
.Layout((CalendarLayout)Enum.Parse(typeof(CalendarLayout), type.ToString()!))
.Run();
}


PromptPlus.DoubleDash($"Control:Calendar DateTime - with overwrite culture:pt-br.");

cld = PromptPlus
Expand All @@ -44,7 +55,7 @@

PromptPlus
.Calendar("Date", "Select date")
.Layout(CalendarLayout.HeavyGrid)
.Layout(CalendarLayout.SingleGrid)
.DisabledWeekends()
.Run();

Expand Down
5 changes: 5 additions & 0 deletions Src/Controls/BaseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ internal string Symbol(SymbolType schema)
{
return _optSymbols[schema].unicode;
}
return SymbolUnSupported(schema);
}

internal string SymbolUnSupported(SymbolType schema)
{
return _optSymbols[schema].value;
}

Expand Down
492 changes: 55 additions & 437 deletions Src/Controls/Calendar/CalendarControl.cs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Src/Controls/Calendar/CalendarLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public enum CalendarLayout
/// <summary>
/// Acsii double grid
/// </summary>
AsciiDoubleGrid,
/// <summary>
/// Heavy line grid
/// </summary>
HeavyGrid
AsciiDoubleGrid
}
}
72 changes: 12 additions & 60 deletions Src/Controls/Chart/ChartBarControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,43 +564,19 @@
}
}
var maxlengthlabel = _options.Labels.Max(x => x.Label.Length);
char charbarOn = ' ';
char barOn = ' ';
switch (barType)
{
case ChartBarType.Fill:
{
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
break;
case ChartBarType.Light:
{
charbarOn = '─';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '-';
}
}
barOn = _options.Symbol(SymbolType.ChartLight)[0];
break;
case ChartBarType.Heavy:
{
charbarOn = '━';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '=';
}
}
barOn = _options.Symbol(SymbolType.ChartHeavy)[0];
break;
case ChartBarType.Square:
{
charbarOn = '■';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
barOn = _options.Symbol(SymbolType.ChartSquare)[0];
break;
default:
throw new PromptPlusException($"Not implemented {barType}");
Expand Down Expand Up @@ -638,13 +614,13 @@
}
if (_options.CurrentShowLegend)
{
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
else
{
screenBuffer.AddBuffer(item.Label.PadRight(maxlengthlabel) , _options.StyleContent(ChartStyles.ChartLabel));
screenBuffer.AddBuffer(": ",Style.Default, false, false);
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
if (!_options.HideValueBar)
{
Expand All @@ -668,7 +644,7 @@

private void WriteStackBar(ScreenBuffer screenBuffer, ChartBarType barType, double ticketStep)
{
char charbarOn = ' ';
char barOn = ' ';
if (!_options.OptMinimalRender)
{
if (!(string.IsNullOrEmpty(_options.OptPrompt) && string.IsNullOrEmpty(_options.OptDescription)))
Expand All @@ -683,39 +659,15 @@
switch (barType)
{
case ChartBarType.Fill:
{
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
break;
case ChartBarType.Light:
{
charbarOn = '─';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '-';
}
}
barOn = _options.Symbol(SymbolType.ChartLight)[0];
break;
case ChartBarType.Heavy:
{
charbarOn = '━';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = '=';
}
}
barOn = _options.Symbol(SymbolType.ChartHeavy)[0];
break;
case ChartBarType.Square:
{
charbarOn = '■';
if (!ConsolePlus.IsUnicodeSupported)
{
charbarOn = _options.CharBar;
}
}
barOn = _options.Symbol(SymbolType.ChartSquare)[0];
break;
default:
throw new PromptPlusException($"Not implemented {barType}");
Expand All @@ -741,7 +693,7 @@
tkt = 1;
}
}
screenBuffer.AddBuffer(new string(charbarOn, tkt), OnStyle, false, true);
screenBuffer.AddBuffer(new string(barOn, tkt), OnStyle, false, true);
}
}

Expand All @@ -766,7 +718,7 @@
foreach (var item in _options.Labels.Skip(inipos).Take(pagesize))
{
screenBuffer.NewLine();
screenBuffer.AddBuffer("■", _options.StyleContent(StyleControls.ChartLabel).Foreground(item.ColorBar.Value), false, false);
screenBuffer.AddBuffer(_options.Symbol(SymbolType.ChartLabel), _options.StyleContent(StyleControls.ChartLabel).Foreground(item.ColorBar.Value), false, false);
Dismissed Show dismissed Hide dismissed
screenBuffer.AddBuffer(" ", _options.StyleContent(StyleControls.ChartLabel), false, false);
screenBuffer.AddBuffer($"{item.Label.PadRight(maxlengthlabel)}", _options.StyleContent(StyleControls.ChartLabel));
if (_options.ShowLegendValue || _options.ShowLegendPercent)
Expand Down
Loading
Loading