Add JSDoc documentation and file headers to all source files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
// The Lucia project.
|
||||
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/**
|
||||
* @module cytoscapeMap Cytoscape.js process map rendering with
|
||||
* interactive node/edge highlighting, tooltips, and position persistence.
|
||||
*/
|
||||
|
||||
import cytoscape from 'cytoscape';
|
||||
import spread from 'cytoscape-spread';
|
||||
import dagre from 'cytoscape-dagre';
|
||||
@@ -6,11 +17,20 @@ import cola from 'cytoscape-cola';
|
||||
import tippy from 'tippy.js';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
import { useMapPathStore } from '@/stores/mapPathStore';
|
||||
import { getTimeLabel } from '@/module/timeLabel.js'; // 時間格式轉換器
|
||||
import { getTimeLabel } from '@/module/timeLabel.js';
|
||||
import { useCytoscapeStore } from '@/stores/cytoscapeStore';
|
||||
import { SAVE_KEY_NAME } from '@/constants/constants.js';
|
||||
|
||||
const composeFreqTypeText = (baseText, dataLayerOption, optionValue) => { //sonar-qube
|
||||
/**
|
||||
* Composes display text for frequency-type data layer values.
|
||||
*
|
||||
* @param {string} baseText - The base label text prefix.
|
||||
* @param {string} dataLayerOption - The data layer option key
|
||||
* (e.g. "rel_freq" for relative frequency).
|
||||
* @param {number} optionValue - The numeric value to format.
|
||||
* @returns {string} The formatted text with the value appended.
|
||||
*/
|
||||
const composeFreqTypeText = (baseText, dataLayerOption, optionValue) => {
|
||||
let text = baseText;
|
||||
const textInt = dataLayerOption === 'rel_freq' ? baseText + optionValue * 100 + "%" : baseText + optionValue;
|
||||
const textFloat = dataLayerOption === 'rel_freq' ? baseText + (optionValue * 100).toFixed(2) + "%" : baseText + optionValue.toFixed(2);
|
||||
@@ -26,18 +46,23 @@ cytoscape.use(fcose);
|
||||
cytoscape.use(cola);
|
||||
|
||||
/**
|
||||
* @param {object} mapData processMapData | bpmnData,可選以上任一。
|
||||
* mapData:{
|
||||
* startId: 0,
|
||||
* endId: 1,
|
||||
* nodes: [],
|
||||
* edges: []
|
||||
* }
|
||||
* @param {string} dataLayerType DataLayer's type
|
||||
* @param {string} dataLayerOption DataLayer's options
|
||||
* @param {string} curve Curve's type
|
||||
* @param {string} graphId cytoscape's container
|
||||
* @return {cytoscape.Core} cy
|
||||
* Creates and configures a Cytoscape.js process map instance with
|
||||
* interactive features including node/edge highlighting, tooltips,
|
||||
* and position persistence via localStorage.
|
||||
*
|
||||
* @param {Object} mapData - The map data containing nodes and edges.
|
||||
* @param {number} mapData.startId - The start node ID.
|
||||
* @param {number} mapData.endId - The end node ID.
|
||||
* @param {Array} mapData.nodes - Array of node data objects.
|
||||
* @param {Array} mapData.edges - Array of edge data objects.
|
||||
* @param {string} dataLayerType - The data layer type ("freq" or "duration").
|
||||
* @param {string} dataLayerOption - The data layer option key
|
||||
* (e.g. "abs_freq", "rel_freq", "rel_duration").
|
||||
* @param {string} curveStyle - The edge curve style
|
||||
* ("unbundled-bezier" or "taxi").
|
||||
* @param {string} rank - The layout direction ("TB" or "LR").
|
||||
* @param {HTMLElement} graphId - The DOM container element for Cytoscape.
|
||||
* @returns {cytoscape.Core} The configured Cytoscape instance.
|
||||
*/
|
||||
export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, curveStyle, rank, graphId) {
|
||||
// 設定每個 node, edges 的顏色與樣式
|
||||
|
||||
Reference in New Issue
Block a user