Commit 1babd22f by liuyong

修改bug

1 parent 5679bde9
......@@ -1543,7 +1543,7 @@ var EditDataDialog = function(ui, cell)
mxUtils.write(text, id);
var idInput = form.addField(mxResources.get('id') + ':', text);
mxEvent.addListener(text, 'dblclick', function(evt)
{
var dlg = new FilenameDialog(ui, id, mxResources.get('apply'), mxUtils.bind(this, function(value)
......@@ -1744,6 +1744,7 @@ var EditDataDialog = function(ui, cell)
var applyBtn = mxUtils.button(mxResources.get('apply'), function()
{
//二次开发,编辑数据的时候点击应用时候的操作
try
{
ui.hideDialog.apply(ui, arguments);
......
......@@ -1547,34 +1547,93 @@ AttributePanel = function(format, editorUi, container)
}
mxUtils.extend(AttributePanel, BaseFormatPanel);
AttributePanel.prototype.init = function()
AttributePanel.prototype.init = function()//二次开发,属性面板内容
{
console.log('属性面板');
var ss = this.editorUi.getSelectionState();
const nodeInfo = ss.cells[0].value;
const nodeName = typeof nodeInfo == 'string' ? nodeInfo : '节点名称';
var ui = this.editorUi;
var editor = ui.editor;
var graph = editor.graph;
// var ss = this.editorUi.getSelectionState();
const objectTag = graph.getSelectionCell().value;
const nodeName = typeof objectTag == 'string' ? objectTag : objectTag.getAttribute('label');
var div = document.createElement('div');
div.style.padding = '8px';
if(typeof nodeInfo == 'string') {
div.innerHTML = `
<div>节点名称: <span>${ nodeName }</span></div>
`;
}else {
// console.log(ss);
let resHtml = '';
for (const key in nodeInfo.attributes){
if(nodeInfo.attributes.hasOwnProperty(key)) {
// console.log(nodeInfo.attributes[key].name);
// console.log(nodeInfo.attributes[key].value);
resHtml += `<div>${ nodeInfo.attributes[key].name } : ${ nodeInfo.attributes[key].value }</div>`;
}
}
// console.log(resHtml);
div.innerHTML = resHtml;
}
div.style.cssText = 'padding: 8px;display: flex;align-items: center;justify-content: space-around;';
const div2 = document.createElement('div');
div2.innerHTML = '节点名称: ';
div.appendChild(div2);
const input = document.createElement("input");
input.type = "text";
input.value = nodeName;
input.addEventListener("blur", function(e) {
const value_ = e.target.value;
graph.getModel().setValue(graph.getSelectionCell(), value_);//修改节点名称
});
div.appendChild(input);
this.container.appendChild(div);
if(typeof objectTag == 'object') {
this.addListPanel(this.container);
}
}
AttributePanel.prototype.addListPanel = function(container)
{
var ui = this.editorUi;
var editor = ui.editor;
var graph = editor.graph;
const div = document.createElement('div');
const objectTag = graph.getSelectionCell().value;
const attributeArr = Array.from(objectTag.attributes);
attributeArr.shift();//去掉节点名称
const nodeName = attributeArr.map(attr => attr.name);
const nodeValue = attributeArr.map(attr => attr.value);
nodeName.forEach((item, index) => {
const itemContainer = document.createElement('div');
itemContainer.style.display = 'flex';
itemContainer.style.alignItems = 'center';
itemContainer.style.justifyContent = 'space-around';
const nameDiv = document.createElement('div');
nameDiv.innerHTML = item + ': ';
itemContainer.appendChild(nameDiv);
const input = document.createElement("input");
input.type = "text";
input.value = nodeValue[index];
input.addEventListener("blur", function(e) {
const value_ = e.target.value;
objectTag.setAttribute(item, value_);
});
itemContainer.appendChild(input);
div.appendChild(itemContainer);
})
// input.addEventListener("blur", function(e) {
// const value_ = e.target.value;
// const ObjectTag = graph.getSelectionCell().value;
// ObjectTag.setAttribute('age', value_);
// });
// div.appendChild(input);
container.appendChild(div);
}
/**
* Adds the label menu items to the given menu and parent.
......@@ -2056,6 +2115,7 @@ ArrangePanel.prototype.addDistribute = function(div)
*/
ArrangePanel.prototype.addAngle = function(div)
{
var ui = this.editorUi;
var editor = ui.editor;
var graph = editor.graph;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!