add readonly password reveal

This commit is contained in:
TheXamlGuy
2024-07-06 17:01:50 +01:00
parent 0507c21a43
commit ee79b97416
18 changed files with 212 additions and 24 deletions
+17 -1
View File
@@ -10,6 +10,22 @@
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness>
</SettingsExpander.Resources>
<SettingsExpander.Action>
<Button
Grid.Column="1"
MinWidth="30"
MinHeight="40"
Margin="8,0,0,0"
Padding="5,0,5,0"
Theme="{StaticResource TransparentButton}">
<Viewbox Width="14" Height="14">
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 6.24 11.799999 C 6.239999 12.146667 6.119999 12.440001 5.88 12.679999 C 5.64 12.92 5.346666 13.039999 5 13.039999 C 4.653333 13.039999 4.36 12.92 4.12 12.679999 C 3.88 12.440001 3.76 12.146667 3.76 11.799999 C 3.76 11.453333 3.88 11.16 4.12 10.919999 C 4.36 10.679999 4.653333 10.559999 5 10.559999 C 5.346666 10.559999 5.64 10.679999 5.88 10.919999 C 6.119999 11.16 6.239999 11.453333 6.24 11.799999 Z M 11.24 11.799999 C 11.24 12.146667 11.12 12.440001 10.88 12.679999 C 10.639999 12.92 10.346666 13.039999 10 13.039999 C 9.653333 13.039999 9.359999 12.92 9.12 12.679999 C 8.879999 12.440001 8.76 12.146667 8.76 11.799999 C 8.76 11.453333 8.879999 11.16 9.12 10.919999 C 9.359999 10.679999 9.653333 10.559999 10 10.559999 C 10.346666 10.559999 10.639999 10.679999 10.88 10.919999 C 11.12 11.16 11.24 11.453333 11.24 11.799999 Z M 15 13.039999 C 15.346665 13.039999 15.639999 12.92 15.88 12.679999 C 16.119999 12.440001 16.24 12.146667 16.24 11.799999 C 16.24 11.453333 16.119999 11.16 15.88 10.919999 C 15.639999 10.679999 15.346665 10.559999 15 10.559999 C 14.653333 10.559999 14.36 10.679999 14.12 10.919999 C 13.879999 11.16 13.759998 11.453333 13.759999 11.799999 C 13.759998 12.146667 13.879999 12.440001 14.12 12.679999 C 14.36 12.92 14.653333 13.039999 15 13.039999 Z " />
</Viewbox>
</Button>
</SettingsExpander.Action>
<SettingsExpander.Footer>
<Grid>
<DatePicker SelectedDate="{Binding Value}">
@@ -52,7 +68,7 @@
<Setter Property="IsVisible" Value="True" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactThemePadding}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Foreground">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Opacity="0.7" Color="{DynamicResource TextFillColorPrimary}" />
</Setter.Value>
+145 -8
View File
@@ -7,33 +7,169 @@
Header="{Binding Key}"
IsExpanded="False">
<SettingsExpander.Resources>
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactThemePadding">0</Thickness>
<Thickness x:Key="TextControlMargin">0</Thickness>
<Thickness x:Key="TextControlPadding">10,5,6,6</Thickness>
<Thickness x:Key="TextControlCompactPadding">0</Thickness>
<Thickness x:Key="TextControlCompactMargin">0,-3,0,0</Thickness>
<Thickness x:Key="MoreButtonMargin">8,0,0,0</Thickness>
<Thickness x:Key="MoreButtonPadding">5,0,5,0</Thickness>
<x:Double x:Key="MoreButtonMinWidth">30</x:Double>
<x:Double x:Key="MoreButtonMinHeight">40</x:Double>
<BooleanToPasswordCharConverter x:Key="BooleanToPasswordCharConverter" PasswordChar="&#x25CF;" />
</SettingsExpander.Resources>
<SettingsExpander.Action>
<Button
Grid.Column="1"
Width="{StaticResource ButtonWidth}"
Height="{StaticResource ButtonHeight}"
MinWidth="{StaticResource MoreButtonMinWidth}"
MinHeight="{StaticResource MoreButtonMinHeight}"
Margin="{StaticResource MoreButtonMargin}"
Padding="{StaticResource MoreButtonPadding}"
Theme="{StaticResource TransparentButton}">
<Viewbox Width="14" Height="14">
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 3.28 13.4 C 3.493333 12.333333 3.926666 11.373333 4.58 10.52 C 5.233333 9.666667 6.033333 9 6.98 8.52 C 7.926666 8.039999 8.933332 7.799999 10 7.799999 C 11.066666 7.799999 12.073333 8.039999 13.02 8.52 C 13.966666 9 14.766666 9.666667 15.42 10.52 C 16.073334 11.373333 16.52 12.333333 16.76 13.4 C 16.786667 13.533333 16.853333 13.639999 16.959999 13.719999 C 17.066666 13.799999 17.186665 13.826666 17.32 13.799999 C 17.453333 13.773333 17.559999 13.699999 17.639999 13.579999 C 17.719999 13.459999 17.746666 13.333333 17.719999 13.2 C 17.453333 11.973333 16.946667 10.873333 16.199999 9.9 C 15.453332 8.926666 14.539999 8.166667 13.46 7.62 C 12.379999 7.073334 11.226666 6.8 10 6.799999 C 8.773333 6.8 7.62 7.073334 6.54 7.62 C 5.46 8.166667 4.546667 8.926666 3.8 9.9 C 3.053333 10.873333 2.546666 11.973333 2.28 13.2 C 2.253333 13.333333 2.28 13.459999 2.36 13.579999 C 2.44 13.699999 2.546667 13.773333 2.68 13.799999 C 2.813333 13.826666 2.933333 13.799999 3.04 13.719999 C 3.146666 13.639999 3.226666 13.533333 3.28 13.4 Z M 10 9.799999 C 9.039999 9.799999 8.213333 10.139999 7.52 10.82 C 6.826666 11.5 6.486667 12.326666 6.5 13.299999 C 6.513333 14.273333 6.86 15.099999 7.54 15.779999 C 8.219999 16.459999 9.039999 16.799999 10 16.799999 C 10.959999 16.799999 11.786666 16.459999 12.48 15.779999 C 13.173332 15.099999 13.519999 14.273333 13.52 13.299999 C 13.519999 12.326666 13.173332 11.5 12.48 10.82 C 11.786666 10.139999 10.959999 9.799999 10 9.799999 Z M 7.52 13.28 C 7.493333 12.613334 7.726666 12.033333 8.22 11.539999 C 8.713333 11.046666 9.306666 10.799999 10 10.799999 C 10.693333 10.799999 11.28 11.046666 11.759999 11.539999 C 12.239999 12.033333 12.486666 12.62 12.5 13.299999 C 12.513332 13.98 12.273333 14.566667 11.78 15.059999 C 11.286667 15.553333 10.693333 15.799999 10 15.799999 C 9.306666 15.799999 8.719999 15.553333 8.24 15.059999 C 7.759999 14.566667 7.52 13.973333 7.52 13.28 Z " />
Data="F1 M 6.24 11.799999 C 6.239999 12.146667 6.119999 12.440001 5.88 12.679999 C 5.64 12.92 5.346666 13.039999 5 13.039999 C 4.653333 13.039999 4.36 12.92 4.12 12.679999 C 3.88 12.440001 3.76 12.146667 3.76 11.799999 C 3.76 11.453333 3.88 11.16 4.12 10.919999 C 4.36 10.679999 4.653333 10.559999 5 10.559999 C 5.346666 10.559999 5.64 10.679999 5.88 10.919999 C 6.119999 11.16 6.239999 11.453333 6.24 11.799999 Z M 11.24 11.799999 C 11.24 12.146667 11.12 12.440001 10.88 12.679999 C 10.639999 12.92 10.346666 13.039999 10 13.039999 C 9.653333 13.039999 9.359999 12.92 9.12 12.679999 C 8.879999 12.440001 8.76 12.146667 8.76 11.799999 C 8.76 11.453333 8.879999 11.16 9.12 10.919999 C 9.359999 10.679999 9.653333 10.559999 10 10.559999 C 10.346666 10.559999 10.639999 10.679999 10.88 10.919999 C 11.12 11.16 11.24 11.453333 11.24 11.799999 Z M 15 13.039999 C 15.346665 13.039999 15.639999 12.92 15.88 12.679999 C 16.119999 12.440001 16.24 12.146667 16.24 11.799999 C 16.24 11.453333 16.119999 11.16 15.88 10.919999 C 15.639999 10.679999 15.346665 10.559999 15 10.559999 C 14.653333 10.559999 14.36 10.679999 14.12 10.919999 C 13.879999 11.16 13.759998 11.453333 13.759999 11.799999 C 13.759998 12.146667 13.879999 12.440001 14.12 12.679999 C 14.36 12.92 14.653333 13.039999 15 13.039999 Z " />
</Viewbox>
<Button.Flyout>
<MenuFlyout>
<MenuItem
Width="216"
Classes="Show"
Command="{Binding RevealCommand}"
Header="Reveal">
<MenuItem.Styles>
<Style Selector="MenuItem.Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="MenuItem.Show">
<Setter Property="IsVisible" Value="True" />
</Style>
</MenuItem.Styles>
<MenuItem.Icon>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 3.28 13.4 C 3.493333 12.333333 3.926666 11.373333 4.58 10.52 C 5.233333 9.666667 6.033333 9 6.98 8.52 C 7.926666 8.039999 8.933332 7.799999 10 7.799999 C 11.066666 7.799999 12.073333 8.039999 13.02 8.52 C 13.966666 9 14.766666 9.666667 15.42 10.52 C 16.073334 11.373333 16.52 12.333333 16.76 13.4 C 16.786667 13.533333 16.853333 13.639999 16.959999 13.719999 C 17.066666 13.799999 17.186665 13.826666 17.32 13.799999 C 17.453333 13.773333 17.559999 13.699999 17.639999 13.579999 C 17.719999 13.459999 17.746666 13.333333 17.719999 13.2 C 17.453333 11.973333 16.946667 10.873333 16.199999 9.9 C 15.453332 8.926666 14.539999 8.166667 13.46 7.62 C 12.379999 7.073334 11.226666 6.8 10 6.799999 C 8.773333 6.8 7.62 7.073334 6.54 7.62 C 5.46 8.166667 4.546667 8.926666 3.8 9.9 C 3.053333 10.873333 2.546666 11.973333 2.28 13.2 C 2.253333 13.333333 2.28 13.459999 2.36 13.579999 C 2.44 13.699999 2.546667 13.773333 2.68 13.799999 C 2.813333 13.826666 2.933333 13.799999 3.04 13.719999 C 3.146666 13.639999 3.226666 13.533333 3.28 13.4 Z M 10 9.799999 C 9.039999 9.799999 8.213333 10.139999 7.52 10.82 C 6.826666 11.5 6.486667 12.326666 6.5 13.299999 C 6.513333 14.273333 6.86 15.099999 7.54 15.779999 C 8.219999 16.459999 9.039999 16.799999 10 16.799999 C 10.959999 16.799999 11.786666 16.459999 12.48 15.779999 C 13.173332 15.099999 13.519999 14.273333 13.52 13.299999 C 13.519999 12.326666 13.173332 11.5 12.48 10.82 C 11.786666 10.139999 10.959999 9.799999 10 9.799999 Z M 7.52 13.28 C 7.493333 12.613334 7.726666 12.033333 8.22 11.539999 C 8.713333 11.046666 9.306666 10.799999 10 10.799999 C 10.693333 10.799999 11.28 11.046666 11.759999 11.539999 C 12.239999 12.033333 12.486666 12.62 12.5 13.299999 C 12.513332 13.98 12.273333 14.566667 11.78 15.059999 C 11.286667 15.553333 10.693333 15.799999 10 15.799999 C 9.306666 15.799999 8.719999 15.553333 8.24 15.059999 C 7.759999 14.566667 7.52 13.973333 7.52 13.28 Z " />
</MenuItem.Icon>
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{Binding IsRevealed}" Value="True">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsConcealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Hide" RemoveIfExists="True" />
<RemoveClassAction ClassName="Show" />
</ConditionAction>
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding IsRevealed}" Value="False">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsConcealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Show" RemoveIfExists="True" />
<RemoveClassAction ClassName="Hide" />
</ConditionAction>
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding IsConcealed}" Value="True">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsRevealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Show" RemoveIfExists="True" />
<RemoveClassAction ClassName="Hide" />
</ConditionAction>
</DataTriggerBehavior>
</Interaction.Behaviors>
</MenuItem>
<MenuItem
Width="216"
Classes="Hide"
Command="{Binding HideCommand}"
Header="Hide">
<MenuItem.Styles>
<Style Selector="MenuItem.Hide">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="MenuItem.Show">
<Setter Property="IsVisible" Value="True" />
</Style>
</MenuItem.Styles>
<MenuItem.Icon>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 2.84 3.959999 C 2.76 3.853333 2.646667 3.799999 2.5 3.799999 C 2.353333 3.799999 2.233333 3.846668 2.14 3.940001 C 2.046667 4.033333 2 4.153334 2 4.299999 C 2 4.446667 2.053333 4.560001 2.16 4.639999 L 5.64 8.16 C 4.786666 8.746668 4.066667 9.473333 3.48 10.339999 C 2.893333 11.206667 2.493333 12.16 2.28 13.2 C 2.253333 13.386666 2.306667 13.546666 2.44 13.679999 C 2.573333 13.813334 2.733333 13.846666 2.92 13.78 C 3.106666 13.713333 3.213333 13.586666 3.24 13.4 C 3.453333 12.466666 3.826667 11.606667 4.36 10.82 C 4.893333 10.033334 5.559999 9.386667 6.36 8.879999 L 7.96 10.44 C 7.4 10.866667 6.993333 11.4 6.74 12.039999 C 6.486666 12.679999 6.426666 13.34 6.56 14.02 C 6.693333 14.7 7.006666 15.286667 7.5 15.779999 C 7.993333 16.273333 8.58 16.586666 9.26 16.719999 C 9.94 16.853333 10.606666 16.799999 11.259999 16.559999 C 11.913332 16.32 12.439999 15.906666 12.84 15.32 L 17.16 19.639999 C 17.239998 19.746666 17.353333 19.799999 17.5 19.799999 C 17.646666 19.799999 17.766666 19.753332 17.859999 19.66 C 17.953331 19.566666 18 19.446667 18 19.299999 C 18 19.153332 17.946667 19.039999 17.84 18.959999 Z M 10.12 9.799999 L 13.48 13.16 C 13.453333 12.253333 13.113333 11.473333 12.46 10.82 C 11.806666 10.166666 11.026667 9.826666 10.12 9.799999 Z M 7.52 7.2 L 8.32 8 C 8.879999 7.866667 9.44 7.799999 10 7.799999 C 11.066666 7.799999 12.073333 8.039999 13.02 8.52 C 13.966666 9 14.766666 9.666667 15.42 10.52 C 16.073334 11.373333 16.52 12.333333 16.76 13.4 C 16.786667 13.533333 16.853333 13.639999 16.959999 13.719999 C 17.066666 13.799999 17.186665 13.826666 17.32 13.799999 C 17.453333 13.773333 17.559999 13.699999 17.639999 13.579999 C 17.719999 13.459999 17.746666 13.333333 17.719999 13.2 C 17.453333 11.973333 16.946667 10.873333 16.199999 9.9 C 15.453332 8.926666 14.539999 8.166667 13.46 7.62 C 12.379999 7.073334 11.226666 6.8 10 6.799999 C 9.146667 6.8 8.32 6.933333 7.52 7.2 Z " />
</MenuItem.Icon>
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{Binding IsRevealed}" Value="True">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsConcealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Show" RemoveIfExists="True" />
<RemoveClassAction ClassName="Hide" />
</ConditionAction>
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding IsRevealed}" Value="False">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsConcealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Hide" RemoveIfExists="True" />
<RemoveClassAction ClassName="Show" />
</ConditionAction>
</DataTriggerBehavior>
<DataTriggerBehavior Binding="{Binding IsConcealed}" Value="True">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsRevealed}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<AddClassAction ClassName="Hide" RemoveIfExists="True" />
<RemoveClassAction ClassName="Show" />
</ConditionAction>
</DataTriggerBehavior>
</Interaction.Behaviors>
</MenuItem>
<MenuItem
Width="216"
Classes="Hide"
Header="Copy">
<MenuItem.Icon>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 8 3.799999 C 7.44 3.799999 6.966666 3.993334 6.58 4.379999 C 6.193333 4.766666 6 5.24 6 5.799999 L 6 15.799999 C 6 16.360001 6.193333 16.833332 6.58 17.219999 C 6.966666 17.606667 7.44 17.799999 8 17.799999 L 14 17.799999 C 14.559999 17.799999 15.033333 17.606667 15.42 17.219999 C 15.806666 16.833332 16 16.360001 16 15.799999 L 16 5.799999 C 16 5.24 15.806666 4.766666 15.42 4.379999 C 15.033333 3.993334 14.559999 3.799999 14 3.799999 Z M 7 5.799999 C 7 5.533333 7.1 5.299999 7.3 5.1 C 7.5 4.9 7.733333 4.799999 8 4.799999 L 14 4.799999 C 14.266666 4.799999 14.5 4.9 14.7 5.1 C 14.9 5.299999 14.999999 5.533333 15 5.799999 L 15 15.799999 C 14.999999 16.066666 14.9 16.299999 14.7 16.5 C 14.5 16.700001 14.266666 16.799999 14 16.799999 L 8 16.799999 C 7.733333 16.799999 7.5 16.700001 7.3 16.5 C 7.1 16.299999 7 16.066666 7 15.799999 Z M 4 7.799999 C 4 7.453333 4.086667 7.12 4.26 6.799999 C 4.433333 6.48 4.68 6.240001 5 6.08 L 5 16.279999 C 5 16.973333 5.246666 17.566666 5.74 18.059999 C 6.233333 18.553333 6.813333 18.799999 7.48 18.799999 L 13.719999 18.799999 C 13.559999 19.119999 13.32 19.366667 13 19.539999 C 12.679998 19.713333 12.346665 19.799999 12 19.799999 L 7.52 19.799999 C 6.533333 19.799999 5.7 19.459999 5.02 18.779999 C 4.34 18.099998 4 17.266666 4 16.279999 Z " />
</MenuItem.Icon>
</MenuItem>
</MenuFlyout>
</Button.Flyout>
</Button>
</SettingsExpander.Action>
<SettingsExpander.Footer>
<TextBox
Classes="revealPasswordButton"
PasswordChar="&#x25CF;"
PasswordChar="{Binding IsRevealed, Converter={StaticResource BooleanToPasswordCharConverter}}"
RevealPassword="{Binding IsRevealed}"
Text="{Binding Value}">
<TextBox.Styles>
<Style Selector="TextBox.Write">
<Setter Property="MaxWidth" Value="{Binding Width}" />
<Setter Property="MinWidth" Value="{Binding Width}" />
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}" />
<Setter Property="Margin" Value="{StaticResource TextControlMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlPadding}" />
<Setter Property="TextWrapping" Value="NoWrap" />
</Style>
<Style Selector="TextBox.Read">
@@ -41,7 +177,8 @@
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactThemePadding}" />
<Setter Property="Margin" Value="{StaticResource TextControlCompactMargin}" />
<Setter Property="Padding" Value="{StaticResource TextControlCompactPadding}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Foreground">
+3 -1
View File
@@ -12,4 +12,6 @@ public partial class DateEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
DateTimeOffset value,
double width) : ItemEntryViewModel<DateTimeOffset>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
bool isConcealed,
bool isRevealed,
double width) : ItemEntryViewModel<DateTimeOffset>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
+1 -1
View File
@@ -20,7 +20,7 @@ public class DateEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<DateEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, false, false, width])
is DateEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+1 -1
View File
@@ -23,7 +23,7 @@ public class DropdownEntryViewModelHandler(IServiceFactory serviceFactory) :
DropdownValueViewModel? selected = values.FirstOrDefault(x => x.Value is not null && x.Value.Equals($"{value}"));
if (serviceFactory.Create<DropdownEntryViewModel>(args => args.Initialize(),
[values, .. args.Parameters, configuration, label, value, width, selected])
[values, .. args.Parameters, configuration, label, value, width, false, false, selected])
is DropdownEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+3 -1
View File
@@ -13,7 +13,9 @@ public partial class HyperlinkEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width)
double width,
bool isConcealed,
bool isRevealed) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width)
{
[RelayCommand]
private void Invoke() => Publisher.Publish(Create.As(new Hyperlink(Value)));
+1 -1
View File
@@ -15,7 +15,7 @@ public class HyperlinkEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<HyperlinkEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, false, false, width])
is HyperlinkEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+21
View File
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Toolkit.Foundation;
namespace Wallet;
@@ -13,6 +14,8 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
TValue value,
bool isConcealed,
bool isRevealed,
double width) :
Observable<string, TValue>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
IItemEntryViewModel,
@@ -21,6 +24,12 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
INotificationHandler<CancelEventArgs<Item>>
where TValue : notnull
{
[ObservableProperty]
private bool isConcealed = isConcealed;
[ObservableProperty]
private bool isRevealed = isRevealed;
[ObservableProperty]
private ItemState state = state;
@@ -48,4 +57,16 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
protected override void OnValueChanged() =>
configuration.Value = Value;
[RelayCommand]
private void Hide()
{
IsRevealed = false;
}
[RelayCommand]
private void Reveal()
{
IsRevealed = true;
}
}
+3 -1
View File
@@ -14,7 +14,9 @@ public partial class MaskedTextEntryViewModel(IServiceProvider provider,
string pattern,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width)
bool isConcealed,
bool isRevealed,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width)
{
[ObservableProperty]
private string pattern = pattern;
+1 -1
View File
@@ -15,7 +15,7 @@ public class MaskedTextEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<MaskedTextEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, configuration.Pattern, label, value, width])
[.. args.Parameters, configuration, configuration.Pattern, label, value, false, false, width])
is MaskedTextEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+3 -1
View File
@@ -12,5 +12,7 @@ public partial class MultilineTextEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
bool isConcealed,
bool isRevealed,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
+1 -1
View File
@@ -15,7 +15,7 @@ public class MultilineTextEntryViewModelHandler(IServiceFactory serviceFactory)
double? width = configuration.Width;
if (serviceFactory.Create<MultilineTextEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, false, false, width])
is MultilineTextEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+3 -1
View File
@@ -12,4 +12,6 @@ public partial class PasswordEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
bool isConcealed,
bool isRevealed,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
+1 -1
View File
@@ -15,7 +15,7 @@ public class PasswordEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<PasswordEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, true, false, width])
is PasswordEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+3 -1
View File
@@ -12,4 +12,6 @@ public partial class PinEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
double width,
bool isConcealed,
bool isRevealed) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
+1 -1
View File
@@ -15,7 +15,7 @@ public class PinEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<PinEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, true, false, width])
is PinEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);
+3 -1
View File
@@ -12,4 +12,6 @@ public partial class TextEntryViewModel(IServiceProvider provider,
ItemEntryConfiguration configuration,
string key,
string value,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
bool isConcealed,
bool isRevealed,
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
+1 -1
View File
@@ -15,7 +15,7 @@ public class TextEntryViewModelHandler(IServiceFactory serviceFactory) :
double? width = configuration.Width;
if (serviceFactory.Create<TextEntryViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, width])
[.. args.Parameters, configuration, label, value, false, false, width])
is TextEntryViewModel viewModel)
{
return Task.FromResult<IItemEntryViewModel?>(viewModel);