Skip to content

Commit f71351b

Browse files
authoredNov 15, 2022
feat(abc:sv): add hideLabel property (#1553)
1 parent 59b8a22 commit f71351b

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed
 

‎packages/abc/sv/demo/fixed.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Use `labelWidth` to make the layout look cleaner
1515

1616
```ts
1717
import { Component } from '@angular/core';
18+
19+
import { STColumn } from '@delon/abc/st';
1820
import { NzMessageService } from 'ng-zorro-antd/message';
1921

2022
@Component({
@@ -34,10 +36,15 @@ import { NzMessageService } from 'ng-zorro-antd/message';
3436
</ng-template>
3537
Custom label
3638
</sv>
39+
<sv hideLabel col="1">
40+
<st [columns]="columns" size="small"></st>
41+
</sv>
3742
</sv-container>
38-
`,
43+
`
3944
})
4045
export class DemoComponent {
46+
columns: STColumn[] = [{ title: 'id' }];
47+
4148
constructor(public msg: NzMessageService) {}
4249
}
4350
```

‎packages/abc/sv/index.en-US.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Viewing grid system is a higher-order components based on the original [Grid Sys
3737
| `[optionalHelp]` | Label optional help | `string, TemplateRef<void>` | - |
3838
| `[optionalHelpColor]` | The background color of label optional help | `string` | - |
3939
| `[noColon]` | Whether to not display : after label text | `boolean` | `false` | - |
40+
| `[hideLabel]` | Whether to hide the current label | `boolean` | `false` |
4041

4142
### sv-title
4243

‎packages/abc/sv/index.zh-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module: import { SVModule } from '@delon/abc/sv';
3737
| `[optionalHelp]` | 标签可选帮助 | `string, TemplateRef<void>` | - |
3838
| `[optionalHelpColor]` | 标签可选帮助背景颜色 | `string` | - |
3939
| `[noColon]` | 是否不显示 label 后面的冒号 | `boolean` | `false` | - |
40+
| `[hideLabel]` | 是否隐藏当前 `label` | `boolean` | `false` |
4041

4142
### sv-title
4243

‎packages/abc/sv/sv.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div
2+
*ngIf="!hideLabel"
23
class="sv__label"
34
[class.sv__label-empty]="!label"
45
[class.sv__label-width]="labelWidth !== null && labelWidth !== undefined"

‎packages/abc/sv/sv.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class SVComponent implements AfterViewInit, OnChanges {
3737
static ngAcceptInputType_col: NumberInput;
3838
static ngAcceptInputType_default: BooleanInput;
3939
static ngAcceptInputType_noColon: BooleanInput;
40+
static ngAcceptInputType_hideLabel: BooleanInput;
4041

4142
@ViewChild('conEl', { static: false })
4243
private conEl!: ElementRef;
@@ -55,6 +56,7 @@ export class SVComponent implements AfterViewInit, OnChanges {
5556
@Input() @InputBoolean(null) default?: boolean | null;
5657
@Input() type?: 'primary' | 'success' | 'danger' | 'warning';
5758
@Input() @InputBoolean(null) noColon?: boolean | null;
59+
@Input() @InputBoolean() hideLabel = false;
5860

5961
// #endregion
6062

‎packages/abc/sv/sv.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ describe('abc: view', () => {
174174
fixture.detectChanges();
175175
page.expect(`${prefixCls}type-danger`);
176176
});
177+
it('#hideLabel', () => {
178+
context.hideLabel = true;
179+
fixture.detectChanges();
180+
page.expect(`${prefixCls}item ${prefixCls}label`, 0);
181+
});
177182
});
178183
});
179184
});
@@ -254,6 +259,7 @@ describe('abc: view', () => {
254259
[unit]="unit"
255260
[optional]="optional"
256261
[optionalHelp]="optionalHelp"
262+
[hideLabel]="hideLabel"
257263
>
258264
{{ content }}
259265
</sv>
@@ -285,4 +291,5 @@ class TestComponent {
285291
default?: boolean;
286292
unit?: string;
287293
type?: 'primary' | 'success' | 'danger' | 'warning';
294+
hideLabel = false;
288295
}

0 commit comments

Comments
 (0)
Please sign in to comment.