|
189 | 189 | } |
190 | 190 | return total |
191 | 191 | } |
| 192 | +
|
| 193 | + let hoveredIndex: number = -1 |
192 | 194 | </script> |
193 | 195 |
|
194 | 196 | {#if departmentStaff.length} |
195 | | - <Scroller> |
| 197 | + <Scroller tableFade> |
196 | 198 | <table> |
197 | 199 | <thead class="scroller-thead"> |
198 | 200 | <tr class="scroller-thead__tr"> |
199 | 201 | <th> |
200 | 202 | <Label label={contact.string.Employee} /> |
201 | 203 | </th> |
202 | | - {#each values as value} |
| 204 | + {#each values as value, i} |
203 | 205 | {#if mode === CalendarMode.Year} |
204 | 206 | {@const month = getMonth(currentDate, value)} |
205 | 207 | <th |
206 | 208 | class="fixed" |
207 | 209 | class:today={month.getFullYear() === todayDate.getFullYear() && |
208 | 210 | month.getMonth() === todayDate.getMonth()} |
| 211 | + on:mousemove={() => { |
| 212 | + hoveredIndex = i |
| 213 | + }} |
| 214 | + on:mouseleave={() => { |
| 215 | + hoveredIndex = -1 |
| 216 | + }} |
209 | 217 | > |
210 | | - <div class="cursor-pointer uppercase flex-col-center"> |
211 | | - <div class="flex-center">{getMonthName(month)}</div> |
212 | | - </div> |
| 218 | + {getMonthName(month)} |
213 | 219 | </th> |
214 | 220 | {:else} |
215 | 221 | {@const day = getDay(new Date(startDate), value)} |
216 | | - <th class:today={areDatesEqual(todayDate, day)} class:weekend={isWeekend(day)}> |
217 | | - <div class="cursor-pointer uppercase flex-col-center"> |
218 | | - <div class="flex-center">{getWeekDayName(day, 'short')}</div> |
219 | | - <div class="flex-center">{day.getDate()}</div> |
220 | | - </div> |
| 222 | + <th |
| 223 | + class:today={areDatesEqual(todayDate, day)} |
| 224 | + class:weekend={isWeekend(day)} |
| 225 | + on:mousemove={() => { |
| 226 | + hoveredIndex = i |
| 227 | + }} |
| 228 | + on:mouseleave={() => { |
| 229 | + hoveredIndex = -1 |
| 230 | + }} |
| 231 | + > |
| 232 | + {getWeekDayName(day, 'short')} |
| 233 | + <span>{day.getDate()}</span> |
221 | 234 | </th> |
222 | 235 | {/if} |
223 | 236 | {/each} |
224 | 237 | </tr> |
225 | 238 | </thead> |
226 | 239 | <tbody> |
227 | | - {#each departmentStaff as employee} |
| 240 | + {#each departmentStaff as employee, row} |
228 | 241 | <tr> |
229 | 242 | <td> |
230 | 243 | <EmployeePresenter value={employee} /> |
231 | 244 | </td> |
232 | | - {#each values as value} |
| 245 | + {#each values as value, i} |
233 | 246 | {#if mode === CalendarMode.Year} |
234 | 247 | {@const month = getMonth(currentDate, value)} |
235 | 248 | {@const requests = getRequests(employee._id, month)} |
|
256 | 269 | class:today={areDatesEqual(todayDate, date)} |
257 | 270 | class:weekend={isWeekend(date)} |
258 | 271 | class:cursor-pointer={editable} |
| 272 | + class:hovered={i === hoveredIndex} |
| 273 | + class:firstLine={row === 0} |
| 274 | + class:lastLine={row === departmentStaff.length - 1} |
259 | 275 | use:tooltip={tooltipValue} |
260 | 276 | on:click={(e) => createRequest(e, date, employee)} |
261 | 277 | > |
|
272 | 288 | </table> |
273 | 289 | </Scroller> |
274 | 290 | {:else} |
275 | | - <div class="flex-center h-full flex-grow fs-title"> |
| 291 | + <div class="flex-center h-full w-full flex-grow fs-title"> |
276 | 292 | <Label label={hr.string.NoEmployeesInDepartment} /> |
277 | 293 | </div> |
278 | 294 | {/if} |
279 | 295 |
|
280 | 296 | <style lang="scss"> |
281 | 297 | table { |
282 | | - border-collapse: collapse; |
283 | | - table-layout: fixed; |
284 | | - width: auto; |
285 | 298 | position: relative; |
| 299 | + width: 100%; |
286 | 300 |
|
287 | 301 | td, |
288 | 302 | th { |
289 | 303 | width: auto; |
290 | | - min-width: 1rem; |
| 304 | + width: 2rem; |
| 305 | + min-width: 1.5rem; |
| 306 | + border: none; |
291 | 307 | &.fixed { |
292 | 308 | width: 5rem; |
| 309 | + padding: 0 0.125rem; |
| 310 | + hyphens: auto; |
293 | 311 | } |
294 | 312 | &:first-child { |
295 | 313 | width: 15rem; |
296 | 314 | padding: 0.5rem; |
297 | 315 | } |
298 | 316 | } |
299 | 317 | th { |
300 | | - padding: 0.5rem; |
| 318 | + flex-shrink: 0; |
| 319 | + padding: 0; |
301 | 320 | height: 2.5rem; |
| 321 | + min-height: 2.5rem; |
| 322 | + max-height: 2.5rem; |
| 323 | + text-transform: uppercase; |
302 | 324 | font-weight: 500; |
303 | 325 | font-size: 0.75rem; |
| 326 | + line-height: 105%; |
304 | 327 | color: var(--dark-color); |
305 | 328 | box-shadow: inset 0 -1px 0 0 var(--divider-color); |
306 | 329 | user-select: none; |
| 330 | + cursor: pointer; |
| 331 | +
|
| 332 | + span { |
| 333 | + display: block; |
| 334 | + font-weight: 600; |
| 335 | + font-size: 1rem; |
| 336 | + } |
307 | 337 | &.today { |
308 | 338 | color: var(--caption-color); |
309 | 339 | } |
|
313 | 343 | } |
314 | 344 | td { |
315 | 345 | height: 3.5rem; |
316 | | - border: 1px solid var(--divider-color); |
| 346 | + border: none; |
317 | 347 | color: var(--caption-color); |
318 | 348 | &.today { |
319 | 349 | background-color: var(--theme-bg-accent-hover); |
|
322 | 352 | background-color: var(--theme-bg-accent-color); |
323 | 353 | } |
324 | 354 | } |
| 355 | + td:not(:last-child) { |
| 356 | + border-right: 1px solid var(--divider-color); |
| 357 | + } |
| 358 | + tr:not(.scroller-thead__tr) { |
| 359 | + border-bottom: 1px solid var(--divider-color); |
| 360 | + } |
| 361 | + tr.scroller-thead__tr:not(:last-child) { |
| 362 | + border-right: 1px solid var(--divider-color); |
| 363 | + } |
| 364 | +
|
| 365 | + .hovered { |
| 366 | + position: relative; |
| 367 | +
|
| 368 | + &::after { |
| 369 | + position: absolute; |
| 370 | + content: ''; |
| 371 | + top: 0; |
| 372 | + left: 0; |
| 373 | + width: 100%; |
| 374 | + height: 100%; |
| 375 | + background-color: var(--caption-color); |
| 376 | + opacity: 0.15; |
| 377 | + } |
| 378 | + } |
325 | 379 | } |
326 | 380 | </style> |
0 commit comments