Commit 71c0bb9363dbb2cfcc71ec7b3b80e102d3406220
1 parent
e517fa06
perf: perf some component hidde data source bind panel
Showing
1 changed file
with
28 additions
and
7 deletions
@@ -372,6 +372,7 @@ Format.prototype.immediateRefresh = function () { | @@ -372,6 +372,7 @@ Format.prototype.immediateRefresh = function () { | ||
372 | div.style.color = "rgb(112, 112, 112)"; | 372 | div.style.color = "rgb(112, 112, 112)"; |
373 | div.style.textAlign = "left"; | 373 | div.style.textAlign = "left"; |
374 | div.style.cursor = "default"; | 374 | div.style.cursor = "default"; |
375 | + div.style.display = 'flex' | ||
375 | 376 | ||
376 | var label = document.createElement("div"); | 377 | var label = document.createElement("div"); |
377 | label.className = "geFormatSection"; | 378 | label.className = "geFormatSection"; |
@@ -385,6 +386,7 @@ Format.prototype.immediateRefresh = function () { | @@ -385,6 +386,7 @@ Format.prototype.immediateRefresh = function () { | ||
385 | label.style.height = "25px"; | 386 | label.style.height = "25px"; |
386 | label.style.overflow = "hidden"; | 387 | label.style.overflow = "hidden"; |
387 | label.style.width = "100%"; | 388 | label.style.width = "100%"; |
389 | + label.style.flex = 'auto' | ||
388 | this.container.appendChild(div); | 390 | this.container.appendChild(div); |
389 | 391 | ||
390 | // Prevents text selection | 392 | // Prevents text selection |
@@ -584,14 +586,33 @@ Format.prototype.immediateRefresh = function () { | @@ -584,14 +586,33 @@ Format.prototype.immediateRefresh = function () { | ||
584 | this.panels.push(new ArrangePanel(this, ui, arrangePanel)); | 586 | this.panels.push(new ArrangePanel(this, ui, arrangePanel)); |
585 | this.container.appendChild(arrangePanel); | 587 | this.container.appendChild(arrangePanel); |
586 | 588 | ||
587 | - // bind data | ||
588 | - mxUtils.write(label4, "数据绑定"); | ||
589 | - div.appendChild(label4); | 589 | + /** |
590 | + * @description 验证是否有数据绑定面板 | ||
591 | + * @returns {boolean} | ||
592 | + */ | ||
593 | + const validateHasDataSourcePanel = () => { | ||
594 | + const ui = this.editorUi; | ||
595 | + const ss = ui.getSelectionState(); | ||
596 | + const vertices = ss.vertices || [] | ||
597 | + const sidebarInstance = ui.sidebar | ||
598 | + const cell = vertices[0] | ||
599 | + if (!cell) return false | ||
600 | + const basicAttr = sidebarInstance.enumCellBasicAttribute | ||
601 | + const componentType = cell.getAttribute(basicAttr.COMPONENT_TYPE) | ||
602 | + const hasPermission = sidebarInstance.getComponentPermission(componentType) | ||
603 | + return !!hasPermission.length | ||
604 | + } | ||
605 | + | ||
606 | + if (validateHasDataSourcePanel()) { | ||
607 | + // bind data | ||
608 | + mxUtils.write(label4, "数据绑定"); | ||
609 | + div.appendChild(label4); | ||
590 | 610 | ||
591 | - var dataPanel = div.cloneNode(false); | ||
592 | - dataPanel.style.display = "none"; | ||
593 | - this.panels.push(new DataFormatPanel(this, ui, dataPanel)); | ||
594 | - this.container.appendChild(dataPanel); | 611 | + var dataPanel = div.cloneNode(false); |
612 | + dataPanel.style.display = "none"; | ||
613 | + this.panels.push(new DataFormatPanel(this, ui, dataPanel)); | ||
614 | + this.container.appendChild(dataPanel); | ||
615 | + } | ||
595 | 616 | ||
596 | if (ss.cells.length > 0) { | 617 | if (ss.cells.length > 0) { |
597 | addClickHandler(label2, textPanel, idx++); | 618 | addClickHandler(label2, textPanel, idx++); |