File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/BootstrapBlazor/Components/Upload Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 66{
77 <BootstrapLabel required =" @Required" ShowLabelTooltip =" ShowLabelTooltip" Value =" @DisplayText" />
88}
9- <div @attributes =" @AdditionalAttributes" class =" @ClassString" id =" @Id" >
9+ <div @attributes =" @AdditionalAttributes" class =" @ClassString" id =" @Id" data-bb-previewer-id = " @PreviewerId " >
1010 <div class =" upload-body is-avatar" >
1111 @if (IsUploadButtonAtFirst && ShowAddButton ())
1212 {
4141 @RenderAdd
4242 }
4343 </div >
44+ @if (ShowPreviewList )
45+ {
46+ <ImagePreviewer Id =" @PreviewerId" PreviewList =" PreviewList" ></ImagePreviewer >
47+ }
4448 <InputFile AdditionalAttributes =" @GetUploadAdditionalAttributes()" OnChange =" OnFileChange" />
4549</div >
4650
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ public partial class AvatarUpload<TValue>
115115 . AddClass ( InvalidStatusIcon )
116116 . Build ( ) ;
117117
118+ private bool ShowPreviewList => Files . Count != 0 ;
119+
120+ private string PreviewerId => $ "prev_{ Id } ";
121+
122+ private List < string ? > PreviewList => [ .. Files . Select ( i => i . PrevUrl ) ] ;
123+
118124 /// <summary>
119125 /// <inheritdoc/>
120126 /// </summary>
@@ -144,6 +150,14 @@ protected override async Task TriggerOnChanged(UploadFile file)
144150 await base . TriggerOnChanged ( file ) ;
145151 }
146152
153+ public async Task Preview ( )
154+ {
155+ if ( ShowPreviewList )
156+ {
157+
158+ }
159+ }
160+
147161 private IReadOnlyCollection < ValidationResult > _results = [ ] ;
148162
149163 /// <summary>
You can’t perform that action at this time.
0 commit comments