{"version":3,"file":"useTimeLine.mjs","sources":["../../../../../../src/components/ganttView/ganttBody/ganttTimeLineView/useTimeLine.ts"],"sourcesContent":["import { inject, shallowRef, ref } from 'vue';\nimport type { Ref, ComputedRef } from 'vue';\nimport type { GanttRowNode, VisibleRow, TimeLineNode, TimeLine, TimePointNode, VisibleTimeLine } from '@/types';\nimport dayjs from 'dayjs';\nimport { treeForEach, arrangementArr } from '@/utils/common';\n\nexport const useTimeLine = ({\n  rowHeight,\n  rowBuffer,\n  perHourSpacing,\n  scrollViewScrollTop,\n  scrollViewScrollLeft,\n  rowNodeMap,\n  currentVisibleRowIds,\n  startInfo,\n  movingTimeLineRowId,\n  movingTimeLine,\n  createTimePointNodes\n}: {\n  rowHeight: Ref<number>,\n  rowBuffer: number,\n  perHourSpacing: Ref<number>,\n  scrollViewScrollTop: Ref<number>,\n  scrollViewScrollLeft: Ref<number>,\n  rowNodeMap: Ref<Map<string, GanttRowNode>, Map<string, GanttRowNode>>,\n  currentVisibleRowIds: Ref<string[], string[]>,\n  startInfo: ComputedRef<{\n    startDate: dayjs.Dayjs;\n  }>,\n  movingTimeLineRowId: Ref<string>,\n  movingTimeLine: Ref<VisibleTimeLine | null>,\n  createTimePointNodes: (timeLine: TimeLine) => TimePointNode[] | undefined\n}) => {\n  const wrapRef = inject('wrapRef') as Ref<HTMLDivElement | undefined>;\n  const visibleRows = shallowRef<VisibleRow[]>([]);\n  const visibleTimeLineMap = shallowRef<Map<string, VisibleTimeLine[]>>(new Map());\n  const bufferWidth = 200;\n  const wrapWidth = ref(0);\n  const wrapHeight = ref(0);\n\n  const freshTimeLineView = () => {\n    wrapWidth.value = wrapRef.value?.offsetWidth || 0;\n    wrapHeight.value = wrapRef.value?.offsetHeight || 0;\n    freshVisibleRows();\n    freshVisibleTimeLines();\n  };\n\n  const freshTimeLineViewAfterScrollTop = () => {\n    freshVisibleRows();\n    freshVisibleTimeLines(false);\n  };\n\n  const freshVisibleRows = () => {\n    if (!wrapRef.value) return;\n    const bufferHeight = rowHeight.value * rowBuffer;\n    const startNumInView = Math.floor((scrollViewScrollTop.value - bufferHeight) / rowHeight.value);\n    const endNumInView = Math.ceil((scrollViewScrollTop.value + wrapHeight.value + bufferHeight) / rowHeight.value);\n\n    const newVisibleRows: VisibleRow[] = [];\n    const start = Math.max(0, startNumInView);\n    const end = Math.min(currentVisibleRowIds.value.length - 1, endNumInView);\n\n    for (let i = start; i <= end; i++) {\n      const currentRowId = currentVisibleRowIds.value[i];\n      const currentRowNode = rowNodeMap.value.get(currentRowId);\n      if (currentRowNode) {\n        newVisibleRows.push({\n          id: currentRowId,\n          rowNode: currentRowNode,\n          translateY: i * rowHeight.value\n        });\n\n        // sort timeline node for convenience of calculating the position of timeline in the canvas\n        const timeLineNodes = sortTimeLinesInRowNode(currentRowNode);\n\n        if (timeLineNodes) {\n          const timeLineNodesAfterCombine = mergeOverlapTimeLine(timeLineNodes);\n          currentRowNode.timeLineNodes = timeLineNodesAfterCombine;\n        }\n\n      }\n\n    }\n    visibleRows.value = arrangementArr(newVisibleRows, visibleRows.value);\n  };\n\n  const sortTimeLinesInRowNode = (rowNode: GanttRowNode) => {\n    if (!rowNode.timeLineNodes && rowNode.data.timeLines) {\n      const timeLineNodes:TimeLineNode[] = [];\n\n      if (rowNode.hasChildren) {\n        const timeLineNode = createTimeLineNodeFromRowNode(rowNode);\n        timeLineNode && timeLineNodes.push(timeLineNode);\n      } else {\n        for (let timeLine of rowNode.data.timeLines) {\n          const timeLineNode = createTimeLineNode(timeLine);\n          timeLineNodes.push(timeLineNode);\n        }\n      }\n      sortTimeLineNodes(timeLineNodes);\n      return timeLineNodes;\n    }\n  };\n\n  const createTimeLineNodeFromRowNode = (rowNode: GanttRowNode) => {\n    const startDate = rowNode.startDate;\n    const endDate = rowNode.endDate;\n    const styleOption = { backgroundColor: '#000' };\n    if (startDate && endDate) {\n      const isSameDate = startDate.isSame(endDate);\n      const baseNode: TimeLineNode = {\n        id: rowNode.id,\n        startDate,\n        endDate,\n        isSameDate,\n        hasChildren: rowNode.hasChildren,\n        styleOption\n      };\n      return baseNode;\n    }\n  };\n\n  const sortTimeLineNodes = (timeLineNodes: TimeLineNode[]) => {\n    timeLineNodes.sort((timeLine1, timeLine2) => {\n      if (timeLine1.startDate.isSame(timeLine2.startDate)) return 0;\n      if (timeLine1.startDate.isBefore(timeLine2.startDate)) {\n        return -1;\n      } else {\n        return 1;\n      }\n    });\n  };\n\n  // if timeLineNodes have overlap area, merge them\n  const mergeOverlapTimeLine = (timeLineNodes: TimeLineNode[]) => {\n    const newTimeLineNodes: TimeLineNode[] = [];\n    for (let timeLineNode of timeLineNodes) {\n      const lastTimeLineNode = newTimeLineNodes[newTimeLineNodes.length - 1];\n      if (lastTimeLineNode && !timeLineNode.startDate.isAfter(lastTimeLineNode.endDate)) {\n        lastTimeLineNode.isMerge = true;\n        const maxEndDate = dayjs.max([lastTimeLineNode.endDate, timeLineNode.endDate]);\n        maxEndDate && (lastTimeLineNode.endDate = maxEndDate);\n        // if timeLineNode has timePointNodes, not merge\n        // if (lastTimeLineNode.timePointNodes && timeLineNode.timePointNodes) {\n        //   lastTimeLineNode.timePointNodes = lastTimeLineNode.timePointNodes.concat(timeLineNode.timePointNodes)\n        // }\n\n        if (!lastTimeLineNode.mergedTimeLineNodes) {\n          lastTimeLineNode.mergedTimeLineNodes = [lastTimeLineNode];\n        }\n        if (timeLineNode.isMerge) {\n          timeLineNode.isMerge = false;\n          lastTimeLineNode.mergedTimeLineNodes = lastTimeLineNode.mergedTimeLineNodes.concat(timeLineNode.mergedTimeLineNodes!);\n          timeLineNode.mergedTimeLineNodes = undefined;\n        } else {\n          lastTimeLineNode.mergedTimeLineNodes.push(timeLineNode);\n        }\n      } else {\n        newTimeLineNodes.push(timeLineNode);\n      }\n    }\n    return newTimeLineNodes;\n  };\n\n  const createTimeLineNode = (timeLine: TimeLine) => {\n    const startDate = dayjs(timeLine.startDate);\n    const endDate = dayjs(timeLine.endDate);\n    const isSameDate = startDate.isSame(endDate);\n    const styleOption = { ...timeLine.styleOption };\n\n    if (isSameDate) {\n      styleOption.backgroundColor = '#000';\n    }\n\n    const timePointNodes = createTimePointNodes(timeLine);\n    const baseNode: TimeLineNode = {\n      id: timeLine.id,\n      timePointNodes,\n      data: timeLine,\n      startDate,\n      endDate,\n      isSameDate,\n      styleOption,\n      icon: timeLine.icon,\n      label: timeLine.label,\n      disableStretch: timeLine.disableStretch,\n      disableMove: timeLine.disableMove,\n    };\n    return baseNode;\n  };\n\n  /**\n   * core function to show time lines\n   * @param freshAll\n   * @returns\n   */\n  const freshVisibleTimeLines = (freshAll = true) => {\n    if (!wrapRef.value) return;\n    const { startDate } = startInfo.value;\n    const startLeftInView = scrollViewScrollLeft.value - bufferWidth;\n    const endLeftInView = scrollViewScrollLeft.value + wrapWidth.value + bufferWidth;\n\n    const startDateInView = startDate.add(Math.max(0, startLeftInView) / perHourSpacing.value, 'hour');\n    const endDateInView = startDate.add(endLeftInView / perHourSpacing.value, 'hour');\n\n    const newVisibleTimeLineMap: Map<string, VisibleTimeLine[]> = new Map();\n\n    let needFreshRows: VisibleRow[] = [];\n    if (freshAll) {\n      needFreshRows = visibleRows.value;\n    } else {\n      needFreshRows = visibleRows.value.filter(row => {\n        const oldTimeLineCache = visibleTimeLineMap.value.get(row.id);\n        if (oldTimeLineCache) {\n          newVisibleTimeLineMap.set(row.id, oldTimeLineCache);\n        }\n        return !oldTimeLineCache;\n      });\n    }\n    for (let visibleRow of needFreshRows) {\n      const rowId = visibleRow.id;\n      const timeLineNodes = visibleRow.rowNode.timeLineNodes;\n      if (timeLineNodes) {\n        const visibleTimeLines: VisibleTimeLine[] = [];\n        const startIndex = getTimeLineIndexInView(timeLineNodes, startDateInView, 'min');\n        const endIndex = getTimeLineIndexInView(timeLineNodes, endDateInView, 'max');\n        const hasMovingTimeLine = movingTimeLineRowId.value === rowId;\n        for (let i = startIndex; i < endIndex; i++) {\n          const currentTimeNode = timeLineNodes[i];\n\n          if (hasMovingTimeLine && currentTimeNode.id === movingTimeLine.value?.id) continue;\n\n          const currentStartDate = currentTimeNode.startDate;\n          const currentEndDate = currentTimeNode.endDate;\n          const translateX = currentStartDate.diff(startDate, 'hour', true) * perHourSpacing.value;\n          const width = currentTimeNode.isSameDate ? 0 : currentEndDate.diff(currentStartDate, 'hour', true) * perHourSpacing.value;\n          let type: 'parentTimeLineNode' | 'sameDateTimeLineNode' | 'normal' = 'normal';\n\n          if (currentTimeNode.hasChildren) {\n            type = 'parentTimeLineNode';\n          } else if (currentTimeNode.isSameDate) {\n            type = 'sameDateTimeLineNode';\n          }\n\n          const originalTimePoints = currentTimeNode.timePointNodes || [];\n          const timePointNodes: TimePointNode[] = [];\n\n          for (let timePointNode of originalTimePoints) {\n            if (timePointNode.date.isBetween(currentStartDate, currentEndDate, undefined, '[]')) {\n              const timePointNodeTranslateX = timePointNode.date.diff(currentStartDate, 'hour', true) * perHourSpacing.value;\n              timePointNode.translateX = timePointNodeTranslateX;\n              timePointNodes.push(timePointNode);\n            }\n          }\n\n          visibleTimeLines.push({\n            id: currentTimeNode.id,\n            startDate: currentTimeNode.startDate,\n            endDate: currentTimeNode.endDate,\n            timeLineNode: currentTimeNode,\n            width,\n            translateX,\n            styleOption: currentTimeNode.styleOption,\n            type,\n            timePointNodes,\n            icon: currentTimeNode.icon,\n            label: currentTimeNode.label,\n            disableStretch: currentTimeNode.disableStretch,\n            disableMove: currentTimeNode.disableMove,\n          });\n        }\n        if (hasMovingTimeLine) {\n          visibleTimeLines.push(movingTimeLine.value!);\n        }\n        newVisibleTimeLineMap.set(rowId, visibleTimeLines);\n      }\n    }\n    visibleTimeLineMap.value = newVisibleTimeLineMap;\n  };\n\n  // find the index of the time line in the display area (binary search), timeLineNodes are sorted and merged, and the start time of each node must be different\n  const getTimeLineIndexInView = (timeLineNodes: TimeLineNode[], targetDate: dayjs.Dayjs, type: 'min' | 'max') => {\n    let minIndex = 0;\n    let maxIndex = timeLineNodes.length - 1;\n\n    while (maxIndex >= minIndex) {\n      const midIndex = Math.floor((minIndex + maxIndex) / 2);\n      const startDate = timeLineNodes[midIndex].startDate;\n      const endDate = timeLineNodes[midIndex].endDate;\n      const currentDate = type === 'min' ? endDate : startDate;\n      if (currentDate.isBefore(targetDate)) {\n        minIndex = midIndex + 1;\n      } else {\n        maxIndex = midIndex - 1;\n      }\n    }\n    return minIndex;\n  };\n\n  /**\n   *  user can call this function to refresh the time lines of the specified row\n   * @param rowNodes\n   * @returns\n   */\n  const freshTimeLines = (rowNodes: GanttRowNode[]) => {\n    if (rowNodes.length === 0) return;\n    treeForEach(rowNodes, (rowNode) => {\n      const currentRowId = rowNode.id;\n      const currentRowNode = rowNodeMap.value.get(currentRowId);\n      currentRowNode && (currentRowNode.timeLineNodes = undefined);\n      visibleTimeLineMap.value.delete(currentRowId);\n    });\n    freshTimeLineViewAfterScrollTop();\n  };\n\n  /**\n   * update the parent time line date if child time line date is changed\n   * @param rowId\n   */\n  const updateParentTimeLine = (rowId: string) => {\n    const parentRowNode = rowNodeMap.value.get(rowId);\n    const { startDate } = startInfo.value;\n    if (parentRowNode) {\n      const parentTimeLineNode = parentRowNode.timeLineNodes?.[0];\n      const parentVisibleTimeLine = visibleTimeLineMap.value.get(rowId)?.[0];\n      if (parentTimeLineNode) {\n        const childrenRowNodes = parentRowNode.children || [];\n        const startDateArr: dayjs.Dayjs[] = [];\n        const endDateArr: dayjs.Dayjs[] = [];\n        for (let childRowNode of childrenRowNodes) {\n          const childTimeLineNodes = childRowNode.timeLineNodes || [];\n          for (let childTimeLineNode of childTimeLineNodes) {\n            startDateArr.push(childTimeLineNode.startDate);\n            endDateArr.push(childTimeLineNode.endDate);\n          }\n          const minStartDate = dayjs.min(startDateArr);\n          const maxEndDate = dayjs.max(endDateArr);\n          if (minStartDate && maxEndDate) {\n            parentTimeLineNode.startDate = minStartDate;\n            parentTimeLineNode.endDate = maxEndDate;\n            if (parentVisibleTimeLine) {\n              const translateX = parentTimeLineNode.startDate.diff(startDate, 'hour', true) * perHourSpacing.value;\n              const width = parentTimeLineNode.endDate.diff(parentTimeLineNode.startDate, 'hour', true) * perHourSpacing.value;\n              parentVisibleTimeLine.translateX = translateX;\n              parentVisibleTimeLine.width = width;\n            }\n          }\n\n        }\n        parentRowNode.parentId && updateParentTimeLine(parentRowNode.parentId);\n      }\n    }\n  };\n\n  return {\n    freshTimeLineView,\n    freshTimeLineViewAfterScrollTop,\n    freshTimeLines,\n    freshVisibleTimeLines,\n    sortTimeLineNodes,\n    mergeOverlapTimeLine,\n    visibleTimeLineMap,\n    visibleRows,\n    updateParentTimeLine\n  };\n};"],"names":[],"mappings":";;;AAMO,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAcM;AACE,QAAA,UAAU,OAAO,SAAS;AAC1B,QAAA,cAAc,WAAyB,EAAE;AAC/C,QAAM,qBAAqB,WAA+C,oBAAA,KAAK;AAC/E,QAAM,cAAc;AACd,QAAA,YAAY,IAAI,CAAC;AACjB,QAAA,aAAa,IAAI,CAAC;AAExB,QAAM,oBAAoB,MAAM;;AACpB,cAAA,UAAQ,aAAQ,UAAR,mBAAe,gBAAe;AACrC,eAAA,UAAQ,aAAQ,UAAR,mBAAe,iBAAgB;AACjC,qBAAA;AACK,0BAAA;AAAA,EACxB;AAEA,QAAM,kCAAkC,MAAM;AAC3B,qBAAA;AACjB,0BAAsB,KAAK;AAAA,EAC7B;AAEA,QAAM,mBAAmB,MAAM;AACzB,QAAA,CAAC,QAAQ,MAAO;AACd,UAAA,eAAe,UAAU,QAAQ;AACvC,UAAM,iBAAiB,KAAK,OAAO,oBAAoB,QAAQ,gBAAgB,UAAU,KAAK;AACxF,UAAA,eAAe,KAAK,MAAM,oBAAoB,QAAQ,WAAW,QAAQ,gBAAgB,UAAU,KAAK;AAE9G,UAAM,iBAA+B,CAAC;AACtC,UAAM,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