Skip to content

chore(DockView): bump version 9.1.18#493

Merged
ArgoZhang merged 1 commit intomasterfrom
chore-dockview-v4.5.0
Jul 21, 2025
Merged

chore(DockView): bump version 9.1.18#493
ArgoZhang merged 1 commit intomasterfrom
chore-dockview-v4.5.0

Conversation

@zhaijunlei955
Copy link
Copy Markdown
Contributor

@zhaijunlei955 zhaijunlei955 commented Jul 21, 2025

Link issues

fixes #494

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Upgrade dockview to version 4.5.0 with support for dynamically enabling/disabling drag-and-drop, optional suppression of active state changes during moves, and refined styling and state-refresh capabilities across components.

New Features:

  • Introduce disableDnd option to enable or disable drag-and-drop dynamically
  • Add skipSetActive flag to move and open operations to control active panel/group behavior

Enhancements:

  • Upgrade dockview-core dependency from v4.4.0 to v4.5.0
  • Add updateDragAndDropState methods across components to refresh draggable state
  • Propagate skipSetActive through moveTo, panel opening, and panel-moving workflows
  • Improve CSS: add global box-sizing and enhance tab focus, drag, and action styling

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 21, 2025

Reviewer's Guide

This PR upgrades dockview core to v4.5.0, enabling runtime toggling of drag-and-drop via the new disableDnd option with propagated state updates, introduces a skipSetActive flag throughout panel move APIs for consistent active state handling, and refines CSS (box-sizing and tab styling) while removing duplicate rules.

Class diagram for Dockview drag-and-drop and active state updates

classDiagram
    class DockviewComponent {
        +options
        +updateDragAndDropState()
        +updateOptions(options)
    }
    class DockviewGroupPanelModel {
        +tabsContainer
        +updateDragAndDropState()
    }
    class TabsContainer {
        +tabs
        +voidContainer
        +updateDragAndDropState()
    }
    class Tabs {
        +_tabs
        +updateDragAndDropState()
    }
    class Tab {
        +_element
        +updateDragAndDropState()
    }
    class VoidContainer {
        +_element
        +updateDragAndDropState()
    }

    DockviewComponent --> "*" DockviewGroupPanelModel : groups
    DockviewGroupPanelModel --> TabsContainer : tabsContainer
    TabsContainer --> Tabs : tabs
    TabsContainer --> VoidContainer : voidContainer
    Tabs --> Tab : _tabs
Loading

Class diagram for moveTo and skipSetActive propagation

classDiagram
    class DockviewComponent {
        +moveGroupOrPanel(options)
    }
    class DockviewGroupPanelApiImpl {
        +moveTo(options)
    }
    class DockviewPanelApiImpl {
        +moveTo(options)
    }

    DockviewGroupPanelApiImpl --|> DockviewComponent : uses moveGroupOrPanel
    DockviewPanelApiImpl --|> DockviewComponent : uses moveGroupOrPanel
    DockviewGroupPanelApiImpl : +skipSetActive
    DockviewPanelApiImpl : +skipSetActive
    DockviewComponent : +skipSetActive
Loading

File-Level Changes

Change Details Files
Runtime toggle of drag-and-drop via disableDnd
  • Use accessor.options.disableDnd for draggable property in Tab and VoidContainer
  • Add updateDragAndDropState methods to Tab, VoidContainer, Tabs, TabsContainer, and DockviewGroupPanelModel
  • Invoke updateDragAndDropState in DockviewComponent when disableDnd option changes
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Consistent skipSetActive flag in panel move operations
  • Add skipSetActive handling to DockviewGroupPanelApiImpl.moveTo and panel API methods
  • Propagate skipSetActive and skipSetGroupActive through moveGroupOrPanel and openPanel calls
  • Conditionally call doSetGroupAndPanelActive in DockviewComponent based on skipSetActive
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
CSS box-sizing and tab styling refinements
  • Add box-sizing: border-box to key containers
  • Introduce dv-dragged and dv-tab focus/hover styling rules
  • Remove duplicate CSS block at end of file
src/components/BootstrapBlazor.DockView/wwwroot/css/dockview.css
Version bump to v4.5.0
  • Update @Version comment from 4.4.0 to 4.5.0
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto
Copy link
Copy Markdown

bb-auto Bot commented Jul 21, 2025

