Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2985c43

Browse files
fix:bug
fix:bug
2 parents 4a3a40e + 6d73990 commit 2985c43

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-visual-modeling",
3-
"version": "1.0.33",
3+
"version": "1.0.37",
44
"description": "一个基于React的数据可视化建模的DAG图,适用于UML,数据库建模,数据仓库建设等业务",
55
"main": "dist/index.js",
66
"pack": "pack/index.js",

‎src/canvas/canvas.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export default class TableCanvas extends Canvas {
224224
let newEdges = this.addEdges(newEdgesInfos, true);
225225

226226
newEdges.forEach((item) => {
227+
item.collapse = true;
227228
item.sourceEndpoint.updatePos();
228229
item.targetEndpoint.updatePos();
229230
item.redraw();

‎src/canvas/node.js‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ export default class TableNode extends Node {
4444
mounted() {
4545
// 生成field的endpoint
4646
this._createNodeEndpoint();
47-
// 保持title宽度
48-
if (this.fieldsList.length > 0) {
49-
let width = $(this.fieldsList[0].dom).width();
50-
$(this.dom).find('.title').css('width', width);
51-
} else {
52-
$(this.dom).find('.title').css('width', this.options._emptyWidth || width);
47+
48+
if (this.fieldsList.length === 0) {
49+
$(this.dom).find('.title').css('width', this.options._emptyWidth || 150);
5350
}
5451

5552
$(this.dom).on('dblclick', (e) => {
@@ -96,8 +93,8 @@ export default class TableNode extends Node {
9693

9794
// 记录状态
9895
this.status = 'expand';
99-
// 改变icon状态
100-
$(this.dom).find('.table-build-icon-xiala').removeClass('collapse');
96+
// 改变伸缩状态
97+
$(this.dom).removeClass('collapse');
10198
}
10299

103100
_collapse(oldEdges) {
@@ -113,8 +110,8 @@ export default class TableNode extends Node {
113110
});
114111
// 记录状态
115112
this.status = 'collapse';
116-
// 改变icon状态
117-
$(this.dom).find('.table-build-icon-xiala').addClass('collapse');
113+
// 改变伸缩状态
114+
$(this.dom).addClass('collapse');
118115

119116
// 生成新线段,并去重
120117
let newEdges = [];
@@ -391,11 +388,6 @@ export default class TableNode extends Node {
391388
_.set(this, 'options._columns', newCol);
392389
this._addFields();
393390

394-
// 获取所有columns的宽度
395-
let width = getWidth(newCol);
396-
let textWidth = width - OPER_ICON_WIDTH;
397-
$(this.dom).find('.title').css('width', width);
398-
$(this.dom).find('.title-text').css('width', textWidth);
399391
}
400392

401393
_createTitleEndpoint() {

‎src/index.less‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
border: 1px solid #5A5A5A;
1111
border-radius: 4px;
1212
color: #fff;
13+
background: #252525;
14+
&.collapse {
15+
.title {
16+
border-bottom: none;
17+
}
18+
}
1319
.title {
1420
position: relative;
15-
background: #252525;
1621
border-bottom: 1px solid #5A5A5A;
17-
padding-left: 15px;
22+
padding: 050px0 15px;
1823
height: 30px;
1924
line-height: 30px;
25+
min-width: 150px;
2026
cursor: pointer;
2127
.title-text {
2228
overflow: hidden;
@@ -53,9 +59,6 @@
5359
}
5460
.table-build-icon-xiala{
5561
display: inline-block;
56-
&.collapse{
57-
/* todo: 需要一个新icon */
58-
}
5962
}
6063
}
6164
}
@@ -67,7 +70,6 @@
6770
line-height: 24px;
6871
align-items: center;
6972
display: flex;
70-
background: #252525;
7173
&:hover {
7274
background: rgba(216, 216, 216, 0.06);
7375
.point {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /