Skip to content

Commit 7448e17

Browse files
Release v0.0.76
1 parent 737eea6 commit 7448e17

7 files changed

Lines changed: 75 additions & 10 deletions

File tree

dist/index.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43400,7 +43400,9 @@ var SchemaDesignerEntity = class {
4340043400
header.appendChild(headerIcon);
4340143401
const headerText = document.createElement("div");
4340243402
headerText.classList.add("sd-table-header-text");
43403-
headerText.innerText = `${this.schema}.${this.name}`;
43403+
const tableTitle = `${this.schema}.${this.name}`;
43404+
headerText.innerText = tableTitle;
43405+
headerText.title = tableTitle;
4340443406
header.appendChild(headerText);
4340543407
parent.appendChild(header);
4340643408
const columns = document.createElement("div");
@@ -43413,14 +43415,15 @@ var SchemaDesignerEntity = class {
4341343415
if (this._config.icons.dataTypeIcons[column.dataType] !== void 0) {
4341443416
columnIcon.innerHTML = this._config.icons.dataTypeIcons[column.dataType];
4341543417
} else {
43416-
console.log(column.dataType);
4341743418
columnIcon.innerHTML = this._config.icons.customDataTypeIcon;
4341843419
}
4341943420
columnIcon.title = column.dataType;
4342043421
columnDiv.appendChild(columnIcon);
4342143422
const columnText = document.createElement("div");
4342243423
columnText.classList.add("sd-table-column-text");
43424+
columnText.title = column.name;
4342343425
columnText.innerText = column.name;
43426+
columnText.title = this.getColumnTitle(column, index);
4342443427
columnDiv.appendChild(columnText);
4342543428
const columnConstraints = document.createElement("div");
4342643429
columnConstraints.classList.add("sd-table-column-constraints");
@@ -43452,6 +43455,24 @@ var SchemaDesignerEntity = class {
4345243455
}
4345343456
return constraints.join(", ");
4345443457
}
43458+
getColumnTitle(column, index) {
43459+
let columnTitle = `${column.name}`;
43460+
if (column.isPrimaryKey) {
43461+
columnTitle += ` Primary key`;
43462+
}
43463+
const cells = this._graph.getChildCells(this._graph.getDefaultParent());
43464+
const vertex = cells.find((cell2) => cell2.vertex && cell2.value.name === this.name && cell2.value.schema === this.schema);
43465+
if (vertex) {
43466+
const edges = this._graph.getEdges(vertex);
43467+
const outgoingEdges = edges.filter((edge) => edge.source === vertex);
43468+
for (const edge of outgoingEdges) {
43469+
if (edge.value.sourceRow - 1 === index) {
43470+
return columnTitle + ` Foreign key`;
43471+
}
43472+
}
43473+
}
43474+
return columnTitle;
43475+
}
4345543476
};
4345643477

4345743478
// src/ts/schemaDesigner/schemaDesignerLayout.ts

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/ts/schemaDesigner/schemaDesignerEntity.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export declare class SchemaDesignerEntity implements IEntity {
1010
constructor(entity: IEntity, _config: SchemaDesignerConfig, _graph: mxGraph);
1111
render(): HTMLElement;
1212
private getConstraintText;
13+
private getColumnTitle;
1314
}

