-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚩 feat: input support overflow (#177)
* 📝 docs: add checkbox demo * 🚩 feat: input support overflow * ✅ test: update test case
- Loading branch information
Showing
7 changed files
with
77 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Input | ||
order: 51 | ||
--- | ||
|
||
# Input | ||
|
||
<code src="./demos/Input.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Input } from 'antd'; | ||
import React from 'react'; | ||
|
||
export default () => ( | ||
<> | ||
<Input placeholder="请输入请输入请输入请输入" style={{ width: 100 }} /> | ||
<br /> | ||
<br /> | ||
<Input value="请输入请输入请输入请输入" style={{ width: 100 }} /> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Group, Rectangle } from 'html2sketch'; | ||
|
||
export const createOverflowMask = (node: HTMLElement, children: any) => { | ||
const { width, height, left, top } = node.getBoundingClientRect(); | ||
const nodeStyles = getComputedStyle(node); | ||
const paddingLeft = parseFloat(nodeStyles.getPropertyValue('padding-left')); | ||
const paddingTop = parseFloat(nodeStyles.getPropertyValue('padding-top')); | ||
const paddingRight = parseFloat(nodeStyles.getPropertyValue('padding-right')); | ||
const paddingBottom = parseFloat(nodeStyles.getPropertyValue('padding-bottom')); | ||
const rect = new Rectangle({ | ||
width: width - paddingLeft - paddingRight, | ||
height: height - paddingTop - paddingBottom, | ||
x: paddingLeft, | ||
y: paddingTop, | ||
name: '蒙层', | ||
}); | ||
rect.hasClippingMask = true; | ||
|
||
const group = new Group({ x: left, y: top, name: '子元素' }); | ||
group.layers.push(rect); | ||
group.addLayer(children); | ||
|
||
return group; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters