@worktile/gantt 15.1.0-next.2 → 15.1.0-next.3

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.
@@ -1778,7 +1778,7 @@ class GanttTableBodyComponent {
1778
1778
  onItemDragStarted(event) {
1779
1779
  this.ganttTableDragging = true;
1780
1780
  // 拖动开始时隐藏所有的子项
1781
- const children = this.getChildrenElementsByElement(event.source.getPlaceholderElement());
1781
+ const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
1782
1782
  children.forEach((element) => {
1783
1783
  element.classList.add('drag-item-hide');
1784
1784
  });
@@ -1893,11 +1893,12 @@ class GanttTableBodyComponent {
1893
1893
  return n.children?.includes(item);
1894
1894
  });
1895
1895
  }
1896
- getChildrenElementsByElement(element) {
1896
+ getChildrenElementsByElement(dragElement) {
1897
1897
  // 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
1898
1898
  const children = [];
1899
- const dragRef = this.itemDragRefMap.get(element);
1900
- let nextElement = element.nextElementSibling;
1899
+ const dragRef = this.itemDragRefMap.get(dragElement);
1900
+ // 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
1901
+ let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
1901
1902
  let nextDragRef = this.itemDragRefMap.get(nextElement);
1902
1903
  while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
1903
1904
  children.push(nextElement);