Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SortableList): bump version 9.0.1 #150

Merged
merged 2 commits into from
Nov 29, 2024
Merged

feat(SortableList): bump version 9.0.1 #150

merged 2 commits into from
Nov 29, 2024

Conversation

ArgoZhang
Copy link
Contributor

@ArgoZhang ArgoZhang commented Nov 29, 2024

bump version 9.0.1

Summary of the changes (Less than 80 chars)

Description

fixes #149

Customer Impact

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

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

Enhancements:

  • Update Sortable.js library to version 1.15.6, improving support for pointer events and enhancing compatibility with Safari and iOS.

@bb-auto bb-auto bot added the enhancement New feature or request label Nov 29, 2024
Copy link

sourcery-ai bot commented Nov 29, 2024

Reviewer's Guide by Sourcery

This PR updates the Sortable library from version 1.15.2 to 1.15.6, introducing several improvements to pointer event handling, drag-and-drop functionality, and multi-drag selection behavior. The changes also modify how the library handles Safari and iOS support.

Sequence diagram for updated pointer event handling in Sortable

sequenceDiagram
    participant User
    participant Browser
    participant Sortable

    User->>Browser: Initiate drag
    Browser->>Sortable: Trigger pointerdown event
    Sortable->>Sortable: Check supportPointer
    alt supportPointer enabled
        Sortable->>Browser: Listen for pointerup
        Sortable->>Browser: Listen for pointercancel
    else
        Sortable->>Browser: Listen for mouseup
        Sortable->>Browser: Listen for touchend
        Sortable->>Browser: Listen for touchcancel
    end
    Browser->>Sortable: Trigger pointerup/mouseup/touchend
    Sortable->>Sortable: Execute _onDrop

    User->>Browser: End drag
Loading

Updated class diagram for Sortable changes

classDiagram
    class Sortable {
        -version: String
        -supportPointer: Boolean
        +Sortable(el, options)
        +_onDrop()
        +_disableDelayedDrag()
        +_delayedDragTouchMoveHandler()
    }

    class MultiDragPlugin {
        +MultiDragPlugin()
    }

    Sortable : +expando
    Sortable : +getChild
    Sortable : +detectDirection
    Sortable : +cancelNextTick
    Sortable : +nextTick

    Sortable <|-- MultiDragPlugin

    note for Sortable "Updated to handle pointer events and Safari/iOS support"
Loading

File-Level Changes

Change Details Files
Updated Sortable library version and pointer event handling
  • Bumped version from 1.15.2 to 1.15.6
  • Modified pointer support logic for Safari and iOS devices
  • Added pointer event handlers for drag and drop operations
  • Improved cleanup of pointer event listeners
src/components/BootstrapBlazor.Sortable/wwwroot/sortable.esm.js
Enhanced drag and drop functionality
  • Removed cancelable check from preventDefault calls
  • Added window selection clearing during drag start
  • Improved parent element traversal logic
src/components/BootstrapBlazor.Sortable/wwwroot/sortable.esm.js
Improved multi-drag selection behavior
  • Added filtering support for multi-drag selection
  • Enhanced element draggability checking during selection
  • Wrapped selection logic in self-executing function for better scoping
src/components/BootstrapBlazor.Sortable/wwwroot/sortable.esm.js
Modified module exports and plugin mounting
  • Removed default mounting of Swap and MultiDrag plugins
  • Added named exports for Sortable, MultiDrag, and Swap plugins
src/components/BootstrapBlazor.Sortable/wwwroot/sortable.esm.js

Assessment against linked issues

Issue Objective Addressed Explanation
#149 Update Sortable library version from 1.15.2 to 1.15.6

Possibly linked issues


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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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 bb-auto bot added this to the v9.0.0 milestone Nov 29, 2024
@ArgoZhang ArgoZhang merged commit aa984f3 into master Nov 29, 2024
1 check failed
@ArgoZhang ArgoZhang deleted the dev-sortablejs branch November 29, 2024 03:32
Copy link

@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 @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • This contains a breaking change in how MultiDrag and Swap plugins are exported (they're no longer mounted by default). This should be clearly documented in the PR description.
  • Given the breaking change in plugin mounting, this should likely be a major version bump rather than a patch version (9.1.0 or 10.0.0) to follow semantic versioning.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@@ -1232,7 +1233,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
pluginEvent('filter', _this, {
evt: evt
});
preventOnFilter && evt.cancelable && evt.preventDefault();
preventOnFilter && evt.preventDefault();
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Consider checking evt.cancelable before calling preventDefault()

Removing the cancelable check could cause errors in some browsers when the event isn't cancelable. This could break drag and drop functionality in certain scenarios.

@@ -128,7 +128,7 @@
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

var version = "1.15.2";
var version = "1.15.6";
Copy link

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

i = currentIndex;
n = lastIndex + 1;
}
var filter = options.filter;
Copy link

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

}
var filter = options.filter;
for (; i < n; i++) {
if (~multiDragElements.indexOf(children[i])) continue;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (~multiDragElements.indexOf(children[i])) continue;
if (~multiDragElements.indexOf(children[i])) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

for (; i < n; i++) {
if (~multiDragElements.indexOf(children[i])) continue;
// Check if element is draggable
if (!closest(children[i], options.draggable, parentEl, false)) continue;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (!closest(children[i], options.draggable, parentEl, false)) continue;
if (!closest(children[i], options.draggable, parentEl, false)) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

Comment on lines +3114 to +3116
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
return closest(children[i], criteria.trim(), parentEl, false);
}));
Copy link

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

var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
return closest(children[i], criteria.trim(), parentEl, false);
}));
if (filtered) continue;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces)

Suggested change
if (filtered) continue;
if (filtered) {


ExplanationIt is recommended to always use braces and create explicit statement blocks.

Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).

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(SortableList): bump version 9.0.1
1 participant