@robot-admin/naive-ui-components 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +27 -1
- package/README_EN.md +26 -0
- package/dist/C_ActionBar.css +60 -60
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.css +49 -49
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +3 -3
- package/dist/C_AudioPlayer.css +81 -66
- package/dist/C_AudioPlayer2.cjs +1 -1
- package/dist/C_AudioPlayer2.js +1 -1
- package/dist/C_AvatarGroup.css +40 -25
- package/dist/C_AvatarGroup2.cjs +1 -1
- package/dist/C_AvatarGroup2.js +1 -1
- package/dist/C_Barcode.css +6 -6
- package/dist/C_Barcode2.cjs +1 -1
- package/dist/C_Barcode2.js +1 -1
- package/dist/C_Breadcrumb.css +14 -14
- package/dist/C_Breadcrumb2.cjs +1 -1
- package/dist/C_Breadcrumb2.js +1 -1
- package/dist/C_Captcha.css +50 -50
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.css +2 -2
- package/dist/C_Cascade2.cjs +1 -1
- package/dist/C_Cascade2.js +1 -1
- package/dist/C_Chat.css +96 -78
- package/dist/C_Chat2.cjs +1 -1
- package/dist/C_Chat2.js +1 -1
- package/dist/C_City.css +52 -28
- package/dist/C_City2.cjs +1 -1
- package/dist/C_City2.js +1 -1
- package/dist/C_Code.css +48 -42
- package/dist/C_Code2.cjs +1 -1
- package/dist/C_Code2.js +1 -1
- package/dist/C_CollapsePanel.css +14 -14
- package/dist/C_CollapsePanel2.cjs +1 -1
- package/dist/C_CollapsePanel2.js +1 -1
- package/dist/C_ContextMenu.css +14 -14
- package/dist/C_ContextMenu2.cjs +1 -1
- package/dist/C_ContextMenu2.js +1 -1
- package/dist/C_Cron.css +94 -55
- package/dist/C_Cron2.cjs +1 -1
- package/dist/C_Cron2.js +1 -1
- package/dist/C_Date2.cjs +1 -1
- package/dist/C_Date2.js +1 -1
- package/dist/C_Draggable.css +48 -48
- package/dist/C_Draggable2.cjs +1 -1
- package/dist/C_Draggable2.js +1 -1
- package/dist/C_Editor.css +13 -14
- package/dist/C_Editor2.cjs +1 -1
- package/dist/C_Editor2.js +1 -1
- package/dist/C_FilePreview.css +18 -18
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.base.css +36 -36
- package/dist/C_Form.css +49 -50
- package/dist/C_Form2.cjs +1 -1
- package/dist/C_Form2.js +1 -1
- package/dist/C_FormModal.css +8 -8
- package/dist/C_FormModal2.cjs +1 -1
- package/dist/C_FormModal2.js +1 -1
- package/dist/C_FormSearch.css +45 -45
- package/dist/C_FormSearch2.cjs +1 -1
- package/dist/C_FormSearch2.js +1 -1
- package/dist/C_FormulaEditor.css +94 -55
- package/dist/C_FormulaEditor2.cjs +2 -2
- package/dist/C_FormulaEditor2.js +2 -2
- package/dist/C_FullCalendar.css +8 -1
- package/dist/C_FullCalendar2.cjs +1 -1
- package/dist/C_FullCalendar2.js +1 -1
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Guide.css +14 -14
- package/dist/C_Guide2.cjs +1 -1
- package/dist/C_Guide2.js +1 -1
- package/dist/C_Icon.css +14 -14
- package/dist/C_Icon2.cjs +1 -1
- package/dist/C_Icon2.js +1 -1
- package/dist/C_ImageCropper.css +22 -22
- package/dist/C_ImageCropper2.cjs +1 -1
- package/dist/C_ImageCropper2.js +1 -1
- package/dist/C_Language.css +14 -14
- package/dist/C_Language2.cjs +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Login.css +134 -134
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +3 -3
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Markdown.css +35 -35
- package/dist/C_Markdown2.cjs +1 -1
- package/dist/C_Markdown2.js +1 -1
- package/dist/C_Menu2.cjs +1 -1
- package/dist/C_Menu2.js +1 -1
- package/dist/C_NotificationCenter.css +30 -30
- package/dist/C_NotificationCenter2.cjs +1 -1
- package/dist/C_NotificationCenter2.js +1 -1
- package/dist/C_OrgChart.css +4 -0
- package/dist/C_OrgChart2.cjs +1 -1
- package/dist/C_OrgChart2.js +1 -1
- package/dist/C_Progress2.cjs +1 -1
- package/dist/C_Progress2.js +1 -1
- package/dist/C_QRCode.css +8 -8
- package/dist/C_QRCode2.cjs +1 -1
- package/dist/C_QRCode2.js +1 -1
- package/dist/C_Signature.css +14 -14
- package/dist/C_Signature2.cjs +1 -1
- package/dist/C_Signature2.js +1 -1
- package/dist/C_Skeleton2.cjs +1 -1
- package/dist/C_Skeleton2.js +1 -1
- package/dist/C_SplitPane.css +39 -39
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.css +48 -38
- package/dist/C_Steps2.cjs +1 -1
- package/dist/C_Steps2.js +1 -1
- package/dist/C_Table.base.css +160 -160
- package/dist/C_Table.css +173 -174
- package/dist/C_TagsView.css +52 -52
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_Theme.css +14 -14
- package/dist/C_Theme2.cjs +1 -1
- package/dist/C_Theme2.js +1 -1
- package/dist/C_Time.css +4 -4
- package/dist/C_Time2.cjs +1 -1
- package/dist/C_Time2.js +1 -1
- package/dist/C_Timeline.css +76 -58
- package/dist/C_Timeline2.cjs +1 -1
- package/dist/C_Timeline2.js +1 -1
- package/dist/C_Transfer.css +51 -51
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree.css +35 -32
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +53 -50
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/C_VideoPlayer.css +17 -13
- package/dist/C_VideoPlayer2.cjs +2 -2
- package/dist/C_VideoPlayer2.js +2 -2
- package/dist/C_VtableGantt.css +19 -19
- package/dist/C_VtableGantt2.cjs +1 -1
- package/dist/C_VtableGantt2.js +1 -1
- package/dist/C_WaterFall.css +19 -15
- package/dist/C_WaterFall2.cjs +1 -1
- package/dist/C_WaterFall2.js +1 -1
- package/dist/C_WorkFlow.css +123 -123
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/constants.d.cts +4 -4
- package/dist/constants.d.ts +4 -4
- package/dist/constants2.d.cts +4 -4
- package/dist/constants2.d.ts +4 -4
- package/dist/constants3.d.cts +9 -5
- package/dist/constants3.d.ts +9 -5
- package/dist/constants4.d.cts +5 -5
- package/dist/constants4.d.ts +5 -5
- package/dist/constants5.d.cts +2 -2
- package/dist/constants5.d.ts +2 -2
- package/dist/data.d.cts +15 -15
- package/dist/data.d.ts +15 -15
- package/dist/data2.cjs +1 -1
- package/dist/data2.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +2 -0
- package/dist/index.vue.d.ts +2 -0
- package/dist/index10.vue.d.cts +1 -1
- package/dist/index10.vue.d.ts +3 -3
- package/dist/index11.vue.d.cts +3 -3
- package/dist/index11.vue.d.ts +3 -3
- package/dist/index12.vue.d.cts +3 -3
- package/dist/index13.vue.d.ts +2 -2
- package/dist/index14.vue.d.cts +2 -2
- package/dist/index14.vue.d.ts +14 -47
- package/dist/index15.vue.d.cts +14 -47
- package/dist/index15.vue.d.ts +2 -2
- package/dist/index16.vue.d.cts +2 -2
- package/dist/index17.vue.d.ts +5 -5
- package/dist/index18.vue.d.cts +5 -5
- package/dist/index18.vue.d.ts +2 -2
- package/dist/index19.vue.d.cts +1 -1
- package/dist/index19.vue.d.ts +1 -1
- package/dist/index2.vue.d.cts +2 -2
- package/dist/index2.vue.d.ts +2 -2
- package/dist/index20.vue.d.cts +2 -2
- package/dist/index20.vue.d.ts +2 -2
- package/dist/index21.vue.d.cts +2 -2
- package/dist/index21.vue.d.ts +2 -2
- package/dist/index22.vue.d.cts +2 -2
- package/dist/index22.vue.d.ts +2 -2
- package/dist/index24.vue.d.cts +3 -3
- package/dist/index24.vue.d.ts +3 -3
- package/dist/index25.vue.d.cts +1 -1
- package/dist/index25.vue.d.ts +1 -1
- package/dist/index26.vue.d.cts +4 -4
- package/dist/index26.vue.d.ts +4 -4
- package/dist/index27.vue.d.cts +3 -3
- package/dist/index27.vue.d.ts +3 -3
- package/dist/index3.vue.d.cts +4 -4
- package/dist/index3.vue.d.ts +4 -4
- package/dist/index4.vue.d.cts +2 -2
- package/dist/index5.vue.d.ts +2 -2
- package/dist/index6.vue.d.cts +2 -2
- package/dist/index7.vue.d.ts +2 -2
- package/dist/index8.vue.d.cts +2 -2
- package/dist/index9.vue.d.ts +1 -1
- package/dist/mapUtils.d.cts +3 -3
- package/dist/mapUtils.d.ts +3 -3
- package/dist/presets.d.cts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/style.css +1573 -1365
- package/dist/useCalendarEvents.d.cts +23 -18
- package/dist/useCalendarEvents.d.ts +23 -18
- package/dist/useCollapsePanel.d.cts +7 -6
- package/dist/useCollapsePanel.d.ts +7 -6
- package/dist/useCropperCore.d.cts +34 -19
- package/dist/useCropperCore.d.ts +34 -19
- package/dist/useDraggableLayout.d.cts +4 -4
- package/dist/useDraggableLayout.d.ts +4 -4
- package/dist/useDynamicFormState.d.cts +7 -2
- package/dist/useDynamicFormState.d.ts +7 -2
- package/dist/useEdgeInteraction.d.cts +19 -19
- package/dist/useEdgeInteraction.d.ts +19 -19
- package/dist/useFullscreen.d.cts +6 -6
- package/dist/useFullscreen.d.ts +6 -6
- package/dist/useInfiniteScroll.d.cts +4 -4
- package/dist/useInfiniteScroll.d.ts +4 -4
- package/dist/useQRCode.d.cts +5 -4
- package/dist/useQRCode.d.ts +5 -4
- package/dist/useSearchState.d.cts +9 -9
- package/dist/useSearchState.d.ts +9 -9
- package/dist/useSignatureHistory.d.cts +18 -10
- package/dist/useSignatureHistory.d.ts +18 -10
- package/dist/useSplitResize.d.cts +3 -3
- package/dist/useSplitResize.d.ts +3 -3
- package/dist/useTableQuery.cjs +3 -3
- package/dist/useTableQuery.d.cts +3 -6
- package/dist/useTableQuery.d.ts +3 -6
- package/dist/useTableQuery.js +3 -3
- package/dist/useTimeSelection.d.cts +8 -5
- package/dist/useTimeSelection.d.ts +8 -5
- package/dist/useTreeOperations.d.cts +8 -8
- package/dist/useTreeOperations.d.ts +8 -8
- package/dist/useWorkflowValidation.d.cts +10 -8
- package/dist/useWorkflowValidation.d.ts +10 -8
- package/dist/verification.d.cts +3 -3
- package/dist/verification.d.ts +3 -3
- package/package.json +4 -3
|
@@ -337,37 +337,37 @@
|
|
|
337
337
|
font-size: 13px;
|
|
338
338
|
color: var(--c-text-4);
|
|
339
339
|
}
|
|
340
|
-
/* unplugin-vue-components disabled */.notification-detail[data-v-
|
|
340
|
+
/* unplugin-vue-components disabled */.notification-detail[data-v-dd3085a7] {
|
|
341
341
|
display: flex;
|
|
342
342
|
flex-direction: column;
|
|
343
343
|
height: 100%;
|
|
344
344
|
}
|
|
345
|
-
.notification-detail__back[data-v-
|
|
345
|
+
.notification-detail__back[data-v-dd3085a7] {
|
|
346
346
|
padding: 8px 16px;
|
|
347
347
|
border-bottom: 1px solid var(--c-border);
|
|
348
348
|
}
|
|
349
|
-
.notification-detail__header[data-v-
|
|
349
|
+
.notification-detail__header[data-v-dd3085a7] {
|
|
350
350
|
padding: 16px;
|
|
351
351
|
border-bottom: 1px solid var(--c-border);
|
|
352
352
|
}
|
|
353
|
-
.notification-detail__title[data-v-
|
|
353
|
+
.notification-detail__title[data-v-dd3085a7] {
|
|
354
354
|
font-size: 15px;
|
|
355
355
|
font-weight: 600;
|
|
356
356
|
color: var(--c-text-1);
|
|
357
357
|
line-height: 1.5;
|
|
358
358
|
margin: 0 0 8px;
|
|
359
359
|
}
|
|
360
|
-
.notification-detail__meta[data-v-
|
|
360
|
+
.notification-detail__meta[data-v-dd3085a7] {
|
|
361
361
|
display: flex;
|
|
362
362
|
align-items: center;
|
|
363
363
|
gap: 8px;
|
|
364
364
|
flex-wrap: wrap;
|
|
365
365
|
}
|
|
366
|
-
.notification-detail__time[data-v-
|
|
366
|
+
.notification-detail__time[data-v-dd3085a7] {
|
|
367
367
|
font-size: 11px;
|
|
368
368
|
color: var(--c-text-4);
|
|
369
369
|
}
|
|
370
|
-
.notification-detail__sender[data-v-
|
|
370
|
+
.notification-detail__sender[data-v-dd3085a7] {
|
|
371
371
|
display: flex;
|
|
372
372
|
align-items: center;
|
|
373
373
|
gap: 6px;
|
|
@@ -375,82 +375,82 @@
|
|
|
375
375
|
font-size: 12px;
|
|
376
376
|
color: var(--c-text-2);
|
|
377
377
|
}
|
|
378
|
-
.notification-detail__content[data-v-
|
|
378
|
+
.notification-detail__content[data-v-dd3085a7] {
|
|
379
379
|
flex: 1;
|
|
380
380
|
min-height: 0;
|
|
381
381
|
}
|
|
382
|
-
.notification-detail__body[data-v-
|
|
382
|
+
.notification-detail__body[data-v-dd3085a7] {
|
|
383
383
|
padding: 16px;
|
|
384
384
|
font-size: 13px;
|
|
385
385
|
line-height: 1.7;
|
|
386
386
|
color: var(--c-text-1);
|
|
387
387
|
word-break: break-word;
|
|
388
388
|
}
|
|
389
|
-
.notification-detail__body[data-v-
|
|
389
|
+
.notification-detail__body[data-v-dd3085a7] p {
|
|
390
390
|
margin: 0 0 8px;
|
|
391
391
|
}
|
|
392
|
-
.notification-detail__body[data-v-
|
|
393
|
-
.notification-detail__body[data-v-
|
|
392
|
+
.notification-detail__body[data-v-dd3085a7] ul,
|
|
393
|
+
.notification-detail__body[data-v-dd3085a7] ol {
|
|
394
394
|
padding-left: 20px;
|
|
395
395
|
margin: 8px 0;
|
|
396
396
|
}
|
|
397
|
-
.notification-detail__body[data-v-
|
|
397
|
+
.notification-detail__body[data-v-dd3085a7] li {
|
|
398
398
|
margin: 4px 0;
|
|
399
399
|
}
|
|
400
|
-
.notification-detail__body[data-v-
|
|
400
|
+
.notification-detail__body[data-v-dd3085a7] strong {
|
|
401
401
|
font-weight: 600;
|
|
402
402
|
color: var(--c-primary);
|
|
403
403
|
}
|
|
404
|
-
.notification-detail__footer[data-v-
|
|
404
|
+
.notification-detail__footer[data-v-dd3085a7] {
|
|
405
405
|
padding: 12px 16px;
|
|
406
406
|
border-top: 1px solid var(--c-border);
|
|
407
407
|
display: flex;
|
|
408
408
|
justify-content: flex-end;
|
|
409
409
|
}
|
|
410
|
-
/* unplugin-vue-components disabled */.c-notification-center[data-v-
|
|
410
|
+
/* unplugin-vue-components disabled */.c-notification-center[data-v-67b5bf1b] {
|
|
411
411
|
display: inline-flex;
|
|
412
412
|
align-items: center;
|
|
413
413
|
}
|
|
414
|
-
.c-notification-center__panel[data-v-
|
|
414
|
+
.c-notification-center__panel[data-v-67b5bf1b] {
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
max-height: 560px;
|
|
418
418
|
}
|
|
419
|
-
.c-notification-center__header[data-v-
|
|
419
|
+
.c-notification-center__header[data-v-67b5bf1b] {
|
|
420
420
|
display: flex;
|
|
421
421
|
align-items: center;
|
|
422
422
|
justify-content: space-between;
|
|
423
423
|
padding: 14px 16px 10px;
|
|
424
424
|
border-bottom: 1px solid var(--c-border);
|
|
425
425
|
}
|
|
426
|
-
.c-notification-center__title[data-v-
|
|
426
|
+
.c-notification-center__title[data-v-67b5bf1b] {
|
|
427
427
|
font-size: 15px;
|
|
428
428
|
font-weight: 600;
|
|
429
429
|
color: var(--c-text-1);
|
|
430
430
|
}
|
|
431
|
-
.c-notification-center__header-extra[data-v-
|
|
431
|
+
.c-notification-center__header-extra[data-v-67b5bf1b] {
|
|
432
432
|
display: flex;
|
|
433
433
|
align-items: center;
|
|
434
434
|
gap: 8px;
|
|
435
435
|
}
|
|
436
|
-
.c-notification-center__ws-dot[data-v-
|
|
436
|
+
.c-notification-center__ws-dot[data-v-67b5bf1b] {
|
|
437
437
|
width: 8px;
|
|
438
438
|
height: 8px;
|
|
439
439
|
border-radius: 50%;
|
|
440
440
|
transition: background-color var(--c-transition, 0.2s ease);
|
|
441
441
|
}
|
|
442
|
-
.c-notification-center__ws-dot--connected[data-v-
|
|
442
|
+
.c-notification-center__ws-dot--connected[data-v-67b5bf1b] {
|
|
443
443
|
background: #52c41a;
|
|
444
444
|
box-shadow: 0 0 4px rgba(82, 196, 26, 0.5);
|
|
445
445
|
}
|
|
446
|
-
.c-notification-center__ws-dot--connecting[data-v-
|
|
446
|
+
.c-notification-center__ws-dot--connecting[data-v-67b5bf1b], .c-notification-center__ws-dot--reconnecting[data-v-67b5bf1b] {
|
|
447
447
|
background: #faad14;
|
|
448
|
-
animation: status-blink-
|
|
448
|
+
animation: status-blink-67b5bf1b 1s ease-in-out infinite;
|
|
449
449
|
}
|
|
450
|
-
.c-notification-center__ws-dot--disconnected[data-v-
|
|
450
|
+
.c-notification-center__ws-dot--disconnected[data-v-67b5bf1b] {
|
|
451
451
|
background: var(--c-text-4);
|
|
452
452
|
}
|
|
453
|
-
@keyframes status-blink-
|
|
453
|
+
@keyframes status-blink-67b5bf1b {
|
|
454
454
|
0%, 100% {
|
|
455
455
|
opacity: 1;
|
|
456
456
|
}
|
|
@@ -459,17 +459,17 @@
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
/* ─── 切换过渡 ───────────────────────────────── */
|
|
462
|
-
.slide-fade-enter-active[data-v-
|
|
462
|
+
.slide-fade-enter-active[data-v-67b5bf1b] {
|
|
463
463
|
transition: all 0.25s ease-out;
|
|
464
464
|
}
|
|
465
|
-
.slide-fade-leave-active[data-v-
|
|
465
|
+
.slide-fade-leave-active[data-v-67b5bf1b] {
|
|
466
466
|
transition: all 0.2s ease-in;
|
|
467
467
|
}
|
|
468
|
-
.slide-fade-enter-from[data-v-
|
|
468
|
+
.slide-fade-enter-from[data-v-67b5bf1b] {
|
|
469
469
|
opacity: 0;
|
|
470
470
|
transform: translateY(8px);
|
|
471
471
|
}
|
|
472
|
-
.slide-fade-leave-to[data-v-
|
|
472
|
+
.slide-fade-leave-to[data-v-67b5bf1b] {
|
|
473
473
|
opacity: 0;
|
|
474
474
|
transform: translateY(-8px);
|
|
475
475
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`),n=require(`./html.cjs`),r=require(`./storage.cjs`);let i=require(`vue`),a=require(`naive-ui`);const o=6e4,s=`notification_center`,c=3e3,l=3e4,u=`ping`,d={system:{label:`系统通知`,icon:`mdi:cog-outline`,color:`info`},business:{label:`业务消息`,icon:`mdi:briefcase-outline`,color:`success`},alarm:{label:`告警预警`,icon:`mdi:alert-outline`,color:`warning`}},f=[{key:`all`,label:`全部`},{key:`system`,label:`系统通知`},{key:`business`,label:`业务消息`},{key:`alarm`,label:`告警预警`}],p={low:{label:`低`,type:`default`},normal:{label:`普通`,type:`info`},high:{label:`重要`,type:`warning`},urgent:{label:`紧急`,type:`error`}},m=[{id:`msg-001`,title:`系统维护通知`,summary:`系统将于今晚 22:00-23:00 进行例行维护升级,届时部分功能可能暂时不可用。`,content:`<p>尊敬的用户:</p><p>为了提升系统性能和稳定性,我们计划于 <strong>2026年2月27日 22:00-23:00</strong> 对系统进行例行维护升级。</p><p>维护期间,以下功能可能暂时不可用:</p><ul><li>报表导出</li><li>数据同步</li><li>定时任务</li></ul><p>请提前保存好未完成的工作,感谢您的理解与支持!</p>`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-15*6e4).toISOString(),sender:{name:`系统管理员`,avatar:``}},{id:`msg-002`,title:`审批流程待处理`,summary:`张三提交的《Q1 季度预算申请》需要您审批,请尽快处理。`,category:`business`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-30*6e4).toISOString(),sender:{name:`张三`,avatar:``},actionUrl:`/workflow/approval`,actionText:`去审批`},{id:`msg-003`,title:`服务器 CPU 使用率告警`,summary:`生产环境节点 prod-node-03 CPU 使用率持续超过 90%,已触发告警阈值。`,category:`alarm`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-2*6e4).toISOString(),sender:{name:`监控中心`},actionUrl:`/monitor/server`,actionText:`查看详情`},{id:`msg-004`,title:`新版本发布 v1.14.0`,summary:`系统已升级至 v1.14.0,新增通知中心、工作流增强等多项功能。`,category:`system`,priority:`normal`,status:`unread`,timestamp:new Date(Date.now()-3*36e5).toISOString(),sender:{name:`系统管理员`}},{id:`msg-005`,title:`项目交付提醒`,summary:`「Robot Admin 二期」项目交付截止日期为 3月15日,当前进度 78%。`,category:`business`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-8*36e5).toISOString(),sender:{name:`项目管理系统`}},{id:`msg-006`,title:`数据库连接池告警`,summary:`数据库连接池使用率达到 85%,建议关注并适时扩容。`,category:`alarm`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-12*36e5).toISOString(),sender:{name:`监控中心`}},{id:`msg-007`,title:`周报提交提醒`,summary:`本周周报提交截止时间为周五 18:00,请及时提交。`,category:`business`,priority:`normal`,status:`read`,timestamp:new Date(Date.now()-24*36e5).toISOString(),sender:{name:`OA 系统`}},{id:`msg-008`,title:`账号安全提醒`,summary:`检测到您的账号在新设备上登录,如非本人操作请及时修改密码。`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-45*6e4).toISOString(),sender:{name:`安全中心`}}];function h(e,t){let n=(0,i.ref)(`disconnected`),r=null,a=0,o=null,s=null,d=null,f=0;function p(e){n.value=e,t?.(e)}function m(e){d=e,a=0,h(e)}function h(e){let t=++f;x();let n=g(e);p(`connecting`);try{r=new WebSocket(n)}catch{p(`disconnected`),v(e);return}let i=r;i.addEventListener(`open`,()=>{t!==f||i!==r||(p(`connected`),a=0,y(e))}),i.addEventListener(`message`,e=>{t!==f||i!==r||_(e.data)}),i.addEventListener(`close`,()=>{t!==f||i!==r||(r=null,b(),p(`disconnected`),e.autoReconnect!==!1&&v(e))}),i.addEventListener(`error`,()=>{})}function g(e){let t=e.getToken?.();if(t){let n=e.url.includes(`?`)?`&`:`?`;return`${e.url}${n}token=${encodeURIComponent(t)}`}return e.url}function _(t){if(typeof t==`string`&&t!==`pong`)try{let n=JSON.parse(t);n&&typeof n==`object`&&[`new_message`,`read_sync`,`count_update`].includes(String(n.type))&&`data`in n&&e(n)}catch{}}function v(e){if(d!==e||o)return;let t=Math.max(0,Math.trunc(e.maxReconnectAttempts??5));if(a>=t)return;a++,p(`reconnecting`);let n=Math.max(0,e.reconnectInterval??c),r=Math.min(6e4,n*2**(a-1)),i=f;o=setTimeout(()=>{o=null,!(i!==f||d!==e)&&h(e)},r)}function y(e){b();let t=e.heartbeatInterval??l;if(t<=0)return;let n=e.heartbeatMessage??u;s=setInterval(()=>{if(r?.readyState===WebSocket.OPEN)try{r.send(n)}catch{r.close()}},t)}function b(){s&&=(clearInterval(s),null)}function x(){b(),o&&=(clearTimeout(o),null),r&&=(r.close(),null)}function S(){d=null,f++,a=0,x(),p(`disconnected`)}function C(){d&&(a=0,h(d))}return(0,i.onBeforeUnmount)(()=>{d=null,f++,x()}),{status:(0,i.readonly)(n),connect:m,disconnect:S,reconnect:C}}function g(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.title==`string`&&typeof t.summary==`string`&&typeof t.timestamp==`string`&&[`system`,`business`,`alarm`].includes(String(t.category))&&[`low`,`normal`,`high`,`urgent`].includes(String(t.priority))&&[`read`,`unread`,`archived`].includes(String(t.status))}function _(e){let t=(0,i.ref)([]),n=(0,i.ref)(`all`),a=(0,i.ref)(!1),c=(0,i.ref)(0),l=(0,i.ref)(1),u=(0,i.ref)(null),d=(0,i.ref)(!1),f=(0,i.ref)(`disconnected`),p=0,_=(0,i.computed)(()=>t.value.filter(e=>e.status===`unread`).length),v=(0,i.computed)(()=>{let e={system:0,business:0,alarm:0};for(let n of t.value)n.status===`unread`&&n.category in e&&e[n.category]++;return e}),y=(0,i.computed)(()=>n.value===`all`?t.value:t.value.filter(e=>e.category===n.value)),b=(0,i.computed)(()=>t.value.length<c.value),x=(0,i.computed)(()=>e.storageKey??s);function S(){let e=r.t(x.value);if(Array.isArray(e?.unreadIds)){let n=new Set(e.unreadIds.filter(e=>typeof e==`string`));for(let e of t.value)n.has(e.id)&&(e.status=`unread`)}}let C=null;function w(){C&&clearTimeout(C),C=setTimeout(()=>{let e=t.value.filter(e=>e.status===`unread`).map(e=>e.id);r.i(x.value,{unreadIds:e,lastFetchTime:Date.now()}),C=null},300)}async function T(r=!1){let i=++p;r&&(l.value=1),a.value=!0;try{if(e.fetchNotifications){let a=n.value===`all`?void 0:n.value,o=e.pageSize??20,s=await e.fetchNotifications({category:a,page:l.value,pageSize:o});if(i!==p)return;let u=Array.isArray(s.list)?s.list:[];if(r)t.value=u;else{let e=new Set(t.value.map(e=>e.id));t.value.push(...u.filter(t=>!e.has(t.id)))}c.value=Math.max(t.value.length,Number(s.total)||0)}else E();i===p&&S()}catch(t){throw i===p&&e.onError?.(t,`fetch`),t}finally{i===p&&(a.value=!1)}}function E(){t.value=m.map(e=>({...e})),c.value=m.length}async function D(){if(!b.value||a.value)return;let e=l.value;l.value++;try{await T()}catch(t){throw l.value=e,t}}async function O(n){let r=new Set(n),i=new Map(t.value.filter(e=>r.has(e.id)).map(e=>[e.id,e.status]));for(let e of t.value)r.has(e.id)&&(e.status=`read`);if(w(),e.markAsRead)try{await e.markAsRead(n)}catch(n){for(let e of t.value){let t=i.get(e.id);t&&(e.status=t)}throw w(),e.onError?.(n,`mark-as-read`),n}}async function k(n){let r=n?t.value.filter(e=>e.category===n&&e.status===`unread`):t.value.filter(e=>e.status===`unread`);for(let e of r)e.status=`read`;if(w(),e.markAllRead)try{await e.markAllRead(n)}catch(t){for(let e of r)e.status=`unread`;throw w(),e.onError?.(t,`mark-all-as-read`),t}}async function A(n){let r=new Set(n),i=[...t.value],a=c.value;if(t.value=t.value.filter(e=>!r.has(e.id)),c.value=Math.max(0,c.value-(i.length-t.value.length)),w(),e.deleteNotification)try{await e.deleteNotification(n)}catch(n){throw t.value=i,c.value=a,w(),e.onError?.(n,`delete`),n}}async function j(n){let r=[...t.value],i=c.value;if(n?t.value=t.value.filter(e=>e.category!==n):t.value=[],c.value=t.value.length,w(),e.clearNotifications)try{await e.clearNotifications(n)}catch(n){throw t.value=r,c.value=i,w(),e.onError?.(n,`clear`),n}}function M(e){switch(e.type){case`new_message`:{let n=e.data;if(!g(n))return;t.value.some(e=>e.id===n.id)||(t.value.unshift(n),c.value++,w(),I(n));break}case`read_sync`:{if(!Array.isArray(e.data))return;let n=e.data.filter(g),r=new Set(n.map(e=>e.id));for(let e of t.value)r.has(e.id)&&(e.status=`read`);w();break}case`count_update`:break}}function N(e){f.value=e}let{connect:P,disconnect:F}=h(M,N);function I(t){e.desktopNotification&&(typeof window>`u`||!(`Notification`in window)||Notification.permission===`granted`&&R(t))}async function L(){return typeof window>`u`||!(`Notification`in window)?`unsupported`:Notification.requestPermission()}function R(e){let t=new Notification(e.title,{body:e.summary,icon:e.sender?.avatar||`/robot-avatar.png`,tag:e.id});t.addEventListener(`click`,()=>{window.focus(),H(e),t.close()}),setTimeout(()=>t.close(),5e3)}let z=null;function B(){V();let t=e.pollingInterval??o;t<=0||(z=setInterval(()=>{a.value||T(!0).catch(()=>void 0)},t))}function V(){z&&=(clearInterval(z),null)}function H(e){u.value=e,e.status===`unread`&&O([e.id]).catch(()=>void 0)}function U(){u.value=null}function W(t){n.value=t,u.value=null,e.fetchNotifications&&T(!0).catch(()=>void 0)}function G(){T(!0).catch(()=>void 0),B(),e.wsConfig&&P(e.wsConfig)}function K(){p++,V(),F(),C&&=(clearTimeout(C),null)}return(0,i.onMounted)(G),(0,i.onBeforeUnmount)(K),{messages:t,activeCategory:n,loading:a,total:c,page:l,selectedMessage:u,popoverVisible:d,wsStatus:f,unreadCount:_,unreadByCategory:v,filteredMessages:y,hasMore:b,fetchMessages:T,loadMore:D,markAsRead:O,markAllAsRead:k,deleteMessages:A,clearMessages:j,selectMessage:H,clearSelection:U,switchCategory:W,requestDesktopPermission:L,connectWS:P,disconnectWS:F}}const v={class:`notification-badge`},y=[`aria-label`],b={key:0,class:`notification-badge__count`},x={key:0,class:`notification-badge__pulse`},S=(0,i.defineComponent)({__name:`NotificationBadge`,props:{count:{default:0},maxCount:{default:99},hasUrgent:{type:Boolean,default:!1}},emits:[`click`],setup(t){let n=t,r=(0,i.computed)(()=>n.count>n.maxCount?`${n.maxCount}+`:String(n.count));return(n,o)=>{let s=a.NTooltip;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,v,[(0,i.createVNode)(s,{trigger:`hover`,placement:`bottom`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`button`,{type:`button`,class:`notification-badge__trigger`,"aria-label":`消息通知${t.count>0?`(${t.count} 条未读)`:``}`,onClick:o[0]||=e=>n.$emit(`click`)},[(0,i.createVNode)(e.t,{name:`mdi:bell-outline`,size:18,class:`notification-badge__icon`}),(0,i.createCommentVNode)(` 未读角标 `),(0,i.createVNode)(i.Transition,{name:`badge-bounce`},{default:(0,i.withCtx)(()=>[t.count>0?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,b,(0,i.toDisplayString)(r.value),1)):(0,i.createCommentVNode)(`v-if`,!0)]),_:1}),(0,i.createCommentVNode)(` 脉冲动画(有紧急消息时) `),t.hasUrgent?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,x)):(0,i.createCommentVNode)(`v-if`,!0)],8,y)]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` 消息通知`+(0,i.toDisplayString)(t.count>0?`(${t.count} 条未读)`:``),1)]),_:1})])}}});var C=t.t(S,[[`__scopeId`,`data-v-082ef9da`]]);const w=6e4,T=36e5,E=864e5,D=7*E,O=30*E;365*E;let k=null;function A(){return k||=j(),k}function j(){function e(e){let r=new Date(e),i=Date.now()-r.getTime();if(i<0||i<w)return`刚刚`;if(i<T)return`${Math.floor(i/w)}分钟前`;if(i<E)return`${Math.floor(i/T)}小时前`;let a=new Date;return a.setHours(0,0,0,0),r>=new Date(a.getTime()-E)&&r<a?`昨天 ${n(r.getHours())}:${n(r.getMinutes())}`:i<D?`${Math.floor(i/E)}天前`:i<O?`${Math.floor(i/D)}周前`:i<31536e6?`${Math.floor(i/O)}个月前`:t(r)}function t(e){return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}function n(e){return e<10?`0${e}`:String(e)}return{formatRelativeTime:e,formatFullDate:t}}const M={class:`notification-item__indicator`},N={class:`notification-item__avatar`},P={class:`notification-item__body`},F={class:`notification-item__header`},I={class:`notification-item__title`},L={class:`notification-item__summary`},R={class:`notification-item__meta`},z={class:`notification-item__time`},B={key:0,class:`notification-item__sender`},V=(0,i.defineComponent)({__name:`NotificationItem`,props:{message:{}},emits:[`click`,`read`,`delete`],setup(t){let n=t,{formatRelativeTime:r}=A(),o=(0,i.computed)(()=>d[n.message.category]?.icon??`mdi:bell-outline`),s=(0,i.computed)(()=>p[n.message.priority]??p.normal),c=(0,i.computed)(()=>r(n.message.timestamp));return(n,r)=>{let l=a.NAvatar,u=a.NTag,d=a.NTooltip;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,{class:(0,i.normalizeClass)([`notification-item`,{"notification-item--unread":t.message.status===`unread`,"notification-item--urgent":t.message.priority===`urgent`}]),onClick:r[3]||=e=>n.$emit(`click`,t.message)},[(0,i.createCommentVNode)(` 未读指示点 `),(0,i.createElementVNode)(`div`,M,[t.message.status===`unread`?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,{key:0,class:(0,i.normalizeClass)([`notification-item__dot`,`notification-item__dot--${t.message.priority}`])},null,2)):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createCommentVNode)(` 头像 `),(0,i.createElementVNode)(`div`,N,[t.message.sender?.avatar?((0,i.openBlock)(),(0,i.createBlock)(l,{key:0,src:t.message.sender.avatar,size:36,round:``},null,8,[`src`])):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:(0,i.normalizeClass)([`notification-item__avatar-placeholder`,`notification-item__avatar-placeholder--${t.message.category}`])},[(0,i.createVNode)(e.t,{name:o.value,size:16},null,8,[`name`])],2))]),(0,i.createCommentVNode)(` 内容 `),(0,i.createElementVNode)(`div`,P,[(0,i.createElementVNode)(`div`,F,[(0,i.createElementVNode)(`span`,I,(0,i.toDisplayString)(t.message.title),1),t.message.priority===`urgent`||t.message.priority===`high`?((0,i.openBlock)(),(0,i.createBlock)(u,{key:0,type:s.value.type,size:`tiny`,bordered:!1,round:``},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(s.value.label),1)]),_:1},8,[`type`])):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createElementVNode)(`div`,L,(0,i.toDisplayString)(t.message.summary),1),(0,i.createElementVNode)(`div`,R,[(0,i.createElementVNode)(`span`,z,(0,i.toDisplayString)(c.value),1),t.message.sender?.name?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,B,(0,i.toDisplayString)(t.message.sender.name),1)):(0,i.createCommentVNode)(`v-if`,!0)])]),(0,i.createCommentVNode)(` 操作区 `),(0,i.createElementVNode)(`div`,{class:`notification-item__actions`,onClick:r[2]||=(0,i.withModifiers)(()=>{},[`stop`])},[t.message.status===`unread`?((0,i.openBlock)(),(0,i.createBlock)(d,{key:0,trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:`notification-item__action`,onClick:r[0]||=e=>n.$emit(`read`,t.message.id)},[(0,i.createVNode)(e.t,{name:`mdi:check`,size:16})])]),default:(0,i.withCtx)(()=>[r[4]||=(0,i.createTextVNode)(` 标记已读 `,-1)]),_:1})):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createVNode)(d,{trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:`notification-item__action`,onClick:r[1]||=e=>n.$emit(`delete`,t.message.id)},[(0,i.createVNode)(e.t,{name:`mdi:delete-outline`,size:16})])]),default:(0,i.withCtx)(()=>[r[5]||=(0,i.createTextVNode)(` 删除 `,-1)]),_:1})])],2)}}});var H=t.t(V,[[`__scopeId`,`data-v-0104dbfc`]]);const U={class:`notification-list`},W={class:`notification-list__tabs`},G=[`onClick`],K={key:0,class:`notification-list__tab-count`},ee={key:0,class:`notification-list__toolbar`},q={class:`notification-list__skeleton-text`},J={class:`notification-list__items`},Y={class:`notification-list__empty`},X=(0,i.defineComponent)({__name:`NotificationList`,props:{messages:{},activeCategory:{},unreadByCategory:{},unreadCount:{},loading:{type:Boolean},hasMore:{type:Boolean},scrollHeight:{default:420}},emits:[`switchCategory`,`itemClick`,`read`,`delete`,`markAllRead`,`clear`,`loadMore`],setup(t){let n=t,r=(0,i.computed)(()=>n.activeCategory===`all`?n.unreadCount:n.unreadByCategory[n.activeCategory]??0);function o(e){return e===`all`?n.unreadCount:n.unreadByCategory[e]??0}return(n,s)=>{let c=a.NButton,l=a.NSkeleton,u=a.NSpin,d=a.NScrollbar;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,U,[(0,i.createCommentVNode)(` 分类 Tab `),(0,i.createElementVNode)(`div`,W,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)((0,i.unref)(f),e=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:e.key,class:(0,i.normalizeClass)([`notification-list__tab`,{"notification-list__tab--active":t.activeCategory===e.key}]),onClick:t=>n.$emit(`switchCategory`,e.key)},[(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(e.label),1),o(e.key)>0?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,K,(0,i.toDisplayString)(o(e.key)),1)):(0,i.createCommentVNode)(`v-if`,!0)],10,G))),128))]),(0,i.createCommentVNode)(` 操作栏 `),t.messages.length>0?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,ee,[(0,i.createVNode)(c,{text:``,size:`tiny`,disabled:r.value===0,onClick:s[0]||=e=>n.$emit(`markAllRead`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:check-all`,size:14})]),default:(0,i.withCtx)(()=>[s[6]||=(0,i.createTextVNode)(` 全部已读 `,-1)]),_:1},8,[`disabled`]),(0,i.createVNode)(c,{text:``,size:`tiny`,onClick:s[1]||=e=>n.$emit(`clear`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:delete-sweep-outline`,size:14})]),default:(0,i.withCtx)(()=>[s[7]||=(0,i.createTextVNode)(` 清空 `,-1)]),_:1})])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 消息列表 `),(0,i.createVNode)(d,{class:`notification-list__scroll`,style:(0,i.normalizeStyle)({maxHeight:`${t.scrollHeight}px`})},{default:(0,i.withCtx)(()=>[t.loading&&t.messages.length===0?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[(0,i.createCommentVNode)(` 骨架屏 `),((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(4,e=>(0,i.createElementVNode)(`div`,{key:e,class:`notification-list__skeleton`},[(0,i.createVNode)(l,{circle:``,width:36,height:36}),(0,i.createElementVNode)(`div`,q,[(0,i.createVNode)(l,{text:``,width:`60%`,height:14}),(0,i.createVNode)(l,{text:``,width:`90%`,height:12}),(0,i.createVNode)(l,{text:``,width:`40%`,height:10})])])),64))],64)):t.messages.length>0?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[(0,i.createElementVNode)(`div`,J,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(t.messages,e=>((0,i.openBlock)(),(0,i.createBlock)(H,{key:e.id,message:e,onClick:s[2]||=e=>n.$emit(`itemClick`,e),onRead:s[3]||=e=>n.$emit(`read`,e),onDelete:s[4]||=e=>n.$emit(`delete`,e)},null,8,[`message`]))),128))]),(0,i.createCommentVNode)(` 加载更多 `),t.hasMore?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,class:`notification-list__load-more`,onClick:s[5]||=e=>n.$emit(`loadMore`)},[t.loading?((0,i.openBlock)(),(0,i.createBlock)(u,{key:0,size:14})):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(t.loading?`加载中...`:`加载更多`),1)])):(0,i.createCommentVNode)(`v-if`,!0)],64)):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:2},[(0,i.createCommentVNode)(` 空状态 `),(0,i.createElementVNode)(`div`,Y,[(0,i.createVNode)(e.t,{name:`mdi:bell-off-outline`,size:48,class:`notification-list__empty-icon`}),s[8]||=(0,i.createElementVNode)(`span`,{class:`notification-list__empty-text`},`暂无消息`,-1)])],2112))]),_:1},8,[`style`])])}}});var Z=t.t(X,[[`__scopeId`,`data-v-47e5497f`]]);const Q={class:`notification-detail`},te={class:`notification-detail__back`},ne={class:`notification-detail__header`},re={class:`notification-detail__title`},ie={class:`notification-detail__meta`},ae={class:`notification-detail__time`},oe={key:0,class:`notification-detail__sender`},se=[`innerHTML`],ce={key:1,class:`notification-detail__body`},le={key:0,class:`notification-detail__footer`},ue=(0,i.defineComponent)({__name:`NotificationDetail`,props:{message:{},scrollHeight:{default:320}},emits:[`back`,`action`,`navigate`],setup(t,{emit:r}){let o=t,s=r,{formatRelativeTime:c}=A(),l=(0,i.computed)(()=>d[o.message.category]??d.system),u=(0,i.computed)(()=>p[o.message.priority]??p.normal),f=(0,i.computed)(()=>c(o.message.timestamp)),m=(0,i.computed)(()=>n.t(o.message.content||``));function h(){let e=o.message.actionUrl;if(e){if(s(`action`,e),/^https?:\/\//i.test(e)){let t=new URL(e);(t.protocol===`http:`||t.protocol===`https:`)&&window.open(t.href,`_blank`,`noopener,noreferrer`);return}/^[a-z][a-z\d+.-]*:/i.test(e)||s(`navigate`,e)}}return(n,r)=>{let o=a.NButton,s=a.NTag,c=a.NAvatar,d=a.NScrollbar;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,Q,[(0,i.createCommentVNode)(` 返回栏 `),(0,i.createElementVNode)(`div`,te,[(0,i.createVNode)(o,{text:``,size:`small`,onClick:r[0]||=e=>n.$emit(`back`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:arrow-left`,size:16})]),default:(0,i.withCtx)(()=>[r[1]||=(0,i.createTextVNode)(` 返回列表 `,-1)]),_:1})]),(0,i.createCommentVNode)(` 消息头部 `),(0,i.createElementVNode)(`div`,ne,[(0,i.createElementVNode)(`h3`,re,(0,i.toDisplayString)(t.message.title),1),(0,i.createElementVNode)(`div`,ie,[(0,i.createVNode)(s,{type:l.value.color,size:`tiny`,bordered:!1,round:``},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:l.value.icon,size:12},null,8,[`name`])]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` `+(0,i.toDisplayString)(l.value.label),1)]),_:1},8,[`type`]),t.message.priority===`urgent`||t.message.priority===`high`?((0,i.openBlock)(),(0,i.createBlock)(s,{key:0,type:u.value.type,size:`tiny`,bordered:!1,round:``},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(u.value.label),1)]),_:1},8,[`type`])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,ae,(0,i.toDisplayString)(f.value),1)]),t.message.sender?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,oe,[t.message.sender.avatar?((0,i.openBlock)(),(0,i.createBlock)(c,{key:0,src:t.message.sender.avatar,size:20,round:``},null,8,[`src`])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(t.message.sender.name),1)])):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createCommentVNode)(` 消息内容 `),(0,i.createVNode)(d,{class:`notification-detail__content`,style:(0,i.normalizeStyle)({maxHeight:`${t.scrollHeight}px`})},{default:(0,i.withCtx)(()=>[t.message.content?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,class:`notification-detail__body`,innerHTML:m.value},null,8,se)):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,ce,(0,i.toDisplayString)(t.message.summary),1))]),_:1},8,[`style`]),(0,i.createCommentVNode)(` 操作区 `),t.message.actionUrl?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,le,[(0,i.createVNode)(o,{type:`primary`,size:`small`,onClick:h},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:arrow-right`,size:16})]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(t.message.actionText||`查看详情`)+` `,1)]),_:1})])):(0,i.createCommentVNode)(`v-if`,!0)])}}});var de=t.t(ue,[[`__scopeId`,`data-v-59296724`]]);const $={class:`c-notification-center`},fe={class:`c-notification-center__panel`},pe={class:`c-notification-center__header`},me={class:`c-notification-center__header-extra`},he=(0,i.defineComponent)({name:`C_NotificationCenter`,__name:`index`,props:{fetchNotifications:{},markAsRead:{},markAllRead:{},deleteNotification:{},clearNotifications:{},wsConfig:{},desktopNotification:{type:Boolean,default:!1},maxBadgeCount:{default:99},pollingInterval:{default:6e4},pageSize:{default:20},storageKey:{default:`notification_center`},onError:{}},emits:[`itemClick`,`read`,`allRead`,`delete`,`unreadChange`,`wsStatusChange`,`newMessage`,`navigate`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=_(r),c=(0,i.computed)(()=>s.messages.value.some(e=>e.status===`unread`&&e.priority===`urgent`)),l=(0,i.computed)(()=>({connected:`已连接`,connecting:`连接中...`,disconnected:`未连接`,reconnecting:`重连中...`})[s.wsStatus.value]??`未知`);(0,i.watch)(()=>s.unreadCount.value,e=>{o(`unreadChange`,e)});function u(){s.popoverVisible.value=!s.popoverVisible.value}function d(e){s.selectMessage(e),o(`itemClick`,e)}async function f(e){try{await s.markAsRead([e]),o(`read`,[e])}catch{}}async function p(e){try{await s.deleteMessages([e]),o(`delete`,[e])}catch{}}async function m(){let e=s.activeCategory.value===`all`?void 0:s.activeCategory.value;try{await s.markAllAsRead(e),o(`allRead`,e)}catch{}}async function h(){let e=s.activeCategory.value===`all`?void 0:s.activeCategory.value;try{await s.clearMessages(e)}catch{}}function g(){s.popoverVisible.value=!1}function v(){s.clearSelection()}return t({refresh:()=>s.fetchMessages(!0),connectWS:()=>{r.wsConfig&&s.connectWS(r.wsConfig)},disconnectWS:s.disconnectWS,getUnreadCount:()=>s.unreadCount.value,getMessages:()=>s.messages.value.map(e=>({...e})),markRead:e=>s.markAsRead(e),markAllAsRead:e=>s.markAllAsRead(e),requestDesktopPermission:s.requestDesktopPermission}),(e,t)=>{let n=a.NTooltip,_=a.NPopover;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,$,[(0,i.createVNode)(_,{show:(0,i.unref)(s).popoverVisible.value,"onUpdate:show":t[1]||=e=>(0,i.unref)(s).popoverVisible.value=e,width:420,trigger:`click`,placement:`bottom-end`,"show-arrow":!1,"content-class":`c-notification-center__popover`,onAfterLeave:v},{trigger:(0,i.withCtx)(()=>[(0,i.createVNode)(C,{count:(0,i.unref)(s).unreadCount.value,"max-count":r.maxBadgeCount,"has-urgent":c.value,onClick:u},null,8,[`count`,`max-count`,`has-urgent`])]),default:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`div`,fe,[(0,i.createCommentVNode)(` 头部标题 `),(0,i.createElementVNode)(`div`,pe,[t[2]||=(0,i.createElementVNode)(`span`,{class:`c-notification-center__title`},`消息中心`,-1),(0,i.createElementVNode)(`div`,me,[(0,i.createCommentVNode)(` WebSocket 连接状态 `),r.wsConfig?((0,i.openBlock)(),(0,i.createBlock)(n,{key:0,trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:(0,i.normalizeClass)([`c-notification-center__ws-dot`,`c-notification-center__ws-dot--${(0,i.unref)(s).wsStatus.value}`])},null,2)]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` `+(0,i.toDisplayString)(l.value),1)]),_:1})):(0,i.createCommentVNode)(`v-if`,!0)])]),(0,i.createCommentVNode)(` 列表 / 详情切换 `),(0,i.createVNode)(i.Transition,{name:`slide-fade`,mode:`out-in`},{default:(0,i.withCtx)(()=>[(0,i.unref)(s).selectedMessage.value?((0,i.openBlock)(),(0,i.createBlock)(de,{key:(0,i.unref)(s).selectedMessage.value.id,message:(0,i.unref)(s).selectedMessage.value,onBack:(0,i.unref)(s).clearSelection,onAction:g,onNavigate:t[0]||=e=>o(`navigate`,e)},null,8,[`message`,`onBack`])):((0,i.openBlock)(),(0,i.createBlock)(Z,{key:1,messages:(0,i.unref)(s).filteredMessages.value,"active-category":(0,i.unref)(s).activeCategory.value,"unread-by-category":(0,i.unref)(s).unreadByCategory.value,"unread-count":(0,i.unref)(s).unreadCount.value,loading:(0,i.unref)(s).loading.value,"has-more":(0,i.unref)(s).hasMore.value,onSwitchCategory:(0,i.unref)(s).switchCategory,onItemClick:d,onRead:f,onDelete:p,onMarkAllRead:m,onClear:h,onLoadMore:(0,i.unref)(s).loadMore},null,8,[`messages`,`active-category`,`unread-by-category`,`unread-count`,`loading`,`has-more`,`onSwitchCategory`,`onLoadMore`]))]),_:1})])]),_:1},8,[`show`])])}}});var ge=t.t(he,[[`__scopeId`,`data-v-d929db80`]]);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return 20}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return 99}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return s}});
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`),n=require(`./html.cjs`),r=require(`./storage.cjs`);let i=require(`vue`),a=require(`naive-ui`);const o=6e4,s=`notification_center`,c=3e3,l=3e4,u=`ping`,d={system:{label:`系统通知`,icon:`mdi:cog-outline`,color:`info`},business:{label:`业务消息`,icon:`mdi:briefcase-outline`,color:`success`},alarm:{label:`告警预警`,icon:`mdi:alert-outline`,color:`warning`}},f=[{key:`all`,label:`全部`},{key:`system`,label:`系统通知`},{key:`business`,label:`业务消息`},{key:`alarm`,label:`告警预警`}],p={low:{label:`低`,type:`default`},normal:{label:`普通`,type:`info`},high:{label:`重要`,type:`warning`},urgent:{label:`紧急`,type:`error`}},m=[{id:`msg-001`,title:`系统维护通知`,summary:`系统将于今晚 22:00-23:00 进行例行维护升级,届时部分功能可能暂时不可用。`,content:`<p>尊敬的用户:</p><p>为了提升系统性能和稳定性,我们计划于 <strong>2026年2月27日 22:00-23:00</strong> 对系统进行例行维护升级。</p><p>维护期间,以下功能可能暂时不可用:</p><ul><li>报表导出</li><li>数据同步</li><li>定时任务</li></ul><p>请提前保存好未完成的工作,感谢您的理解与支持!</p>`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-15*6e4).toISOString(),sender:{name:`系统管理员`,avatar:``}},{id:`msg-002`,title:`审批流程待处理`,summary:`张三提交的《Q1 季度预算申请》需要您审批,请尽快处理。`,category:`business`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-30*6e4).toISOString(),sender:{name:`张三`,avatar:``},actionUrl:`/workflow/approval`,actionText:`去审批`},{id:`msg-003`,title:`服务器 CPU 使用率告警`,summary:`生产环境节点 prod-node-03 CPU 使用率持续超过 90%,已触发告警阈值。`,category:`alarm`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-2*6e4).toISOString(),sender:{name:`监控中心`},actionUrl:`/monitor/server`,actionText:`查看详情`},{id:`msg-004`,title:`新版本发布 v1.14.0`,summary:`系统已升级至 v1.14.0,新增通知中心、工作流增强等多项功能。`,category:`system`,priority:`normal`,status:`unread`,timestamp:new Date(Date.now()-3*36e5).toISOString(),sender:{name:`系统管理员`}},{id:`msg-005`,title:`项目交付提醒`,summary:`「Robot Admin 二期」项目交付截止日期为 3月15日,当前进度 78%。`,category:`business`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-8*36e5).toISOString(),sender:{name:`项目管理系统`}},{id:`msg-006`,title:`数据库连接池告警`,summary:`数据库连接池使用率达到 85%,建议关注并适时扩容。`,category:`alarm`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-12*36e5).toISOString(),sender:{name:`监控中心`}},{id:`msg-007`,title:`周报提交提醒`,summary:`本周周报提交截止时间为周五 18:00,请及时提交。`,category:`business`,priority:`normal`,status:`read`,timestamp:new Date(Date.now()-24*36e5).toISOString(),sender:{name:`OA 系统`}},{id:`msg-008`,title:`账号安全提醒`,summary:`检测到您的账号在新设备上登录,如非本人操作请及时修改密码。`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-45*6e4).toISOString(),sender:{name:`安全中心`}}];function h(e,t){let n=(0,i.ref)(`disconnected`),r=null,a=0,o=null,s=null,d=null,f=0;function p(e){n.value=e,t?.(e)}function m(e){d=e,a=0,h(e)}function h(e){let t=++f;x();let n=g(e);p(`connecting`);try{r=new WebSocket(n)}catch{p(`disconnected`),v(e);return}let i=r;i.addEventListener(`open`,()=>{t!==f||i!==r||(p(`connected`),a=0,y(e))}),i.addEventListener(`message`,e=>{t!==f||i!==r||_(e.data)}),i.addEventListener(`close`,()=>{t!==f||i!==r||(r=null,b(),p(`disconnected`),e.autoReconnect!==!1&&v(e))}),i.addEventListener(`error`,()=>{})}function g(e){let t=e.getToken?.();if(t){let n=e.url.includes(`?`)?`&`:`?`;return`${e.url}${n}token=${encodeURIComponent(t)}`}return e.url}function _(t){if(typeof t==`string`&&t!==`pong`)try{let n=JSON.parse(t);n&&typeof n==`object`&&[`new_message`,`read_sync`,`count_update`].includes(String(n.type))&&`data`in n&&e(n)}catch{}}function v(e){if(d!==e||o)return;let t=Math.max(0,Math.trunc(e.maxReconnectAttempts??5));if(a>=t)return;a++,p(`reconnecting`);let n=Math.max(0,e.reconnectInterval??c),r=Math.min(6e4,n*2**(a-1)),i=f;o=setTimeout(()=>{o=null,!(i!==f||d!==e)&&h(e)},r)}function y(e){b();let t=e.heartbeatInterval??l;if(t<=0)return;let n=e.heartbeatMessage??u;s=setInterval(()=>{if(r?.readyState===WebSocket.OPEN)try{r.send(n)}catch{r.close()}},t)}function b(){s&&=(clearInterval(s),null)}function x(){b(),o&&=(clearTimeout(o),null),r&&=(r.close(),null)}function S(){d=null,f++,a=0,x(),p(`disconnected`)}function C(){d&&(a=0,h(d))}return(0,i.onBeforeUnmount)(()=>{d=null,f++,x()}),{status:(0,i.readonly)(n),connect:m,disconnect:S,reconnect:C}}function g(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.title==`string`&&typeof t.summary==`string`&&typeof t.timestamp==`string`&&[`system`,`business`,`alarm`].includes(String(t.category))&&[`low`,`normal`,`high`,`urgent`].includes(String(t.priority))&&[`read`,`unread`,`archived`].includes(String(t.status))}function _(e,t={}){let n=(0,i.ref)([]),a=(0,i.ref)(`all`),c=(0,i.ref)(!1),l=(0,i.ref)(0),u=(0,i.ref)(1),d=(0,i.ref)(null),f=(0,i.ref)(!1),p=(0,i.ref)(`disconnected`),_=0,v=(0,i.computed)(()=>n.value.filter(e=>e.status===`unread`).length),y=(0,i.computed)(()=>{let e={system:0,business:0,alarm:0};for(let t of n.value)t.status===`unread`&&t.category in e&&e[t.category]++;return e}),b=(0,i.computed)(()=>a.value===`all`?n.value:n.value.filter(e=>e.category===a.value)),x=(0,i.computed)(()=>n.value.length<l.value),S=(0,i.computed)(()=>e.storageKey??s);function C(){if(e.fetchNotifications)return;let t=r.t(S.value);if(Array.isArray(t?.readIds)){let e=new Set(t.readIds.filter(e=>typeof e==`string`));for(let t of n.value)e.has(t.id)&&t.status!==`archived`&&(t.status=`read`)}}let w=null;function T(){e.fetchNotifications||(w&&clearTimeout(w),w=setTimeout(()=>{let e=n.value.filter(e=>e.status===`read`).map(e=>e.id);r.i(S.value,{readIds:e,lastFetchTime:Date.now()}),w=null},300))}async function E(t=!1){let r=++_;t&&(u.value=1),c.value=!0;try{if(e.fetchNotifications){let i=a.value===`all`?void 0:a.value,o=e.pageSize??20,s=await e.fetchNotifications({category:i,page:u.value,pageSize:o});if(r!==_)return;let c=Array.isArray(s.list)?s.list.map(e=>({...e})):[];if(t)n.value=c;else{let e=new Set(n.value.map(e=>e.id));n.value.push(...c.filter(t=>!e.has(t.id)))}l.value=Math.max(n.value.length,Number(s.total)||0)}else D();r===_&&C()}catch(t){throw r===_&&e.onError?.(t,`fetch`),t}finally{r===_&&(c.value=!1)}}function D(){n.value=m.map(e=>({...e})),l.value=m.length}async function O(){if(!x.value||c.value)return;let e=u.value;u.value++;try{await E()}catch(t){throw u.value=e,t}}async function k(t){let r=new Set(t),i=new Map(n.value.filter(e=>r.has(e.id)).map(e=>[e.id,e.status]));for(let e of n.value)r.has(e.id)&&(e.status=`read`);if(T(),e.markAsRead)try{await e.markAsRead(t)}catch(t){for(let e of n.value){let t=i.get(e.id);t&&(e.status=t)}throw T(),e.onError?.(t,`mark-as-read`),t}}async function A(t){let r=t?n.value.filter(e=>e.category===t&&e.status===`unread`):n.value.filter(e=>e.status===`unread`);for(let e of r)e.status=`read`;if(T(),e.markAllRead)try{await e.markAllRead(t)}catch(t){for(let e of r)e.status=`unread`;throw T(),e.onError?.(t,`mark-all-as-read`),t}}async function j(t){let r=new Set(t),i=[...n.value],a=l.value;if(n.value=n.value.filter(e=>!r.has(e.id)),l.value=Math.max(0,l.value-(i.length-n.value.length)),T(),e.deleteNotification)try{await e.deleteNotification(t)}catch(t){throw n.value=i,l.value=a,T(),e.onError?.(t,`delete`),t}}async function M(t){let r=[...n.value],i=l.value;if(t?n.value=n.value.filter(e=>e.category!==t):n.value=[],l.value=n.value.length,T(),e.clearNotifications)try{await e.clearNotifications(t)}catch(t){throw n.value=r,l.value=i,T(),e.onError?.(t,`clear`),t}}function N(e){switch(e.type){case`new_message`:{let r=e.data;if(!g(r))return;n.value.some(e=>e.id===r.id)||(n.value.unshift(r),l.value++,T(),t.onNewMessage?.(r),L(r));break}case`read_sync`:{if(!Array.isArray(e.data))return;let t=e.data.filter(g),r=new Set(t.map(e=>e.id));for(let e of n.value)r.has(e.id)&&(e.status=`read`);T();break}case`count_update`:break}}function P(e){p.value=e,t.onWSStatusChange?.(e)}let{connect:F,disconnect:I}=h(N,P);function L(t){e.desktopNotification&&(typeof window>`u`||!(`Notification`in window)||Notification.permission===`granted`&&z(t))}async function R(){return typeof window>`u`||!(`Notification`in window)?`unsupported`:Notification.requestPermission()}function z(e){let t=new Notification(e.title,{body:e.summary,icon:e.sender?.avatar||`/robot-avatar.png`,tag:e.id});t.addEventListener(`click`,()=>{window.focus(),U(e),t.close()}),setTimeout(()=>t.close(),5e3)}let B=null;function V(){H();let t=e.pollingInterval??o;t<=0||(B=setInterval(()=>{c.value||E(!0).catch(()=>void 0)},t))}function H(){B&&=(clearInterval(B),null)}function U(e){d.value=e,e.status===`unread`&&k([e.id]).catch(()=>void 0)}function W(){d.value=null}function G(t){a.value=t,d.value=null,e.fetchNotifications&&E(!0).catch(()=>void 0)}function K(){E(!0).catch(()=>void 0),V(),e.wsConfig&&F(e.wsConfig)}function q(){_++,H(),I(),w&&=(clearTimeout(w),null)}return(0,i.onMounted)(K),(0,i.onBeforeUnmount)(q),{messages:n,activeCategory:a,loading:c,total:l,page:u,selectedMessage:d,popoverVisible:f,wsStatus:p,unreadCount:v,unreadByCategory:y,filteredMessages:b,hasMore:x,fetchMessages:E,loadMore:O,markAsRead:k,markAllAsRead:A,deleteMessages:j,clearMessages:M,selectMessage:U,clearSelection:W,switchCategory:G,requestDesktopPermission:R,connectWS:F,disconnectWS:I}}const v={class:`notification-badge`},y=[`aria-label`],b={key:0,class:`notification-badge__count`},x={key:0,class:`notification-badge__pulse`},S=(0,i.defineComponent)({__name:`NotificationBadge`,props:{count:{default:0},maxCount:{default:99},hasUrgent:{type:Boolean,default:!1}},emits:[`click`],setup(t){let n=t,r=(0,i.computed)(()=>n.count>n.maxCount?`${n.maxCount}+`:String(n.count));return(n,o)=>{let s=a.NTooltip;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,v,[(0,i.createVNode)(s,{trigger:`hover`,placement:`bottom`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`button`,{type:`button`,class:`notification-badge__trigger`,"aria-label":`消息通知${t.count>0?`(${t.count} 条未读)`:``}`,onClick:o[0]||=e=>n.$emit(`click`)},[(0,i.createVNode)(e.t,{name:`mdi:bell-outline`,size:18,class:`notification-badge__icon`}),(0,i.createCommentVNode)(` 未读角标 `),(0,i.createVNode)(i.Transition,{name:`badge-bounce`},{default:(0,i.withCtx)(()=>[t.count>0?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,b,(0,i.toDisplayString)(r.value),1)):(0,i.createCommentVNode)(`v-if`,!0)]),_:1}),(0,i.createCommentVNode)(` 脉冲动画(有紧急消息时) `),t.hasUrgent?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,x)):(0,i.createCommentVNode)(`v-if`,!0)],8,y)]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` 消息通知`+(0,i.toDisplayString)(t.count>0?`(${t.count} 条未读)`:``),1)]),_:1})])}}});var C=t.t(S,[[`__scopeId`,`data-v-082ef9da`]]);const w=6e4,T=36e5,E=864e5,D=7*E,O=30*E;365*E;let k=null;function A(){return k||=j(),k}function j(){function e(e){let r=new Date(e),i=Date.now()-r.getTime();if(i<0||i<w)return`刚刚`;if(i<T)return`${Math.floor(i/w)}分钟前`;if(i<E)return`${Math.floor(i/T)}小时前`;let a=new Date;return a.setHours(0,0,0,0),r>=new Date(a.getTime()-E)&&r<a?`昨天 ${n(r.getHours())}:${n(r.getMinutes())}`:i<D?`${Math.floor(i/E)}天前`:i<O?`${Math.floor(i/D)}周前`:i<31536e6?`${Math.floor(i/O)}个月前`:t(r)}function t(e){return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}function n(e){return e<10?`0${e}`:String(e)}return{formatRelativeTime:e,formatFullDate:t}}const M={class:`notification-item__indicator`},N={class:`notification-item__avatar`},P={class:`notification-item__body`},F={class:`notification-item__header`},I={class:`notification-item__title`},L={class:`notification-item__summary`},R={class:`notification-item__meta`},z={class:`notification-item__time`},B={key:0,class:`notification-item__sender`},V=(0,i.defineComponent)({__name:`NotificationItem`,props:{message:{}},emits:[`click`,`read`,`delete`],setup(t){let n=t,{formatRelativeTime:r}=A(),o=(0,i.computed)(()=>d[n.message.category]?.icon??`mdi:bell-outline`),s=(0,i.computed)(()=>p[n.message.priority]??p.normal),c=(0,i.computed)(()=>r(n.message.timestamp));return(n,r)=>{let l=a.NAvatar,u=a.NTag,d=a.NTooltip;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,{class:(0,i.normalizeClass)([`notification-item`,{"notification-item--unread":t.message.status===`unread`,"notification-item--urgent":t.message.priority===`urgent`}]),onClick:r[3]||=e=>n.$emit(`click`,t.message)},[(0,i.createCommentVNode)(` 未读指示点 `),(0,i.createElementVNode)(`div`,M,[t.message.status===`unread`?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,{key:0,class:(0,i.normalizeClass)([`notification-item__dot`,`notification-item__dot--${t.message.priority}`])},null,2)):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createCommentVNode)(` 头像 `),(0,i.createElementVNode)(`div`,N,[t.message.sender?.avatar?((0,i.openBlock)(),(0,i.createBlock)(l,{key:0,src:t.message.sender.avatar,size:36,round:``},null,8,[`src`])):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:(0,i.normalizeClass)([`notification-item__avatar-placeholder`,`notification-item__avatar-placeholder--${t.message.category}`])},[(0,i.createVNode)(e.t,{name:o.value,size:16},null,8,[`name`])],2))]),(0,i.createCommentVNode)(` 内容 `),(0,i.createElementVNode)(`div`,P,[(0,i.createElementVNode)(`div`,F,[(0,i.createElementVNode)(`span`,I,(0,i.toDisplayString)(t.message.title),1),t.message.priority===`urgent`||t.message.priority===`high`?((0,i.openBlock)(),(0,i.createBlock)(u,{key:0,type:s.value.type,size:`tiny`,bordered:!1,round:``},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(s.value.label),1)]),_:1},8,[`type`])):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createElementVNode)(`div`,L,(0,i.toDisplayString)(t.message.summary),1),(0,i.createElementVNode)(`div`,R,[(0,i.createElementVNode)(`span`,z,(0,i.toDisplayString)(c.value),1),t.message.sender?.name?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,B,(0,i.toDisplayString)(t.message.sender.name),1)):(0,i.createCommentVNode)(`v-if`,!0)])]),(0,i.createCommentVNode)(` 操作区 `),(0,i.createElementVNode)(`div`,{class:`notification-item__actions`,onClick:r[2]||=(0,i.withModifiers)(()=>{},[`stop`])},[t.message.status===`unread`?((0,i.openBlock)(),(0,i.createBlock)(d,{key:0,trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:`notification-item__action`,onClick:r[0]||=e=>n.$emit(`read`,t.message.id)},[(0,i.createVNode)(e.t,{name:`mdi:check`,size:16})])]),default:(0,i.withCtx)(()=>[r[4]||=(0,i.createTextVNode)(` 标记已读 `,-1)]),_:1})):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createVNode)(d,{trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:`notification-item__action`,onClick:r[1]||=e=>n.$emit(`delete`,t.message.id)},[(0,i.createVNode)(e.t,{name:`mdi:delete-outline`,size:16})])]),default:(0,i.withCtx)(()=>[r[5]||=(0,i.createTextVNode)(` 删除 `,-1)]),_:1})])],2)}}});var H=t.t(V,[[`__scopeId`,`data-v-0104dbfc`]]);const U={class:`notification-list`},W={class:`notification-list__tabs`},G=[`onClick`],K={key:0,class:`notification-list__tab-count`},q={key:0,class:`notification-list__toolbar`},ee={class:`notification-list__skeleton-text`},J={class:`notification-list__items`},Y={class:`notification-list__empty`},X=(0,i.defineComponent)({__name:`NotificationList`,props:{messages:{},activeCategory:{},unreadByCategory:{},unreadCount:{},loading:{type:Boolean},hasMore:{type:Boolean},scrollHeight:{default:420}},emits:[`switchCategory`,`itemClick`,`read`,`delete`,`markAllRead`,`clear`,`loadMore`],setup(t){let n=t,r=(0,i.computed)(()=>n.activeCategory===`all`?n.unreadCount:n.unreadByCategory[n.activeCategory]??0);function o(e){return e===`all`?n.unreadCount:n.unreadByCategory[e]??0}return(n,s)=>{let c=a.NButton,l=a.NSkeleton,u=a.NSpin,d=a.NScrollbar;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,U,[(0,i.createCommentVNode)(` 分类 Tab `),(0,i.createElementVNode)(`div`,W,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)((0,i.unref)(f),e=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:e.key,class:(0,i.normalizeClass)([`notification-list__tab`,{"notification-list__tab--active":t.activeCategory===e.key}]),onClick:t=>n.$emit(`switchCategory`,e.key)},[(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(e.label),1),o(e.key)>0?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,K,(0,i.toDisplayString)(o(e.key)),1)):(0,i.createCommentVNode)(`v-if`,!0)],10,G))),128))]),(0,i.createCommentVNode)(` 操作栏 `),t.messages.length>0?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,q,[(0,i.createVNode)(c,{text:``,size:`tiny`,disabled:r.value===0,onClick:s[0]||=e=>n.$emit(`markAllRead`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:check-all`,size:14})]),default:(0,i.withCtx)(()=>[s[6]||=(0,i.createTextVNode)(` 全部已读 `,-1)]),_:1},8,[`disabled`]),(0,i.createVNode)(c,{text:``,size:`tiny`,onClick:s[1]||=e=>n.$emit(`clear`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:delete-sweep-outline`,size:14})]),default:(0,i.withCtx)(()=>[s[7]||=(0,i.createTextVNode)(` 清空 `,-1)]),_:1})])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 消息列表 `),(0,i.createVNode)(d,{class:`notification-list__scroll`,style:(0,i.normalizeStyle)({maxHeight:`${t.scrollHeight}px`})},{default:(0,i.withCtx)(()=>[t.loading&&t.messages.length===0?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[(0,i.createCommentVNode)(` 骨架屏 `),((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(4,e=>(0,i.createElementVNode)(`div`,{key:e,class:`notification-list__skeleton`},[(0,i.createVNode)(l,{circle:``,width:36,height:36}),(0,i.createElementVNode)(`div`,ee,[(0,i.createVNode)(l,{text:``,width:`60%`,height:14}),(0,i.createVNode)(l,{text:``,width:`90%`,height:12}),(0,i.createVNode)(l,{text:``,width:`40%`,height:10})])])),64))],64)):t.messages.length>0?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[(0,i.createElementVNode)(`div`,J,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(t.messages,e=>((0,i.openBlock)(),(0,i.createBlock)(H,{key:e.id,message:e,onClick:s[2]||=e=>n.$emit(`itemClick`,e),onRead:s[3]||=e=>n.$emit(`read`,e),onDelete:s[4]||=e=>n.$emit(`delete`,e)},null,8,[`message`]))),128))]),(0,i.createCommentVNode)(` 加载更多 `),t.hasMore?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,class:`notification-list__load-more`,onClick:s[5]||=e=>n.$emit(`loadMore`)},[t.loading?((0,i.openBlock)(),(0,i.createBlock)(u,{key:0,size:14})):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(t.loading?`加载中...`:`加载更多`),1)])):(0,i.createCommentVNode)(`v-if`,!0)],64)):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:2},[(0,i.createCommentVNode)(` 空状态 `),(0,i.createElementVNode)(`div`,Y,[(0,i.createVNode)(e.t,{name:`mdi:bell-off-outline`,size:48,class:`notification-list__empty-icon`}),s[8]||=(0,i.createElementVNode)(`span`,{class:`notification-list__empty-text`},`暂无消息`,-1)])],2112))]),_:1},8,[`style`])])}}});var Z=t.t(X,[[`__scopeId`,`data-v-47e5497f`]]);function Q(e){return e.includes(`\\`)||e.startsWith(`//`)||Array.from(e).some(e=>e.charCodeAt(0)<32)}function te(e){let t=e?.trim();if(!t||Q(t))return null;if(/^https?:\/\//i.test(t))try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?null:{kind:`external`,url:e.href}}catch{return null}return/^[a-z][a-z\d+.-]*:/i.test(t)?null:{kind:`internal`,url:t}}const ne={class:`notification-detail`},re={class:`notification-detail__back`},ie={class:`notification-detail__header`},ae={class:`notification-detail__title`},oe={class:`notification-detail__meta`},se={class:`notification-detail__time`},ce={key:0,class:`notification-detail__sender`},le=[`innerHTML`],ue={key:1,class:`notification-detail__body`},$={key:0,class:`notification-detail__footer`},de=(0,i.defineComponent)({__name:`NotificationDetail`,props:{message:{},scrollHeight:{default:320}},emits:[`back`,`action`,`navigate`],setup(t,{emit:r}){let o=t,s=r,{formatRelativeTime:c}=A(),l=(0,i.computed)(()=>d[o.message.category]??d.system),u=(0,i.computed)(()=>p[o.message.priority]??p.normal),f=(0,i.computed)(()=>c(o.message.timestamp)),m=(0,i.computed)(()=>n.t(o.message.content||``));function h(){let e=te(o.message.actionUrl);e&&(s(`action`,e.url),e.kind===`external`?window.open(e.url,`_blank`,`noopener,noreferrer`):s(`navigate`,e.url))}return(n,r)=>{let o=a.NButton,s=a.NTag,c=a.NAvatar,d=a.NScrollbar;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,ne,[(0,i.createCommentVNode)(` 返回栏 `),(0,i.createElementVNode)(`div`,re,[(0,i.createVNode)(o,{text:``,size:`small`,onClick:r[0]||=e=>n.$emit(`back`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:arrow-left`,size:16})]),default:(0,i.withCtx)(()=>[r[1]||=(0,i.createTextVNode)(` 返回列表 `,-1)]),_:1})]),(0,i.createCommentVNode)(` 消息头部 `),(0,i.createElementVNode)(`div`,ie,[(0,i.createElementVNode)(`h3`,ae,(0,i.toDisplayString)(t.message.title),1),(0,i.createElementVNode)(`div`,oe,[(0,i.createVNode)(s,{type:l.value.color,size:`tiny`,bordered:!1,round:``},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:l.value.icon,size:12},null,8,[`name`])]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` `+(0,i.toDisplayString)(l.value.label),1)]),_:1},8,[`type`]),t.message.priority===`urgent`||t.message.priority===`high`?((0,i.openBlock)(),(0,i.createBlock)(s,{key:0,type:u.value.type,size:`tiny`,bordered:!1,round:``},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(u.value.label),1)]),_:1},8,[`type`])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,se,(0,i.toDisplayString)(f.value),1)]),t.message.sender?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,ce,[t.message.sender.avatar?((0,i.openBlock)(),(0,i.createBlock)(c,{key:0,src:t.message.sender.avatar,size:20,round:``},null,8,[`src`])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(t.message.sender.name),1)])):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createCommentVNode)(` 消息内容 `),(0,i.createVNode)(d,{class:`notification-detail__content`,style:(0,i.normalizeStyle)({maxHeight:`${t.scrollHeight}px`})},{default:(0,i.withCtx)(()=>[t.message.content?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,class:`notification-detail__body`,innerHTML:m.value},null,8,le)):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,ue,(0,i.toDisplayString)(t.message.summary),1))]),_:1},8,[`style`]),(0,i.createCommentVNode)(` 操作区 `),t.message.actionUrl?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,$,[(0,i.createVNode)(o,{type:`primary`,size:`small`,onClick:h},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:`mdi:arrow-right`,size:16})]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(t.message.actionText||`查看详情`)+` `,1)]),_:1})])):(0,i.createCommentVNode)(`v-if`,!0)])}}});var fe=t.t(de,[[`__scopeId`,`data-v-dd3085a7`]]);const pe={class:`c-notification-center`},me={class:`c-notification-center__panel`},he={class:`c-notification-center__header`},ge={class:`c-notification-center__header-extra`},_e=(0,i.defineComponent)({name:`C_NotificationCenter`,__name:`index`,props:{fetchNotifications:{},markAsRead:{},markAllRead:{},deleteNotification:{},clearNotifications:{},wsConfig:{},desktopNotification:{type:Boolean,default:!1},maxBadgeCount:{default:99},pollingInterval:{default:6e4},pageSize:{default:20},storageKey:{default:`notification_center`},onError:{}},emits:[`itemClick`,`read`,`allRead`,`delete`,`unreadChange`,`wsStatusChange`,`newMessage`,`navigate`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=_(r,{onNewMessage:e=>o(`newMessage`,e),onWSStatusChange:e=>o(`wsStatusChange`,e)}),c=(0,i.computed)(()=>s.messages.value.some(e=>e.status===`unread`&&e.priority===`urgent`)),l=(0,i.computed)(()=>({connected:`已连接`,connecting:`连接中...`,disconnected:`未连接`,reconnecting:`重连中...`})[s.wsStatus.value]??`未知`);(0,i.watch)(()=>s.unreadCount.value,e=>{o(`unreadChange`,e)});function u(){s.popoverVisible.value=!s.popoverVisible.value}function d(e){s.selectMessage(e),o(`itemClick`,e)}async function f(e){try{await s.markAsRead([e]),o(`read`,[e])}catch{}}async function p(e){try{await s.deleteMessages([e]),o(`delete`,[e])}catch{}}async function m(){let e=s.activeCategory.value===`all`?void 0:s.activeCategory.value;try{await s.markAllAsRead(e),o(`allRead`,e)}catch{}}async function h(){let e=s.activeCategory.value===`all`?void 0:s.activeCategory.value;try{await s.clearMessages(e)}catch{}}function g(){s.popoverVisible.value=!1}function v(){s.clearSelection()}return t({refresh:()=>s.fetchMessages(!0),connectWS:()=>{r.wsConfig&&s.connectWS(r.wsConfig)},disconnectWS:s.disconnectWS,getUnreadCount:()=>s.unreadCount.value,getMessages:()=>s.messages.value.map(e=>({...e})),markRead:e=>s.markAsRead(e),markAllAsRead:e=>s.markAllAsRead(e),requestDesktopPermission:s.requestDesktopPermission}),(e,t)=>{let n=a.NTooltip,_=a.NPopover;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,pe,[(0,i.createVNode)(_,{show:(0,i.unref)(s).popoverVisible.value,"onUpdate:show":t[1]||=e=>(0,i.unref)(s).popoverVisible.value=e,width:420,trigger:`manual`,placement:`bottom-end`,"show-arrow":!1,"content-class":`c-notification-center__popover`,onAfterLeave:v},{trigger:(0,i.withCtx)(()=>[(0,i.createVNode)(C,{count:(0,i.unref)(s).unreadCount.value,"max-count":r.maxBadgeCount,"has-urgent":c.value,onClick:u},null,8,[`count`,`max-count`,`has-urgent`])]),default:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`div`,me,[(0,i.createCommentVNode)(` 头部标题 `),(0,i.createElementVNode)(`div`,he,[t[2]||=(0,i.createElementVNode)(`span`,{class:`c-notification-center__title`},`消息中心`,-1),(0,i.createElementVNode)(`div`,ge,[(0,i.createCommentVNode)(` WebSocket 连接状态 `),r.wsConfig?((0,i.openBlock)(),(0,i.createBlock)(n,{key:0,trigger:`hover`,placement:`top`},{trigger:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:(0,i.normalizeClass)([`c-notification-center__ws-dot`,`c-notification-center__ws-dot--${(0,i.unref)(s).wsStatus.value}`])},null,2)]),default:(0,i.withCtx)(()=>[(0,i.createTextVNode)(` `+(0,i.toDisplayString)(l.value),1)]),_:1})):(0,i.createCommentVNode)(`v-if`,!0)])]),(0,i.createCommentVNode)(` 列表 / 详情切换 `),(0,i.createVNode)(i.Transition,{name:`slide-fade`,mode:`out-in`},{default:(0,i.withCtx)(()=>[(0,i.unref)(s).selectedMessage.value?((0,i.openBlock)(),(0,i.createBlock)(fe,{key:(0,i.unref)(s).selectedMessage.value.id,message:(0,i.unref)(s).selectedMessage.value,onBack:(0,i.unref)(s).clearSelection,onAction:g,onNavigate:t[0]||=e=>o(`navigate`,e)},null,8,[`message`,`onBack`])):((0,i.openBlock)(),(0,i.createBlock)(Z,{key:1,messages:(0,i.unref)(s).filteredMessages.value,"active-category":(0,i.unref)(s).activeCategory.value,"unread-by-category":(0,i.unref)(s).unreadByCategory.value,"unread-count":(0,i.unref)(s).unreadCount.value,loading:(0,i.unref)(s).loading.value,"has-more":(0,i.unref)(s).hasMore.value,onSwitchCategory:(0,i.unref)(s).switchCategory,onItemClick:d,onRead:f,onDelete:p,onMarkAllRead:m,onClear:h,onLoadMore:(0,i.unref)(s).loadMore},null,8,[`messages`,`active-category`,`unread-by-category`,`unread-count`,`loading`,`has-more`,`onSwitchCategory`,`onLoadMore`]))]),_:1})])]),_:1},8,[`show`])])}}});var ve=t.t(_e,[[`__scopeId`,`data-v-67b5bf1b`]]);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return 20}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return 5}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return 99}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{t as n}from"./html.js";import{i as r,t as i}from"./storage.js";import{Fragment as a,Transition as o,computed as s,createBlock as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createTextVNode as f,createVNode as p,defineComponent as m,normalizeClass as h,normalizeStyle as g,onBeforeUnmount as _,onMounted as v,openBlock as y,readonly as b,ref as x,renderList as S,resolveComponent as C,toDisplayString as w,unref as T,watch as ee,withCtx as E,withModifiers as D}from"vue";import{NAvatar as O,NButton as k,NPopover as A,NScrollbar as j,NSkeleton as M,NSpin as N,NTag as P,NTooltip as F}from"naive-ui";const I=99,L=20,R=6e4,z=`notification_center`,B=3e3,V=5,H=3e4,U=`ping`,W={system:{label:`系统通知`,icon:`mdi:cog-outline`,color:`info`},business:{label:`业务消息`,icon:`mdi:briefcase-outline`,color:`success`},alarm:{label:`告警预警`,icon:`mdi:alert-outline`,color:`warning`}},G=[{key:`all`,label:`全部`},{key:`system`,label:`系统通知`},{key:`business`,label:`业务消息`},{key:`alarm`,label:`告警预警`}],K={low:{label:`低`,type:`default`},normal:{label:`普通`,type:`info`},high:{label:`重要`,type:`warning`},urgent:{label:`紧急`,type:`error`}},q=[{id:`msg-001`,title:`系统维护通知`,summary:`系统将于今晚 22:00-23:00 进行例行维护升级,届时部分功能可能暂时不可用。`,content:`<p>尊敬的用户:</p><p>为了提升系统性能和稳定性,我们计划于 <strong>2026年2月27日 22:00-23:00</strong> 对系统进行例行维护升级。</p><p>维护期间,以下功能可能暂时不可用:</p><ul><li>报表导出</li><li>数据同步</li><li>定时任务</li></ul><p>请提前保存好未完成的工作,感谢您的理解与支持!</p>`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-15*6e4).toISOString(),sender:{name:`系统管理员`,avatar:``}},{id:`msg-002`,title:`审批流程待处理`,summary:`张三提交的《Q1 季度预算申请》需要您审批,请尽快处理。`,category:`business`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-30*6e4).toISOString(),sender:{name:`张三`,avatar:``},actionUrl:`/workflow/approval`,actionText:`去审批`},{id:`msg-003`,title:`服务器 CPU 使用率告警`,summary:`生产环境节点 prod-node-03 CPU 使用率持续超过 90%,已触发告警阈值。`,category:`alarm`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-2*6e4).toISOString(),sender:{name:`监控中心`},actionUrl:`/monitor/server`,actionText:`查看详情`},{id:`msg-004`,title:`新版本发布 v1.14.0`,summary:`系统已升级至 v1.14.0,新增通知中心、工作流增强等多项功能。`,category:`system`,priority:`normal`,status:`unread`,timestamp:new Date(Date.now()-3*36e5).toISOString(),sender:{name:`系统管理员`}},{id:`msg-005`,title:`项目交付提醒`,summary:`「Robot Admin 二期」项目交付截止日期为 3月15日,当前进度 78%。`,category:`business`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-8*36e5).toISOString(),sender:{name:`项目管理系统`}},{id:`msg-006`,title:`数据库连接池告警`,summary:`数据库连接池使用率达到 85%,建议关注并适时扩容。`,category:`alarm`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-12*36e5).toISOString(),sender:{name:`监控中心`}},{id:`msg-007`,title:`周报提交提醒`,summary:`本周周报提交截止时间为周五 18:00,请及时提交。`,category:`business`,priority:`normal`,status:`read`,timestamp:new Date(Date.now()-24*36e5).toISOString(),sender:{name:`OA 系统`}},{id:`msg-008`,title:`账号安全提醒`,summary:`检测到您的账号在新设备上登录,如非本人操作请及时修改密码。`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-45*6e4).toISOString(),sender:{name:`安全中心`}}];function J(e,t){let n=x(`disconnected`),r=null,i=0,a=null,o=null,s=null,c=0;function l(e){n.value=e,t?.(e)}function u(e){s=e,i=0,d(e)}function d(e){let t=++c;v();let n=f(e);l(`connecting`);try{r=new WebSocket(n)}catch{l(`disconnected`),m(e);return}let a=r;a.addEventListener(`open`,()=>{t!==c||a!==r||(l(`connected`),i=0,h(e))}),a.addEventListener(`message`,e=>{t!==c||a!==r||p(e.data)}),a.addEventListener(`close`,()=>{t!==c||a!==r||(r=null,g(),l(`disconnected`),e.autoReconnect!==!1&&m(e))}),a.addEventListener(`error`,()=>{})}function f(e){let t=e.getToken?.();if(t){let n=e.url.includes(`?`)?`&`:`?`;return`${e.url}${n}token=${encodeURIComponent(t)}`}return e.url}function p(t){if(typeof t==`string`&&t!==`pong`)try{let n=JSON.parse(t);n&&typeof n==`object`&&[`new_message`,`read_sync`,`count_update`].includes(String(n.type))&&`data`in n&&e(n)}catch{}}function m(e){if(s!==e||a)return;let t=Math.max(0,Math.trunc(e.maxReconnectAttempts??5));if(i>=t)return;i++,l(`reconnecting`);let n=Math.max(0,e.reconnectInterval??B),r=Math.min(6e4,n*2**(i-1)),o=c;a=setTimeout(()=>{a=null,!(o!==c||s!==e)&&d(e)},r)}function h(e){g();let t=e.heartbeatInterval??H;if(t<=0)return;let n=e.heartbeatMessage??U;o=setInterval(()=>{if(r?.readyState===WebSocket.OPEN)try{r.send(n)}catch{r.close()}},t)}function g(){o&&=(clearInterval(o),null)}function v(){g(),a&&=(clearTimeout(a),null),r&&=(r.close(),null)}function y(){s=null,c++,i=0,v(),l(`disconnected`)}function S(){s&&(i=0,d(s))}return _(()=>{s=null,c++,v()}),{status:b(n),connect:u,disconnect:y,reconnect:S}}function Y(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.title==`string`&&typeof t.summary==`string`&&typeof t.timestamp==`string`&&[`system`,`business`,`alarm`].includes(String(t.category))&&[`low`,`normal`,`high`,`urgent`].includes(String(t.priority))&&[`read`,`unread`,`archived`].includes(String(t.status))}function X(e){let t=x([]),n=x(`all`),a=x(!1),o=x(0),c=x(1),l=x(null),u=x(!1),d=x(`disconnected`),f=0,p=s(()=>t.value.filter(e=>e.status===`unread`).length),m=s(()=>{let e={system:0,business:0,alarm:0};for(let n of t.value)n.status===`unread`&&n.category in e&&e[n.category]++;return e}),h=s(()=>n.value===`all`?t.value:t.value.filter(e=>e.category===n.value)),g=s(()=>t.value.length<o.value),y=s(()=>e.storageKey??z);function b(){let e=i(y.value);if(Array.isArray(e?.unreadIds)){let n=new Set(e.unreadIds.filter(e=>typeof e==`string`));for(let e of t.value)n.has(e.id)&&(e.status=`unread`)}}let S=null;function C(){S&&clearTimeout(S),S=setTimeout(()=>{let e=t.value.filter(e=>e.status===`unread`).map(e=>e.id);r(y.value,{unreadIds:e,lastFetchTime:Date.now()}),S=null},300)}async function w(r=!1){let i=++f;r&&(c.value=1),a.value=!0;try{if(e.fetchNotifications){let a=n.value===`all`?void 0:n.value,s=e.pageSize??20,l=await e.fetchNotifications({category:a,page:c.value,pageSize:s});if(i!==f)return;let u=Array.isArray(l.list)?l.list:[];if(r)t.value=u;else{let e=new Set(t.value.map(e=>e.id));t.value.push(...u.filter(t=>!e.has(t.id)))}o.value=Math.max(t.value.length,Number(l.total)||0)}else T();i===f&&b()}catch(t){throw i===f&&e.onError?.(t,`fetch`),t}finally{i===f&&(a.value=!1)}}function T(){t.value=q.map(e=>({...e})),o.value=q.length}async function ee(){if(!g.value||a.value)return;let e=c.value;c.value++;try{await w()}catch(t){throw c.value=e,t}}async function E(n){let r=new Set(n),i=new Map(t.value.filter(e=>r.has(e.id)).map(e=>[e.id,e.status]));for(let e of t.value)r.has(e.id)&&(e.status=`read`);if(C(),e.markAsRead)try{await e.markAsRead(n)}catch(n){for(let e of t.value){let t=i.get(e.id);t&&(e.status=t)}throw C(),e.onError?.(n,`mark-as-read`),n}}async function D(n){let r=n?t.value.filter(e=>e.category===n&&e.status===`unread`):t.value.filter(e=>e.status===`unread`);for(let e of r)e.status=`read`;if(C(),e.markAllRead)try{await e.markAllRead(n)}catch(t){for(let e of r)e.status=`unread`;throw C(),e.onError?.(t,`mark-all-as-read`),t}}async function O(n){let r=new Set(n),i=[...t.value],a=o.value;if(t.value=t.value.filter(e=>!r.has(e.id)),o.value=Math.max(0,o.value-(i.length-t.value.length)),C(),e.deleteNotification)try{await e.deleteNotification(n)}catch(n){throw t.value=i,o.value=a,C(),e.onError?.(n,`delete`),n}}async function k(n){let r=[...t.value],i=o.value;if(n?t.value=t.value.filter(e=>e.category!==n):t.value=[],o.value=t.value.length,C(),e.clearNotifications)try{await e.clearNotifications(n)}catch(n){throw t.value=r,o.value=i,C(),e.onError?.(n,`clear`),n}}function A(e){switch(e.type){case`new_message`:{let n=e.data;if(!Y(n))return;t.value.some(e=>e.id===n.id)||(t.value.unshift(n),o.value++,C(),P(n));break}case`read_sync`:{if(!Array.isArray(e.data))return;let n=e.data.filter(Y),r=new Set(n.map(e=>e.id));for(let e of t.value)r.has(e.id)&&(e.status=`read`);C();break}case`count_update`:break}}function j(e){d.value=e}let{connect:M,disconnect:N}=J(A,j);function P(t){e.desktopNotification&&(typeof window>`u`||!(`Notification`in window)||Notification.permission===`granted`&&I(t))}async function F(){return typeof window>`u`||!(`Notification`in window)?`unsupported`:Notification.requestPermission()}function I(e){let t=new Notification(e.title,{body:e.summary,icon:e.sender?.avatar||`/robot-avatar.png`,tag:e.id});t.addEventListener(`click`,()=>{window.focus(),H(e),t.close()}),setTimeout(()=>t.close(),5e3)}let L=null;function B(){V();let t=e.pollingInterval??R;t<=0||(L=setInterval(()=>{a.value||w(!0).catch(()=>void 0)},t))}function V(){L&&=(clearInterval(L),null)}function H(e){l.value=e,e.status===`unread`&&E([e.id]).catch(()=>void 0)}function U(){l.value=null}function W(t){n.value=t,l.value=null,e.fetchNotifications&&w(!0).catch(()=>void 0)}function G(){w(!0).catch(()=>void 0),B(),e.wsConfig&&M(e.wsConfig)}function K(){f++,V(),N(),S&&=(clearTimeout(S),null)}return v(G),_(K),{messages:t,activeCategory:n,loading:a,total:o,page:c,selectedMessage:l,popoverVisible:u,wsStatus:d,unreadCount:p,unreadByCategory:m,filteredMessages:h,hasMore:g,fetchMessages:w,loadMore:ee,markAsRead:E,markAllAsRead:D,deleteMessages:O,clearMessages:k,selectMessage:H,clearSelection:U,switchCategory:W,requestDesktopPermission:F,connectWS:M,disconnectWS:N}}const te={class:`notification-badge`},ne=[`aria-label`],re={key:0,class:`notification-badge__count`},ie={key:0,class:`notification-badge__pulse`};var ae=t(m({__name:`NotificationBadge`,props:{count:{default:0},maxCount:{default:99},hasUrgent:{type:Boolean,default:!1}},emits:[`click`],setup(t){let n=t,r=s(()=>n.count>n.maxCount?`${n.maxCount}+`:String(n.count));return(n,i)=>{let a=F;return y(),u(`div`,te,[p(a,{trigger:`hover`,placement:`bottom`},{trigger:E(()=>[d(`button`,{type:`button`,class:`notification-badge__trigger`,"aria-label":`消息通知${t.count>0?`(${t.count} 条未读)`:``}`,onClick:i[0]||=e=>n.$emit(`click`)},[p(e,{name:`mdi:bell-outline`,size:18,class:`notification-badge__icon`}),l(` 未读角标 `),p(o,{name:`badge-bounce`},{default:E(()=>[t.count>0?(y(),u(`span`,re,w(r.value),1)):l(`v-if`,!0)]),_:1}),l(` 脉冲动画(有紧急消息时) `),t.hasUrgent?(y(),u(`span`,ie)):l(`v-if`,!0)],8,ne)]),default:E(()=>[f(` 消息通知`+w(t.count>0?`(${t.count} 条未读)`:``),1)]),_:1})])}}}),[[`__scopeId`,`data-v-082ef9da`]]);const Z=6e4,oe=36e5,Q=864e5,se=7*Q,ce=30*Q;365*Q;let le=null;function $(){return le||=ue(),le}function ue(){function e(e){let r=new Date(e),i=Date.now()-r.getTime();if(i<0||i<Z)return`刚刚`;if(i<oe)return`${Math.floor(i/Z)}分钟前`;if(i<Q)return`${Math.floor(i/oe)}小时前`;let a=new Date;return a.setHours(0,0,0,0),r>=new Date(a.getTime()-Q)&&r<a?`昨天 ${n(r.getHours())}:${n(r.getMinutes())}`:i<se?`${Math.floor(i/Q)}天前`:i<ce?`${Math.floor(i/se)}周前`:i<31536e6?`${Math.floor(i/ce)}个月前`:t(r)}function t(e){return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}function n(e){return e<10?`0${e}`:String(e)}return{formatRelativeTime:e,formatFullDate:t}}const de={class:`notification-item__indicator`},fe={class:`notification-item__avatar`},pe={class:`notification-item__body`},me={class:`notification-item__header`},he={class:`notification-item__title`},ge={class:`notification-item__summary`},_e={class:`notification-item__meta`},ve={class:`notification-item__time`},ye={key:0,class:`notification-item__sender`};var be=t(m({__name:`NotificationItem`,props:{message:{}},emits:[`click`,`read`,`delete`],setup(t){let n=t,{formatRelativeTime:r}=$(),i=s(()=>W[n.message.category]?.icon??`mdi:bell-outline`),a=s(()=>K[n.message.priority]??K.normal),o=s(()=>r(n.message.timestamp));return(n,r)=>{let s=O,m=P,g=F;return y(),u(`div`,{class:h([`notification-item`,{"notification-item--unread":t.message.status===`unread`,"notification-item--urgent":t.message.priority===`urgent`}]),onClick:r[3]||=e=>n.$emit(`click`,t.message)},[l(` 未读指示点 `),d(`div`,de,[t.message.status===`unread`?(y(),u(`span`,{key:0,class:h([`notification-item__dot`,`notification-item__dot--${t.message.priority}`])},null,2)):l(`v-if`,!0)]),l(` 头像 `),d(`div`,fe,[t.message.sender?.avatar?(y(),c(s,{key:0,src:t.message.sender.avatar,size:36,round:``},null,8,[`src`])):(y(),u(`div`,{key:1,class:h([`notification-item__avatar-placeholder`,`notification-item__avatar-placeholder--${t.message.category}`])},[p(e,{name:i.value,size:16},null,8,[`name`])],2))]),l(` 内容 `),d(`div`,pe,[d(`div`,me,[d(`span`,he,w(t.message.title),1),t.message.priority===`urgent`||t.message.priority===`high`?(y(),c(m,{key:0,type:a.value.type,size:`tiny`,bordered:!1,round:``},{default:E(()=>[f(w(a.value.label),1)]),_:1},8,[`type`])):l(`v-if`,!0)]),d(`div`,ge,w(t.message.summary),1),d(`div`,_e,[d(`span`,ve,w(o.value),1),t.message.sender?.name?(y(),u(`span`,ye,w(t.message.sender.name),1)):l(`v-if`,!0)])]),l(` 操作区 `),d(`div`,{class:`notification-item__actions`,onClick:r[2]||=D(()=>{},[`stop`])},[t.message.status===`unread`?(y(),c(g,{key:0,trigger:`hover`,placement:`top`},{trigger:E(()=>[d(`span`,{class:`notification-item__action`,onClick:r[0]||=e=>n.$emit(`read`,t.message.id)},[p(e,{name:`mdi:check`,size:16})])]),default:E(()=>[r[4]||=f(` 标记已读 `,-1)]),_:1})):l(`v-if`,!0),p(g,{trigger:`hover`,placement:`top`},{trigger:E(()=>[d(`span`,{class:`notification-item__action`,onClick:r[1]||=e=>n.$emit(`delete`,t.message.id)},[p(e,{name:`mdi:delete-outline`,size:16})])]),default:E(()=>[r[5]||=f(` 删除 `,-1)]),_:1})])],2)}}}),[[`__scopeId`,`data-v-0104dbfc`]]);const xe={class:`notification-list`},Se={class:`notification-list__tabs`},Ce=[`onClick`],we={key:0,class:`notification-list__tab-count`},Te={key:0,class:`notification-list__toolbar`},Ee={class:`notification-list__skeleton-text`},De={class:`notification-list__items`},Oe={class:`notification-list__empty`};var ke=t(m({__name:`NotificationList`,props:{messages:{},activeCategory:{},unreadByCategory:{},unreadCount:{},loading:{type:Boolean},hasMore:{type:Boolean},scrollHeight:{default:420}},emits:[`switchCategory`,`itemClick`,`read`,`delete`,`markAllRead`,`clear`,`loadMore`],setup(t){let n=t,r=s(()=>n.activeCategory===`all`?n.unreadCount:n.unreadByCategory[n.activeCategory]??0);function i(e){return e===`all`?n.unreadCount:n.unreadByCategory[e]??0}return(n,o)=>{let s=k,m=M,_=N,v=j;return y(),u(`div`,xe,[l(` 分类 Tab `),d(`div`,Se,[(y(!0),u(a,null,S(T(G),e=>(y(),u(`div`,{key:e.key,class:h([`notification-list__tab`,{"notification-list__tab--active":t.activeCategory===e.key}]),onClick:t=>n.$emit(`switchCategory`,e.key)},[d(`span`,null,w(e.label),1),i(e.key)>0?(y(),u(`span`,we,w(i(e.key)),1)):l(`v-if`,!0)],10,Ce))),128))]),l(` 操作栏 `),t.messages.length>0?(y(),u(`div`,Te,[p(s,{text:``,size:`tiny`,disabled:r.value===0,onClick:o[0]||=e=>n.$emit(`markAllRead`)},{icon:E(()=>[p(e,{name:`mdi:check-all`,size:14})]),default:E(()=>[o[6]||=f(` 全部已读 `,-1)]),_:1},8,[`disabled`]),p(s,{text:``,size:`tiny`,onClick:o[1]||=e=>n.$emit(`clear`)},{icon:E(()=>[p(e,{name:`mdi:delete-sweep-outline`,size:14})]),default:E(()=>[o[7]||=f(` 清空 `,-1)]),_:1})])):l(`v-if`,!0),l(` 消息列表 `),p(v,{class:`notification-list__scroll`,style:g({maxHeight:`${t.scrollHeight}px`})},{default:E(()=>[t.loading&&t.messages.length===0?(y(),u(a,{key:0},[l(` 骨架屏 `),(y(),u(a,null,S(4,e=>d(`div`,{key:e,class:`notification-list__skeleton`},[p(m,{circle:``,width:36,height:36}),d(`div`,Ee,[p(m,{text:``,width:`60%`,height:14}),p(m,{text:``,width:`90%`,height:12}),p(m,{text:``,width:`40%`,height:10})])])),64))],64)):t.messages.length>0?(y(),u(a,{key:1},[d(`div`,De,[(y(!0),u(a,null,S(t.messages,e=>(y(),c(be,{key:e.id,message:e,onClick:o[2]||=e=>n.$emit(`itemClick`,e),onRead:o[3]||=e=>n.$emit(`read`,e),onDelete:o[4]||=e=>n.$emit(`delete`,e)},null,8,[`message`]))),128))]),l(` 加载更多 `),t.hasMore?(y(),u(`div`,{key:0,class:`notification-list__load-more`,onClick:o[5]||=e=>n.$emit(`loadMore`)},[t.loading?(y(),c(_,{key:0,size:14})):l(`v-if`,!0),d(`span`,null,w(t.loading?`加载中...`:`加载更多`),1)])):l(`v-if`,!0)],64)):(y(),u(a,{key:2},[l(` 空状态 `),d(`div`,Oe,[p(e,{name:`mdi:bell-off-outline`,size:48,class:`notification-list__empty-icon`}),o[8]||=d(`span`,{class:`notification-list__empty-text`},`暂无消息`,-1)])],2112))]),_:1},8,[`style`])])}}}),[[`__scopeId`,`data-v-47e5497f`]]);const Ae={class:`notification-detail`},je={class:`notification-detail__back`},Me={class:`notification-detail__header`},Ne={class:`notification-detail__title`},Pe={class:`notification-detail__meta`},Fe={class:`notification-detail__time`},Ie={key:0,class:`notification-detail__sender`},Le=[`innerHTML`],Re={key:1,class:`notification-detail__body`},ze={key:0,class:`notification-detail__footer`};var Be=t(m({__name:`NotificationDetail`,props:{message:{},scrollHeight:{default:320}},emits:[`back`,`action`,`navigate`],setup(t,{emit:r}){let i=t,a=r,{formatRelativeTime:o}=$(),m=s(()=>W[i.message.category]??W.system),h=s(()=>K[i.message.priority]??K.normal),_=s(()=>o(i.message.timestamp)),v=s(()=>n(i.message.content||``));function b(){let e=i.message.actionUrl;if(e){if(a(`action`,e),/^https?:\/\//i.test(e)){let t=new URL(e);(t.protocol===`http:`||t.protocol===`https:`)&&window.open(t.href,`_blank`,`noopener,noreferrer`);return}/^[a-z][a-z\d+.-]*:/i.test(e)||a(`navigate`,e)}}return(n,r)=>{let i=k,a=P,o=O,s=j;return y(),u(`div`,Ae,[l(` 返回栏 `),d(`div`,je,[p(i,{text:``,size:`small`,onClick:r[0]||=e=>n.$emit(`back`)},{icon:E(()=>[p(e,{name:`mdi:arrow-left`,size:16})]),default:E(()=>[r[1]||=f(` 返回列表 `,-1)]),_:1})]),l(` 消息头部 `),d(`div`,Me,[d(`h3`,Ne,w(t.message.title),1),d(`div`,Pe,[p(a,{type:m.value.color,size:`tiny`,bordered:!1,round:``},{icon:E(()=>[p(e,{name:m.value.icon,size:12},null,8,[`name`])]),default:E(()=>[f(` `+w(m.value.label),1)]),_:1},8,[`type`]),t.message.priority===`urgent`||t.message.priority===`high`?(y(),c(a,{key:0,type:h.value.type,size:`tiny`,bordered:!1,round:``},{default:E(()=>[f(w(h.value.label),1)]),_:1},8,[`type`])):l(`v-if`,!0),d(`span`,Fe,w(_.value),1)]),t.message.sender?(y(),u(`div`,Ie,[t.message.sender.avatar?(y(),c(o,{key:0,src:t.message.sender.avatar,size:20,round:``},null,8,[`src`])):l(`v-if`,!0),d(`span`,null,w(t.message.sender.name),1)])):l(`v-if`,!0)]),l(` 消息内容 `),p(s,{class:`notification-detail__content`,style:g({maxHeight:`${t.scrollHeight}px`})},{default:E(()=>[t.message.content?(y(),u(`div`,{key:0,class:`notification-detail__body`,innerHTML:v.value},null,8,Le)):(y(),u(`div`,Re,w(t.message.summary),1))]),_:1},8,[`style`]),l(` 操作区 `),t.message.actionUrl?(y(),u(`div`,ze,[p(i,{type:`primary`,size:`small`,onClick:b},{icon:E(()=>[p(e,{name:`mdi:arrow-right`,size:16})]),default:E(()=>[f(w(t.message.actionText||`查看详情`)+` `,1)]),_:1})])):l(`v-if`,!0)])}}}),[[`__scopeId`,`data-v-59296724`]]);const Ve={class:`c-notification-center`},He={class:`c-notification-center__panel`},Ue={class:`c-notification-center__header`},We={class:`c-notification-center__header-extra`};var Ge=t(m({name:`C_NotificationCenter`,__name:`index`,props:{fetchNotifications:{},markAsRead:{},markAllRead:{},deleteNotification:{},clearNotifications:{},wsConfig:{},desktopNotification:{type:Boolean,default:!1},maxBadgeCount:{default:99},pollingInterval:{default:6e4},pageSize:{default:20},storageKey:{default:`notification_center`},onError:{}},emits:[`itemClick`,`read`,`allRead`,`delete`,`unreadChange`,`wsStatusChange`,`newMessage`,`navigate`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=X(r),m=s(()=>a.messages.value.some(e=>e.status===`unread`&&e.priority===`urgent`)),g=s(()=>({connected:`已连接`,connecting:`连接中...`,disconnected:`未连接`,reconnecting:`重连中...`})[a.wsStatus.value]??`未知`);ee(()=>a.unreadCount.value,e=>{i(`unreadChange`,e)});function _(){a.popoverVisible.value=!a.popoverVisible.value}function v(e){a.selectMessage(e),i(`itemClick`,e)}async function b(e){try{await a.markAsRead([e]),i(`read`,[e])}catch{}}async function x(e){try{await a.deleteMessages([e]),i(`delete`,[e])}catch{}}async function S(){let e=a.activeCategory.value===`all`?void 0:a.activeCategory.value;try{await a.markAllAsRead(e),i(`allRead`,e)}catch{}}async function C(){let e=a.activeCategory.value===`all`?void 0:a.activeCategory.value;try{await a.clearMessages(e)}catch{}}function D(){a.popoverVisible.value=!1}function O(){a.clearSelection()}return t({refresh:()=>a.fetchMessages(!0),connectWS:()=>{r.wsConfig&&a.connectWS(r.wsConfig)},disconnectWS:a.disconnectWS,getUnreadCount:()=>a.unreadCount.value,getMessages:()=>a.messages.value.map(e=>({...e})),markRead:e=>a.markAsRead(e),markAllAsRead:e=>a.markAllAsRead(e),requestDesktopPermission:a.requestDesktopPermission}),(e,t)=>{let n=F,s=A;return y(),u(`div`,Ve,[p(s,{show:T(a).popoverVisible.value,"onUpdate:show":t[1]||=e=>T(a).popoverVisible.value=e,width:420,trigger:`click`,placement:`bottom-end`,"show-arrow":!1,"content-class":`c-notification-center__popover`,onAfterLeave:O},{trigger:E(()=>[p(ae,{count:T(a).unreadCount.value,"max-count":r.maxBadgeCount,"has-urgent":m.value,onClick:_},null,8,[`count`,`max-count`,`has-urgent`])]),default:E(()=>[d(`div`,He,[l(` 头部标题 `),d(`div`,Ue,[t[2]||=d(`span`,{class:`c-notification-center__title`},`消息中心`,-1),d(`div`,We,[l(` WebSocket 连接状态 `),r.wsConfig?(y(),c(n,{key:0,trigger:`hover`,placement:`top`},{trigger:E(()=>[d(`span`,{class:h([`c-notification-center__ws-dot`,`c-notification-center__ws-dot--${T(a).wsStatus.value}`])},null,2)]),default:E(()=>[f(` `+w(g.value),1)]),_:1})):l(`v-if`,!0)])]),l(` 列表 / 详情切换 `),p(o,{name:`slide-fade`,mode:`out-in`},{default:E(()=>[T(a).selectedMessage.value?(y(),c(Be,{key:T(a).selectedMessage.value.id,message:T(a).selectedMessage.value,onBack:T(a).clearSelection,onAction:D,onNavigate:t[0]||=e=>i(`navigate`,e)},null,8,[`message`,`onBack`])):(y(),c(ke,{key:1,messages:T(a).filteredMessages.value,"active-category":T(a).activeCategory.value,"unread-by-category":T(a).unreadByCategory.value,"unread-count":T(a).unreadCount.value,loading:T(a).loading.value,"has-more":T(a).hasMore.value,onSwitchCategory:T(a).switchCategory,onItemClick:v,onRead:b,onDelete:x,onMarkAllRead:S,onClear:C,onLoadMore:T(a).loadMore},null,8,[`messages`,`active-category`,`unread-by-category`,`unread-count`,`loading`,`has-more`,`onSwitchCategory`,`onLoadMore`]))]),_:1})])]),_:1},8,[`show`])])}}}),[[`__scopeId`,`data-v-d929db80`]]);export{W as a,L as c,H as d,U as f,K as g,q as h,J as i,R as l,B as m,$ as n,G as o,V as p,X as r,I as s,Ge as t,z as u};
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{t as n}from"./html.js";import{i as r,t as i}from"./storage.js";import{Fragment as a,Transition as o,computed as s,createBlock as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createTextVNode as f,createVNode as p,defineComponent as m,normalizeClass as h,normalizeStyle as g,onBeforeUnmount as _,onMounted as v,openBlock as y,readonly as b,ref as x,renderList as S,resolveComponent as C,toDisplayString as w,unref as T,watch as E,withCtx as D,withModifiers as O}from"vue";import{NAvatar as k,NButton as A,NPopover as ee,NScrollbar as j,NSkeleton as M,NSpin as N,NTag as P,NTooltip as F}from"naive-ui";const I=99,L=20,R=6e4,z=`notification_center`,B=3e3,V=5,H=3e4,U=`ping`,W={system:{label:`系统通知`,icon:`mdi:cog-outline`,color:`info`},business:{label:`业务消息`,icon:`mdi:briefcase-outline`,color:`success`},alarm:{label:`告警预警`,icon:`mdi:alert-outline`,color:`warning`}},G=[{key:`all`,label:`全部`},{key:`system`,label:`系统通知`},{key:`business`,label:`业务消息`},{key:`alarm`,label:`告警预警`}],K={low:{label:`低`,type:`default`},normal:{label:`普通`,type:`info`},high:{label:`重要`,type:`warning`},urgent:{label:`紧急`,type:`error`}},q=[{id:`msg-001`,title:`系统维护通知`,summary:`系统将于今晚 22:00-23:00 进行例行维护升级,届时部分功能可能暂时不可用。`,content:`<p>尊敬的用户:</p><p>为了提升系统性能和稳定性,我们计划于 <strong>2026年2月27日 22:00-23:00</strong> 对系统进行例行维护升级。</p><p>维护期间,以下功能可能暂时不可用:</p><ul><li>报表导出</li><li>数据同步</li><li>定时任务</li></ul><p>请提前保存好未完成的工作,感谢您的理解与支持!</p>`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-15*6e4).toISOString(),sender:{name:`系统管理员`,avatar:``}},{id:`msg-002`,title:`审批流程待处理`,summary:`张三提交的《Q1 季度预算申请》需要您审批,请尽快处理。`,category:`business`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-30*6e4).toISOString(),sender:{name:`张三`,avatar:``},actionUrl:`/workflow/approval`,actionText:`去审批`},{id:`msg-003`,title:`服务器 CPU 使用率告警`,summary:`生产环境节点 prod-node-03 CPU 使用率持续超过 90%,已触发告警阈值。`,category:`alarm`,priority:`urgent`,status:`unread`,timestamp:new Date(Date.now()-2*6e4).toISOString(),sender:{name:`监控中心`},actionUrl:`/monitor/server`,actionText:`查看详情`},{id:`msg-004`,title:`新版本发布 v1.14.0`,summary:`系统已升级至 v1.14.0,新增通知中心、工作流增强等多项功能。`,category:`system`,priority:`normal`,status:`unread`,timestamp:new Date(Date.now()-3*36e5).toISOString(),sender:{name:`系统管理员`}},{id:`msg-005`,title:`项目交付提醒`,summary:`「Robot Admin 二期」项目交付截止日期为 3月15日,当前进度 78%。`,category:`business`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-8*36e5).toISOString(),sender:{name:`项目管理系统`}},{id:`msg-006`,title:`数据库连接池告警`,summary:`数据库连接池使用率达到 85%,建议关注并适时扩容。`,category:`alarm`,priority:`high`,status:`read`,timestamp:new Date(Date.now()-12*36e5).toISOString(),sender:{name:`监控中心`}},{id:`msg-007`,title:`周报提交提醒`,summary:`本周周报提交截止时间为周五 18:00,请及时提交。`,category:`business`,priority:`normal`,status:`read`,timestamp:new Date(Date.now()-24*36e5).toISOString(),sender:{name:`OA 系统`}},{id:`msg-008`,title:`账号安全提醒`,summary:`检测到您的账号在新设备上登录,如非本人操作请及时修改密码。`,category:`system`,priority:`high`,status:`unread`,timestamp:new Date(Date.now()-45*6e4).toISOString(),sender:{name:`安全中心`}}];function J(e,t){let n=x(`disconnected`),r=null,i=0,a=null,o=null,s=null,c=0;function l(e){n.value=e,t?.(e)}function u(e){s=e,i=0,d(e)}function d(e){let t=++c;v();let n=f(e);l(`connecting`);try{r=new WebSocket(n)}catch{l(`disconnected`),m(e);return}let a=r;a.addEventListener(`open`,()=>{t!==c||a!==r||(l(`connected`),i=0,h(e))}),a.addEventListener(`message`,e=>{t!==c||a!==r||p(e.data)}),a.addEventListener(`close`,()=>{t!==c||a!==r||(r=null,g(),l(`disconnected`),e.autoReconnect!==!1&&m(e))}),a.addEventListener(`error`,()=>{})}function f(e){let t=e.getToken?.();if(t){let n=e.url.includes(`?`)?`&`:`?`;return`${e.url}${n}token=${encodeURIComponent(t)}`}return e.url}function p(t){if(typeof t==`string`&&t!==`pong`)try{let n=JSON.parse(t);n&&typeof n==`object`&&[`new_message`,`read_sync`,`count_update`].includes(String(n.type))&&`data`in n&&e(n)}catch{}}function m(e){if(s!==e||a)return;let t=Math.max(0,Math.trunc(e.maxReconnectAttempts??5));if(i>=t)return;i++,l(`reconnecting`);let n=Math.max(0,e.reconnectInterval??B),r=Math.min(6e4,n*2**(i-1)),o=c;a=setTimeout(()=>{a=null,!(o!==c||s!==e)&&d(e)},r)}function h(e){g();let t=e.heartbeatInterval??H;if(t<=0)return;let n=e.heartbeatMessage??U;o=setInterval(()=>{if(r?.readyState===WebSocket.OPEN)try{r.send(n)}catch{r.close()}},t)}function g(){o&&=(clearInterval(o),null)}function v(){g(),a&&=(clearTimeout(a),null),r&&=(r.close(),null)}function y(){s=null,c++,i=0,v(),l(`disconnected`)}function S(){s&&(i=0,d(s))}return _(()=>{s=null,c++,v()}),{status:b(n),connect:u,disconnect:y,reconnect:S}}function Y(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.title==`string`&&typeof t.summary==`string`&&typeof t.timestamp==`string`&&[`system`,`business`,`alarm`].includes(String(t.category))&&[`low`,`normal`,`high`,`urgent`].includes(String(t.priority))&&[`read`,`unread`,`archived`].includes(String(t.status))}function X(e,t={}){let n=x([]),a=x(`all`),o=x(!1),c=x(0),l=x(1),u=x(null),d=x(!1),f=x(`disconnected`),p=0,m=s(()=>n.value.filter(e=>e.status===`unread`).length),h=s(()=>{let e={system:0,business:0,alarm:0};for(let t of n.value)t.status===`unread`&&t.category in e&&e[t.category]++;return e}),g=s(()=>a.value===`all`?n.value:n.value.filter(e=>e.category===a.value)),y=s(()=>n.value.length<c.value),b=s(()=>e.storageKey??z);function S(){if(e.fetchNotifications)return;let t=i(b.value);if(Array.isArray(t?.readIds)){let e=new Set(t.readIds.filter(e=>typeof e==`string`));for(let t of n.value)e.has(t.id)&&t.status!==`archived`&&(t.status=`read`)}}let C=null;function w(){e.fetchNotifications||(C&&clearTimeout(C),C=setTimeout(()=>{let e=n.value.filter(e=>e.status===`read`).map(e=>e.id);r(b.value,{readIds:e,lastFetchTime:Date.now()}),C=null},300))}async function T(t=!1){let r=++p;t&&(l.value=1),o.value=!0;try{if(e.fetchNotifications){let i=a.value===`all`?void 0:a.value,o=e.pageSize??20,s=await e.fetchNotifications({category:i,page:l.value,pageSize:o});if(r!==p)return;let u=Array.isArray(s.list)?s.list.map(e=>({...e})):[];if(t)n.value=u;else{let e=new Set(n.value.map(e=>e.id));n.value.push(...u.filter(t=>!e.has(t.id)))}c.value=Math.max(n.value.length,Number(s.total)||0)}else E();r===p&&S()}catch(t){throw r===p&&e.onError?.(t,`fetch`),t}finally{r===p&&(o.value=!1)}}function E(){n.value=q.map(e=>({...e})),c.value=q.length}async function D(){if(!y.value||o.value)return;let e=l.value;l.value++;try{await T()}catch(t){throw l.value=e,t}}async function O(t){let r=new Set(t),i=new Map(n.value.filter(e=>r.has(e.id)).map(e=>[e.id,e.status]));for(let e of n.value)r.has(e.id)&&(e.status=`read`);if(w(),e.markAsRead)try{await e.markAsRead(t)}catch(t){for(let e of n.value){let t=i.get(e.id);t&&(e.status=t)}throw w(),e.onError?.(t,`mark-as-read`),t}}async function k(t){let r=t?n.value.filter(e=>e.category===t&&e.status===`unread`):n.value.filter(e=>e.status===`unread`);for(let e of r)e.status=`read`;if(w(),e.markAllRead)try{await e.markAllRead(t)}catch(t){for(let e of r)e.status=`unread`;throw w(),e.onError?.(t,`mark-all-as-read`),t}}async function A(t){let r=new Set(t),i=[...n.value],a=c.value;if(n.value=n.value.filter(e=>!r.has(e.id)),c.value=Math.max(0,c.value-(i.length-n.value.length)),w(),e.deleteNotification)try{await e.deleteNotification(t)}catch(t){throw n.value=i,c.value=a,w(),e.onError?.(t,`delete`),t}}async function ee(t){let r=[...n.value],i=c.value;if(t?n.value=n.value.filter(e=>e.category!==t):n.value=[],c.value=n.value.length,w(),e.clearNotifications)try{await e.clearNotifications(t)}catch(t){throw n.value=r,c.value=i,w(),e.onError?.(t,`clear`),t}}function j(e){switch(e.type){case`new_message`:{let r=e.data;if(!Y(r))return;n.value.some(e=>e.id===r.id)||(n.value.unshift(r),c.value++,w(),t.onNewMessage?.(r),F(r));break}case`read_sync`:{if(!Array.isArray(e.data))return;let t=e.data.filter(Y),r=new Set(t.map(e=>e.id));for(let e of n.value)r.has(e.id)&&(e.status=`read`);w();break}case`count_update`:break}}function M(e){f.value=e,t.onWSStatusChange?.(e)}let{connect:N,disconnect:P}=J(j,M);function F(t){e.desktopNotification&&(typeof window>`u`||!(`Notification`in window)||Notification.permission===`granted`&&L(t))}async function I(){return typeof window>`u`||!(`Notification`in window)?`unsupported`:Notification.requestPermission()}function L(e){let t=new Notification(e.title,{body:e.summary,icon:e.sender?.avatar||`/robot-avatar.png`,tag:e.id});t.addEventListener(`click`,()=>{window.focus(),U(e),t.close()}),setTimeout(()=>t.close(),5e3)}let B=null;function V(){H();let t=e.pollingInterval??R;t<=0||(B=setInterval(()=>{o.value||T(!0).catch(()=>void 0)},t))}function H(){B&&=(clearInterval(B),null)}function U(e){u.value=e,e.status===`unread`&&O([e.id]).catch(()=>void 0)}function W(){u.value=null}function G(t){a.value=t,u.value=null,e.fetchNotifications&&T(!0).catch(()=>void 0)}function K(){T(!0).catch(()=>void 0),V(),e.wsConfig&&N(e.wsConfig)}function X(){p++,H(),P(),C&&=(clearTimeout(C),null)}return v(K),_(X),{messages:n,activeCategory:a,loading:o,total:c,page:l,selectedMessage:u,popoverVisible:d,wsStatus:f,unreadCount:m,unreadByCategory:h,filteredMessages:g,hasMore:y,fetchMessages:T,loadMore:D,markAsRead:O,markAllAsRead:k,deleteMessages:A,clearMessages:ee,selectMessage:U,clearSelection:W,switchCategory:G,requestDesktopPermission:I,connectWS:N,disconnectWS:P}}const te={class:`notification-badge`},ne=[`aria-label`],re={key:0,class:`notification-badge__count`},ie={key:0,class:`notification-badge__pulse`};var ae=t(m({__name:`NotificationBadge`,props:{count:{default:0},maxCount:{default:99},hasUrgent:{type:Boolean,default:!1}},emits:[`click`],setup(t){let n=t,r=s(()=>n.count>n.maxCount?`${n.maxCount}+`:String(n.count));return(n,i)=>{let a=F;return y(),u(`div`,te,[p(a,{trigger:`hover`,placement:`bottom`},{trigger:D(()=>[d(`button`,{type:`button`,class:`notification-badge__trigger`,"aria-label":`消息通知${t.count>0?`(${t.count} 条未读)`:``}`,onClick:i[0]||=e=>n.$emit(`click`)},[p(e,{name:`mdi:bell-outline`,size:18,class:`notification-badge__icon`}),l(` 未读角标 `),p(o,{name:`badge-bounce`},{default:D(()=>[t.count>0?(y(),u(`span`,re,w(r.value),1)):l(`v-if`,!0)]),_:1}),l(` 脉冲动画(有紧急消息时) `),t.hasUrgent?(y(),u(`span`,ie)):l(`v-if`,!0)],8,ne)]),default:D(()=>[f(` 消息通知`+w(t.count>0?`(${t.count} 条未读)`:``),1)]),_:1})])}}}),[[`__scopeId`,`data-v-082ef9da`]]);const Z=6e4,oe=36e5,Q=864e5,se=7*Q,ce=30*Q;365*Q;let le=null;function $(){return le||=ue(),le}function ue(){function e(e){let r=new Date(e),i=Date.now()-r.getTime();if(i<0||i<Z)return`刚刚`;if(i<oe)return`${Math.floor(i/Z)}分钟前`;if(i<Q)return`${Math.floor(i/oe)}小时前`;let a=new Date;return a.setHours(0,0,0,0),r>=new Date(a.getTime()-Q)&&r<a?`昨天 ${n(r.getHours())}:${n(r.getMinutes())}`:i<se?`${Math.floor(i/Q)}天前`:i<ce?`${Math.floor(i/se)}周前`:i<31536e6?`${Math.floor(i/ce)}个月前`:t(r)}function t(e){return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())} ${n(e.getHours())}:${n(e.getMinutes())}`}function n(e){return e<10?`0${e}`:String(e)}return{formatRelativeTime:e,formatFullDate:t}}const de={class:`notification-item__indicator`},fe={class:`notification-item__avatar`},pe={class:`notification-item__body`},me={class:`notification-item__header`},he={class:`notification-item__title`},ge={class:`notification-item__summary`},_e={class:`notification-item__meta`},ve={class:`notification-item__time`},ye={key:0,class:`notification-item__sender`};var be=t(m({__name:`NotificationItem`,props:{message:{}},emits:[`click`,`read`,`delete`],setup(t){let n=t,{formatRelativeTime:r}=$(),i=s(()=>W[n.message.category]?.icon??`mdi:bell-outline`),a=s(()=>K[n.message.priority]??K.normal),o=s(()=>r(n.message.timestamp));return(n,r)=>{let s=k,m=P,g=F;return y(),u(`div`,{class:h([`notification-item`,{"notification-item--unread":t.message.status===`unread`,"notification-item--urgent":t.message.priority===`urgent`}]),onClick:r[3]||=e=>n.$emit(`click`,t.message)},[l(` 未读指示点 `),d(`div`,de,[t.message.status===`unread`?(y(),u(`span`,{key:0,class:h([`notification-item__dot`,`notification-item__dot--${t.message.priority}`])},null,2)):l(`v-if`,!0)]),l(` 头像 `),d(`div`,fe,[t.message.sender?.avatar?(y(),c(s,{key:0,src:t.message.sender.avatar,size:36,round:``},null,8,[`src`])):(y(),u(`div`,{key:1,class:h([`notification-item__avatar-placeholder`,`notification-item__avatar-placeholder--${t.message.category}`])},[p(e,{name:i.value,size:16},null,8,[`name`])],2))]),l(` 内容 `),d(`div`,pe,[d(`div`,me,[d(`span`,he,w(t.message.title),1),t.message.priority===`urgent`||t.message.priority===`high`?(y(),c(m,{key:0,type:a.value.type,size:`tiny`,bordered:!1,round:``},{default:D(()=>[f(w(a.value.label),1)]),_:1},8,[`type`])):l(`v-if`,!0)]),d(`div`,ge,w(t.message.summary),1),d(`div`,_e,[d(`span`,ve,w(o.value),1),t.message.sender?.name?(y(),u(`span`,ye,w(t.message.sender.name),1)):l(`v-if`,!0)])]),l(` 操作区 `),d(`div`,{class:`notification-item__actions`,onClick:r[2]||=O(()=>{},[`stop`])},[t.message.status===`unread`?(y(),c(g,{key:0,trigger:`hover`,placement:`top`},{trigger:D(()=>[d(`span`,{class:`notification-item__action`,onClick:r[0]||=e=>n.$emit(`read`,t.message.id)},[p(e,{name:`mdi:check`,size:16})])]),default:D(()=>[r[4]||=f(` 标记已读 `,-1)]),_:1})):l(`v-if`,!0),p(g,{trigger:`hover`,placement:`top`},{trigger:D(()=>[d(`span`,{class:`notification-item__action`,onClick:r[1]||=e=>n.$emit(`delete`,t.message.id)},[p(e,{name:`mdi:delete-outline`,size:16})])]),default:D(()=>[r[5]||=f(` 删除 `,-1)]),_:1})])],2)}}}),[[`__scopeId`,`data-v-0104dbfc`]]);const xe={class:`notification-list`},Se={class:`notification-list__tabs`},Ce=[`onClick`],we={key:0,class:`notification-list__tab-count`},Te={key:0,class:`notification-list__toolbar`},Ee={class:`notification-list__skeleton-text`},De={class:`notification-list__items`},Oe={class:`notification-list__empty`};var ke=t(m({__name:`NotificationList`,props:{messages:{},activeCategory:{},unreadByCategory:{},unreadCount:{},loading:{type:Boolean},hasMore:{type:Boolean},scrollHeight:{default:420}},emits:[`switchCategory`,`itemClick`,`read`,`delete`,`markAllRead`,`clear`,`loadMore`],setup(t){let n=t,r=s(()=>n.activeCategory===`all`?n.unreadCount:n.unreadByCategory[n.activeCategory]??0);function i(e){return e===`all`?n.unreadCount:n.unreadByCategory[e]??0}return(n,o)=>{let s=A,m=M,_=N,v=j;return y(),u(`div`,xe,[l(` 分类 Tab `),d(`div`,Se,[(y(!0),u(a,null,S(T(G),e=>(y(),u(`div`,{key:e.key,class:h([`notification-list__tab`,{"notification-list__tab--active":t.activeCategory===e.key}]),onClick:t=>n.$emit(`switchCategory`,e.key)},[d(`span`,null,w(e.label),1),i(e.key)>0?(y(),u(`span`,we,w(i(e.key)),1)):l(`v-if`,!0)],10,Ce))),128))]),l(` 操作栏 `),t.messages.length>0?(y(),u(`div`,Te,[p(s,{text:``,size:`tiny`,disabled:r.value===0,onClick:o[0]||=e=>n.$emit(`markAllRead`)},{icon:D(()=>[p(e,{name:`mdi:check-all`,size:14})]),default:D(()=>[o[6]||=f(` 全部已读 `,-1)]),_:1},8,[`disabled`]),p(s,{text:``,size:`tiny`,onClick:o[1]||=e=>n.$emit(`clear`)},{icon:D(()=>[p(e,{name:`mdi:delete-sweep-outline`,size:14})]),default:D(()=>[o[7]||=f(` 清空 `,-1)]),_:1})])):l(`v-if`,!0),l(` 消息列表 `),p(v,{class:`notification-list__scroll`,style:g({maxHeight:`${t.scrollHeight}px`})},{default:D(()=>[t.loading&&t.messages.length===0?(y(),u(a,{key:0},[l(` 骨架屏 `),(y(),u(a,null,S(4,e=>d(`div`,{key:e,class:`notification-list__skeleton`},[p(m,{circle:``,width:36,height:36}),d(`div`,Ee,[p(m,{text:``,width:`60%`,height:14}),p(m,{text:``,width:`90%`,height:12}),p(m,{text:``,width:`40%`,height:10})])])),64))],64)):t.messages.length>0?(y(),u(a,{key:1},[d(`div`,De,[(y(!0),u(a,null,S(t.messages,e=>(y(),c(be,{key:e.id,message:e,onClick:o[2]||=e=>n.$emit(`itemClick`,e),onRead:o[3]||=e=>n.$emit(`read`,e),onDelete:o[4]||=e=>n.$emit(`delete`,e)},null,8,[`message`]))),128))]),l(` 加载更多 `),t.hasMore?(y(),u(`div`,{key:0,class:`notification-list__load-more`,onClick:o[5]||=e=>n.$emit(`loadMore`)},[t.loading?(y(),c(_,{key:0,size:14})):l(`v-if`,!0),d(`span`,null,w(t.loading?`加载中...`:`加载更多`),1)])):l(`v-if`,!0)],64)):(y(),u(a,{key:2},[l(` 空状态 `),d(`div`,Oe,[p(e,{name:`mdi:bell-off-outline`,size:48,class:`notification-list__empty-icon`}),o[8]||=d(`span`,{class:`notification-list__empty-text`},`暂无消息`,-1)])],2112))]),_:1},8,[`style`])])}}}),[[`__scopeId`,`data-v-47e5497f`]]);function Ae(e){return e.includes(`\\`)||e.startsWith(`//`)||Array.from(e).some(e=>e.charCodeAt(0)<32)}function je(e){let t=e?.trim();if(!t||Ae(t))return null;if(/^https?:\/\//i.test(t))try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?null:{kind:`external`,url:e.href}}catch{return null}return/^[a-z][a-z\d+.-]*:/i.test(t)?null:{kind:`internal`,url:t}}const Me={class:`notification-detail`},Ne={class:`notification-detail__back`},Pe={class:`notification-detail__header`},Fe={class:`notification-detail__title`},Ie={class:`notification-detail__meta`},Le={class:`notification-detail__time`},Re={key:0,class:`notification-detail__sender`},ze=[`innerHTML`],Be={key:1,class:`notification-detail__body`},Ve={key:0,class:`notification-detail__footer`};var He=t(m({__name:`NotificationDetail`,props:{message:{},scrollHeight:{default:320}},emits:[`back`,`action`,`navigate`],setup(t,{emit:r}){let i=t,a=r,{formatRelativeTime:o}=$(),m=s(()=>W[i.message.category]??W.system),h=s(()=>K[i.message.priority]??K.normal),_=s(()=>o(i.message.timestamp)),v=s(()=>n(i.message.content||``));function b(){let e=je(i.message.actionUrl);e&&(a(`action`,e.url),e.kind===`external`?window.open(e.url,`_blank`,`noopener,noreferrer`):a(`navigate`,e.url))}return(n,r)=>{let i=A,a=P,o=k,s=j;return y(),u(`div`,Me,[l(` 返回栏 `),d(`div`,Ne,[p(i,{text:``,size:`small`,onClick:r[0]||=e=>n.$emit(`back`)},{icon:D(()=>[p(e,{name:`mdi:arrow-left`,size:16})]),default:D(()=>[r[1]||=f(` 返回列表 `,-1)]),_:1})]),l(` 消息头部 `),d(`div`,Pe,[d(`h3`,Fe,w(t.message.title),1),d(`div`,Ie,[p(a,{type:m.value.color,size:`tiny`,bordered:!1,round:``},{icon:D(()=>[p(e,{name:m.value.icon,size:12},null,8,[`name`])]),default:D(()=>[f(` `+w(m.value.label),1)]),_:1},8,[`type`]),t.message.priority===`urgent`||t.message.priority===`high`?(y(),c(a,{key:0,type:h.value.type,size:`tiny`,bordered:!1,round:``},{default:D(()=>[f(w(h.value.label),1)]),_:1},8,[`type`])):l(`v-if`,!0),d(`span`,Le,w(_.value),1)]),t.message.sender?(y(),u(`div`,Re,[t.message.sender.avatar?(y(),c(o,{key:0,src:t.message.sender.avatar,size:20,round:``},null,8,[`src`])):l(`v-if`,!0),d(`span`,null,w(t.message.sender.name),1)])):l(`v-if`,!0)]),l(` 消息内容 `),p(s,{class:`notification-detail__content`,style:g({maxHeight:`${t.scrollHeight}px`})},{default:D(()=>[t.message.content?(y(),u(`div`,{key:0,class:`notification-detail__body`,innerHTML:v.value},null,8,ze)):(y(),u(`div`,Be,w(t.message.summary),1))]),_:1},8,[`style`]),l(` 操作区 `),t.message.actionUrl?(y(),u(`div`,Ve,[p(i,{type:`primary`,size:`small`,onClick:b},{icon:D(()=>[p(e,{name:`mdi:arrow-right`,size:16})]),default:D(()=>[f(w(t.message.actionText||`查看详情`)+` `,1)]),_:1})])):l(`v-if`,!0)])}}}),[[`__scopeId`,`data-v-dd3085a7`]]);const Ue={class:`c-notification-center`},We={class:`c-notification-center__panel`},Ge={class:`c-notification-center__header`},Ke={class:`c-notification-center__header-extra`};var qe=t(m({name:`C_NotificationCenter`,__name:`index`,props:{fetchNotifications:{},markAsRead:{},markAllRead:{},deleteNotification:{},clearNotifications:{},wsConfig:{},desktopNotification:{type:Boolean,default:!1},maxBadgeCount:{default:99},pollingInterval:{default:6e4},pageSize:{default:20},storageKey:{default:`notification_center`},onError:{}},emits:[`itemClick`,`read`,`allRead`,`delete`,`unreadChange`,`wsStatusChange`,`newMessage`,`navigate`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=X(r,{onNewMessage:e=>i(`newMessage`,e),onWSStatusChange:e=>i(`wsStatusChange`,e)}),m=s(()=>a.messages.value.some(e=>e.status===`unread`&&e.priority===`urgent`)),g=s(()=>({connected:`已连接`,connecting:`连接中...`,disconnected:`未连接`,reconnecting:`重连中...`})[a.wsStatus.value]??`未知`);E(()=>a.unreadCount.value,e=>{i(`unreadChange`,e)});function _(){a.popoverVisible.value=!a.popoverVisible.value}function v(e){a.selectMessage(e),i(`itemClick`,e)}async function b(e){try{await a.markAsRead([e]),i(`read`,[e])}catch{}}async function x(e){try{await a.deleteMessages([e]),i(`delete`,[e])}catch{}}async function S(){let e=a.activeCategory.value===`all`?void 0:a.activeCategory.value;try{await a.markAllAsRead(e),i(`allRead`,e)}catch{}}async function C(){let e=a.activeCategory.value===`all`?void 0:a.activeCategory.value;try{await a.clearMessages(e)}catch{}}function O(){a.popoverVisible.value=!1}function k(){a.clearSelection()}return t({refresh:()=>a.fetchMessages(!0),connectWS:()=>{r.wsConfig&&a.connectWS(r.wsConfig)},disconnectWS:a.disconnectWS,getUnreadCount:()=>a.unreadCount.value,getMessages:()=>a.messages.value.map(e=>({...e})),markRead:e=>a.markAsRead(e),markAllAsRead:e=>a.markAllAsRead(e),requestDesktopPermission:a.requestDesktopPermission}),(e,t)=>{let n=F,s=ee;return y(),u(`div`,Ue,[p(s,{show:T(a).popoverVisible.value,"onUpdate:show":t[1]||=e=>T(a).popoverVisible.value=e,width:420,trigger:`manual`,placement:`bottom-end`,"show-arrow":!1,"content-class":`c-notification-center__popover`,onAfterLeave:k},{trigger:D(()=>[p(ae,{count:T(a).unreadCount.value,"max-count":r.maxBadgeCount,"has-urgent":m.value,onClick:_},null,8,[`count`,`max-count`,`has-urgent`])]),default:D(()=>[d(`div`,We,[l(` 头部标题 `),d(`div`,Ge,[t[2]||=d(`span`,{class:`c-notification-center__title`},`消息中心`,-1),d(`div`,Ke,[l(` WebSocket 连接状态 `),r.wsConfig?(y(),c(n,{key:0,trigger:`hover`,placement:`top`},{trigger:D(()=>[d(`span`,{class:h([`c-notification-center__ws-dot`,`c-notification-center__ws-dot--${T(a).wsStatus.value}`])},null,2)]),default:D(()=>[f(` `+w(g.value),1)]),_:1})):l(`v-if`,!0)])]),l(` 列表 / 详情切换 `),p(o,{name:`slide-fade`,mode:`out-in`},{default:D(()=>[T(a).selectedMessage.value?(y(),c(He,{key:T(a).selectedMessage.value.id,message:T(a).selectedMessage.value,onBack:T(a).clearSelection,onAction:O,onNavigate:t[0]||=e=>i(`navigate`,e)},null,8,[`message`,`onBack`])):(y(),c(ke,{key:1,messages:T(a).filteredMessages.value,"active-category":T(a).activeCategory.value,"unread-by-category":T(a).unreadByCategory.value,"unread-count":T(a).unreadCount.value,loading:T(a).loading.value,"has-more":T(a).hasMore.value,onSwitchCategory:T(a).switchCategory,onItemClick:v,onRead:b,onDelete:x,onMarkAllRead:S,onClear:C,onLoadMore:T(a).loadMore},null,8,[`messages`,`active-category`,`unread-by-category`,`unread-count`,`loading`,`has-more`,`onSwitchCategory`,`onLoadMore`]))]),_:1})])]),_:1},8,[`show`])])}}}),[[`__scopeId`,`data-v-67b5bf1b`]]);export{W as a,L as c,H as d,U as f,K as g,q as h,J as i,R as l,B as m,$ as n,G as o,V as p,X as r,I as s,qe as t,z as u};
|
package/dist/C_OrgChart.css
CHANGED
package/dist/C_OrgChart2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);let e=require(`vue`);const t={class:`c-orgchart__node-wrapper`},n={class:`c-orgchart__node-default`},
|
|
1
|
+
require(`./chunk.cjs`);let e=require(`vue`);const t={class:`c-orgchart__node-wrapper`},n=[`role`,`tabindex`,`aria-label`,`onKeydown`],r={class:`c-orgchart__node-default`},i={key:0,class:`c-orgchart__avatar`},a=[`src`,`alt`],o={class:`c-orgchart__info`},s={class:`c-orgchart__label`},c={key:0,class:`c-orgchart__subtitle`},l=[`aria-label`,`aria-expanded`],u={key:0,class:`c-orgchart__children`},d=(0,e.defineComponent)({name:`OrgNode`,__name:`OrgNode`,props:{node:{},collapsible:{type:Boolean}},emits:[`node-click`,`node-expand`,`node-collapse`],setup(d,{emit:f}){let p=d,m=f,h=(0,e.ref)(!p.node.collapsed);(0,e.watch)(()=>p.node.collapsed,e=>{h.value=!e});let g=(0,e.computed)(()=>p.node.children&&p.node.children.length>0),_=(0,e.computed)(()=>!g.value),v=e=>{e instanceof KeyboardEvent&&e.target!==e.currentTarget||e.target.closest(`button, a, input, select, textarea`)||m(`node-click`,p.node)},y=()=>{h.value=!h.value,h.value?m(`node-expand`,p.node):m(`node-collapse`,p.node)};return(f,p)=>{let m=(0,e.resolveComponent)(`OrgNode`,!0);return(0,e.openBlock)(),(0,e.createElementBlock)(`div`,t,[(0,e.createCommentVNode)(` 节点卡片 `),(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`c-orgchart__node`,[d.node.className,{"c-orgchart__node--leaf":_.value}]])},[(0,e.createElementVNode)(`div`,{class:`c-orgchart__node-select`,role:f.$slots.node?void 0:`button`,tabindex:f.$slots.node?void 0:0,"aria-label":f.$slots.node?void 0:d.node.label,onClick:(0,e.withModifiers)(v,[`stop`]),onKeydown:[(0,e.withKeys)((0,e.withModifiers)(v,[`stop`]),[`enter`]),(0,e.withKeys)((0,e.withModifiers)(v,[`stop`,`prevent`]),[`space`])]},[(0,e.renderSlot)(f.$slots,`node`,{node:d.node,isLeaf:_.value,isExpanded:h.value},()=>[(0,e.createCommentVNode)(` 默认节点渲染 `),(0,e.createElementVNode)(`div`,r,[d.node.avatar?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,i,[(0,e.createElementVNode)(`img`,{src:d.node.avatar,alt:d.node.label},null,8,a)])):(0,e.createCommentVNode)(`v-if`,!0),(0,e.createElementVNode)(`div`,o,[(0,e.createElementVNode)(`div`,s,(0,e.toDisplayString)(d.node.label),1),d.node.subtitle?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,c,(0,e.toDisplayString)(d.node.subtitle),1)):(0,e.createCommentVNode)(`v-if`,!0)])])])],40,n),(0,e.createCommentVNode)(` 折叠/展开按钮 `),d.collapsible&&!_.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,type:`button`,class:`c-orgchart__toggle`,"aria-label":h.value?`折叠 ${d.node.label}`:`展开 ${d.node.label}`,"aria-expanded":h.value,onClick:(0,e.withModifiers)(y,[`stop`])},(0,e.toDisplayString)(h.value?`−`:`+`),9,l)):(0,e.createCommentVNode)(`v-if`,!0)],2),(0,e.createCommentVNode)(` 子节点容器 `),g.value&&h.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,u,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(d.node.children,t=>((0,e.openBlock)(),(0,e.createBlock)(m,{key:t.id,node:t,collapsible:d.collapsible,onNodeClick:p[0]||=e=>f.$emit(`node-click`,e),onNodeExpand:p[1]||=e=>f.$emit(`node-expand`,e),onNodeCollapse:p[2]||=e=>f.$emit(`node-collapse`,e)},null,8,[`node`,`collapsible`]))),128))])):(0,e.createCommentVNode)(`v-if`,!0)])}}}),f={key:0,class:`c-orgchart__controls`},p={class:`c-orgchart__zoom-level`},m=(0,e.defineComponent)({name:`C_OrgChart`,__name:`index`,props:{data:{},direction:{default:`vertical`},lineStyle:{default:`rounded`},lineColor:{default:`#d1d5db`},lineWidth:{default:2},nodeSpacing:{default:24},levelSpacing:{default:48},zoomable:{type:Boolean,default:!0},pannable:{type:Boolean,default:!0},initialZoom:{default:1},minZoom:{default:.3},maxZoom:{default:2},collapsible:{type:Boolean,default:!0}},emits:[`node-click`,`node-expand`,`node-collapse`],setup(t,{expose:n,emit:r}){let i=t,a=r,o=(0,e.ref)(null),s=(0,e.ref)(i.initialZoom),c=(0,e.ref)(0),l=(0,e.ref)(0),u=(0,e.ref)(!1),m=(0,e.ref)(0),h=(0,e.ref)(0),g=(0,e.computed)(()=>Math.round(s.value*100)),_=(0,e.computed)(()=>({"--c-orgchart-line-color":i.lineColor,"--c-orgchart-line-width":`${i.lineWidth}px`,"--c-orgchart-node-spacing":`${i.nodeSpacing}px`,"--c-orgchart-level-spacing":`${i.levelSpacing}px`})),v=(0,e.computed)(()=>({transform:`translate(${c.value}px, ${l.value}px) scale(${s.value})`,transformOrigin:`center top`})),y=e=>{if(!i.zoomable)return;e.preventDefault();let t=e.deltaY>0?-.1:.1,n=Math.max(i.minZoom,Math.min(i.maxZoom,s.value+t));s.value=Math.round(n*100)/100},b=e=>{!i.pannable||e.button!==0||e.target.closest(`.c-orgchart__node, .c-orgchart__controls`)||(u.value=!0,m.value=e.clientX-c.value,h.value=e.clientY-l.value)},x=e=>{u.value&&(c.value=e.clientX-m.value,l.value=e.clientY-h.value)},S=()=>{u.value=!1},C=()=>{s.value=Math.min(i.maxZoom,s.value+.1)},w=()=>{s.value=Math.max(i.minZoom,s.value-.1)},T=()=>{s.value=Math.max(i.minZoom,Math.min(i.maxZoom,i.initialZoom)),c.value=0,l.value=0},E=e=>a(`node-click`,e),D=e=>a(`node-expand`,e),O=e=>a(`node-collapse`,e);return n({zoomIn:C,zoomOut:w,resetView:T,zoom:s}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`containerRef`,ref:o,class:(0,e.normalizeClass)([`c-orgchart`,[`c-orgchart--${i.direction}`,`c-orgchart--line-${i.lineStyle}`]]),style:(0,e.normalizeStyle)(_.value),onWheel:y,onMousedown:b,onMousemove:x,onMouseup:S,onMouseleave:S},[(0,e.createElementVNode)(`div`,{class:`c-orgchart__viewport`,style:(0,e.normalizeStyle)(v.value)},[(0,e.createVNode)(d,{node:i.data,collapsible:i.collapsible,onNodeClick:E,onNodeExpand:D,onNodeCollapse:O},(0,e.createSlots)({_:2},[t.$slots.node?{name:`node`,fn:(0,e.withCtx)(n=>[(0,e.renderSlot)(t.$slots,`node`,(0,e.normalizeProps)((0,e.guardReactiveProps)(n)))]),key:`0`}:void 0]),1032,[`node`,`collapsible`])],4),(0,e.createCommentVNode)(` 缩放控制 `),i.zoomable?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,f,[(0,e.createElementVNode)(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`放大`,onClick:C},` + `),(0,e.createElementVNode)(`span`,p,(0,e.toDisplayString)(g.value)+`%`,1),(0,e.createElementVNode)(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`缩小`,onClick:w},` − `),(0,e.createElementVNode)(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`重置`,onClick:T},` ⟳ `)])):(0,e.createCommentVNode)(`v-if`,!0)],38))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return m}});
|
package/dist/C_OrgChart2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as e,computed as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,createSlots as o,createVNode as s,defineComponent as c,guardReactiveProps as l,normalizeClass as u,normalizeProps as d,normalizeStyle as f,openBlock as p,ref as m,renderList as h,renderSlot as g,resolveComponent as _,toDisplayString as v,
|
|
1
|
+
import{Fragment as e,computed as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,createSlots as o,createVNode as s,defineComponent as c,guardReactiveProps as l,normalizeClass as u,normalizeProps as d,normalizeStyle as f,openBlock as p,ref as m,renderList as h,renderSlot as g,resolveComponent as _,toDisplayString as v,watch as y,withCtx as b,withKeys as x,withModifiers as S}from"vue";const C={class:`c-orgchart__node-wrapper`},w=[`role`,`tabindex`,`aria-label`,`onKeydown`],T={class:`c-orgchart__node-default`},E={key:0,class:`c-orgchart__avatar`},D=[`src`,`alt`],O={class:`c-orgchart__info`},k={class:`c-orgchart__label`},A={key:0,class:`c-orgchart__subtitle`},j=[`aria-label`,`aria-expanded`],M={key:0,class:`c-orgchart__children`},N=c({name:`OrgNode`,__name:`OrgNode`,props:{node:{},collapsible:{type:Boolean}},emits:[`node-click`,`node-expand`,`node-collapse`],setup(o,{emit:s}){let c=o,l=s,d=m(!c.node.collapsed);y(()=>c.node.collapsed,e=>{d.value=!e});let f=t(()=>c.node.children&&c.node.children.length>0),b=t(()=>!f.value),N=e=>{e instanceof KeyboardEvent&&e.target!==e.currentTarget||e.target.closest(`button, a, input, select, textarea`)||l(`node-click`,c.node)},P=()=>{d.value=!d.value,d.value?l(`node-expand`,c.node):l(`node-collapse`,c.node)};return(t,s)=>{let c=_(`OrgNode`,!0);return p(),i(`div`,C,[r(` 节点卡片 `),a(`div`,{class:u([`c-orgchart__node`,[o.node.className,{"c-orgchart__node--leaf":b.value}]])},[a(`div`,{class:`c-orgchart__node-select`,role:t.$slots.node?void 0:`button`,tabindex:t.$slots.node?void 0:0,"aria-label":t.$slots.node?void 0:o.node.label,onClick:S(N,[`stop`]),onKeydown:[x(S(N,[`stop`]),[`enter`]),x(S(N,[`stop`,`prevent`]),[`space`])]},[g(t.$slots,`node`,{node:o.node,isLeaf:b.value,isExpanded:d.value},()=>[r(` 默认节点渲染 `),a(`div`,T,[o.node.avatar?(p(),i(`div`,E,[a(`img`,{src:o.node.avatar,alt:o.node.label},null,8,D)])):r(`v-if`,!0),a(`div`,O,[a(`div`,k,v(o.node.label),1),o.node.subtitle?(p(),i(`div`,A,v(o.node.subtitle),1)):r(`v-if`,!0)])])])],40,w),r(` 折叠/展开按钮 `),o.collapsible&&!b.value?(p(),i(`button`,{key:0,type:`button`,class:`c-orgchart__toggle`,"aria-label":d.value?`折叠 ${o.node.label}`:`展开 ${o.node.label}`,"aria-expanded":d.value,onClick:S(P,[`stop`])},v(d.value?`−`:`+`),9,j)):r(`v-if`,!0)],2),r(` 子节点容器 `),f.value&&d.value?(p(),i(`div`,M,[(p(!0),i(e,null,h(o.node.children,e=>(p(),n(c,{key:e.id,node:e,collapsible:o.collapsible,onNodeClick:s[0]||=e=>t.$emit(`node-click`,e),onNodeExpand:s[1]||=e=>t.$emit(`node-expand`,e),onNodeCollapse:s[2]||=e=>t.$emit(`node-collapse`,e)},null,8,[`node`,`collapsible`]))),128))])):r(`v-if`,!0)])}}}),P={key:0,class:`c-orgchart__controls`},F={class:`c-orgchart__zoom-level`},I=c({name:`C_OrgChart`,__name:`index`,props:{data:{},direction:{default:`vertical`},lineStyle:{default:`rounded`},lineColor:{default:`#d1d5db`},lineWidth:{default:2},nodeSpacing:{default:24},levelSpacing:{default:48},zoomable:{type:Boolean,default:!0},pannable:{type:Boolean,default:!0},initialZoom:{default:1},minZoom:{default:.3},maxZoom:{default:2},collapsible:{type:Boolean,default:!0}},emits:[`node-click`,`node-expand`,`node-collapse`],setup(e,{expose:n,emit:c}){let h=e,_=c,y=m(null),x=m(h.initialZoom),S=m(0),C=m(0),w=m(!1),T=m(0),E=m(0),D=t(()=>Math.round(x.value*100)),O=t(()=>({"--c-orgchart-line-color":h.lineColor,"--c-orgchart-line-width":`${h.lineWidth}px`,"--c-orgchart-node-spacing":`${h.nodeSpacing}px`,"--c-orgchart-level-spacing":`${h.levelSpacing}px`})),k=t(()=>({transform:`translate(${S.value}px, ${C.value}px) scale(${x.value})`,transformOrigin:`center top`})),A=e=>{if(!h.zoomable)return;e.preventDefault();let t=e.deltaY>0?-.1:.1,n=Math.max(h.minZoom,Math.min(h.maxZoom,x.value+t));x.value=Math.round(n*100)/100},j=e=>{!h.pannable||e.button!==0||e.target.closest(`.c-orgchart__node, .c-orgchart__controls`)||(w.value=!0,T.value=e.clientX-S.value,E.value=e.clientY-C.value)},M=e=>{w.value&&(S.value=e.clientX-T.value,C.value=e.clientY-E.value)},I=()=>{w.value=!1},L=()=>{x.value=Math.min(h.maxZoom,x.value+.1)},R=()=>{x.value=Math.max(h.minZoom,x.value-.1)},z=()=>{x.value=Math.max(h.minZoom,Math.min(h.maxZoom,h.initialZoom)),S.value=0,C.value=0},B=e=>_(`node-click`,e),V=e=>_(`node-expand`,e),H=e=>_(`node-collapse`,e);return n({zoomIn:L,zoomOut:R,resetView:z,zoom:x}),(e,t)=>(p(),i(`div`,{ref_key:`containerRef`,ref:y,class:u([`c-orgchart`,[`c-orgchart--${h.direction}`,`c-orgchart--line-${h.lineStyle}`]]),style:f(O.value),onWheel:A,onMousedown:j,onMousemove:M,onMouseup:I,onMouseleave:I},[a(`div`,{class:`c-orgchart__viewport`,style:f(k.value)},[s(N,{node:h.data,collapsible:h.collapsible,onNodeClick:B,onNodeExpand:V,onNodeCollapse:H},o({_:2},[e.$slots.node?{name:`node`,fn:b(t=>[g(e.$slots,`node`,d(l(t)))]),key:`0`}:void 0]),1032,[`node`,`collapsible`])],4),r(` 缩放控制 `),h.zoomable?(p(),i(`div`,P,[a(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`放大`,onClick:L},` + `),a(`span`,F,v(D.value)+`%`,1),a(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`缩小`,onClick:R},` − `),a(`button`,{type:`button`,class:`c-orgchart__control-btn`,title:`重置`,onClick:z},` ⟳ `)])):r(`v-if`,!0)],38))}});export{I as t};
|
package/dist/C_Progress2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);let e=require(`vue`),t=require(`naive-ui`);const n=(0,e.defineComponent)({name:`C_Progress`,__name:`index`,props:{percentage:{default:0},isAnimation:{type:Boolean,default:!1},time:{default:3e3},type:{},borderRadius:{},circleGap:{},color:{},fillBorderRadius:{},gapDegree:{},gapOffsetDegree:{},height:{},indicatorPlacement:{default:`outside`},indicatorTextColor:{},offsetDegree:{},railColor:{},railStyle:{},showIndicator:{type:Boolean,default:!0},status:{default:`default`},strokeWidth:{default:7},unit:{default:`%`}},setup(n){let r=n,i=(0,e.useSlots)(),a=(0,e.ref)(Array.isArray(r.percentage)?[...r.percentage]:
|
|
1
|
+
require(`./chunk.cjs`);let e=require(`vue`),t=require(`naive-ui`);const n=(0,e.defineComponent)({name:`C_Progress`,__name:`index`,props:{percentage:{default:0},isAnimation:{type:Boolean,default:!1},time:{default:3e3},type:{},borderRadius:{},circleGap:{},color:{},fillBorderRadius:{},gapDegree:{},gapOffsetDegree:{},height:{},indicatorPlacement:{default:`outside`},indicatorTextColor:{},offsetDegree:{},railColor:{},railStyle:{},showIndicator:{type:Boolean,default:!0},status:{default:`default`},strokeWidth:{default:7},unit:{default:`%`}},setup(n){let r=n,i=(0,e.useSlots)(),a=(0,e.ref)(r.isAnimation&&r.type!==`multiple-circle`?0:Array.isArray(r.percentage)?[...r.percentage]:r.percentage),o=(0,e.computed)(()=>!!i.indicator),s=(0,e.computed)(()=>r.type===`multiple-circle`?Array.isArray(a.value)?a.value:[a.value]:Array.isArray(a.value)?a.value[0]:a.value),c=(0,e.computed)(()=>({type:r.type,borderRadius:r.borderRadius,circleGap:r.circleGap,color:r.color,fillBorderRadius:r.fillBorderRadius,gapDegree:r.gapDegree,gapOffsetDegree:r.gapOffsetDegree,height:r.height,indicatorPlacement:r.indicatorPlacement,indicatorTextColor:r.indicatorTextColor,offsetDegree:r.offsetDegree,railColor:r.railColor,railStyle:r.railStyle,showIndicator:r.showIndicator,status:r.status,strokeWidth:r.strokeWidth,unit:r.unit})),l=!1,u=null;function d(){u!==null&&cancelAnimationFrame(u),u=null}function f(e,t){let n=Array.isArray(a.value)?a.value[0]:a.value,r=Number.isFinite(n)?n:0;if(r===e)return;let i=performance.now();function o(n){let s=Math.min(Math.max((n-i)/t,0),1);a.value=Math.round(r+(e-r)*s),u=s<1?requestAnimationFrame(o):null}u=requestAnimationFrame(o)}function p(){d();let e=r.percentage;if(r.type===`multiple-circle`){a.value=Array.isArray(e)?[...e]:[e];return}let t=Array.isArray(e)?e[0]:e,n=Number.isFinite(t)?t:0,i=Number.isFinite(r.time)?Math.max(0,r.time):0;if(!r.isAnimation||i===0){a.value=n;return}f(n,i)}return(0,e.watch)([()=>r.percentage,()=>r.isAnimation,()=>r.type,()=>r.time],()=>{l&&p()},{deep:!0}),(0,e.onMounted)(()=>{l=!0,p()}),(0,e.onBeforeUnmount)(()=>{l=!1,d()}),(r,i)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.NProgress),(0,e.mergeProps)(c.value,{percentage:s.value,processing:n.isAnimation}),(0,e.createSlots)({_:2},[n.showIndicator&&o.value?{name:`default`,fn:(0,e.withCtx)(()=>[(0,e.renderSlot)(r.$slots,`indicator`)]),key:`0`}:void 0]),1040,[`percentage`,`processing`]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
package/dist/C_Progress2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{computed as e,createBlock as t,createSlots as n,defineComponent as r,mergeProps as i,
|
|
1
|
+
import{computed as e,createBlock as t,createSlots as n,defineComponent as r,mergeProps as i,onBeforeUnmount as a,onMounted as o,openBlock as s,ref as c,renderSlot as l,unref as u,useSlots as d,watch as f,withCtx as p}from"vue";import{NProgress as m}from"naive-ui";const h=r({name:`C_Progress`,__name:`index`,props:{percentage:{default:0},isAnimation:{type:Boolean,default:!1},time:{default:3e3},type:{},borderRadius:{},circleGap:{},color:{},fillBorderRadius:{},gapDegree:{},gapOffsetDegree:{},height:{},indicatorPlacement:{default:`outside`},indicatorTextColor:{},offsetDegree:{},railColor:{},railStyle:{},showIndicator:{type:Boolean,default:!0},status:{default:`default`},strokeWidth:{default:7},unit:{default:`%`}},setup(r){let h=r,g=d(),_=c(h.isAnimation&&h.type!==`multiple-circle`?0:Array.isArray(h.percentage)?[...h.percentage]:h.percentage),v=e(()=>!!g.indicator),y=e(()=>h.type===`multiple-circle`?Array.isArray(_.value)?_.value:[_.value]:Array.isArray(_.value)?_.value[0]:_.value),b=e(()=>({type:h.type,borderRadius:h.borderRadius,circleGap:h.circleGap,color:h.color,fillBorderRadius:h.fillBorderRadius,gapDegree:h.gapDegree,gapOffsetDegree:h.gapOffsetDegree,height:h.height,indicatorPlacement:h.indicatorPlacement,indicatorTextColor:h.indicatorTextColor,offsetDegree:h.offsetDegree,railColor:h.railColor,railStyle:h.railStyle,showIndicator:h.showIndicator,status:h.status,strokeWidth:h.strokeWidth,unit:h.unit})),x=!1,S=null;function C(){S!==null&&cancelAnimationFrame(S),S=null}function w(e,t){let n=Array.isArray(_.value)?_.value[0]:_.value,r=Number.isFinite(n)?n:0;if(r===e)return;let i=performance.now();function a(n){let o=Math.min(Math.max((n-i)/t,0),1);_.value=Math.round(r+(e-r)*o),S=o<1?requestAnimationFrame(a):null}S=requestAnimationFrame(a)}function T(){C();let e=h.percentage;if(h.type===`multiple-circle`){_.value=Array.isArray(e)?[...e]:[e];return}let t=Array.isArray(e)?e[0]:e,n=Number.isFinite(t)?t:0,r=Number.isFinite(h.time)?Math.max(0,h.time):0;if(!h.isAnimation||r===0){_.value=n;return}w(n,r)}return f([()=>h.percentage,()=>h.isAnimation,()=>h.type,()=>h.time],()=>{x&&T()},{deep:!0}),o(()=>{x=!0,T()}),a(()=>{x=!1,C()}),(e,a)=>(s(),t(u(m),i(b.value,{percentage:y.value,processing:r.isAnimation}),n({_:2},[r.showIndicator&&v.value?{name:`default`,fn:p(()=>[l(e.$slots,`indicator`)]),key:`0`}:void 0]),1040,[`percentage`,`processing`]))}});export{h as t};
|
package/dist/C_QRCode.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* unplugin-vue-components disabled *//* C_QRCode styles */
|
|
2
|
-
.c-qrcode[data-v-
|
|
2
|
+
.c-qrcode[data-v-d73134a9] {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
align-items: center;
|
|
6
6
|
gap: 8px;
|
|
7
7
|
max-width: 100%;
|
|
8
8
|
}
|
|
9
|
-
.c-qrcode .qrcode-wrapper[data-v-
|
|
9
|
+
.c-qrcode .qrcode-wrapper[data-v-d73134a9] {
|
|
10
10
|
display: inline-block;
|
|
11
11
|
padding: 8px;
|
|
12
12
|
background: var(--c-bg-content, #fff);
|
|
@@ -16,30 +16,30 @@
|
|
|
16
16
|
max-width: 100%;
|
|
17
17
|
line-height: 0;
|
|
18
18
|
}
|
|
19
|
-
.c-qrcode .qrcode-wrapper.with-border[data-v-
|
|
19
|
+
.c-qrcode .qrcode-wrapper.with-border[data-v-d73134a9] {
|
|
20
20
|
border: 1px dashed var(--c-border-default, #e0e0e6);
|
|
21
21
|
}
|
|
22
|
-
.c-qrcode .qrcode-wrapper[data-v-
|
|
22
|
+
.c-qrcode .qrcode-wrapper[data-v-d73134a9]:hover {
|
|
23
23
|
border-color: var(--primary-color, #409eff);
|
|
24
24
|
box-shadow: var(--c-shadow-sm, 0 1px 4px rgba(0, 0, 0, 0.08));
|
|
25
25
|
}
|
|
26
|
-
.c-qrcode .qrcode-wrapper canvas[data-v-
|
|
26
|
+
.c-qrcode .qrcode-wrapper canvas[data-v-d73134a9] {
|
|
27
27
|
display: block;
|
|
28
28
|
max-width: 100%;
|
|
29
29
|
height: auto;
|
|
30
30
|
}
|
|
31
|
-
.c-qrcode .qrcode-wrapper .qrcode-svg[data-v-
|
|
31
|
+
.c-qrcode .qrcode-wrapper .qrcode-svg[data-v-d73134a9] {
|
|
32
32
|
display: flex;
|
|
33
33
|
align-items: center;
|
|
34
34
|
justify-content: center;
|
|
35
35
|
max-width: 100%;
|
|
36
36
|
}
|
|
37
|
-
.c-qrcode .qrcode-wrapper .qrcode-svg[data-v-
|
|
37
|
+
.c-qrcode .qrcode-wrapper .qrcode-svg[data-v-d73134a9] svg {
|
|
38
38
|
width: 100%;
|
|
39
39
|
height: 100%;
|
|
40
40
|
display: block;
|
|
41
41
|
}
|
|
42
|
-
.c-qrcode .qrcode-label[data-v-
|
|
42
|
+
.c-qrcode .qrcode-label[data-v-d73134a9] {
|
|
43
43
|
font-size: 14px;
|
|
44
44
|
color: var(--c-text-secondary, #999);
|
|
45
45
|
text-align: center;
|