10
10
* @todo [ ] Integration test.
11
11
* @todo [✔] Update the typescript.
12
12
*/
13
-
13
+ import { useFullscreen } from ' @vueuse/core '
14
14
import type { ScrollbarInst } from " naive-ui" ;
15
15
import { isWindows } from " ~/utils/PlatformUtils" ;
16
16
import type {
@@ -254,74 +254,33 @@ onMounted(() => {
254
254
255
255
<template >
256
256
<NModal v-model:show =" isDialogVisible" class =" search-dialog" >
257
- <NCard
258
- class =" w-[650px]"
259
- content-style =" padding: 0;"
260
- :bordered =" false"
261
- size =" huge"
262
- role =" dialog"
263
- aria-modal =" true"
264
- >
265
- <div
266
- class =" search-dialog-action-bar rounded-2xl"
267
- @keydown.up =" movePrevItem()"
268
- @keydown.down =" moveNextItem()"
269
- >
257
+ <NCard class =" w-[650px]" content-style =" padding: 0;" :bordered =" false" size =" huge" role =" dialog" aria-modal =" true" >
258
+ <div class =" search-dialog-action-bar rounded-2xl" @keydown.up =" movePrevItem()" @keydown.down =" moveNextItem()" >
270
259
<div class =" search-input flex items-center gap-5 px-5 h-12" >
271
260
<Icon :name =" SearchIcon" size =" 16" />
272
- <input
273
- v-model =" search"
274
- :placeholder =" t('searchDialog.searchPlaceholder')"
275
- class =" grow bg-transparent outline-none border-none"
276
- />
261
+ <input v-model =" search" :placeholder =" t('searchDialog.searchPlaceholder')"
262
+ class =" grow bg-transparent outline-none border-none" />
277
263
<NText code > ESC </NText >
278
- <Icon
279
- :name =" CloseIcon"
280
- size =" 20"
281
- class =" cursor-pointer"
282
- @click =" closeDialog()"
283
- />
264
+ <Icon :name =" CloseIcon" size =" 20" class =" cursor-pointer" @click =" closeDialog()" />
284
265
</div >
285
266
<NDivider />
286
267
<NScrollbar ref =" scrollContent" style =" height : 400px " >
287
268
<div class =" content-wrap" >
288
- <div
289
- v-for =" group of filteredGroups"
290
- :key =" group.name"
291
- class =" group"
292
- >
269
+ <div v-for =" group of filteredGroups" :key =" group.name" class =" group" >
293
270
<div class =" group-title" >
294
271
{{ group.name }}
295
272
</div >
296
273
<NEl class =" group-list" >
297
- <div
298
- v-for =" item of group.items"
299
- :id =" item.key.toString()"
300
- :key =" item.key"
301
- class =" item flex items-center my-2"
302
- :class =" { active: item.key === activeItem }"
303
- @click =" executeAction(item.action)"
304
- >
274
+ <div v-for =" item of group.items" :id =" item.key.toString()" :key =" item.key"
275
+ class =" item flex items-center my-2" :class =" { active: item.key === activeItem }"
276
+ @click =" executeAction(item.action)" >
305
277
<NEl class =" icon" >
306
- <NAvatar
307
- v-if =" item.iconImage"
308
- round
309
- :size =" 28"
310
- :src =" item.iconImage"
311
- />
312
- <Icon
313
- v-if =" item.iconName"
314
- :name =" item.iconName"
315
- size =" 18"
316
- />
278
+ <NAvatar v-if =" item.iconImage" round :size =" 28" :src =" item.iconImage" />
279
+ <Icon v-if =" item.iconName" :name =" item.iconName" size =" 18" />
317
280
</NEl >
318
281
<div class =" title grow" >
319
- <Highlighter
320
- highlight-class-name =" highlight"
321
- :search-words =" keywords"
322
- :auto-escape =" true"
323
- :text-to-highlight =" item.title"
324
- />
282
+ <Highlighter highlight-class-name =" highlight" :search-words =" keywords" :auto-escape =" true"
283
+ :text-to-highlight =" item.title" />
325
284
</div >
326
285
<div class =" label" >
327
286
{{ item.label }}
@@ -362,45 +321,41 @@ onMounted(() => {
362
321
.search-dialog .search-dialog-action-bar .search-input .ca-text--code {
363
322
white-space : nowrap ;
364
323
}
324
+
365
325
.search-dialog .search-dialog-action-bar .ca-divider {
366
326
margin-top : 0 ;
367
327
margin-bottom : 0 ;
368
328
}
329
+
369
330
.search-dialog .search-dialog-action-bar .content-wrap {
370
331
padding-bottom : 30px ;
371
332
}
333
+
372
334
.search-dialog .search-dialog-action-bar .content-wrap .group-empty {
373
335
text-align : center ;
374
336
padding : 30px 0 40px 0 ;
375
337
}
338
+
376
339
.search-dialog .search-dialog-action-bar .content-wrap .group {
377
340
padding : 0 10px ;
378
341
}
342
+
379
343
.search-dialog .search-dialog-action-bar .content-wrap .group .group-title {
380
344
opacity : 0.6 ;
381
345
margin-bottom : 5px ;
382
346
padding : 20px 10px 5px ;
383
347
}
384
- .search-dialog
385
- .search-dialog-action-bar
386
- .content-wrap
387
- .group
388
- .group-list
389
- .item {
348
+
349
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item {
390
350
padding : 7px 10px ;
391
351
gap : 10px ;
392
352
cursor : pointer ;
393
353
border-radius : 10px ;
394
354
width : 100% ;
395
355
text-align : left ;
396
356
}
397
- .search-dialog
398
- .search-dialog-action-bar
399
- .content-wrap
400
- .group
401
- .group-list
402
- .item
403
- .icon {
357
+
358
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .icon {
404
359
width : 28px ;
405
360
height : 28px ;
406
361
border-radius : 50% ;
@@ -409,39 +364,21 @@ onMounted(() => {
409
364
justify-content : center ;
410
365
align-items : center ;
411
366
}
412
- .search-dialog
413
- .search-dialog-action-bar
414
- .content-wrap
415
- .group
416
- .group-list
417
- .item
418
- .title {
367
+
368
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .title {
419
369
font-weight : bold ;
420
370
}
421
- .search-dialog
422
- .search-dialog-action-bar
423
- .content-wrap
424
- .group
425
- .group-list
426
- .item
427
- .label {
371
+
372
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item .label {
428
373
opacity : 0.8 ;
429
374
font-size : 0.9em ;
430
375
}
431
- .search-dialog
432
- .search-dialog-action-bar
433
- .content-wrap
434
- .group
435
- .group-list
436
- .item.active {
376
+
377
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item.active {
437
378
background-color : var (--hover-color );
438
379
}
439
- .search-dialog
440
- .search-dialog-action-bar
441
- .content-wrap
442
- .group
443
- .group-list
444
- .item :hover {
380
+
381
+ .search-dialog .search-dialog-action-bar .content-wrap .group .group-list .item :hover {
445
382
box-shadow : 0 0 0 1px var (--primary-color-hover ) inset ;
446
383
}
447
384
</style >
0 commit comments