Skip to content

Commit fb54672

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 4667f48 + 3e6760b commit fb54672

24 files changed

+809
-434
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A powerful Gantt chart component for Vue 3, evolved from vue-ganttastic. Provide
66

77
## Guide and Docs
88

9-
For further guides and references, check out the [documentation](https://github.com/Xeyos88/HyVueGantt).
9+
For further guides and references, check out the [documentation](https://xeyos88.github.io/HyVueGantt/).
1010

1111
## 🚀 Installation
1212

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
import { GGanttChart, GGanttRow, type ChartRow, type LabelColumnConfig } from 'hy-vue-gantt'
4+
5+
const chartStart = ref('2024-01-01')
6+
const chartEnd = ref('2024-03-31')
7+
const precision = ref('day')
8+
const barStart = ref('start')
9+
const barEnd = ref('end')
10+
11+
const getN = (row: ChartRow) => {
12+
return row.bars.length
13+
}
14+
15+
const sortN = (a: ChartRow, b: ChartRow) => {
16+
const aId = a.bars.length ?? 0
17+
const bId = b.bars.length ?? 0
18+
return aId < bId ? -1 : aId > bId ? 1 : 0
19+
}
20+
21+
22+
const multiColumnLabel = ref<LabelColumnConfig[]>([
23+
{
24+
field: 'Id',
25+
sortable: false,
26+
},
27+
{
28+
field: 'Label',
29+
},
30+
{
31+
field: 'StartDate',
32+
},
33+
{
34+
field: 'Duration',
35+
},
36+
{
37+
field: 'Bars N°',
38+
valueGetter: getN,
39+
sortFn: sortN,
40+
},
41+
])
42+
43+
const rows = ref([
44+
{
45+
id: 1,
46+
label: 'Design Phase',
47+
bars: [
48+
{
49+
start: '2024-01-05',
50+
end: '2024-01-20',
51+
ganttBarConfig: {
52+
id: '1',
53+
label: 'UI/UX Design',
54+
style: { background: '#42b883' }
55+
}
56+
}
57+
]
58+
},
59+
{
60+
id: 2,
61+
label: 'Development',
62+
bars: [
63+
{
64+
start: '2024-01-21',
65+
end: '2024-02-15',
66+
ganttBarConfig: {
67+
id: '2',
68+
label: 'Frontend Implementation',
69+
style: { background: '#35495e' }
70+
}
71+
}
72+
]
73+
},
74+
{
75+
id: 3,
76+
label: 'Testing',
77+
bars: [
78+
{
79+
start: '2024-02-10',
80+
end: '2024-02-28',
81+
ganttBarConfig: {
82+
id: '3',
83+
label: 'QA and Testing',
84+
style: { background: '#ff7e67' }
85+
}
86+
}
87+
]
88+
}
89+
])
90+
</script>
91+
92+
<template>
93+
<div class="demo-container">
94+
<g-gantt-chart
95+
:chart-start="chartStart"
96+
:chart-end="chartEnd"
97+
:precision="precision"
98+
:bar-start="barStart"
99+
:bar-end="barEnd"
100+
:row-height="40"
101+
grid
102+
label-column-title="Project Details"
103+
:multi-column-label="multiColumnLabel"
104+
sortable
105+
color-scheme="slumber"
106+
>
107+
<g-gantt-row
108+
v-for="row in rows"
109+
:key="row.label"
110+
:label="row.label"
111+
:bars="row.bars"
112+
/>
113+
</g-gantt-chart>
114+
</div>
115+
</template>
116+
117+
<style scoped>
118+
.demo-container {
119+
padding: 20px;
120+
border: 1px solid #eaeaea;
121+
border-radius: 8px;
122+
margin: 20px 0;
123+
}
124+
125+
h3 {
126+
margin-bottom: 20px;
127+
color: #42b883;
128+
}
129+
</style>

docs/.vitepress/theme/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,12 @@
8282

8383
.dark .VPFeatures .item .icon {
8484
background-color: #2a2a2a;
85+
}
86+
87+
.VPContent.has-sidebar {
88+
padding-right: calc((90vw - var(--vp-layout-max-width)) / 2) !important;
89+
}
90+
91+
.VPDoc.has-aside .content-container {
92+
max-width: 900px !important;
8593
}

docs/.vitepress/theme/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ const OtherGanttDemo = defineClientComponent(() => {
3333
return import('./components/OtherGanttDemo.vue')
3434
})
3535

36+
const MultiColumnDemo= defineClientComponent(() => {
37+
return import('./components/MultiColumnDemo.vue')
38+
})
39+
40+
3641

3742
export default {
3843
extends: DefaultTheme,
@@ -41,7 +46,8 @@ export default {
4146
app.component('BasicGanttDemo', GanttDemo)
4247
app.component('ConnectionsGanttDemo', ConnectionsGanttDemo)
4348
app.component('TimeGanttDemo', TimeGanttDemo)
44-
app.component('AdvancedGanttDemo',AdvancedGanttDemo)
49+
app.component('AdvancedGanttDemo', AdvancedGanttDemo)
4550
app.component('OtherGanttDemo', OtherGanttDemo)
51+
app.component('MultiColumnDemo', MultiColumnDemo)
4652
}
4753
}

docs/api/types.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ HyVue Gantt exposes several TypeScript types and interfaces for use in your appl
88
// Time Units
99
type TimeUnit = 'hour' | 'day' | 'week' | 'month';
1010

11-
// Sort Direction
12-
type SortDirection = 'asc' | 'desc' | 'none';
13-
1411
// Connection Types
1512
type ConnectionType = 'bezier' | 'straight' | 'squared';
1613
type ConnectionPattern = 'solid' | 'dot' | 'dash' | 'dashdot';
@@ -57,4 +54,18 @@ interface BarConnection {
5754
animated?: boolean;
5855
animationSpeed?: ConnectionSpeed;
5956
}
57+
```
58+
## Label Data Types
59+
60+
```typescript
61+
export type LabelColumnField = "Id" | "Label" | "StartDate" | "EndDate" | "Duration"
62+
63+
export type SortFunction = (a: ChartRow, b: ChartRow) => number
64+
65+
interface LabelColumnConfig {
66+
field: LabelColumnField | string
67+
sortable?: boolean
68+
valueGetter?: (row: ChartRow) => string | number
69+
sortFn?: SortFunction
70+
}
6071
```

docs/components/g-gantt-chart.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Here's a minimal example of using the GGanttChart component:
4848
| font | `string` | `'inherit'` | Font family for the chart |
4949
| labelColumnTitle | `string` | `''` | Title for the label column |
5050
| labelColumnWidth | `string` | `'150px'` | Width of the label column |
51+
| sortable | `boolean` | `true` | Enable row sorting functionality |
52+
| multiColumnLabel | `LabelColumnConfig[]` | `[]` | Array of columns to display in the header |
5153
| commands | `boolean` | `true` | Show chart control commands |
5254
| enableMinutes | `boolean` | `false` | Enable minutes precision for hour view |
5355
| enableConnections | `boolean` | `true` | Enable connections between bars |

docs/components/g-gantt-row.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ The GGanttRow component represents a single row in the Gantt chart. It manages t
3737
| label | None | Custom row label content |
3838
| bar-label | `{ bar: GanttBarObject }` | Custom bar label content |
3939

40+
# Keyboard Controls
41+
42+
Bars within the row support the following keyboard controls:
43+
44+
| Key | Action | With Shift |
45+
|-----|--------|------------|
46+
| Left Arrow | Move bar backward | Move 12 units |
47+
| Right Arrow | Move bar forward | Move 12 units |
48+
| Up Arrow | Expand bar | Expand 12 units |
49+
| Down Arrow | Shrink bar | Shrink 12 units |
50+
51+
The actual unit size depends on the chart's precision setting (hours, days, etc.).
52+
4053
## Bar Configuration
4154

4255
Each bar in the bars array should follow this structure:

docs/examples/live.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Time Precions Live Demo for Hyper Vue Gantt:
2424
<TimeGanttDemo />
2525
</ClientOnly>
2626

27+
## Multi-Column Demo
28+
29+
Demo showcasing multi-column display with sorting capabilities:
30+
31+
<ClientOnly>
32+
<MultiColumnDemo />
33+
</ClientOnly>
34+
2735
## Advanced Custom Demo
2836

2937
Advanced Custom Live Demo for Hyper Vue Gantt:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "hy-vue-gantt",
3-
"version": "1.0.1",
4-
"description": "Fork and update of vue-ganttastic",
3+
"version": "1.1.0",
4+
"description": "Evolution of vue-ganttastic package",
55
"author": "Eugenio Topa (@Xeyos88)",
66
"scripts": {
77
"serve": "vite",

0 commit comments

Comments
 (0)