jqtree 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqTree",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "main": [
5
5
  "jqtree.css",
6
6
  "jqtree-circle.png",
package/docs/_config.yml CHANGED
@@ -118,7 +118,7 @@ defaults:
118
118
  values:
119
119
  layout: "example"
120
120
 
121
- jqtree_version: 1.8.1
121
+ jqtree_version: 1.8.2
122
122
 
123
123
  # Build settings
124
124
  markdown: kramdown
@@ -3,6 +3,10 @@ title: Changelog
3
3
  name: changelog
4
4
  ---
5
5
 
6
+ #### 1.8.2 (march 24 2024)
7
+
8
+ - Issue #751: fix dnd regression (thanks to Tom De Ford)
9
+
6
10
  #### 1.8.1 (march 16 2024)
7
11
 
8
12
  - Issue #791: fix onCanMoveTo (thanks to Christophe Caron)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqtree",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Tree widget for jQuery",
5
5
  "keywords": [
6
6
  "jquery-plugin",
@@ -80,6 +80,17 @@ const generatePositions = (tree: Node, currentNode: Node): HitArea[] => {
80
80
  const handleOpenFolder = (node: Node, element: HTMLElement) => {
81
81
  if (node === currentNode) {
82
82
  // Cannot move inside current item
83
+
84
+ // Dnd over the current element is not possible: add a position with type None for the top and the bottom.
85
+ const top = getOffsetTop(element);
86
+ const height = element.clientHeight;
87
+ addPosition(node, Position.None, top);
88
+
89
+ if (height > 5) {
90
+ // Subtract 5 pixels to allow more space for the next element.
91
+ addPosition(node, Position.None, top + height - 5);
92
+ }
93
+
83
94
  // Stop iterating
84
95
  return false;
85
96
  }
@@ -120,7 +131,7 @@ const generateHitAreasForGroup = (
120
131
  while (i < positionCount) {
121
132
  const position = positionsInGroup[i];
122
133
 
123
- if (position) {
134
+ if (position && position.position !== Position.None) {
124
135
  hitAreas.push({
125
136
  top: areaTop,
126
137
  bottom: areaTop + areaHeight,
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
- const version = "1.8.1";
1
+ const version = "1.8.2";
2
2
 
3
3
  export default version;
@@ -1,5 +1,5 @@
1
1
  /*
2
- JqTree 1.8.1
2
+ JqTree 1.8.2
3
3
 
4
4
  Copyright 2024 Marco Braak
5
5
 
@@ -20,7 +20,7 @@ limitations under the License.
20
20
  var jqtree = (function (exports) {
21
21
  'use strict';
22
22
 
23
- const version = "1.8.1";
23
+ const version = "1.8.2";
24
24
 
25
25
  let Position = /*#__PURE__*/function (Position) {
26
26
  Position[Position["Before"] = 1] = "Before";
@@ -204,6 +204,16 @@ var jqtree = (function (exports) {
204
204
  const handleOpenFolder = (node, element) => {
205
205
  if (node === currentNode) {
206
206
  // Cannot move inside current item
207
+
208
+ // Dnd over the current element is not possible: add a position with type None for the top and the bottom.
209
+ const top = getOffsetTop(element);
210
+ const height = element.clientHeight;
211
+ addPosition(node, Position.None, top);
212
+ if (height > 5) {
213
+ // Subtract 5 pixels to allow more space for the next element.
214
+ addPosition(node, Position.None, top + height - 5);
215
+ }
216
+
207
217
  // Stop iterating
208
218
  return false;
209
219
  }
@@ -233,7 +243,7 @@ var jqtree = (function (exports) {
233
243
  let i = 0;
234
244
  while (i < positionCount) {
235
245
  const position = positionsInGroup[i];
236
- if (position) {
246
+ if (position && position.position !== Position.None) {
237
247
  hitAreas.push({
238
248
  top: areaTop,
239
249
  bottom: areaTop + areaHeight,