Skip to content

Commit c79ae91

Browse files
gusibigusibi
authored andcommitted
update date picker
1 parent 818fc56 commit c79ae91

File tree

7 files changed

+288
-347
lines changed

7 files changed

+288
-347
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moli-todo",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "一款常驻在桌面边缘的悬浮式待办事项应用",
55
"main": "src/main/main.js",
66
"scripts": {
@@ -57,6 +57,7 @@
5757
"pinia": "^2.1.7",
5858
"sqlite": "^5.1.1",
5959
"sqlite3": "^5.1.7",
60+
"v-calendar": "^3.1.2",
6061
"vue": "^3.3.8",
6162
"vue-chartjs": "^5.3.2",
6263
"vue-i18n": "^9.14.5",
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
/* V-Calendar 样式 - 完全使用 Tailwind CSS 语义化变量 */
2+
.task-edit-vertical .date-picker-popup {
3+
@apply absolute z-50 mt-2 bg-popover border border-border rounded-xl shadow-xl p-3 text-xs overflow-hidden;
4+
animation: slideIn 0.2s ease-out;
5+
}
6+
7+
@keyframes slideIn {
8+
from {
9+
opacity: 0;
10+
transform: translateY(-10px);
11+
}
12+
to {
13+
opacity: 1;
14+
transform: translateY(0);
15+
}
16+
}
17+
18+
/* 主容器样式 */
19+
.task-edit-vertical .v-calendar {
20+
@apply bg-popover text-popover-foreground rounded-lg border-none shadow-none;
21+
}
22+
23+
/* 头部样式 */
24+
.task-edit-vertical .vc-header {
25+
@apply p-0 mb-3;
26+
}
27+
28+
.task-edit-vertical .vc-title {
29+
@apply text-foreground font-semibold text-sm;
30+
}
31+
32+
.task-edit-vertical .vc-arrow {
33+
@apply text-muted-foreground hover:text-foreground hover:bg-accent rounded-full p-1 transition-all duration-200;
34+
}
35+
36+
.task-edit-vertical .vc-select {
37+
@apply bg-muted/50 text-foreground hover:bg-muted/70 border border-border rounded-md text-xs px-2 py-1 font-medium transition-all duration-200;
38+
}
39+
40+
/* 日期网格样式 */
41+
.task-edit-vertical .vc-weeks {
42+
@apply p-0;
43+
}
44+
45+
.task-edit-vertical .vc-weekdays {
46+
@apply grid grid-cols-7 gap-1 mb-2;
47+
}
48+
49+
.task-edit-vertical .vc-weekday {
50+
@apply text-muted-foreground text-[10px] font-medium text-center uppercase tracking-wider;
51+
}
52+
53+
/* 日期单元格样式 */
54+
.task-edit-vertical .vc-day {
55+
@apply text-foreground hover:bg-accent hover:text-accent-foreground text-xs rounded-md transition-all duration-200 flex items-center justify-center h-8 w-8 mx-auto;
56+
}
57+
58+
.task-edit-vertical .vc-day-content {
59+
@apply w-full h-full flex items-center justify-center rounded-md hover:bg-accent hover:text-accent-foreground transition-colors;
60+
}
61+
62+
.task-edit-vertical .vc-day.is-today .vc-day-content {
63+
@apply bg-primary/10 text-primary font-bold border border-primary/20;
64+
}
65+
66+
.task-edit-vertical .vc-day.is-selected .vc-day-content {
67+
@apply bg-primary text-primary-foreground font-bold shadow-md;
68+
}
69+
70+
.task-edit-vertical .vc-day.is-disabled {
71+
@apply text-muted-foreground/30 cursor-not-allowed pointer-events-none;
72+
}
73+
74+
.task-edit-vertical .vc-day.is-not-in-month {
75+
@apply text-muted-foreground/30;
76+
}
77+
78+
/* 时间选择器样式优化 */
79+
.task-edit-vertical .vc-time-picker {
80+
@apply border-t border-border pt-3 mt-2 px-1 pb-1;
81+
}
82+
83+
.task-edit-vertical .vc-time-header {
84+
@apply text-xs font-medium mb-2 text-muted-foreground flex justify-between items-center leading-none;
85+
}
86+
87+
.task-edit-vertical .vc-time-header > * {
88+
@apply flex items-center self-center leading-none;
89+
vertical-align: middle;
90+
}
91+
92+
/* 针对 v-calendar v3 的时间选择器列样式 */
93+
.task-edit-vertical .vc-time-select-group {
94+
@apply flex items-center justify-center gap-1 bg-muted/30 rounded-lg p-1 border border-border;
95+
align-items: center; /* 确保所有子元素垂直居中 */
96+
height: auto; /* 确保容器高度自适应 */
97+
}
98+
99+
.task-edit-vertical .vc-base-select {
100+
@apply flex items-center self-center;
101+
vertical-align: middle;
102+
}
103+
104+
.task-edit-vertical .vc-time-select-group .vc-base-icon {
105+
@apply text-muted-foreground mr-1 flex items-center self-center leading-none;
106+
display: inline-flex;
107+
vertical-align: middle;
108+
}
109+
110+
/* 滚动容器 */
111+
.task-edit-vertical .vc-base-select select {
112+
@apply bg-transparent text-foreground text-xs p-1 border-none outline-none cursor-pointer rounded hover:bg-muted/50 transition-colors;
113+
appearance: none; /* 移除默认下拉箭头 */
114+
text-align: center;
115+
vertical-align: middle; /* 确保垂直居中对齐 */
116+
align-self: center;
117+
}
118+
119+
/* 分钟选择器优化 - 限制高度和选项数量 */
120+
.task-edit-vertical .vc-base-select-group {
121+
@apply max-h-40 overflow-y-auto;
122+
}
123+
124+
/* 限制分钟内选择器高度,确保只显示部分选项 */
125+
.task-edit-vertical .vc-time-select-group {
126+
@apply max-h-32 overflow-y-auto bg-muted/20 rounded-md border border-border/50;
127+
}
128+
129+
/* 优化分钟选择器,只显示12个选项的高度 */
130+
.task-edit-vertical .vc-base-select select {
131+
@apply bg-transparent text-foreground text-xs p-1 border-none outline-none cursor-pointer rounded hover:bg-muted/50 transition-colors;
132+
appearance: none; /* 移除默认下拉箭头 */
133+
text-align: center;
134+
}
135+
136+
/* 针对分钟选择器的特殊处理 - 限制高度为12个选项 */
137+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child select {
138+
@apply max-h-32; /* 限制整体高度 */
139+
size: 12; /* 只显示12个选项 */
140+
scroll-behavior: smooth;
141+
height: auto;
142+
max-height: 12em; /* 大约12个选项的高度 */
143+
}
144+
145+
/* 为分钟选择器创建更紧凑的显示 */
146+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child {
147+
@apply max-h-32 overflow-y-auto;
148+
position: relative;
149+
display: flex; /* 改为flex布局以支持垂直居中 */
150+
align-items: center;
151+
align-self: center;
152+
vertical-align: middle;
153+
}
154+
155+
/* 确保分钟选项更紧凑 */
156+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child option {
157+
@apply py-1 text-xs leading-tight; /* 减少上下内边距和行高 */
158+
height: 1.5em; /* 每个选项的高度 */
159+
}
160+
161+
/* 时间选择器整体高度限制 */
162+
.task-edit-vertical .vc-time-select-group {
163+
@apply max-h-40 overflow-y-auto; /* 限制整体高度 */
164+
}
165+
166+
/* 小时和分钟选择器的通用样式 */
167+
.task-edit-vertical .vc-time-select-group .vc-base-select select {
168+
@apply text-xs py-1; /* 减少内边距 */
169+
}
170+
171+
/* 更精确地控制分钟选择器的显示 */
172+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child {
173+
@apply max-h-32; /* 限制分钟选择器高度 */
174+
}
175+
176+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child select {
177+
@apply max-h-24; /* 大约12个选项的高度 (每个选项2em) */
178+
overflow-y: auto; /* 启用滚动 */
179+
display: flex;
180+
align-items: center;
181+
align-self: center;
182+
vertical-align: middle;
183+
margin: auto; /* 添加自动边距以帮助居中 */
184+
}
185+
186+
/* 确保时间选择器列不会太高 */
187+
.task-edit-vertical .vc-time-select-group {
188+
@apply flex items-center justify-center gap-1 bg-muted/30 rounded-lg p-1 border border-border;
189+
max-height: 10rem; /* 限制整体高度 */
190+
overflow: hidden;
191+
align-items: center; /* 确保所有元素垂直居中 */
192+
}
193+
194+
/* 优化下拉选择器的滚动条样式 */
195+
.task-edit-vertical .vc-base-select-group::-webkit-scrollbar {
196+
@apply w-1;
197+
}
198+
199+
.task-edit-vertical .vc-base-select-group::-webkit-scrollbar-track {
200+
@apply bg-transparent;
201+
}
202+
203+
.task-edit-vertical .vc-base-select-group::-webkit-scrollbar-thumb {
204+
@apply bg-muted-foreground/30 rounded-full;
205+
}
206+
207+
.task-edit-vertical .vc-base-select-group::-webkit-scrollbar-thumb:hover {
208+
@apply bg-muted-foreground/50;
209+
}
210+
211+
/* 移除不需要的样式 */
212+
.task-edit-vertical .vc-time-content,
213+
.task-edit-vertical .vc-time-date {
214+
@apply hidden;
215+
}
216+
217+
/* 确保分钟选择器完全垂直居中 */
218+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child {
219+
display: flex !important;
220+
flex-direction: column;
221+
justify-content: center;
222+
align-items: center;
223+
align-self: center;
224+
vertical-align: middle;
225+
}
226+
227+
.task-edit-vertical .vc-time-select-group .vc-base-select:last-child select {
228+
display: flex !important;
229+
flex-direction: column;
230+
justify-content: center;
231+
align-items: center;
232+
align-self: center;
233+
vertical-align: middle;
234+
margin: 0 auto;
235+
}

0 commit comments

Comments
 (0)