Skip to content

Commit

Permalink
feat(module:input): support borderless (#5781)
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie authored Sep 15, 2020
1 parent e5ed4d2 commit 6e7877b
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { NzSafeAny } from 'ng-zorro-antd/core/types';
* https://github.com/angular/angular/issues/34718
*/
@Directive({
selector: '[nz-button],nz-button-group,[nz-icon],[nz-menu-item],[nz-submenu],nz-select-top-control,nz-select-placeholder'
selector:
'[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group'
})
export class NzTransitionPatchDirective implements AfterViewInit, OnChanges {
@Input() hidden: NzSafeAny = null;
Expand Down
2 changes: 1 addition & 1 deletion components/divider/doc/index.en-US.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
category: Components
type: Other
type: Layout
title: Divider
cover: https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg
---
Expand Down
2 changes: 1 addition & 1 deletion components/divider/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
category: Components
type: 其他
type: 布局
title: Divider
subtitle: 分割线
cover: https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg
Expand Down
14 changes: 14 additions & 0 deletions components/input/demo/borderless.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
order: 11
title:
zh-CN: 无边框
en-US: Borderless
---

## zh-CN

没有边框。

## en-US

Borderless input.
9 changes: 9 additions & 0 deletions components/input/demo/borderless.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';

@Component({
selector: 'nz-demo-input-borderless',
template: `
<input nz-input placeholder="borderless" nzBorderless />
`
})
export class NzDemoInputBorderlessComponent {}
1 change: 1 addition & 0 deletions components/input/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ All props of input supported by [w3c standards](https://www.w3schools.com/tags/t
| -------- | ----------- | ---- | ------- |
| `[nzSize]` | The size of the input box. Note: in the context of a form, the `large` size is used. | `'large' \| 'small' \| 'default'` | `'default'` |
| `[nzAutosize]` | Only used for `textarea`, height autosize feature, can be set to `boolean` or an object `{ minRows: 2, maxRows: 6 }` | `boolean \| { minRows: number, maxRows: number }` | `false` |
| `[nzBorderless]` | Whether hide border | `boolean` | `false` |


### nz-input-group
Expand Down
1 change: 1 addition & 0 deletions components/input/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ nz-input 可以使用所有的W3C标准下的所有 [使用方式](https://www.w
| --- | --- | --- | --- |
| `[nzSize]` | 控件大小。注:标准表单内的输入框大小限制为 `large` | `'large' \| 'small' \| 'default'` | `'default'` |
| `[nzAutosize]` | 只可以用于 `textarea`,自适应内容高度,可设置为 `boolean` 或对象:`{ minRows: 2, maxRows: 6 }` | `boolean \| { minRows: number, maxRows: number }` | `false` |
| `[nzBorderless]` | 是否隐藏边框 | `boolean` | `false` |

### nz-input-group

Expand Down
5 changes: 4 additions & 1 deletion components/input/input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Directive, ElementRef, Input, OnChanges, OnDestroy, OnInit, Optional, Renderer2, Self, SimpleChanges } from '@angular/core';
import { NgControl } from '@angular/forms';
import { BooleanInput, NzSizeLDSType } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';
import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';

Expand All @@ -14,14 +15,16 @@ import { filter, takeUntil } from 'rxjs/operators';
exportAs: 'nzInput',
host: {
'[class.ant-input-disabled]': 'disabled',
'[class.ant-input-borderless]': 'nzBorderless',
'[class.ant-input-lg]': `nzSize === 'large'`,
'[class.ant-input-sm]': `nzSize === 'small'`,
'[attr.disabled]': 'disabled || null'
}
})
export class NzInputDirective implements OnChanges, OnInit, OnDestroy {
static ngAcceptInputType_disabled: BooleanInput;

static ngAcceptInputType_nzBorderless: BooleanInput;
@Input() @InputBoolean() nzBorderless = false;
@Input() nzSize: NzSizeLDSType = 'default';
@Input()
get disabled(): boolean {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"tslint": "~6.1.0",
"typescript": "~4.0.2",
"yaml-front-matter": "^4.0.0",
"zone.js": "~0.10.3"
"zone.js": "~0.11.1"
},
"lint-staged": {
"components/**/*.{html,ts}": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/site/_site/doc/app/header/header.less
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

& > .ant-menu-item,
& > .ant-menu-submenu {
min-width: 72px;
min-width: 40px;
height: @header-height;
line-height: @header-height - @menu-item-border - 2px;
border-top: @menu-item-border solid transparent;
Expand Down

0 comments on commit 6e7877b

Please sign in to comment.