uiik 1.3.3 → 1.3.4

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/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Changelog
2
+ ## [1.3.4] - 2025/8/24
3
+ ### 修复
4
+ - Sortable filter数据后spill表现异常
2
5
 
3
6
  ## [1.3.2] - 2024/4/6
4
7
  ### 修复
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * uiik v1.3.3
2
+ * uiik v1.3.4
3
3
  * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
@@ -11,6 +11,7 @@ import { compact, findIndex } from 'myfx/array';
11
11
  import { split, test } from 'myfx/string';
12
12
  import { closest } from 'myfx/tree';
13
13
  import { alphaId } from 'myfx/utils';
14
+ import { filter, last } from 'myfx';
14
15
 
15
16
  /******************************************************************************
16
17
  Copyright (c) Microsoft Corporation.
@@ -2640,6 +2641,8 @@ class Sortable extends Uii {
2640
2641
  onOptionChanged() { }
2641
2642
  }
2642
2643
  _Sortable_removeListenItems = new WeakMap();
2644
+ const NextNodeMap = new Map();
2645
+ const FilteredNodeMap = new Map();
2643
2646
  let DraggingData = null;
2644
2647
  function bindContainer(registerEvent, container, opts) {
2645
2648
  registerEvent(container, "mousedown", (e) => {
@@ -2674,6 +2677,8 @@ function bindContainer(registerEvent, container, opts) {
2674
2677
  let dragging = false;
2675
2678
  let ghostNode = null;
2676
2679
  let removeListenItems = null;
2680
+ NextNodeMap.set(draggingItem, draggingItem.nextElementSibling);
2681
+ FilteredNodeMap.set(con, filteredItems);
2677
2682
  const dragListener = (ev) => {
2678
2683
  const newX = ev.clientX;
2679
2684
  const newY = ev.clientY;
@@ -2783,7 +2788,7 @@ function bindContainer(registerEvent, container, opts) {
2783
2788
  }
2784
2789
  else if (DraggingData.spill === 'revert') {
2785
2790
  (_b = DraggingData.item.parentElement) === null || _b === void 0 ? void 0 : _b.removeChild(DraggingData.item);
2786
- const nextSibling = DraggingData.fromContainer.children[DraggingData.fromIndex];
2791
+ const nextSibling = NextNodeMap.get(DraggingData.item);
2787
2792
  DraggingData.fromContainer.insertBefore(DraggingData.item, nextSibling);
2788
2793
  }
2789
2794
  }
@@ -2863,12 +2868,17 @@ function bindContainer(registerEvent, container, opts) {
2863
2868
  else {
2864
2869
  if (draggingItem.parentElement)
2865
2870
  draggingItem.parentElement.removeChild(draggingItem);
2871
+ const list = filter(FilteredNodeMap.get(container), x => x !== draggingItem);
2866
2872
  if (dir[0] === "t") {
2867
- container.insertBefore(draggingItem, container.children[0]);
2873
+ container.insertBefore(draggingItem, list[0]);
2868
2874
  }
2869
2875
  else {
2870
- container.appendChild(draggingItem);
2871
- container.children.length - 1;
2876
+ if (list.length !== container.children.length) {
2877
+ last(list).after(draggingItem);
2878
+ }
2879
+ else {
2880
+ container.appendChild(draggingItem);
2881
+ }
2872
2882
  }
2873
2883
  }
2874
2884
  }
@@ -2947,7 +2957,7 @@ function newSortable(container, opts) {
2947
2957
  return new Sortable(container, opts);
2948
2958
  }
2949
2959
 
2950
- var version = "1.3.3";
2960
+ var version = "1.3.4";
2951
2961
  var repository = {
2952
2962
  type: "git",
2953
2963
  url: "https://github.com/holyhigh2/uiik"
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
- * uiik v1.3.3
2
+ * uiik v1.3.4
3
3
  * A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.
4
4
  * https://github.com/holyhigh2/uiik
5
5
  * c) 2021-2025 @holyhigh2 may be freely distributed under the MIT license
6
6
  */
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/collection'), require('myfx/is'), require('myfx/object'), require('myfx/array'), require('myfx/string'), require('myfx/tree'), require('myfx/utils')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'myfx/collection', 'myfx/is', 'myfx/object', 'myfx/array', 'myfx/string', 'myfx/tree', 'myfx/utils'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.collection, global.is, global.object, global.array, global.string, global.tree, global.utils));
11
- })(this, (function (exports, collection, is, object, array, string, tree, utils) { 'use strict';
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('myfx/collection'), require('myfx/is'), require('myfx/object'), require('myfx/array'), require('myfx/string'), require('myfx/tree'), require('myfx/utils'), require('myfx')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', 'myfx/collection', 'myfx/is', 'myfx/object', 'myfx/array', 'myfx/string', 'myfx/tree', 'myfx/utils', 'myfx'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uiik = {}, global.collection, global.is, global.object, global.array, global.string, global.tree, global.utils, global.myfx));
11
+ })(this, (function (exports, collection, is, object, array, string, tree, utils, myfx) { 'use strict';
12
12
 
13
13
  /******************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
@@ -2638,6 +2638,8 @@
2638
2638
  onOptionChanged() { }
2639
2639
  }
2640
2640
  _Sortable_removeListenItems = new WeakMap();
2641
+ const NextNodeMap = new Map();
2642
+ const FilteredNodeMap = new Map();
2641
2643
  let DraggingData = null;
2642
2644
  function bindContainer(registerEvent, container, opts) {
2643
2645
  registerEvent(container, "mousedown", (e) => {
@@ -2672,6 +2674,8 @@
2672
2674
  let dragging = false;
2673
2675
  let ghostNode = null;
2674
2676
  let removeListenItems = null;
2677
+ NextNodeMap.set(draggingItem, draggingItem.nextElementSibling);
2678
+ FilteredNodeMap.set(con, filteredItems);
2675
2679
  const dragListener = (ev) => {
2676
2680
  const newX = ev.clientX;
2677
2681
  const newY = ev.clientY;
@@ -2781,7 +2785,7 @@
2781
2785
  }
2782
2786
  else if (DraggingData.spill === 'revert') {
2783
2787
  (_b = DraggingData.item.parentElement) === null || _b === void 0 ? void 0 : _b.removeChild(DraggingData.item);
2784
- const nextSibling = DraggingData.fromContainer.children[DraggingData.fromIndex];
2788
+ const nextSibling = NextNodeMap.get(DraggingData.item);
2785
2789
  DraggingData.fromContainer.insertBefore(DraggingData.item, nextSibling);
2786
2790
  }
2787
2791
  }
@@ -2861,12 +2865,17 @@
2861
2865
  else {
2862
2866
  if (draggingItem.parentElement)
2863
2867
  draggingItem.parentElement.removeChild(draggingItem);
2868
+ const list = myfx.filter(FilteredNodeMap.get(container), x => x !== draggingItem);
2864
2869
  if (dir[0] === "t") {
2865
- container.insertBefore(draggingItem, container.children[0]);
2870
+ container.insertBefore(draggingItem, list[0]);
2866
2871
  }
2867
2872
  else {
2868
- container.appendChild(draggingItem);
2869
- container.children.length - 1;
2873
+ if (list.length !== container.children.length) {
2874
+ myfx.last(list).after(draggingItem);
2875
+ }
2876
+ else {
2877
+ container.appendChild(draggingItem);
2878
+ }
2870
2879
  }
2871
2880
  }
2872
2881
  }
@@ -2945,7 +2954,7 @@
2945
2954
  return new Sortable(container, opts);
2946
2955
  }
2947
2956
 
2948
- var version = "1.3.3";
2957
+ var version = "1.3.4";
2949
2958
  var repository = {
2950
2959
  type: "git",
2951
2960
  url: "https://github.com/holyhigh2/uiik"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uiik",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "A UI interactions kit includes draggable, splittable, rotatable, selectable, etc.",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",