@@ -43262,12 +43262,13 @@ var SchemaDesignerToolbar = class {
4326243262 this._toolbarDiv = document.createElement("div");
4326343263 this._container.appendChild(this._toolbarDiv);
4326443264 this._toolbarDiv.classList.add("sd-toolbar");
43265+ this._toolbarDiv.style.color = this._config.colors.toolbarForeground;
4326543266 }
4326643267 addButton(icon, title, callback, onDragEndCallback) {
4326743268 const button = document.createElement("div");
4326843269 this._toolbarDiv.appendChild(button);
4326943270 button.classList.add("sd-toolbar-button");
43270- button.style.backgroundImage = `url(${ icon})` ;
43271+ button.innerHTML = icon;
4327143272 button.onclick = callback;
4327243273 button.title = title;
4327343274 if (onDragEndCallback) {
@@ -43393,8 +43394,9 @@ var SchemaDesignerEntity = class {
4339343394 const header = document.createElement("div");
4339443395 header.classList.add("sd-table-header");
4339543396 const headerIcon = document.createElement("div");
43397+ headerIcon.innerHTML = this._config.icons.entityIcon;
4339643398 headerIcon.classList.add("sd-table-header-icon");
43397- headerIcon.style.backgroundImage = `url(${ this._config.icons.entityIcon})` ;
43399+ headerIcon.innerHTML = this._config.icons.entityIcon;
4339843400 header.appendChild(headerIcon);
4339943401 const headerText = document.createElement("div");
4340043402 headerText.classList.add("sd-table-header-text");
@@ -43408,11 +43410,13 @@ var SchemaDesignerEntity = class {
4340843410 columnDiv.classList.add("sd-table-column");
4340943411 const columnIcon = document.createElement("div");
4341043412 columnIcon.classList.add("sd-table-column-icon");
43411- if (this._config.icons.dataTypeIcons[column.datatype] ) {
43412- columnIcon.style.backgroundImage = `url(${ this._config.icons.dataTypeIcons[column.datatype]})` ;
43413+ if (this._config.icons.dataTypeIcons[column.dataType] !== void 0 ) {
43414+ columnIcon.innerHTML = this._config.icons.dataTypeIcons[column.dataType] ;
4341343415 } else {
43414- columnIcon.style.backgroundImage = `url(${this._config.icons.customDataTypeIcon})`;
43416+ console.log(column.dataType);
43417+ columnIcon.innerHTML = this._config.icons.customDataTypeIcon;
4341543418 }
43419+ columnIcon.title = column.dataType;
4341643420 columnDiv.appendChild(columnIcon);
4341743421 const columnText = document.createElement("div");
4341843422 columnText.classList.add("sd-table-column-text");
@@ -43456,9 +43460,85 @@ var SchemaDesignerLayout = class extends mxGraphFactory.mxHierarchicalLayout {
4345643460 super(graph, mxGraphFactory.mxConstants.DIRECTION_EAST, true);
4345743461 }
4345843462 execute(parent) {
43463+ this.graph.getModel().beginUpdate();
4345943464 this.interHierarchySpacing = 100;
4346043465 this.orientation = mxGraphFactory.mxConstants.DIRECTION_WEST;
4346143466 super.execute(parent);
43467+ let cells = this.graph.getModel().getChildCells(this.graph.getDefaultParent());
43468+ this.graph.moveCells(cells, 100, 0, false);
43469+ cells = cells.filter((cell2) => !cell2.edge);
43470+ const cellSet = new Set(cells.map((cell2) => cell2.id));
43471+ const subGraphs = [];
43472+ for (const cell2 of cells) {
43473+ if (cellSet.has(cell2.id)) {
43474+ const subGraph = [];
43475+ const queue = [cell2];
43476+ cellSet.delete(cell2.id);
43477+ while (queue.length > 0) {
43478+ const current = queue.shift();
43479+ cellSet.delete(current.id);
43480+ subGraph.push(current);
43481+ const edges = this.graph.getModel().getEdges(current);
43482+ for (const edge of edges) {
43483+ let nextNode = void 0;
43484+ if (edge.source.id === current.id) {
43485+ nextNode = edge.target;
43486+ } else if (edge.target.id === current.id) {
43487+ nextNode = edge.source;
43488+ }
43489+ if (nextNode !== void 0) {
43490+ if (cellSet.has(nextNode.id)) {
43491+ queue.push(nextNode);
43492+ cellSet.delete(nextNode.id);
43493+ }
43494+ }
43495+ }
43496+ }
43497+ subGraphs.push(subGraph);
43498+ }
43499+ }
43500+ const boundingBoxes = subGraphs.map((subGraph) => {
43501+ let minX = Number.MAX_VALUE;
43502+ let minY = Number.MAX_VALUE;
43503+ let maxX2 = Number.MIN_VALUE;
43504+ let maxY = Number.MIN_VALUE;
43505+ for (const cell2 of subGraph) {
43506+ const geo = cell2.getGeometry();
43507+ if (geo) {
43508+ minX = Math.min(minX, geo.x);
43509+ minY = Math.min(minY, geo.y);
43510+ maxX2 = Math.max(maxX2, geo.x + geo.width);
43511+ maxY = Math.max(maxY, geo.y + geo.height);
43512+ }
43513+ }
43514+ return { minX, minY, maxX: maxX2, maxY };
43515+ });
43516+ const maxX = Math.max(...boundingBoxes.map((box) => box.maxX));
43517+ const standaloneCells = [];
43518+ for (const subGraph of subGraphs) {
43519+ if (subGraph.length === 1) {
43520+ standaloneCells.push(...subGraph);
43521+ }
43522+ }
43523+ const startX = Math.min(...standaloneCells.map((cell2) => cell2.geometry.x));
43524+ const startY = Math.min(...standaloneCells.map((cell2) => cell2.geometry.y));
43525+ const intercellSpacing = 100;
43526+ let currentX = startX;
43527+ let currentY = startY;
43528+ let currentRowMaxHeight = 0;
43529+ for (let i = 0; i < standaloneCells.length; i++) {
43530+ if (currentX + intercellSpacing > maxX) {
43531+ currentX = startX;
43532+ currentY = currentY + currentRowMaxHeight + intercellSpacing;
43533+ currentRowMaxHeight = 0;
43534+ }
43535+ const cell2 = standaloneCells[i];
43536+ cell2.geometry.x = currentX;
43537+ cell2.geometry.y = currentY;
43538+ currentX = currentX + cell2.geometry.width + intercellSpacing;
43539+ currentRowMaxHeight = Math.max(currentRowMaxHeight, cell2.geometry.height);
43540+ }
43541+ this.graph.getModel().endUpdate();
4346243542 }
4346343543};
4346443544
@@ -43495,6 +43575,8 @@ var SchemaDesigner = class {
4349543575 this._container.style.setProperty("--sd-border-color", this._config.colors.cellBorder);
4349643576 this._container.style.setProperty("--sd-cell-html-foreground", this._config.colors.cellForeground);
4349743577 this._container.style.setProperty("--sd-cell-html-hover-column-background", this._config.colors.cellColumnHover);
43578+ this._container.style.setProperty("--sd-cell-divider-color", this._config.colors.cellDivider);
43579+ this._container.style.setProperty("--sd-graph-background-color", this._config.colors.cellBackground);
4349843580 this._graph.getStylesheet().getDefaultVertexStyle()["fillColor"] = this._config.colors.cellBackground;
4349943581 this._graph.getStylesheet().getDefaultEdgeStyle()["strokeColor"] = this._config.colors.edge;
4350043582 this._graph.getStylesheet().getDefaultVertexStyle()["cellHighlightColor"] = this._config.colors.cellHighlight;
@@ -43841,17 +43923,17 @@ var SchemaDesigner = class {
4384143923 schema: "dbo",
4384243924 columns: [{
4384343925 name: "Column1",
43844- datatype : "int",
43926+ dataType : "int",
4384543927 isPrimaryKey: true,
4384643928 isIdentity: true
4384743929 }, {
4384843930 name: "Column2",
43849- datatype : "int",
43931+ dataType : "int",
4385043932 isPrimaryKey: false,
4385143933 isIdentity: false
4385243934 }, {
4385343935 name: "Column2",
43854- datatype : "int",
43936+ dataType : "int",
4385543937 isPrimaryKey: false,
4385643938 isIdentity: false
4385743939 }]
0 commit comments