diff --git a/demo/App.vue b/demo/App.vue index a0743ea..a9804b3 100644 --- a/demo/App.vue +++ b/demo/App.vue @@ -69,6 +69,14 @@ const taskListConfig = computed(() => ({ maxWidth: taskListWidth.value.maxWidth, })) +// 配置面板折叠状态 +const isConfigPanelCollapsed = ref(false) + +// 切换配置面板折叠状态 +const toggleConfigPanel = () => { + isConfigPanelCollapsed.value = !isConfigPanelCollapsed.value +} + // 切换列显示状态 const toggleColumn = (columnKey: string, event: Event) => { const target = event.target as HTMLInputElement @@ -670,92 +678,103 @@ function onTimerStopped(task: Task) { - -
-

- - - - - TaskList 配置 -

- - -
-

- - - - - 宽度设置 -

-
-
- - - px -
-
- - - px -
-
- - - px -
-
-
- - -
-

- + +
+
+

+ - 列显示 -

-
- -
+ TaskList 配置 +

+
+ + + +
+ +
+

+ + + + + 宽度设置 +

+
+
+ + + px +
+
+ + + px +
+
+ + + px +
+
+
+ + +
+

+ + + + 列显示 +

+
+ +
+
+
+
@@ -827,23 +846,98 @@ function onTimerStopped(task: Task) { flex-direction: column; } -/* TaskList列配置面板样式 */ +/* TaskList列配置面板样式 - 可折叠 */ .config-panel { background: var(--gantt-bg-primary, #ffffff); border: 1px solid var(--gantt-border-color, #e4e7ed); border-radius: 8px; - padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; + overflow: hidden; } .config-panel:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } +.config-panel.collapsed { + border-radius: 8px; +} + +.config-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16px; + cursor: pointer; + user-select: none; + transition: background-color 0.2s ease; + border-bottom: 1px solid var(--gantt-border-color, #e4e7ed); +} + +.config-panel.collapsed .config-header { + border-bottom: none; +} + +.config-header:hover { + background-color: var(--gantt-hover-bg, #f8f9fa); +} + +.config-content { + padding: 0 16px 16px; + overflow: hidden; +} + +.collapse-button { + display: flex; + align-items: center; + justify-content: center; + width: 32px; + height: 32px; + border: none; + background: transparent; + border-radius: 6px; + cursor: pointer; + transition: all 0.3s ease; + color: var(--gantt-text-secondary, #666); +} + +.collapse-button:hover { + background-color: var(--gantt-hover-bg, #e8f4fd); + color: var(--gantt-primary-color, #409eff); +} + +.collapse-icon { + width: 20px; + height: 20px; + transition: transform 0.3s ease; +} + +.collapse-button.collapsed .collapse-icon { + transform: rotate(-90deg); +} + +/* 过渡动画 */ +.config-content-enter-active, +.config-content-leave-active { + transition: all 0.3s ease; + overflow: hidden; +} + +.config-content-enter-from, +.config-content-leave-to { + height: 0; + opacity: 0; +} + +.config-content-enter-to, +.config-content-leave-from { + opacity: 1; +} + .config-title { - margin: 0 0 12px 0; + margin: 0; font-size: 16px; font-weight: 600; color: var(--gantt-text-primary, #333); @@ -882,7 +976,7 @@ function onTimerStopped(task: Task) { .width-controls { display: flex; - flex-direction: column; + flex-direction: row; gap: 12px; } @@ -1110,6 +1204,24 @@ function onTimerStopped(task: Task) { color: var(--gantt-primary-color, #66b3ff); } +/* 暗色主题下的折叠面板样式 */ +:global(html[data-theme='dark']) .config-header { + border-bottom-color: var(--gantt-border-color, #4a5568); +} + +:global(html[data-theme='dark']) .config-header:hover { + background-color: var(--gantt-hover-bg, #2d3748); +} + +:global(html[data-theme='dark']) .collapse-button { + color: var(--gantt-text-secondary, #a0aec0); +} + +:global(html[data-theme='dark']) .collapse-button:hover { + background-color: var(--gantt-hover-bg, #2d3748); + color: var(--gantt-primary-color, #66b3ff); +} + /* 暗黑模式下的版本标签 */ :global(html[data-theme='dark']) .version-badge { background: linear-gradient(135deg, #1a73e8 0%, #00bcd4 50%, #3f51b5 100%); diff --git a/demo/HtmlContent.vue b/demo/HtmlContent.vue index dc6a221..b7bb9f1 100644 --- a/demo/HtmlContent.vue +++ b/demo/HtmlContent.vue @@ -6,14 +6,12 @@ interface Props { type: 'task-row' | 'task-bar' } const props = withDefaults(defineProps(), { - color: '#409eff', - progress: 0, }) // console.error('props', props)