From aac34f0d57d690e6a22dce18a8bc17db63a21104 Mon Sep 17 00:00:00 2001 From: Leo Lutz Date: Thu, 21 Dec 2023 17:17:57 -0700 Subject: [PATCH 1/3] Fix dragging onto complex items where the space is completely covered by child elements --- src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index c48696b..c2b69e3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -221,10 +221,11 @@ class NestedSort { } onDragEnter(e: DragEvent): void { - if (!this.canBeTargeted(e.target as HTMLElement)) return + const target = (e.target as HTMLElement)?.closest(`li[data-id],.${this.classNames.placeholder}`) as HTMLElement + if (!target || !this.canBeTargeted(target)) return this.removeClassFromEl(this.classNames.targeted, this.targetedNode) - this.targetedNode = e.target as HTMLElement + this.targetedNode = target this.targetedNode.classList.add(this.classNames.targeted) } From 4ed281d1ed77020cb19a6234f41d8375ba9c22e3 Mon Sep 17 00:00:00 2001 From: Leo Lutz Date: Thu, 11 Jan 2024 13:39:00 -0700 Subject: [PATCH 2/3] Add example of styling complex items --- dev/index.html | 3 +- dev/styling-complex.html | 116 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 dev/styling-complex.html diff --git a/dev/index.html b/dev/index.html index b0b5ca0..e1ff00b 100644 --- a/dev/index.html +++ b/dev/index.html @@ -19,7 +19,8 @@

Samples

  • Data-driven List
  • Ordered Data-driven List
  • Mapped Data-driven List
  • -
  • Styling
  • +
  • Styling - Data List
  • +
  • Styling - Complex Items
  • Persisting Data in Local Storage
  • Enable / Disable
  • Nesting Levels
  • diff --git a/dev/styling-complex.html b/dev/styling-complex.html new file mode 100644 index 0000000..2164683 --- /dev/null +++ b/dev/styling-complex.html @@ -0,0 +1,116 @@ + + + + + + + Nested Sort | Nesting Levels Option Demo + + + + + + + +
    +

    Styling - Complex Items

    + +
    +
      +
    • +
      +
      +
      Topic 1
      +
      +
    • +
    • +
      +
      +
      Topic 2
      +
      +
    • +
    • +
      +
      +
      Topic 3
      +
      +
    • +
    • +
      +
      +
      Topic 4
      +
      +
    • +
    • +
      +
      +
      Topic 5
      +
      +
    • +
    • +
      +
      +
      Topic 6
      +
      +
    • +
    • +
      +
      +
      Topic 7
      +
      +
    • +
    • +
      +
      +
      Topic 8
      +
      +
    • +
    • +
      +
      +
      Topic 9
      +
      +
    • +
    • +
      +
      +
      Topic 10
      +
      +
    • +
    +
    
    +  
    +
    + + + + + + From 944494b12410e033147f76e29ca1546595063d3e Mon Sep 17 00:00:00 2001 From: Leo Lutz Date: Thu, 11 Jan 2024 13:43:02 -0700 Subject: [PATCH 3/3] Fix title --- dev/styling-complex.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/styling-complex.html b/dev/styling-complex.html index 2164683..b3fdeb5 100644 --- a/dev/styling-complex.html +++ b/dev/styling-complex.html @@ -4,7 +4,7 @@ - Nested Sort | Nesting Levels Option Demo + Nested Sort | Styling - Complex Items Demo