@outbuild-company/schedule-core 1.31.0 → 1.31.1

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/dist/index.cjs CHANGED
@@ -14909,11 +14909,14 @@ var PASTE_PLACEMENT = {
14909
14909
  };
14910
14910
 
14911
14911
  // src/activity-copy-paste/paste.ts
14912
+ function childIdsInCorrelativeOrder(parentId, adapter) {
14913
+ return collectChildrenSnapshots(parentId, adapter).sort(compareActivitiesInVisualOrder).map((activity) => activity.id);
14914
+ }
14912
14915
  function resolveEndDestination(adapter) {
14913
- const rootIds = adapter.getRootIds();
14916
+ const rootIds = childIdsInCorrelativeOrder(ROOT_PARENT_ID, adapter);
14914
14917
  const [soleRootId] = rootIds;
14915
14918
  if (rootIds.length === 1 && soleRootId !== void 0) {
14916
- const lastChildId = adapter.getChildren(soleRootId).at(-1);
14919
+ const lastChildId = childIdsInCorrelativeOrder(soleRootId, adapter).at(-1);
14917
14920
  return lastChildId === void 0 ? { ok: true, parentId: soleRootId } : { ok: true, parentId: soleRootId, afterSiblingId: lastChildId };
14918
14921
  }
14919
14922
  const lastRootId = rootIds.at(-1);
@@ -14932,14 +14935,14 @@ function resolvePasteDestination(destination, adapter) {
14932
14935
  return adapter.getRootIds().length === 1 ? {
14933
14936
  ok: true,
14934
14937
  parentId: sibling.id,
14935
- beforeSiblingId: adapter.getChildren(sibling.id)[0]
14938
+ beforeSiblingId: childIdsInCorrelativeOrder(sibling.id, adapter)[0]
14936
14939
  } : { ok: true, parentId: ROOT_PARENT_ID, afterSiblingId };
14937
14940
  }
14938
14941
  if (adapter.hasChildren(sibling.id)) {
14939
14942
  return {
14940
14943
  ok: true,
14941
14944
  parentId: sibling.id,
14942
- beforeSiblingId: adapter.getChildren(sibling.id)[0]
14945
+ beforeSiblingId: childIdsInCorrelativeOrder(sibling.id, adapter)[0]
14943
14946
  };
14944
14947
  }
14945
14948
  return {