Skip to content

Commit

Permalink
refactor(module:input): refactor input (#2593)
Browse files Browse the repository at this point in the history
close #1370 ref #2381
  • Loading branch information
vthinkxie authored Dec 6, 2018
1 parent ef10595 commit 2f4b9f3
Show file tree
Hide file tree
Showing 13 changed files with 684 additions and 762 deletions.
9 changes: 8 additions & 1 deletion components/core/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,11 @@
}
}


textarea.cdk-textarea-autosize-measuring {
height: auto !important;
overflow: hidden !important;
// Having 2px top and bottom padding seems to fix a bug where Chrome gets an incorrect
// measurement. We just have to account for it later and subtract it off the final result.
padding: 2px 0 !important;
box-sizing: content-box !important;
}
169 changes: 0 additions & 169 deletions components/core/util/calculate-node-height.ts

This file was deleted.

1 change: 0 additions & 1 deletion components/core/util/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './calculate-node-height';
export * from './check';
export * from './convert';
export * from './getMentions';
Expand Down
3 changes: 2 additions & 1 deletion components/input/demo/autosize-textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ title:

## zh-CN

`nzAutosize` 属性适用于 `textarea` 节点,并且只有高度会自动变化。另外 `nzAutosize` 可以设定为一个对象,指定最小行数和最大行数。
`nzAutosize` 属性适用于 `textarea` 节点,并且只有高度会自动变化。另外 `nzAutosize` 可以设定为一个对象,指定最小行数和最大行数。注意:`nzAutosize` 需要配合 `ngModel` 或者 `ReactiveForm` 使用

## en-US

`nzAutosize` prop for a `textarea` type of `nz-input` makes the height to automatically adjust based on the content.
An options object can be provided to `nzAutosize` to specify the minimum and maximum number of lines the textarea will automatically adjust.
Note: `nzAutosize` must with `ngModel` or `ReactiveForm`.

9 changes: 4 additions & 5 deletions components/input/demo/autosize-textarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { Component } from '@angular/core';
selector: 'nz-demo-input-autosize-textarea',
template: `
<div>
<textarea nz-input placeholder="Autosize height based on content lines" nzAutosize></textarea>
<textarea nz-input placeholder="Autosize height based on content lines" nzAutosize [(ngModel)]="value"></textarea>
<div style="margin:24px 0;"></div>
<textarea nz-input placeholder="Autosize height with minimum and maximum number of lines" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
<textarea nz-input placeholder="Autosize height with minimum and maximum number of lines" [(ngModel)]="value" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
</div>
`,

styles: []
`
})
export class NzDemoInputAutosizeTextareaComponent {
value;
}
Loading

0 comments on commit 2f4b9f3

Please sign in to comment.