# jordium-gantt-vue3 logo jordium-gantt-vue3 **🌐 Languages**: [πŸ“– English Documentation](./README-EN.md) | [πŸ“– δΈ­ζ–‡ζ–‡ζ‘£](./README.md) [![npm version](https://img.shields.io/npm/v/jordium-gantt-vue3.svg?cacheBust=1)](https://www.npmjs.com/package/jordium-gantt-vue3) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Vue 3](https://img.shields.io/badge/vue-3.x-green.svg)](https://vuejs.org/) [![TypeScript](https://img.shields.io/badge/typescript-5.x-blue.svg)](https://www.typescriptlang.org/) > Modern Vue 3 Gantt chart component library providing complete solutions for project management and task scheduling ## 🌐 Online Demo 🎯 **[Try Github Live Demo β†’](https://nelson820125.github.io/jordium-gantt-vue3/)** *The online demo includes full feature showcase: task management, milestones, theme switching, internationalization, etc.* ## 🎨 Theme Support ### Light Theme ![Light Theme](design/screenshots/light-theme.png) ### Dark Theme ![Dark Theme](design/screenshots/dark-theme.png) ## πŸš€ Features - πŸ“Š **Complete Functionality**: Task management, milestone tracking, dependency relationships, progress visualization - 🎨 **Theme Switching**: Built-in light/dark themes with customizable theme variables - πŸ–±οΈ **Rich Interactions**: Drag adjustment, resizing, double-click editing, context menus - 🌍 **Internationalization**: Built-in Chinese/English support with custom language pack capability - πŸ“± **Responsive**: Desktop and mobile compatible with smooth touch experience - ⚑ **High Performance**: Virtual scrolling, lazy loading, optimized rendering - πŸ”§ **Extensible**: Rich API interfaces supporting custom components and events - πŸ’Ž **Type Safe**: Complete TypeScript support for better development experience ## πŸ“¦ Installation ```bash # npm npm install jordium-gantt-vue3 # yarn yarn add jordium-gantt-vue3 # pnpm pnpm add jordium-gantt-vue3 ``` ## πŸ“„ License [MIT License](./LICENSE) Β© 2025 JordiUM --- ## πŸ“ Project Structure ``` jordium-gantt-vue3/ β”œβ”€β”€ src/ # Source code directory β”‚ β”œβ”€β”€ components/ # Core Vue components β”‚ β”‚ β”œβ”€β”€ GanttChart.vue # Main entry component β”‚ β”‚ β”œβ”€β”€ TaskList.vue # Task list component β”‚ β”‚ β”œβ”€β”€ Timeline.vue # Timeline component β”‚ β”‚ β”œβ”€β”€ TaskBar.vue # Task bar component β”‚ β”‚ β”œβ”€β”€ TaskDrawer.vue # Task edit drawer β”‚ β”‚ β”œβ”€β”€ TaskContextMenu.vue # Task context menu β”‚ β”‚ β”œβ”€β”€ GanttToolbar.vue # Toolbar component β”‚ β”‚ β”œβ”€β”€ MilestonePoint.vue # Milestone point β”‚ β”‚ β”œβ”€β”€ MilestoneDialog.vue # Milestone dialog β”‚ β”‚ β”œβ”€β”€ DatePicker.vue # Date picker β”‚ β”‚ └── ... # Other components β”‚ β”œβ”€β”€ models/ # Data models and configurations β”‚ β”‚ β”œβ”€β”€ classes/ # Class definitions β”‚ β”‚ β”‚ β”œβ”€β”€ Task.ts # Task model β”‚ β”‚ β”‚ β”œβ”€β”€ Milestone.ts # Milestone model β”‚ β”‚ β”‚ └── Language.ts # Language configuration β”‚ β”‚ β”œβ”€β”€ configs/ # Configuration interfaces β”‚ β”‚ β”‚ β”œβ”€β”€ TimelineConfig.ts # Timeline configuration β”‚ β”‚ β”‚ └── ToolbarConfig.ts # Toolbar configuration β”‚ β”‚ └── types/ # Type definitions β”‚ β”‚ └── TimelineScale.ts # Timeline scale types β”‚ β”œβ”€β”€ composables/ # Vue composable functions β”‚ β”‚ β”œβ”€β”€ useI18n.ts # Internationalization utilities β”‚ β”‚ └── useMessage.ts # Message utilities β”‚ β”œβ”€β”€ styles/ # Style files β”‚ β”‚ β”œβ”€β”€ app.css # Main styles β”‚ β”‚ └── theme-variables.css # Theme variables β”‚ β”œβ”€β”€ utils/ # Utility functions β”‚ β”‚ └── predecessorUtils.ts # Predecessor utilities β”‚ └── index.ts # Export entry β”œβ”€β”€ demo/ # Development demo & interactive showcase β”‚ β”œβ”€β”€ App.vue # Demo application main component β”‚ β”œβ”€β”€ data.json # Demo data (includes clinical trial examples) β”‚ β”œβ”€β”€ main.ts # Demo application entry β”‚ └── ... # Other demo files β”œβ”€β”€ packageDemo/ # npm package integration demo β”œβ”€β”€ dist/ # Build output directory β”œβ”€β”€ docs/ # Documentation β”œβ”€β”€ design/ # Design resources and screenshots β”‚ └── screenshots/ # Theme screenshots β”œβ”€β”€ public/ # Public static resources β”‚ └── assets/ # Static asset files β”œβ”€β”€ README.md # Chinese documentation β”œβ”€β”€ README-EN.md # English documentation β”œβ”€β”€ package.json # Project configuration β”œβ”€β”€ vite.config.ts # Vite development configuration β”œβ”€β”€ vite.config.lib.ts # Vite library build configuration β”œβ”€β”€ tsconfig.json # TypeScript configuration └── ... # Other configuration files and metadata ``` ### Directory Description - **`src/components/`**: Core Vue components containing all Gantt chart functionality - **`src/models/`**: Data models, type definitions and configuration interfaces - **`src/composables/`**: Vue 3 composable functions providing reusable logic - **`src/styles/`**: Style files including theme system and CSS variables - **`src/utils/`**: Utility functions for business logic and data transformation - **`demo/`**: Local development and feature demonstration with complete interactive pages and clinical trial sample data - **`packageDemo/`**: Simulates npm package integration in external projects - **`dist/`**: Build output directory for npm publishing or static sites - **`docs/`**: Project documentation including deployment guides and API references ## πŸ”§ API Reference ### GanttChart Properties | Property | Type | Default | Description | |----------|------|---------|-------------| | `tasks` | `Task[]` | `[]` | Task data array | | `milestones` | `Task[]` | `[]` | Milestone data array | | `editComponent` | `any` | - | Custom edit component | | `useDefaultDrawer` | `boolean` | `true` | Use default edit drawer | | `showToolbar` | `boolean` | `true` | Show toolbar | | `toolbarConfig` | `ToolbarConfig` | `{}` | Toolbar configuration | | `localeMessages` | `Partial` | - | Custom locale messages | | `workingHours` | `WorkingHours` | - | Working hours configuration | | `onTaskDoubleClick` | `(task: Task) => void` | - | Task double-click event callback | | `onTaskDelete` | `(task: Task, deleteChildren?: boolean) => void` | - | Task delete event callback | | `onTaskUpdate` | `(task: Task) => void` | - | Task update event callback | | `onTaskAdd` | `(task: Task) => void` | - | Task add event callback | | `onMilestoneSave` | `(milestone: Task) => void` | - | Milestone save event callback | | `onMilestoneDelete` | `(milestoneId: number) => void` | - | Milestone delete event callback | | `onMilestoneIconChange` | `(milestoneId: number, icon: string) => void` | - | Milestone icon change event callback | | `onAddTask` | `() => void` | - | Add task toolbar event callback | | `onAddMilestone` | `() => void` | - | Add milestone toolbar event callback | | `onTodayLocate` | `() => void` | - | Locate today toolbar event callback | | `onExportCsv` | `() => boolean \| void` | - | Export CSV toolbar event callback | | `onExportPdf` | `() => void` | - | Export PDF toolbar event callback | | `onLanguageChange` | `(lang: 'zh-CN' \| 'en-US') => void` | - | Language change toolbar event callback | | `onThemeChange` | `(isDark: boolean) => void` | - | Theme change toolbar event callback | | `onFullscreenChange` | `(isFullscreen: boolean) => void` | - | Fullscreen change toolbar event callback | ### GanttChart Events | Event | Parameters | Description | |--------------------|----------------------------|------------------------------------| | `taskbar-drag-end` | `task: Task` | Task bar drag end | | `taskbar-resize-end` | `task: Task` | Task bar resize end | | `milestone-drag-end` | `milestone: Task` | Milestone drag end | | `predecessor-added`| `{ targetTask, newTask }` | Triggered after adding predecessor.
Parameters:
β€’ `targetTask`: The task to which a predecessor was added (Task object)
β€’ `newTask`: The newly added predecessor task (Task object) | | `successor-added` | `{ targetTask, newTask }` | Triggered after adding successor.
Parameters:
β€’ `targetTask`: The task to which a successor was added (Task object)
β€’ `newTask`: The newly added successor task (Task object) | | `task-deleted` | `{ task }` | Triggered after deleting a task | | `task-added` | `{ task }` | Triggered after creating a task | | `task-updated` | `{ task }` | Triggered after updating a task | #### Timer Event Usage Example ```vue ``` #### Task Event Usage Example ```vue ``` ### Data Types #### Core Types (src/models/classes) **Task Type** ```typescript export interface Task { id: number // Unique task ID name: string // Task name predecessor?: number[] // Predecessor task ID array assignee?: string // Assignee startDate?: string // Start date (ISO string) endDate?: string // End date (ISO string) progress?: number // Progress percentage 0-100 estimatedHours?: number // Estimated hours (supports decimal, up to 2 decimal places) actualHours?: number // Actual hours (supports decimal, up to 2 decimal places) parentId?: number // Parent task ID children?: Task[] // Subtask array collapsed?: boolean // Collapsed state isParent?: boolean // Is parent task type?: string // Task type (e.g. task, story, milestone) description?: string // Task description icon?: string // Icon level?: number // Level // Timer related fields isTimerRunning?: boolean // Is timer running timerStartTime?: number // Timer start timestamp timerEndTime?: number // Timer end timestamp timerStartDesc?: string // Timer start description timerElapsedTime?: number // Accumulated timer duration (seconds) } ``` **Milestone Type** ```typescript // Milestone is actually a special usage of Task type // Task object with type: 'milestone' property interface Milestone extends Task { type: 'milestone' // Must be 'milestone' startDate: string // Milestone date (required) endDate?: string // End date (optional, usually same as startDate) } ``` **Language Type** ```typescript type Language = 'zh' | 'en' // Supported language types type Locale = 'zh-CN' | 'en-US' // Complete language locale identifiers ``` #### Configuration Types (src/models/configs) **TimelineConfig** ```typescript interface TimelineConfig { startDate: Date // Timeline start date endDate: Date // Timeline end date zoomLevel: number // Zoom level } ``` **ToolbarConfig** ```typescript interface ToolbarConfig { showAddTask?: boolean // Show add task button showAddMilestone?: boolean // Show add milestone button showTodayLocate?: boolean // Show locate today button showExportCsv?: boolean // Show export CSV button showExportPdf?: boolean // Show export PDF button showLanguage?: boolean // Show language switch button showTheme?: boolean // Show theme switch button showFullscreen?: boolean // Show fullscreen toggle button showTimeScale?: boolean // Show time scale toggle buttons (Day|Week|Month) } ``` **WorkingHours Configuration** ```typescript interface WorkingHours { morning?: { start: number; end: number } // Morning work hours, e.g. { start: 8, end: 11 } afternoon?: { start: number; end: number } // Afternoon work hours, e.g. { start: 13, end: 17 } } ``` **TimelineScale Types** ```typescript // Timeline display scale types type TimelineScale = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' // Timeline scale constants export const TimelineScale = { HOUR: 'hour', // Hour view - each column displays one hour DAY: 'day', // Day view - each column displays one day WEEK: 'week', // Week view - each column displays one week MONTH: 'month', // Month view - each column displays one month QUARTER: 'quarter', // Quarter view - each column displays one quarter YEAR: 'year', // Year view - each column displays one year } // Timeline scale configuration interface TimelineScaleConfig { scale: TimelineScale // Scale type cellWidth: number // Width of each time unit (px) headerLevels: number // Number of header levels formatters: { primary: string // Primary time label format secondary?: string // Secondary time label format } } ``` ### πŸ• Timeline Scale Features The component supports multiple timeline scale displays. Users can switch timeline granularity through the Day/Week/Month button group in the toolbar or programmatically: #### Built-in Scale Configurations | Scale Type | Cell Width | Primary Format | Secondary Format | Use Case | |------------|------------|----------------|------------------|----------| | `hour` | 40px | yyyy/MM/dd | HH | Short-term projects with hourly precision, such as drug clinical trials | | `day` | 30px | yyyy/MM | dd | Standard view for daily project management | | `week` | 120px | yyyy/MM | W | Weekly planning view for medium-term projects | | `month` | 180px | yyyy | MM | Monthly view for long-term projects | | `quarter` | 360px | yyyy | Q | Quarterly view for strategic planning | | `year` | 360px | yyyy | First Half\|Second Half | Annual view for very long-term projects | #### Usage Example ```vue ``` #### Composable Functions (src/composables) **useI18n Internationalization Tool** ```typescript // Provides multi-language support const { locale, // Current language setLocale, // Switch language t, // Translation function formatYearMonth // Year-month formatting } = useI18n() // Supported languages type Locale = 'zh-CN' | 'en-US' ``` **useMessage Message Tool** ```typescript // Provides global message notifications const { showMessage } = useMessage() // Message types type MessageType = 'success' | 'error' | 'warning' | 'info' // Usage example showMessage('Operation successful', 'success') ``` ## πŸ’» Basic Usage ### Simple Example ```vue ``` ### Custom Event Handling ```vue ``` ### Theme and Internationalization ```vue ``` ### πŸ”§ Working Hours Configuration The component supports setting working hours, affecting task duration calculations and progress display: ```vue ``` ### πŸ“Š High-Precision Work Hours Management The component supports work hour recording precise to 2 decimal places, suitable for projects requiring precise billing: ```vue ``` // Handle toolbar events const handleLanguageChange = (lang) => { console.log('Language changed to:', lang) } const handleThemeChange = (isDark) => { console.log('Theme changed to:', isDark ? 'dark' : 'light') } ``` ## 🀝 Contributing & Collaboration ### Contributing We welcome community contributions! If you want to participate in project development: 1. **Fork** this repository 2. **Create** your feature branch (`git checkout -b feature/AmazingFeature`) 3. **Commit** your changes (`git commit -m 'Add some AmazingFeature'`) 4. **Push** to the branch (`git push origin feature/AmazingFeature`) 5. **Open** a Pull Request ### Report Issues If you find bugs or have feature suggestions: - πŸ“¬ [Submit Github Issue](https://github.com/nelson820125/jordium-gantt-vue3/issues) - πŸ“¬ [Submit Gitee Issue](https://gitee.com/jordium/jordium-gantt-vue3/issues) - πŸ“§ Send email to:ning.li@jordium.com / nelson820125@gmail.com / lining820125@163.com ### Business Collaboration We provide professional technical support and custom development services: - 🏒 **Enterprise Customization**: Custom Gantt chart features based on business needs - πŸ’Ό **Technical Consulting**: Project management system architecture design consultation **Contact Information**: - πŸ“§ Business Email:ning.li@jordium.com / nelson820125@gmail.com ### Development Environment ```bash # Clone project git clone https://github.com/nelson820125/jordium-gantt-vue3.git # Install dependencies npm install # Start development server npm run dev # Build library npm run build:lib # Run tests npm run test ``` --- **πŸ”— Related Links** - [GitHub Repository](https://github.com/nelson820125/jordium-gantt-vue3) - [Changelog](./CHANGELOG.md) > πŸ’‘ **Tip**: If this project helps you, please give us a ⭐ Star!