Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions assets/index.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inputNumberPrefixCls: rc-input-number;

.@{inputNumberPrefixCls} {
display: inline-block;
display: inline-flex;
flex-wrap: nowrap;
height: 26px;
margin: 0;
padding: 0;
Expand All @@ -22,7 +23,7 @@
}
}

&-handler {
&-action {
display: block;
height: 12px;
overflow: hidden;
Expand All @@ -35,8 +36,8 @@
}
}

&-handler-up-inner,
&-handler-down-inner {
&-action-up-inner,
&-action-down-inner {
color: #666666;
-webkit-user-select: none;
user-select: none;
Expand All @@ -45,26 +46,21 @@
&:hover {
border-color: #1890ff;

.@{inputNumberPrefixCls}-handler-up,
.@{inputNumberPrefixCls}-handler-wrap {
.@{inputNumberPrefixCls}-action-up,
.@{inputNumberPrefixCls}-actions {
border-color: #1890ff;
}
}

&-disabled:hover {
border-color: #d9d9d9;

.@{inputNumberPrefixCls}-handler-up,
.@{inputNumberPrefixCls}-handler-wrap {
.@{inputNumberPrefixCls}-action-up,
.@{inputNumberPrefixCls}-actions {
border-color: #d9d9d9;
}
}

&-input-wrap {
height: 100%;
overflow: hidden;
}

&-input {
width: 100%;
height: 100%;
Expand All @@ -80,15 +76,14 @@
-moz-appearance: textfield;
}

&-handler-wrap {
float: right;
&-actions {
width: 20px;
height: 100%;
border-left: 1px solid #d9d9d9;
transition: all 0.3s;
}

&-handler-up {
&-action-up {
padding-top: 1px;
border-bottom: 1px solid #d9d9d9;
transition: all 0.3s;
Expand All @@ -100,7 +95,7 @@
}
}

&-handler-down {
&-action-down {
transition: all 0.3s;

&-inner {
Expand All @@ -118,8 +113,8 @@
}
}

&-handler-down-disabled,
&-handler-up-disabled {
&-action-down-disabled,
&-action-up-disabled {
.handler-disabled();
}

Expand All @@ -129,7 +124,7 @@
cursor: not-allowed;
opacity: 0.72;
}
.@{inputNumberPrefixCls}-handler {
.@{inputNumberPrefixCls}-action {
.handler-disabled();
}
}
Expand All @@ -139,17 +134,17 @@
align-items: center;
}

&-mode-spinner &-handler {
&-mode-spinner &-action {
flex: 0 0 20px;
line-height: 26px;
height: 100%;
line-height: 26px;
}

&-mode-spinner &-handler-up {
&-mode-spinner &-action-up {
border-bottom: 0;
border-left: 1px solid #d9d9d9;
}
&-mode-spinner &-handler-down {
&-mode-spinner &-action-down {
border-top: 0;
border-right: 1px solid #d9d9d9;
}
Expand Down
25 changes: 25 additions & 0 deletions docs/demo/prefix-suffix.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint no-console:0 */
import InputNumber from '@rc-component/input-number';
import React from 'react';
import '../../assets/index.less';

export default () => {
const [value, setValue] = React.useState<string | number>(100);

const onChange = (val: number) => {
console.warn('onChange:', val, typeof val);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在示例代码中使用 console.warn 可能会让使用者误以为这里存在需要注意的问题。如果只是为了演示 onChange 事件,建议移除此行,或者使用 console.log。为了保持示例代码的简洁,最好是移除掉。

setValue(val);
};

return (
<div style={{ margin: 10 }}>
<InputNumber
style={{ width: 200 }}
value={value}
onChange={onChange}
prefix="¥"
suffix="RMB"
/>
</div>
);
};
4 changes: 4 additions & 0 deletions docs/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ nav:

<code src="./demo/simple.tsx"></code>

## prefix-suffix

<code src="./demo/prefix-suffix.tsx"></code>

## combination-key-format

<code src="./demo/combination-key-format.tsx"></code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"dependencies": {
"@rc-component/input": "~1.1.0",
"@rc-component/mini-decimal": "^1.0.1",
"@rc-component/util": "^1.2.0",
"@rc-component/util": "^1.4.0",
"clsx": "^2.1.1"
},
"devDependencies": {
Expand Down
Loading
Loading