Skip to content

Commit f738f27

Browse files
authored
Merge pull request #48 from WeBankFinTech/branch_joy
feat: 新增columnTip组件
2 parents 56e7da7 + 9428f22 commit f738f27

File tree

11 files changed

+118
-5
lines changed

11 files changed

+118
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BTagsPanel
2+
图标悬浮提示说明
3+
4+
## 组件注册
5+
6+
```js
7+
import { BMetricTip } from '@fesjs/traction-widget';
8+
app.use(BMetricTip);
9+
```
10+
## 代码演示
11+
### 基础用法
12+
使用场景:
13+
1. 常规文字后追加
14+
2. 在表格的列名后追加,说明列名含义
15+
16+
--USE
17+
18+
--CODE
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<template>
2+
<span>
3+
一个表格
4+
<BMetricTip tipText="一个表格的描述"></BMetricTip>
5+
</span>
6+
<f-table :data="tableShowLists">
7+
<f-table-column prop="id" label="ID" :width="80" ellipsis />
8+
<f-table-column prop="cn_name" :width="160" ellipsis>
9+
<template #header>
10+
中文名称
11+
<BMetricTip :tipText="tipText"></BMetricTip>
12+
</template>
13+
</f-table-column>
14+
<f-table-column prop="en_name" :width="160" ellipsis>
15+
<template #header>
16+
英文名称
17+
<BMetricTip :tipText="tipTextEn"></BMetricTip>
18+
</template>
19+
</f-table-column>
20+
</f-table>
21+
</template>
22+
<script setup lang="ts">
23+
import { ref } from 'vue';
24+
import { BMetricTip } from '@fesjs/traction-widget';
25+
import { FTable, FTableColumn } from '@fesjs/fes-design';
26+
27+
console.log('MetricTip 加载')
28+
const tipText = "这是中文名称的描述"
29+
const tipTextEn = "这是英文名称的描述这是英文名称的描述,这是英文名称的描述这是英文名称的描述,这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述这是英文名称的描述"
30+
const tableShowLists = ref([
31+
{
32+
id: 'id1',
33+
cn_name: '张三',
34+
en_name: 'zhansan'
35+
},
36+
{
37+
id: 'id2',
38+
cn_name: '李四',
39+
en_name: 'lisi'
40+
},
41+
])
42+
43+
</script>

docs/.vitepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export default defineConfig({
9393
{ text: 'BTableHeaderConfig', link: '/components/BTableHeaderConfig' },
9494
{ text: 'BSearch', link: '/components/BSearch' },
9595
{ text: 'BDynamicForms', link: '/components/BDynamicForms'},
96+
{ text: 'BMetricTip', link: '/components/BMetricTip'},
9697
]
9798
},
9899
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fesjs/traction-widget",
3-
"version": "1.9.5",
3+
"version": "1.10.0",
44
"description": "集合大型中台项目使用到的通用组件和工具函数",
55
"scripts": {
66
"docs:dev": "npm run build && node docs/.vitepress/scripts/generate-doc.js && vitepress dev docs",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<span class="wd-column-tip">
3+
<FTooltip mode="popover">
4+
<InfoCircleOutlined class="wd-hint-icon-column" />
5+
<template #content>
6+
<div style="width: 300px;">
7+
{{tipText}}
8+
</div>
9+
</template>
10+
</FTooltip>
11+
</span>
12+
</template>
13+
<script setup>
14+
import {
15+
defineProps
16+
} from 'vue';
17+
import { InfoCircleOutlined } from '@fesjs/fes-design/icon';
18+
import { FTooltip } from '@fesjs/fes-design';
19+
20+
defineProps({
21+
tipText: {
22+
type: String,
23+
default: ''
24+
}
25+
});
26+
</script>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { withInstall } from '../_util/withInstall';
2+
import MetricTip from './MetricTip.vue';
3+
4+
import type { SFCWithInstall } from '../_util/interface';
5+
6+
type MetricTipType = SFCWithInstall<typeof MetricTip>;
7+
export const BMetricTip = withInstall<MetricTipType>(MetricTip as MetricTipType);
8+
9+
export default BMetricTip;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.wd-column-tip {
2+
position:relative;
3+
.wd-hint-icon-column {
4+
position: absolute;
5+
transform: translateY(-50%);
6+
top: 55%;
7+
color: #B7B7BC;
8+
margin: 0px 6px;
9+
}
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './index.less';

packages/traction-widget/components/_style.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ import './TablePage/style';
88
import './TagSelector/style';
99
import './VerticalLayout/style';
1010
import './TagsPanel/style';
11+
import './MetricTip/style';

packages/traction-widget/components/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { BSearch } from './Search';
99
import { BTablePage } from './TablePage';
1010
import { BNavBar } from './NavBar';
1111
import { BNavHeader } from './NavHeader';
12+
import { BMetricTip } from './MetricTip';
1213

1314
const components = [
1415
BTagsPanel,
@@ -19,7 +20,8 @@ const components = [
1920
BSearch,
2021
BTablePage,
2122
BNavBar,
22-
BNavHeader
23+
BNavHeader,
24+
BMetricTip
2325
];
2426

2527
const install = (app: any): any => {
@@ -46,7 +48,8 @@ export {
4648
BSearch,
4749
BTablePage,
4850
BNavBar,
49-
BNavHeader
51+
BNavHeader,
52+
BMetricTip
5053
};
5154

5255
export default {
@@ -66,5 +69,6 @@ export default {
6669
BSearch,
6770
BTablePage,
6871
BNavBar,
69-
BNavHeader
72+
BNavHeader,
73+
BMetricTip
7074
};

0 commit comments

Comments
 (0)