dist/src/ts/schemaDesigner/schemaDesignerEntity.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class SchemaDesignerEntity {
3030
header.appendChild(headerIcon);
3131
const headerText = document.createElement("div");
3232
headerText.classList.add("sd-table-header-text");
33-
headerText.innerText = `${this.schema}.${this.name}`;
33+
const tableTitle = `${this.schema}.${this.name}`;
34+
headerText.innerText = tableTitle;
35+
headerText.title = tableTitle;
3436
header.appendChild(headerText);
3537
parent.appendChild(header);
3638
const columns = document.createElement("div");
@@ -44,14 +46,15 @@ class SchemaDesignerEntity {
4446
columnIcon.innerHTML = this._config.icons.dataTypeIcons[column.dataType];
4547
}
4648
else {
47-
console.log(column.dataType);
4849
columnIcon.innerHTML = this._config.icons.customDataTypeIcon;
4950
}
5051
columnIcon.title = column.dataType;
5152
columnDiv.appendChild(columnIcon);
5253
const columnText = document.createElement("div");
5354
columnText.classList.add("sd-table-column-text");
55+
columnText.title = column.name;
5456
columnText.innerText = column.name;
57+
columnText.title = this.getColumnTitle(column, index);
5558
columnDiv.appendChild(columnText);
5659
const columnConstraints = document.createElement("div");
5760
columnConstraints.classList.add("sd-table-column-constraints");
@@ -83,5 +86,23 @@ class SchemaDesignerEntity {
8386
}
8487
return constraints.join(", ");
8588
}
89+
getColumnTitle(column, index) {
90+
let columnTitle = `${column.name}`;
91+
if (column.isPrimaryKey) {
92+
columnTitle += ` Primary key`;
93+
}
94+
const cells = this._graph.getChildCells(this._graph.getDefaultParent());
95+
const vertex = cells.find(cell => cell.vertex && cell.value.name === this.name && cell.value.schema === this.schema);
96+
if (vertex) {
97+
const edges = this._graph.getEdges(vertex);
98+
const outgoingEdges = edges.filter(edge => edge.source === vertex);
99+
for (const edge of outgoingEdges) {
100+
if (edge.value.sourceRow - 1 === index) {
101+
return columnTitle + ` Foreign key`;
102+
}
103+
}
104+
}
105+
return columnTitle;
106+
}
86107
}
87108
exports.SchemaDesignerEntity = SchemaDesignerEntity;

dist/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azdataGraph",
33
"description": "azdataGraph is a derivative of mxGraph, which is a fully client side JavaScript diagramming library that uses SVG and HTML for rendering.",
4-
"version": "0.0.75",
4+
"version": "0.0.76",
55
"homepage": "https://github.com/microsoft/azdataGraph",
66
"author": "Microsoft",
77
"license": "Apache-2.0",

src/ts/schemaDesigner/schemaDesignerEntity.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export class SchemaDesignerEntity implements IEntity {
3131
header.appendChild(headerIcon);
3232
const headerText = document.createElement("div");
3333
headerText.classList.add("sd-table-header-text");
34-
headerText.innerText = `${this.schema}.${this.name}`;
34+
const tableTitle = `${this.schema}.${this.name}`;
35+
headerText.innerText = tableTitle;
36+
headerText.title = tableTitle;
3537
header.appendChild(headerText);
3638
parent.appendChild(header);
3739

@@ -45,14 +47,15 @@ export class SchemaDesignerEntity implements IEntity {
4547
if(this._config.icons.dataTypeIcons[column.dataType] !== undefined) {
4648
columnIcon.innerHTML = this._config.icons.dataTypeIcons[column.dataType];
4749
} else {
48-
console.log(column.dataType);
4950
columnIcon.innerHTML = this._config.icons.customDataTypeIcon;
5051
}
5152
columnIcon.title = column.dataType;
5253
columnDiv.appendChild(columnIcon);
5354
const columnText = document.createElement("div");
5455
columnText.classList.add("sd-table-column-text");
56+
columnText.title = column.name;
5557
columnText.innerText = column.name;
58+
columnText.title = this.getColumnTitle(column, index);
5659
columnDiv.appendChild(columnText);
5760
const columnConstraints = document.createElement("div");
5861
columnConstraints.classList.add("sd-table-column-constraints");
@@ -85,4 +88,23 @@ export class SchemaDesignerEntity implements IEntity {
8588
}
8689
return constraints.join(", ");
8790
}
91+
92+
private getColumnTitle(column: IColumn, index: number): string {
93+
let columnTitle = `${column.name}`;
94+
if (column.isPrimaryKey) {
95+
columnTitle += ` Primary key`;
96+
}
97+
const cells = this._graph.getChildCells(this._graph.getDefaultParent());
98+
const vertex = cells.find(cell => cell.vertex && cell.value.name === this.name && cell.value.schema === this.schema);
99+
if (vertex) {
100+
const edges = this._graph.getEdges(vertex);
101+
const outgoingEdges = edges.filter(edge => edge.source === vertex);
102+
for (const edge of outgoingEdges) {
103+
if (edge.value.sourceRow - 1 === index) {
104+
return columnTitle + ` Foreign key`;
105+
}
106+
}
107+
}
108+
return columnTitle;
109+
}
88110
}

0 commit comments

Comments
 (0)