Commit 18b300be9d02da447d523adcd6a4f3a5931c441a
1 parent
e3fb8dbb
fix: fix some component not has data source panel but can checked
Showing
1 changed file
with
20 additions
and
17 deletions
@@ -403,6 +403,24 @@ Format.prototype.immediateRefresh = function () { | @@ -403,6 +403,24 @@ Format.prototype.immediateRefresh = function () { | ||
403 | var currentLabel = null; | 403 | var currentLabel = null; |
404 | var currentPanel = null; | 404 | var currentPanel = null; |
405 | 405 | ||
406 | + | ||
407 | + /** | ||
408 | + * @description 验证是否有数据绑定面板 | ||
409 | + * @returns {boolean} | ||
410 | + */ | ||
411 | + const validateHasDataSourcePanel = () => { | ||
412 | + const ui = this.editorUi; | ||
413 | + const ss = ui.getSelectionState(); | ||
414 | + const vertices = ss.vertices || [] | ||
415 | + const sidebarInstance = ui.sidebar | ||
416 | + const cell = vertices[0] | ||
417 | + if (!cell) return false | ||
418 | + const basicAttr = sidebarInstance.enumCellBasicAttribute | ||
419 | + const componentType = cell.getAttribute(basicAttr.COMPONENT_TYPE) | ||
420 | + const hasPermission = sidebarInstance.getComponentPermission(componentType) | ||
421 | + return !!hasPermission.length | ||
422 | + } | ||
423 | + | ||
406 | var addClickHandler = mxUtils.bind( | 424 | var addClickHandler = mxUtils.bind( |
407 | this, | 425 | this, |
408 | function (elt, panel, index, lastEntry) { | 426 | function (elt, panel, index, lastEntry) { |
@@ -435,6 +453,8 @@ Format.prototype.immediateRefresh = function () { | @@ -435,6 +453,8 @@ Format.prototype.immediateRefresh = function () { | ||
435 | currentPanel.style.display = ""; | 453 | currentPanel.style.display = ""; |
436 | } | 454 | } |
437 | } | 455 | } |
456 | + | ||
457 | + if (!validateHasDataSourcePanel()) this.currentIndex = 0 | ||
438 | }); | 458 | }); |
439 | 459 | ||
440 | mxEvent.addListener(elt, "click", clickHandler); | 460 | mxEvent.addListener(elt, "click", clickHandler); |
@@ -586,23 +606,6 @@ Format.prototype.immediateRefresh = function () { | @@ -586,23 +606,6 @@ Format.prototype.immediateRefresh = function () { | ||
586 | this.panels.push(new ArrangePanel(this, ui, arrangePanel)); | 606 | this.panels.push(new ArrangePanel(this, ui, arrangePanel)); |
587 | this.container.appendChild(arrangePanel); | 607 | this.container.appendChild(arrangePanel); |
588 | 608 | ||
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()) { | 609 | if (validateHasDataSourcePanel()) { |
607 | // bind data | 610 | // bind data |
608 | mxUtils.write(label4, "数据绑定"); | 611 | mxUtils.write(label4, "数据绑定"); |