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