Skip to content

Commit 258f2ba

Browse files
author
jiaojiao.diao
committed
feat: [Popover] 添加新配isReverseBtn
1 parent d6b27be commit 258f2ba

5 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/components/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ bodys.style.setProperty(`--shuyunBlue${i + 1}`,color)
1717
}
1818
}
1919

20-
export const version = '2.1.0';
20+
export const version = '2.0.5';
2121

2222
export { default as Avatar } from './avatar';
2323

src/components/popover/demos/basic.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default function PopoverDemo() {
7171
size="small"
7272
content="这是一段文字描述"
7373
showIcon
74+
isReverseBtn
7475
showCancelBtn
7576
showConfirmBtn>
7677
<Button>文字 + Icon + btn</Button>

src/components/popover/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function Popover(props) {
2121
iconTpl,
2222
iconType,
2323
iconStyle,
24+
isReverseBtn,
2425
showCancelBtn,
2526
showConfirmBtn,
2627
cancelBtnText,
@@ -105,7 +106,7 @@ function Popover(props) {
105106
</div>
106107
</section>
107108

108-
<section className={`${classSelector}-btn`} ref={ref}>
109+
<section className={classnames(`${classSelector}-btn`, {[`${classSelector}-reverse-btn`]: isReverseBtn})} ref={ref}>
109110
{showCancelBtn && (
110111
<Button
111112
onClick={handleCancelClick}
@@ -176,6 +177,7 @@ Popover.propTypes = {
176177
iconStyle: PropTypes.object,
177178
showCancelBtn: PropTypes.bool,
178179
showConfirmBtn: PropTypes.bool,
180+
isReverseBtn: PropTypes.bool,
179181
cancelBtnText: PropTypes.string,
180182
confirmText: PropTypes.string,
181183
size: PropTypes.oneOf([ 'mini', 'small', 'default', 'large' ]),
@@ -197,6 +199,7 @@ Popover.defaultProps = {
197199
iconTpl: '',
198200
iconType: '',
199201
iconStyle: {},
202+
isReverseBtn: false,
200203
showCancelBtn: false,
201204
showConfirmBtn: false,
202205
cancelBtnText: '取消',

src/components/popover/index.less

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
color: @orange-5;
2222
}
2323
}
24+
2425
&-icon {
2526
color: #fd830a;
2627
margin-right: 8px;
@@ -49,6 +50,7 @@
4950
line-height: 18px;
5051
max-height: 190px;
5152
overflow-y: auto;
53+
5254
&::-webkit-scrollbar {
5355
width: 4px;
5456
}
@@ -63,12 +65,18 @@
6365
display: flex;
6466
justify-content: end;
6567

66-
> button {
68+
>button {
6769
margin-top: 16px;
6870
margin-left: 8px;
6971
margin-bottom: 4px;
7072
}
7173
}
74+
75+
&-reverse-btn {
76+
display: flex;
77+
justify-content: right;
78+
flex-direction: row-reverse;
79+
}
7280
}
7381

7482
.@{popover-prefix-cls}-tooltip {
@@ -105,4 +113,4 @@
105113
margin-top: -3px;
106114
cursor: pointer;
107115
}
108-
}
116+
}

src/components/popover/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ group:
2828
| iconTpl | 自定义图标 | Element | '' |
2929
| iconType | 自定义图标,可直接传入组件库的图标类型 | string | '' |
3030
| iconStyle | 图标样式,配置 iconTpl 时,该值无效 | object | {} |
31+
| isReverseBtn | 是否反转确定和取消的位置 | boolean | `false` |
3132
| showCancelBtn | 是否展示取消按钮 | boolean | false |
3233
| showConfirmBtn | 是否展示确认按钮 | boolean | false |
3334
| cancelBtnText | 取消按钮自定义文本 | string | '取消' |

0 commit comments

Comments
 (0)