Skip to content

Commit b7f49fb

Browse files
authored
feat(ImageImageCropper): add Preview parameter (#458)
* feat: 增加 Preview 参数 * refactor: 标记 CropperShape 过期 * style: 增加样式 * chore: bump version 9.0.2
1 parent 6db0fe5 commit b7f49fb

4 files changed

Lines changed: 38 additions & 2 deletions

File tree

src/components/BootstrapBlazor.ImageCropper/BootstrapBlazor.ImageCropper.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.0.1</Version>
4+
<Version>9.0.2</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/components/BootstrapBlazor.ImageCropper/ImageCropper.razor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ public partial class ImageCropper
3939
/// 获取/设置 裁剪形状(矩形/圆形)默认 <see cref="ImageCropperShape.Rectangle"/>
4040
/// </summary>
4141
[Parameter]
42+
[Obsolete("已弃用,使用 ImageCropperOption.IsRound 参数代替;Deprecated, use ImageCropperOption.IsRound parameter instead")]
4243
public ImageCropperShape CropperShape { get; set; }
4344

4445
private string? ClassString => CssBuilder.Default("bb-cropper")
45-
.AddClass("is-round", CropperShape == ImageCropperShape.Round)
46+
.AddClass("is-round", Options?.IsRound ?? false)
4647
.AddClassFromAttributes(AdditionalAttributes)
4748
.Build();
4849

src/components/BootstrapBlazor.ImageCropper/ImageCropperOption.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,10 @@ public class ImageCropperOption
210210
/// </summary>
211211
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
212212
public string? Radius { get; set; }
213+
214+
/// <summary>
215+
/// 获得/设置 预览元素 Selector
216+
/// </summary>
217+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
218+
public string? Preview { get; set; }
213219
}

src/components/BootstrapBlazor.ImageCropper/wwwroot/cropper.bundle.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,32 @@
1919
.bb-cropper.disabled {
2020
opacity: var(--bb-crop-disabled-opacity);
2121
}
22+
23+
.bb-cropper-preview {
24+
overflow: hidden;
25+
}
26+
27+
.bb-cropper-preview-round {
28+
border-radius: 50%;
29+
}
30+
31+
.bb-cropper-preview-lg {
32+
height: 9rem;
33+
width: 16rem;
34+
}
35+
36+
.bb-cropper-preview-md {
37+
height: 4.5rem;
38+
width: 8rem;
39+
}
40+
41+
.bb-cropper-preview-sm {
42+
height: 2.25rem;
43+
width: 4rem;
44+
}
45+
46+
.bb-cropper-preview-xs {
47+
height: 1.125rem;
48+
margin-right: 0;
49+
width: 2rem;
50+
}

0 commit comments

Comments
 (0)