Thanks for your PR, @zhaijunlei955. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@bb-auto bb-auto Bot requested a review from ArgoZhang July 21, 2025 03:33
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zhaijunlei955 - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js:4993` </location>
<code_context>
         this._element.className = 'dv-tab';
         this._element.tabIndex = 0;
-        this._element.draggable = true;
+        this._element.draggable = !this.accessor.options.disableDnd;
         toggleClass(this.element, 'dv-inactive-tab', true);
         const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
</code_context>

<issue_to_address>
Directly toggling draggable based on disableDnd may cause accessibility issues.

Review whether additional ARIA attributes or focus management are needed to maintain accessibility when drag-and-drop is disabled.

Suggested implementation:

```javascript
        this._element = document.createElement('div');
        this._element.className = 'dv-tab';
        this._element.tabIndex = 0;
        this._element.draggable = !this.accessor.options.disableDnd;
        if (!this.accessor.options.disableDnd) {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.setAttribute('aria-dropeffect', 'move');
        } else {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.removeAttribute('aria-dropeffect');
        }
        toggleClass(this.element, 'dv-inactive-tab', true);
        const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);

```

```javascript
    updateDragAndDropState() {
        this._element.draggable = !this.accessor.options.disableDnd;
        if (!this.accessor.options.disableDnd) {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.setAttribute('aria-dropeffect', 'move');
        } else {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.removeAttribute('aria-dropeffect');
        }
    }

```
</issue_to_address>

### Comment 2
<location> `src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js:9885` </location>
<code_context>
+                    // Calculate position based on available properties
+                    let left, top;
+                    if ('left' in box) {
+                        left = box.left + 50;
+                    }
+                    else if ('right' in box) {
+                        left = Math.max(0, box.right - box.width - 50);
+                    }
+                    else {
+                        left = 50; // Default fallback
+                    }
+                    if ('top' in box) {
</code_context>

<issue_to_address>
Default fallback positions for floating groups may cause overlap.

A static fallback of 50 for left/top may cause overlapping windows if several groups lack valid box properties. Consider dynamically adjusting the fallback to prevent overlap, such as incrementing the value or checking for free space.

Suggested implementation:

```javascript
                    let left, top;
                    if ('left' in box) {
                        left = box.left + 50;
                    }
                    else if ('right' in box) {
                        left = Math.max(0, box.right - box.width - 50);
                    }
                    else {
                        // Dynamically offset fallback to avoid overlap
                        if (!this._floatingFallbackCount) {
                            this._floatingFallbackCount = 0;
                        }
                        left = 50 + (this._floatingFallbackCount * 40);
                    }
                    if ('top' in box) {
                        top = box.top + 50;
                    }
                    else if ('bottom' in box) {
                        top = Math.max(0, box.bottom - box.height - 50);
                    }
                    else {
                        // Dynamically offset fallback to avoid overlap
                        if (!this._floatingFallbackCount) {
                            this._floatingFallbackCount = 0;
                        }
                        top = 50 + (this._floatingFallbackCount * 40);
                        this._floatingFallbackCount++;
                    }

```

- You may want to reset `this._floatingFallbackCount` when all floating groups are closed or repositioned, to avoid the counter growing indefinitely.
- If fallback is used for both left and top, incrementing the counter only once per group (as above) is usually sufficient, but you may want to fine-tune the offset logic for your UI.
</issue_to_address>

### Comment 3
<location> `src/components/BootstrapBlazor.DockView/wwwroot/css/dockview.css:1071` </location>
<code_context>
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+.dv-tab .dv-default-tab .dv-default-tab-content {
+  flex-grow: 1;
+  margin-right: 4px;
+}
+.dv-tab .dv-default-tab .dv-default-tab-action {
</code_context>

<issue_to_address>
Hardcoded margin may not scale with different font sizes or themes.

Consider replacing the hardcoded 4px margin with a relative unit like em/rem or a CSS variable to improve scalability across themes and font sizes.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
.dv-tab .dv-default-tab .dv-default-tab-content {
  flex-grow: 1;
  margin-right: 4px;
}
=======
:root {
  --dv-tab-margin-right: 0.5em;
}
.dv-tab .dv-default-tab .dv-default-tab-content {
  flex-grow: 1;
  margin-right: var(--dv-tab-margin-right);
}
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

this._element.className = 'dv-tab';
this._element.tabIndex = 0;
this._element.draggable = true;
this._element.draggable = !this.accessor.options.disableDnd;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Directly toggling draggable based on disableDnd may cause accessibility issues.

Review whether additional ARIA attributes or focus management are needed to maintain accessibility when drag-and-drop is disabled.

Suggested implementation:

        this._element = document.createElement('div');
        this._element.className = 'dv-tab';
        this._element.tabIndex = 0;
        this._element.draggable = !this.accessor.options.disableDnd;
        if (!this.accessor.options.disableDnd) {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.setAttribute('aria-dropeffect', 'move');
        } else {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.removeAttribute('aria-dropeffect');
        }
        toggleClass(this.element, 'dv-inactive-tab', true);
        const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
    updateDragAndDropState() {
        this._element.draggable = !this.accessor.options.disableDnd;
        if (!this.accessor.options.disableDnd) {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.setAttribute('aria-dropeffect', 'move');
        } else {
            this._element.setAttribute('aria-grabbed', 'false');
            this._element.removeAttribute('aria-dropeffect');
        }
    }

Comment on lines +9885 to +9891
left = box.left + 50;
}
else if ('right' in box) {
left = Math.max(0, box.right - box.width - 50);
}
else {
left = 50; // Default fallback
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Default fallback positions for floating groups may cause overlap.

A static fallback of 50 for left/top may cause overlapping windows if several groups lack valid box properties. Consider dynamically adjusting the fallback to prevent overlap, such as incrementing the value or checking for free space.

Suggested implementation:

                    let left, top;
                    if ('left' in box) {
                        left = box.left + 50;
                    }
                    else if ('right' in box) {
                        left = Math.max(0, box.right - box.width - 50);
                    }
                    else {
                        // Dynamically offset fallback to avoid overlap
                        if (!this._floatingFallbackCount) {
                            this._floatingFallbackCount = 0;
                        }
                        left = 50 + (this._floatingFallbackCount * 40);
                    }
                    if ('top' in box) {
                        top = box.top + 50;
                    }
                    else if ('bottom' in box) {
                        top = Math.max(0, box.bottom - box.height - 50);
                    }
                    else {
                        // Dynamically offset fallback to avoid overlap
                        if (!this._floatingFallbackCount) {
                            this._floatingFallbackCount = 0;
                        }
                        top = 50 + (this._floatingFallbackCount * 40);
                        this._floatingFallbackCount++;
                    }
  • You may want to reset this._floatingFallbackCount when all floating groups are closed or repositioned, to avoid the counter growing indefinitely.
  • If fallback is used for both left and top, incrementing the counter only once per group (as above) is usually sufficient, but you may want to fine-tune the offset logic for your UI.

Comment on lines +1071 to +1074
.dv-tab .dv-default-tab .dv-default-tab-content {
flex-grow: 1;
margin-right: 4px;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Hardcoded margin may not scale with different font sizes or themes.

Consider replacing the hardcoded 4px margin with a relative unit like em/rem or a CSS variable to improve scalability across themes and font sizes.

Suggested change
.dv-tab .dv-default-tab .dv-default-tab-content {
flex-grow: 1;
margin-right: 4px;
}
:root {
--dv-tab-margin-right: 0.5em;
}
.dv-tab .dv-default-tab .dv-default-tab-content {
flex-grow: 1;
margin-right: var(--dv-tab-margin-right);
}

}));
this.doSetGroupAndPanelActive(destinationGroup);
this.movingLock(() => {
var _a;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Use const or let instead of var. (avoid-using-var)

Explanation`const` is preferred as it ensures you cannot reassign references (which can lead to buggy and confusing code). `let` may be used if you need to reassign references - it's preferred to `var` because it is block- rather than function-scoped.

From the Airbnb JavaScript Style Guide

@bb-auto bb-auto Bot added the enhancement New feature or request label Jul 21, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Jul 21, 2025
@ArgoZhang ArgoZhang changed the title chore(deps): update dockview to v4.5.0 chore(DockView): bump version 9.1.18 Jul 21, 2025
@ArgoZhang ArgoZhang merged commit 8b14e08 into master Jul 21, 2025
1 check passed
@ArgoZhang ArgoZhang deleted the chore-dockview-v4.5.0 branch July 21, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(DockView): bump version 9.1.18

2 participants