@robot-admin/naive-ui-components 0.31.2 → 0.31.4
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 +13 -0
- package/README.md +1 -1
- package/README_EN.md +1 -1
- package/dist/C_Chat.css +28 -28
- package/dist/C_Chat2.cjs +1 -1
- package/dist/C_Chat2.js +1 -1
- package/dist/C_FilePreview.css +49 -49
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_FormModal.css +1 -1
- package/dist/C_FormModal2.cjs +1 -1
- package/dist/C_FormModal2.js +1 -1
- package/dist/C_FormSearch.css +71 -71
- package/dist/C_GlobalSearch.css +125 -125
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Table.base.css +109 -109
- package/dist/C_Table.css +109 -109
- package/dist/C_Table2.cjs +3 -3
- package/dist/C_Table2.js +3 -3
- package/dist/C_Time.css +4 -4
- package/dist/C_Time2.cjs +1 -1
- package/dist/C_Time2.js +1 -1
- package/dist/C_Transfer.css +3 -3
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +28 -28
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants2.d.cts +2 -2
- package/dist/constants2.d.ts +2 -2
- package/dist/constants3.d.cts +2 -2
- package/dist/constants3.d.ts +2 -2
- package/dist/constants4.d.cts +5 -5
- package/dist/constants4.d.ts +5 -5
- package/dist/data2.d.cts +8 -8
- package/dist/data2.d.ts +8 -8
- package/dist/formField.d.cts +2 -2
- package/dist/formField.d.ts +2 -2
- package/dist/index.vue.d.cts +4 -4
- package/dist/index.vue.d.ts +4 -4
- package/dist/index10.vue.d.cts +6 -6
- package/dist/index10.vue.d.ts +3 -3
- package/dist/index11.vue.d.cts +3 -3
- package/dist/index12.vue.d.ts +2 -2
- package/dist/index13.vue.d.cts +2 -2
- package/dist/index14.vue.d.ts +2 -2
- package/dist/index15.vue.d.cts +2 -2
- package/dist/index16.vue.d.ts +5 -5
- package/dist/index17.vue.d.cts +5 -5
- package/dist/index17.vue.d.ts +3 -3
- package/dist/index18.vue.d.cts +3 -3
- package/dist/index18.vue.d.ts +1 -1
- package/dist/index19.vue.d.cts +1 -1
- package/dist/index19.vue.d.ts +1 -1
- package/dist/index2.vue.d.cts +1 -1
- package/dist/index2.vue.d.ts +1 -1
- package/dist/index20.vue.d.cts +1 -1
- package/dist/index20.vue.d.ts +4 -4
- package/dist/index21.vue.d.cts +4 -4
- package/dist/index21.vue.d.ts +2 -2
- package/dist/index22.vue.d.cts +1 -1
- package/dist/index22.vue.d.ts +1 -1
- package/dist/index23.vue.d.cts +2 -2
- package/dist/index23.vue.d.ts +2 -2
- package/dist/index26.vue.d.cts +2 -2
- package/dist/index26.vue.d.ts +2 -2
- package/dist/index27.vue.d.cts +3 -3
- package/dist/index27.vue.d.ts +3 -3
- package/dist/index29.vue.d.cts +1 -1
- package/dist/index29.vue.d.ts +1 -1
- package/dist/index3.vue.d.cts +4 -4
- package/dist/index3.vue.d.ts +4 -4
- package/dist/index30.vue.d.cts +4 -4
- package/dist/index30.vue.d.ts +4 -4
- package/dist/index31.vue.d.cts +2 -2
- package/dist/index31.vue.d.ts +2 -2
- package/dist/index5.vue.d.cts +2 -2
- package/dist/index6.vue.d.ts +2 -2
- package/dist/index7.vue.d.cts +2 -2
- package/dist/index8.vue.d.ts +2 -2
- package/dist/index9.vue.d.cts +2 -2
- package/dist/index9.vue.d.ts +6 -6
- 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/serializeSearch.cjs +1 -1
- package/dist/serializeSearch.js +1 -1
- package/dist/style.css +419 -419
- package/dist/useCollapsePanel.d.cts +6 -6
- package/dist/useCollapsePanel.d.ts +6 -6
- package/dist/useCropperCore.d.cts +6 -6
- package/dist/useCropperCore.d.ts +6 -6
- package/dist/useDraggableLayout.d.cts +2 -2
- package/dist/useDraggableLayout.d.ts +2 -2
- package/dist/useDynamicFormState.d.cts +3 -3
- package/dist/useDynamicFormState.d.ts +3 -3
- package/dist/useEdgeInteraction.d.cts +1 -1
- package/dist/useEdgeInteraction.d.ts +1 -1
- package/dist/useFullscreen.d.cts +3 -3
- package/dist/useFullscreen.d.ts +3 -3
- package/dist/useInfiniteScroll.d.cts +2 -2
- package/dist/useInfiniteScroll.d.ts +2 -2
- package/dist/useQRCode.d.cts +3 -3
- package/dist/useQRCode.d.ts +3 -3
- package/dist/useSignatureHistory.d.cts +1 -1
- package/dist/useSignatureHistory.d.ts +1 -1
- package/dist/useSplitResize.d.cts +7 -7
- package/dist/useSplitResize.d.ts +7 -7
- package/dist/useTableQuery.d.cts +11 -11
- package/dist/useTableQuery.d.ts +11 -11
- package/dist/useTimeSelection.d.cts +12 -0
- package/dist/useTimeSelection.d.ts +12 -0
- package/dist/useWorkflowValidation.d.cts +36 -36
- package/dist/useWorkflowValidation.d.ts +36 -36
- package/dist/verification.d.cts +2 -2
- package/dist/verification.d.ts +2 -2
- package/dist/virtualList.cjs +1 -0
- package/dist/virtualList.js +1 -0
- package/docs/guides/tree.md +2 -2
- package/docs/guides/usage.en.md +3 -1
- package/docs/guides/usage.md +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @robot-admin/naive-ui-components
|
|
2
2
|
|
|
3
|
+
## 0.31.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 避免表单异步钩子保存过期草稿,补齐搜索校验反馈。上传文件选择与移除按记录隔离,表格跨页选择遵守上限,树异步加载尊重折叠与加载器切换。统一时间格式的显示与校验,切换预览文件时清除旧大小。
|
|
8
|
+
- 修复 Node 20 下从 ESM 入口导入时的虚拟列表依赖兼容问题。
|
|
9
|
+
|
|
10
|
+
## 0.31.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 表单弹窗在保存期间锁定草稿,表格批量操作完成时保留后续修改的选择。远程 Excel 预览在读取中执行大小限制,时间范围按实际显示精度限制结束时间。
|
|
15
|
+
|
|
3
16
|
## 0.31.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
| 按需消费 | 61 个独立组件入口、自动导入 Resolver、组件样式入口,以及表单/表格的基础样式层级 |
|
|
34
34
|
| 独立接入 | 支持全量注册与局部导入;反馈、文案和全局配置可由宿主提供,表单弹窗可接入结构兼容的 Headless CRUD |
|
|
35
35
|
|
|
36
|
-
组件库负责界面与交互。业务接口、身份权限、上传服务和第三方平台配置由应用接入。当前仓库版本 **0.31.
|
|
36
|
+
组件库负责界面与交互。业务接口、身份权限、上传服务和第三方平台配置由应用接入。当前仓库版本 **0.31.4**,版本变化见 [CHANGELOG](./CHANGELOG.md)。
|
|
37
37
|
|
|
38
38
|
搜索条件、录入字段和操作按钮可以由响应式配置生成。筛选和编辑共享紧凑密度,支持校验、异步选项和业务弹窗。后端字典或权限由项目接入,表单和搜索消费普通选项,表格消费普通列配置。
|
|
39
39
|
|
package/README_EN.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
| Selective loading | 61 component entries, an auto-import resolver, component CSS and base styles for forms and tables |
|
|
34
34
|
| Application integration | Global registration or local imports; injectable feedback, locale and defaults; form dialogs compatible with structurally matching headless CRUD controllers |
|
|
35
35
|
|
|
36
|
-
The library handles UI and interaction. Applications supply business APIs, authentication, authorization, upload services and platform configuration. The current repository version is **0.31.
|
|
36
|
+
The library handles UI and interaction. Applications supply business APIs, authentication, authorization, upload services and platform configuration. The current repository version is **0.31.4**. See the [changelog](./CHANGELOG.md) for release details.
|
|
37
37
|
|
|
38
38
|
Use `C_Select` for standalone selections and freeform tags. Multiple selections in forms and search share the compact tag summary. Date and time fields can bind directly to formatted API strings. See the [composition examples](./docs/guides/data-workflows.md#多选标签和日期时间) (Chinese).
|
|
39
39
|
|
package/dist/C_Chat.css
CHANGED
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
.border[data-v-47cd7e6f]{border-width:1px;}
|
|
368
368
|
|
|
369
369
|
/* ─── CSS 变量(基于项目主题变量,自动适配明暗) ───────────────────────── */
|
|
370
|
-
.c-chat[data-v-
|
|
370
|
+
.c-chat[data-v-34763202] {
|
|
371
371
|
--chat-bg: var(--c-bg-card, var(--card-color, #fff));
|
|
372
372
|
--chat-sidebar-bg: var(--c-bg-body, var(--body-color, #f8fafc));
|
|
373
373
|
--chat-sidebar-width: 280px;
|
|
@@ -409,7 +409,7 @@
|
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
/* ─── 联系人侧栏 ──────────────────────────────────────── */
|
|
412
|
-
.c-chat__sidebar[data-v-
|
|
412
|
+
.c-chat__sidebar[data-v-34763202] {
|
|
413
413
|
display: flex;
|
|
414
414
|
flex-direction: column;
|
|
415
415
|
width: var(--chat-sidebar-width);
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
border-right: 1px solid var(--chat-border);
|
|
419
419
|
box-shadow: 2px 0 8px var(--chat-shadow-light);
|
|
420
420
|
}
|
|
421
|
-
.c-chat__sidebar-header[data-v-
|
|
421
|
+
.c-chat__sidebar-header[data-v-34763202] {
|
|
422
422
|
display: flex;
|
|
423
423
|
align-items: center;
|
|
424
424
|
gap: 8px;
|
|
@@ -428,30 +428,30 @@
|
|
|
428
428
|
font-weight: 600;
|
|
429
429
|
font-size: 15px;
|
|
430
430
|
}
|
|
431
|
-
.c-chat__search[data-v-
|
|
431
|
+
.c-chat__search[data-v-34763202] {
|
|
432
432
|
padding: 8px 12px;
|
|
433
433
|
}
|
|
434
|
-
.c-chat__contact-list[data-v-
|
|
434
|
+
.c-chat__contact-list[data-v-34763202],[data-v-34763202] .c-chat__contact-list.v-vl {
|
|
435
435
|
flex: 1;
|
|
436
436
|
overflow-y: auto;
|
|
437
437
|
overscroll-behavior: contain;
|
|
438
438
|
}
|
|
439
|
-
.c-chat__contact-list[data-v-
|
|
439
|
+
.c-chat__contact-list[data-v-34763202]::-webkit-scrollbar,[data-v-34763202] .c-chat__contact-list.v-vl::-webkit-scrollbar {
|
|
440
440
|
width: 4px;
|
|
441
441
|
}
|
|
442
|
-
.c-chat__contact-list[data-v-
|
|
442
|
+
.c-chat__contact-list[data-v-34763202]::-webkit-scrollbar-thumb,[data-v-34763202] .c-chat__contact-list.v-vl::-webkit-scrollbar-thumb {
|
|
443
443
|
background: var(--chat-scrollbar-thumb);
|
|
444
444
|
border-radius: 2px;
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
/* ─── 主聊天区域 ──────────────────────────────────────── */
|
|
448
|
-
.c-chat__main[data-v-
|
|
448
|
+
.c-chat__main[data-v-34763202] {
|
|
449
449
|
flex: 1;
|
|
450
450
|
display: flex;
|
|
451
451
|
flex-direction: column;
|
|
452
452
|
min-width: 0;
|
|
453
453
|
}
|
|
454
|
-
.c-chat__header[data-v-
|
|
454
|
+
.c-chat__header[data-v-34763202] {
|
|
455
455
|
display: flex;
|
|
456
456
|
align-items: center;
|
|
457
457
|
gap: 10px;
|
|
@@ -463,14 +463,14 @@
|
|
|
463
463
|
font-weight: 600;
|
|
464
464
|
font-size: 15px;
|
|
465
465
|
}
|
|
466
|
-
.c-chat__header-status[data-v-
|
|
466
|
+
.c-chat__header-status[data-v-34763202] {
|
|
467
467
|
font-size: 12px;
|
|
468
468
|
font-weight: 400;
|
|
469
469
|
color: var(--chat-text-secondary);
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
/* ─── 消息区域 ────────────────────────────────────────── */
|
|
473
|
-
.c-chat__messages[data-v-
|
|
473
|
+
.c-chat__messages[data-v-34763202],[data-v-34763202] .c-chat__messages--virtual {
|
|
474
474
|
flex: 1;
|
|
475
475
|
overflow-y: auto;
|
|
476
476
|
overscroll-behavior: contain;
|
|
@@ -479,18 +479,18 @@
|
|
|
479
479
|
flex-direction: column;
|
|
480
480
|
background: color-mix(in srgb, var(--c-bg-body, var(--body-color, #f8fafc)) 50%, var(--c-bg-card, var(--card-color, #fff)));
|
|
481
481
|
}
|
|
482
|
-
.c-chat__messages[data-v-
|
|
482
|
+
.c-chat__messages[data-v-34763202]::-webkit-scrollbar,[data-v-34763202] .c-chat__messages--virtual::-webkit-scrollbar {
|
|
483
483
|
width: 4px;
|
|
484
484
|
}
|
|
485
|
-
.c-chat__messages[data-v-
|
|
485
|
+
.c-chat__messages[data-v-34763202]::-webkit-scrollbar-thumb,[data-v-34763202] .c-chat__messages--virtual::-webkit-scrollbar-thumb {
|
|
486
486
|
background: var(--chat-scrollbar-thumb);
|
|
487
487
|
border-radius: 2px;
|
|
488
488
|
}
|
|
489
|
-
.c-chat__load-more[data-v-
|
|
489
|
+
.c-chat__load-more[data-v-34763202] {
|
|
490
490
|
text-align: center;
|
|
491
491
|
padding: 8px;
|
|
492
492
|
}
|
|
493
|
-
.c-chat__empty[data-v-
|
|
493
|
+
.c-chat__empty[data-v-34763202] {
|
|
494
494
|
flex: 1;
|
|
495
495
|
display: flex;
|
|
496
496
|
align-items: center;
|
|
@@ -500,7 +500,7 @@
|
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
/* ─── 输入区域 ────────────────────────────────────────── */
|
|
503
|
-
.c-chat__input-area[data-v-
|
|
503
|
+
.c-chat__input-area[data-v-34763202] {
|
|
504
504
|
display: flex;
|
|
505
505
|
align-items: center;
|
|
506
506
|
gap: 8px;
|
|
@@ -509,21 +509,21 @@
|
|
|
509
509
|
background: var(--chat-input-bg);
|
|
510
510
|
border-top: 1px solid var(--chat-border);
|
|
511
511
|
}
|
|
512
|
-
.c-chat__input-actions[data-v-
|
|
512
|
+
.c-chat__input-actions[data-v-34763202] {
|
|
513
513
|
display: flex;
|
|
514
514
|
gap: 4px;
|
|
515
515
|
flex-shrink: 0;
|
|
516
516
|
}
|
|
517
|
-
.c-chat__input-wrap[data-v-
|
|
517
|
+
.c-chat__input-wrap[data-v-34763202] {
|
|
518
518
|
flex: 1;
|
|
519
519
|
min-width: 0;
|
|
520
520
|
}
|
|
521
|
-
.c-chat__send-btn[data-v-
|
|
521
|
+
.c-chat__send-btn[data-v-34763202] {
|
|
522
522
|
flex-shrink: 0;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
/* ─── 空态 ────────────────────────────────────────────── */
|
|
526
|
-
.c-chat__no-chat[data-v-
|
|
526
|
+
.c-chat__no-chat[data-v-34763202] {
|
|
527
527
|
flex: 1;
|
|
528
528
|
display: flex;
|
|
529
529
|
flex-direction: column;
|
|
@@ -532,36 +532,36 @@
|
|
|
532
532
|
gap: 12px;
|
|
533
533
|
color: var(--chat-text-secondary);
|
|
534
534
|
}
|
|
535
|
-
.c-chat__no-chat-icon[data-v-
|
|
535
|
+
.c-chat__no-chat-icon[data-v-34763202] {
|
|
536
536
|
font-size: 48px;
|
|
537
537
|
opacity: 0.3;
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
/* ─── 响应式 ──────────────────────────────────────────── */
|
|
541
541
|
@media (max-width: 640px) {
|
|
542
|
-
.c-chat[data-v-
|
|
542
|
+
.c-chat[data-v-34763202] {
|
|
543
543
|
--chat-sidebar-width: 72px;
|
|
544
544
|
}
|
|
545
|
-
.c-chat__search[data-v-
|
|
545
|
+
.c-chat__search[data-v-34763202] {
|
|
546
546
|
display: none;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
.c-chat__main[data-v-
|
|
549
|
+
.c-chat__main[data-v-34763202] {
|
|
550
550
|
min-height: 0;
|
|
551
551
|
}
|
|
552
|
-
.c-chat__messages[data-v-
|
|
552
|
+
.c-chat__messages[data-v-34763202],[data-v-34763202] .c-chat__messages--virtual {
|
|
553
553
|
min-height: 0;
|
|
554
554
|
}
|
|
555
|
-
.c-chat__messages--virtual[data-v-
|
|
555
|
+
.c-chat__messages--virtual[data-v-34763202],[data-v-34763202] .c-chat__messages--virtual {
|
|
556
556
|
display: block;
|
|
557
557
|
padding: 0;
|
|
558
558
|
overflow-anchor: none;
|
|
559
559
|
}
|
|
560
|
-
.c-chat__message-items[data-v-
|
|
560
|
+
.c-chat__message-items[data-v-34763202] {
|
|
561
561
|
flex: 1;
|
|
562
562
|
display: flex;
|
|
563
563
|
flex-direction: column;
|
|
564
564
|
}
|
|
565
|
-
.c-chat__contact-list[data-v-
|
|
565
|
+
.c-chat__contact-list[data-v-34763202],[data-v-34763202] .c-chat__contact-list.v-vl {
|
|
566
566
|
min-height: 0;
|
|
567
567
|
}
|
package/dist/C_Chat2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./C_Icon2.cjs`),n=require(`./export-helper.cjs`);let r=require(`vue`),i=require(`naive-ui`),a=require(`vueuc`);const o=[`data-message-id`],s={key:0,class:`c-chat__time-divider`},c={key:0,class:`c-chat__msg-avatar`},l=[`src`],u={key:1,class:`c-chat__avatar-fallback`},d={class:`c-chat__msg-body`},f={key:0,class:`c-chat__msg-username`},p={key:1,class:`c-chat__bubble`},m=[`aria-label`],h=[`src`,`alt`],g={class:`c-chat__file-info`},_={class:`c-chat__file-name`},v={key:0,class:`c-chat__file-size`},y={key:4,class:`c-chat__msg-time`},b={key:6,class:`c-chat__msg-status is-sending`},x=(0,r.defineComponent)({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(n,{emit:i}){let{t:a}=e.t(),x=n,S=i,C=(0,r.computed)(()=>!x.previous||new Date(x.msg.timestamp).getTime()-new Date(x.previous.timestamp).getTime()>3e5),w=e=>e.sender===`self`&&x.selfAvatar||e.avatar,T=e=>e.sender===`self`?x.selfName||e.username||a(`chat.self`):e.username||a(`common.unknown`);function E(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function D(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?E(e):`${t.getMonth()+1}/${t.getDate()} ${E(e)}`}function O(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:`c-chat__message-row`,"data-message-id":n.msg.id},[(0,r.createCommentVNode)(` 时间分割 `),C.value?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,s,(0,r.toDisplayString)(D(n.msg.timestamp)),1)):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createCommentVNode)(` 消息条目 `),(0,r.createElementVNode)(`div`,{class:(0,r.normalizeClass)([`c-chat__msg`,`is-${n.msg.sender}`])},[(0,r.createCommentVNode)(` 头像 `),n.msg.sender===`system`?(0,r.createCommentVNode)(`v-if`,!0):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,c,[w(n.msg)?((0,r.openBlock)(),(0,r.createElementBlock)(`img`,{key:0,src:w(n.msg),class:`c-chat__avatar`},null,8,l)):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,u,(0,r.toDisplayString)(T(n.msg).charAt(0)),1))])),(0,r.createCommentVNode)(` 消息体 `),(0,r.createElementVNode)(`div`,d,[n.msg.sender===`other`&&n.msg.username?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,f,(0,r.toDisplayString)(n.msg.username),1)):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createCommentVNode)(` 文本消息 `),n.msg.type===`text`||n.msg.type===`system`?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,p,(0,r.toDisplayString)(n.msg.content),1)):n.msg.type===`image`?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:2},[(0,r.createCommentVNode)(` 图片消息 `),(0,r.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":(0,r.unref)(a)(`chat.imagePreview`,{name:n.msg.username||(0,r.unref)(a)(`chat.title`)}),onClick:i[0]||=e=>S(`image-preview`,n.msg.content)},[(0,r.createElementVNode)(`img`,{src:n.msg.content,alt:n.msg.fileName||(0,r.unref)(a)(`chat.image`),class:`c-chat__msg-image`},null,8,h)],8,m)],2112)):n.msg.type===`file`?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:3},[(0,r.createCommentVNode)(` 文件消息 `),(0,r.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:i[1]||=e=>S(`file-click`,n.msg)},[(0,r.createVNode)(t.t,{name:`mdi:file-document-outline`,size:28}),(0,r.createElementVNode)(`div`,g,[(0,r.createElementVNode)(`span`,_,(0,r.toDisplayString)(n.msg.fileName||(0,r.unref)(a)(`chat.file`)),1),n.msg.fileSize?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,v,(0,r.toDisplayString)(O(n.msg.fileSize)),1)):(0,r.createCommentVNode)(`v-if`,!0)])])],2112)):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createCommentVNode)(` 时间戳 `),n.showTimestamp&&n.msg.sender!==`system`?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,y,(0,r.toDisplayString)(E(n.msg.timestamp)),1)):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createCommentVNode)(` 发送状态 `),n.msg.sender===`self`&&n.msg.status===`failed`?((0,r.openBlock)(),(0,r.createElementBlock)(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:i[2]||=e=>S(`resend`,n.msg)},(0,r.toDisplayString)((0,r.unref)(a)(`chat.failed`)),1)):n.msg.sender===`self`&&n.msg.status===`sending`?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,b,(0,r.toDisplayString)((0,r.unref)(a)(`chat.sending`)),1)):(0,r.createCommentVNode)(`v-if`,!0)])],2)],8,o))}});var S=n.t(x,[[`__scopeId`,`data-v-47cd7e6f`]]);const C=[`data-contact-id`],w={class:`c-chat__contact-avatar`},T=[`src`,`alt`],E={key:1,class:`c-chat__avatar-fallback`},D={key:2,class:`c-chat__online-dot`},O={class:`c-chat__contact-info`},k={class:`c-chat__contact-name`},A={key:0,class:`c-chat__contact-time`},j={key:0,class:`c-chat__contact-last`},M={key:0,class:`c-chat__unread`},N=(0,r.defineComponent)({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:i}=e.t(),a=n;function o(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return i(`time.now`);if(n<36e5)return i(`time.minutes`,{count:Math.floor(n/6e4)});let r=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?r:`${t.getMonth()+1}/${t.getDate()} ${r}`}return(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`button`,{type:`button`,class:(0,r.normalizeClass)([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>a(`select`,t.contact.id)},[(0,r.createElementVNode)(`div`,w,[t.contact.avatar?((0,r.openBlock)(),(0,r.createElementBlock)(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,T)):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,E,(0,r.toDisplayString)(t.contact.name.charAt(0)),1)),t.contact.online?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,D)):(0,r.createCommentVNode)(`v-if`,!0)]),(0,r.createElementVNode)(`div`,O,[(0,r.createElementVNode)(`div`,k,[(0,r.createElementVNode)(`span`,null,(0,r.toDisplayString)(t.contact.name),1),t.contact.lastTime?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,A,(0,r.toDisplayString)(o(t.contact.lastTime)),1)):(0,r.createCommentVNode)(`v-if`,!0)]),t.contact.lastMessage?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,j,(0,r.toDisplayString)(t.contact.lastMessage),1)):(0,r.createCommentVNode)(`v-if`,!0)]),t.contact.unread?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,M,(0,r.toDisplayString)(t.contact.unread>99?`99+`:t.contact.unread),1)):(0,r.createCommentVNode)(`v-if`,!0)],10,C))}});var P=n.t(N,[[`__scopeId`,`data-v-66c19394`]]);function F(e){let t=!1,n=0,i,a,o,s=!0,c=!1,l=!1,u=0,d=0,f,p=()=>e.virtualRef.value?.listElRef??e.normalRef.value,m=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,h=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function g(){i!==void 0&&cancelAnimationFrame(i),i=void 0}function _(e,r){if(g(),typeof requestAnimationFrame>`u`){r();return}i=requestAnimationFrame(()=>{i=void 0,!t&&e===n&&r()})}function v(e){let i=++n;g(),(0,r.nextTick)(()=>{!t&&i===n&&e(i)})}function y(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function b(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function x(){s=!0,l=!1,c=!0,f=void 0,v(e=>{b(),_(e,()=>{b(),c=!1})})}function S(e){let{top:t}=e.getBoundingClientRect(),n=h(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function C(e,t){let n=p();if(!n||!f)return;let r=h(n).find(e=>e.dataset.messageId===f?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;y(Math.max(0,n.scrollTop+e-f.offset))}t>0?_(e,()=>C(e,t-1)):f=void 0}function w(t){f=t,s=!1,c=!1,v(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),C(n,3)})}function T(e,t){s=!1,c=!1,f=void 0,v(()=>{let n=p();n&&y(Math.max(0,e+n.scrollHeight-t))})}function E(){s=!1,c=!1,n++,g()}function D(){l=!0,f=void 0,E(),a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{if(a=void 0,t||!l)return;l=!1;let e=p();e&&!f&&(s=m(e))})}function O(e){return u>0&&(u!==e.scrollHeight||d!==e.clientHeight)}function k(e){let t=O(e);if(u=e.scrollHeight,d=e.clientHeight,!(c||f)){if(s&&t&&!l){x();return}l=!1,s=m(e)}}function A(){let t=p();t&&(k(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function j(){if(!t)if(f){let e=n;_(e,()=>C(e,1))}else s&&x()}(0,r.watch)(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(o?.disconnect(),o=void 0,e&&typeof ResizeObserver<`u`){o=new ResizeObserver(j),o.observe(e);let t=p();t&&t!==e&&o.observe(t)}},{flush:`post`});let M=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},N=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),P=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function F(e,t,n){let r=e[6]||t[6]?S(n):void 0;r?w(r):T(n.scrollTop,n.scrollHeight)}let I=(e,t,n)=>P(e,t)||t[1]===0||!l&&(m(n)||s&&O(n));function L(e,t,n){I(e,t,n)?x():F(e,t,n)}return(0,r.watch)(M,(e,t)=>{let n=p();if(!t||e[0]!==t[0]||!n){x();return}N(e,t)||e[5]!==t[5]?F(e,t,n):e[6]===t[6]?I(e,t,n)?x():f||E():L(e,t,n)},{immediate:!0,flush:`pre`}),(0,r.onBeforeUnmount)(()=>{t=!0,n++,g(),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}),{scrollToBottom:x,handleMessagesScroll:A,handleScrollIntent:D}}const I={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},L={class:`c-chat`},R={key:0,class:`c-chat__sidebar`},z={class:`c-chat__sidebar-header`},B={class:`c-chat__search`},V={key:1,class:`c-chat__contact-list`},H={key:1,class:`c-chat__main`},U={class:`c-chat__header`},W={key:0,class:`c-chat__header-status`},G={key:0,class:`c-chat__load-more`},K={class:`c-chat__message-items`},q={key:0,class:`c-chat__load-more`},J={key:1,class:`c-chat__empty`},Y={class:`c-chat__input-area`},X={class:`c-chat__input-actions`},Z={class:`c-chat__input-wrap`},Q={class:`c-chat__main c-chat__no-chat`},$=(0,r.defineComponent)({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:I.showContacts},showTimestamp:{type:Boolean,default:I.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:I.showSendBtn},loadingHistory:{type:Boolean,default:I.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:o,emit:s}){let{t:c}=e.t(),l=n,u=s,d=(0,r.computed)(()=>({...I,...l,placeholder:l.placeholder??c(`chat.placeholder`),title:l.title??c(`chat.title`)})),f=(0,r.ref)(``),p=(0,r.ref)(``),m=(0,r.ref)(null),h=(0,r.ref)(null),g=(0,r.computed)(()=>l.contacts??[]),_=(0,r.computed)(()=>l.messages??[]),v=(0,r.computed)(()=>l.currentContactId||g.value[0]?.id||``),y=new Map;(0,r.watch)(v,(e,t)=>{let n=f.value,r=y.get(e)??``;for(y.delete(e),y.delete(t),n&&(l.contacts?.some(e=>e.id===t)||!l.showContacts)&&y.set(t,n);y.size>50;)y.delete(y.keys().next().value);f.value=r},{flush:`sync`}),(0,r.watch)(()=>l.contacts?.map(e=>e.id),e=>{if(!l.showContacts)return;let t=new Set(e);t.has(v.value)||(f.value=``);for(let e of y.keys())t.has(e)||y.delete(e)});let b=(0,r.computed)(()=>g.value.find(e=>e.id===v.value)),x=(0,r.computed)(()=>{if(!p.value)return g.value;let e=p.value.toLowerCase();return g.value.filter(t=>t.name.toLowerCase().includes(e))}),C=(0,r.computed)(()=>l.virtualScroll&&_.value.length>=200),w=(0,r.computed)(()=>l.virtualScroll&&x.value.length>=100),T=e=>{u(`select-contact`,e)},E=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=f.value.trim();t&&(u(`send`,t),f.value=``)},{scrollToBottom:D,handleMessagesScroll:O,handleScrollIntent:k}=F({messages:_,contactId:v,virtual:C,loadingHistory:(0,r.computed)(()=>d.value.loadingHistory),normalRef:m,virtualRef:h,onLoadMore:()=>u(`load-more`)});return o({scrollToBottom:D}),(e,o)=>{let s=i.NInput,l=i.NSpin,y=i.NButton;return(0,r.openBlock)(),(0,r.createElementBlock)(`div`,L,[(0,r.createCommentVNode)(` ===== 联系人侧栏 ===== `),d.value.showContacts&&g.value.length?((0,r.openBlock)(),(0,r.createElementBlock)(`aside`,R,[(0,r.createElementVNode)(`div`,z,[(0,r.createVNode)(t.t,{name:`mdi:chat-outline`,size:20}),(0,r.createTextVNode)(` `+(0,r.toDisplayString)((0,r.unref)(c)(`chat.sessions`)),1)]),(0,r.createCommentVNode)(` 搜索框 `),(0,r.createElementVNode)(`div`,B,[(0,r.createVNode)(s,{value:p.value,"onUpdate:value":o[0]||=e=>p.value=e,placeholder:(0,r.unref)(c)(`chat.search`),clearable:``,size:`small`},{prefix:(0,r.withCtx)(()=>[(0,r.createVNode)(t.t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),w.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(a.VVirtualList),{key:0,class:`c-chat__contact-list`,items:x.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:(0,r.withCtx)(({index:e})=>[(0,r.createVNode)(P,{contact:x.value[e],active:x.value[e].id===v.value,onSelect:T},null,8,[`contact`,`active`])]),_:1},8,[`items`])):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,V,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(x.value,e=>((0,r.openBlock)(),(0,r.createBlock)(P,{key:e.id,contact:e,active:e.id===v.value,onSelect:T},null,8,[`contact`,`active`]))),128))]))])):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createCommentVNode)(` ===== 主聊天区域 ===== `),b.value||!d.value.showContacts?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,H,[(0,r.createCommentVNode)(` 顶栏 `),(0,r.createElementVNode)(`div`,U,[(0,r.renderSlot)(e.$slots,`header`,{},()=>[(0,r.createElementVNode)(`span`,null,(0,r.toDisplayString)(b.value?.name||d.value.title),1),b.value?.online?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,W,(0,r.toDisplayString)((0,r.unref)(c)(`chat.online`)),1)):(0,r.createCommentVNode)(`v-if`,!0)],!0)]),C.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(a.VVirtualList),{key:v.value,ref_key:`virtualMessagesRef`,ref:h,class:`c-chat__messages c-chat__messages--virtual`,items:_.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:(0,r.unref)(O),onWheel:(0,r.unref)(k),onPointerdown:(0,r.unref)(k),onKeydown:(0,r.unref)(k)},{default:(0,r.withCtx)(({index:e})=>[(0,r.createElementVNode)(`div`,null,[e===0&&d.value.loadingHistory?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,G,[(0,r.createVNode)(l,{size:`small`})])):(0,r.createCommentVNode)(`v-if`,!0),(0,r.createVNode)(S,{msg:_.value[e],previous:_.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":d.value.showTimestamp,onImagePreview:o[1]||=e=>u(`image-preview`,e),onFileClick:o[2]||=e=>u(`file-click`,e),onResend:o[3]||=e=>u(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:1,ref_key:`messagesRef`,ref:m,class:`c-chat__messages`,onScroll:o[7]||=(...e)=>(0,r.unref)(O)&&(0,r.unref)(O)(...e),onWheel:o[8]||=(...e)=>(0,r.unref)(k)&&(0,r.unref)(k)(...e),onPointerdown:o[9]||=(...e)=>(0,r.unref)(k)&&(0,r.unref)(k)(...e),onKeydown:o[10]||=(...e)=>(0,r.unref)(k)&&(0,r.unref)(k)(...e)},[(0,r.createElementVNode)(`div`,K,[d.value.loadingHistory?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,q,[(0,r.createVNode)(l,{size:`small`})])):(0,r.createCommentVNode)(`v-if`,!0),!_.value.length&&!d.value.loadingHistory?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,J,(0,r.toDisplayString)((0,r.unref)(c)(`chat.empty`)),1)):(0,r.createCommentVNode)(`v-if`,!0),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(_.value,(e,t)=>((0,r.openBlock)(),(0,r.createBlock)(S,{key:e.id,msg:e,previous:_.value[t-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":d.value.showTimestamp,onImagePreview:o[4]||=e=>u(`image-preview`,e),onFileClick:o[5]||=e=>u(`file-click`,e),onResend:o[6]||=e=>u(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),(0,r.createCommentVNode)(` 输入区域 `),(0,r.createElementVNode)(`div`,Y,[(0,r.createElementVNode)(`div`,X,[(0,r.renderSlot)(e.$slots,`input-actions`,{},()=>[(0,r.createVNode)(y,{quaternary:``,circle:``,size:`small`,"aria-label":(0,r.unref)(c)(`chat.emoji`),onClick:o[11]||=e=>u(`emoji-click`)},{icon:(0,r.withCtx)(()=>[(0,r.createVNode)(t.t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),(0,r.createVNode)(y,{quaternary:``,circle:``,size:`small`,"aria-label":(0,r.unref)(c)(`chat.attach`),onClick:o[12]||=e=>u(`file-upload`)},{icon:(0,r.withCtx)(()=>[(0,r.createVNode)(t.t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),(0,r.createElementVNode)(`div`,Z,[(0,r.createVNode)(s,{value:f.value,"onUpdate:value":o[13]||=e=>f.value=e,placeholder:d.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:(0,r.withKeys)((0,r.withModifiers)(E,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),d.value.showSendBtn?((0,r.openBlock)(),(0,r.createBlock)(y,{key:0,type:`primary`,disabled:!f.value.trim(),class:`c-chat__send-btn`,"aria-label":(0,r.unref)(c)(`chat.send`),onClick:E},{icon:(0,r.withCtx)(()=>[(0,r.createVNode)(t.t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):(0,r.createCommentVNode)(`v-if`,!0)])])):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:2},[(0,r.createCommentVNode)(` ===== 未选中联系人空态 ===== `),(0,r.createElementVNode)(`div`,Q,[(0,r.createVNode)(t.t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),(0,r.createElementVNode)(`span`,null,(0,r.toDisplayString)((0,r.unref)(c)(`chat.choose`)),1)])],2112))])}}});var ee=n.t($,[[`__scopeId`,`data-v-96dfa0d2`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ee}});
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./C_Icon2.cjs`),n=require(`./export-helper.cjs`),r=require(`./virtualList.cjs`);let i=require(`vue`),a=require(`naive-ui`);const o=[`data-message-id`],s={key:0,class:`c-chat__time-divider`},c={key:0,class:`c-chat__msg-avatar`},l=[`src`],u={key:1,class:`c-chat__avatar-fallback`},d={class:`c-chat__msg-body`},f={key:0,class:`c-chat__msg-username`},p={key:1,class:`c-chat__bubble`},m=[`aria-label`],h=[`src`,`alt`],g={class:`c-chat__file-info`},_={class:`c-chat__file-name`},v={key:0,class:`c-chat__file-size`},y={key:4,class:`c-chat__msg-time`},b={key:6,class:`c-chat__msg-status is-sending`},x=(0,i.defineComponent)({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(n,{emit:r}){let{t:a}=e.t(),x=n,S=r,C=(0,i.computed)(()=>!x.previous||new Date(x.msg.timestamp).getTime()-new Date(x.previous.timestamp).getTime()>3e5),w=e=>e.sender===`self`&&x.selfAvatar||e.avatar,T=e=>e.sender===`self`?x.selfName||e.username||a(`chat.self`):e.username||a(`common.unknown`);function E(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function D(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?E(e):`${t.getMonth()+1}/${t.getDate()} ${E(e)}`}function O(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,r)=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{class:`c-chat__message-row`,"data-message-id":n.msg.id},[(0,i.createCommentVNode)(` 时间分割 `),C.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,s,(0,i.toDisplayString)(D(n.msg.timestamp)),1)):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 消息条目 `),(0,i.createElementVNode)(`div`,{class:(0,i.normalizeClass)([`c-chat__msg`,`is-${n.msg.sender}`])},[(0,i.createCommentVNode)(` 头像 `),n.msg.sender===`system`?(0,i.createCommentVNode)(`v-if`,!0):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,c,[w(n.msg)?((0,i.openBlock)(),(0,i.createElementBlock)(`img`,{key:0,src:w(n.msg),class:`c-chat__avatar`},null,8,l)):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,u,(0,i.toDisplayString)(T(n.msg).charAt(0)),1))])),(0,i.createCommentVNode)(` 消息体 `),(0,i.createElementVNode)(`div`,d,[n.msg.sender===`other`&&n.msg.username?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,f,(0,i.toDisplayString)(n.msg.username),1)):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 文本消息 `),n.msg.type===`text`||n.msg.type===`system`?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,p,(0,i.toDisplayString)(n.msg.content),1)):n.msg.type===`image`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:2},[(0,i.createCommentVNode)(` 图片消息 `),(0,i.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":(0,i.unref)(a)(`chat.imagePreview`,{name:n.msg.username||(0,i.unref)(a)(`chat.title`)}),onClick:r[0]||=e=>S(`image-preview`,n.msg.content)},[(0,i.createElementVNode)(`img`,{src:n.msg.content,alt:n.msg.fileName||(0,i.unref)(a)(`chat.image`),class:`c-chat__msg-image`},null,8,h)],8,m)],2112)):n.msg.type===`file`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:3},[(0,i.createCommentVNode)(` 文件消息 `),(0,i.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:r[1]||=e=>S(`file-click`,n.msg)},[(0,i.createVNode)(t.t,{name:`mdi:file-document-outline`,size:28}),(0,i.createElementVNode)(`div`,g,[(0,i.createElementVNode)(`span`,_,(0,i.toDisplayString)(n.msg.fileName||(0,i.unref)(a)(`chat.file`)),1),n.msg.fileSize?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,v,(0,i.toDisplayString)(O(n.msg.fileSize)),1)):(0,i.createCommentVNode)(`v-if`,!0)])])],2112)):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 时间戳 `),n.showTimestamp&&n.msg.sender!==`system`?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,y,(0,i.toDisplayString)(E(n.msg.timestamp)),1)):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` 发送状态 `),n.msg.sender===`self`&&n.msg.status===`failed`?((0,i.openBlock)(),(0,i.createElementBlock)(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:r[2]||=e=>S(`resend`,n.msg)},(0,i.toDisplayString)((0,i.unref)(a)(`chat.failed`)),1)):n.msg.sender===`self`&&n.msg.status===`sending`?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,b,(0,i.toDisplayString)((0,i.unref)(a)(`chat.sending`)),1)):(0,i.createCommentVNode)(`v-if`,!0)])],2)],8,o))}});var S=n.t(x,[[`__scopeId`,`data-v-47cd7e6f`]]);const C=[`data-contact-id`],w={class:`c-chat__contact-avatar`},T=[`src`,`alt`],E={key:1,class:`c-chat__avatar-fallback`},D={key:2,class:`c-chat__online-dot`},O={class:`c-chat__contact-info`},k={class:`c-chat__contact-name`},A={key:0,class:`c-chat__contact-time`},j={key:0,class:`c-chat__contact-last`},M={key:0,class:`c-chat__unread`},N=(0,i.defineComponent)({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e.t(),a=n;function o(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>((0,i.openBlock)(),(0,i.createElementBlock)(`button`,{type:`button`,class:(0,i.normalizeClass)([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>a(`select`,t.contact.id)},[(0,i.createElementVNode)(`div`,w,[t.contact.avatar?((0,i.openBlock)(),(0,i.createElementBlock)(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,T)):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,E,(0,i.toDisplayString)(t.contact.name.charAt(0)),1)),t.contact.online?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,D)):(0,i.createCommentVNode)(`v-if`,!0)]),(0,i.createElementVNode)(`div`,O,[(0,i.createElementVNode)(`div`,k,[(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(t.contact.name),1),t.contact.lastTime?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,A,(0,i.toDisplayString)(o(t.contact.lastTime)),1)):(0,i.createCommentVNode)(`v-if`,!0)]),t.contact.lastMessage?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,j,(0,i.toDisplayString)(t.contact.lastMessage),1)):(0,i.createCommentVNode)(`v-if`,!0)]),t.contact.unread?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,M,(0,i.toDisplayString)(t.contact.unread>99?`99+`:t.contact.unread),1)):(0,i.createCommentVNode)(`v-if`,!0)],10,C))}});var P=n.t(N,[[`__scopeId`,`data-v-66c19394`]]);function F(e){let t=!1,n=0,r,a,o,s=!0,c=!1,l=!1,u=0,d=0,f,p=()=>e.virtualRef.value?.listElRef??e.normalRef.value,m=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,h=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function g(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function _(e,i){if(g(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function v(e){let r=++n;g(),(0,i.nextTick)(()=>{!t&&r===n&&e(r)})}function y(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function b(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function x(){s=!0,l=!1,c=!0,f=void 0,v(e=>{b(),_(e,()=>{b(),c=!1})})}function S(e){let{top:t}=e.getBoundingClientRect(),n=h(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function C(e,t){let n=p();if(!n||!f)return;let r=h(n).find(e=>e.dataset.messageId===f?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;y(Math.max(0,n.scrollTop+e-f.offset))}t>0?_(e,()=>C(e,t-1)):f=void 0}function w(t){f=t,s=!1,c=!1,v(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),C(n,3)})}function T(e,t){s=!1,c=!1,f=void 0,v(()=>{let n=p();n&&y(Math.max(0,e+n.scrollHeight-t))})}function E(){s=!1,c=!1,n++,g()}function D(){l=!0,f=void 0,E(),a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{if(a=void 0,t||!l)return;l=!1;let e=p();e&&!f&&(s=m(e))})}function O(e){return u>0&&(u!==e.scrollHeight||d!==e.clientHeight)}function k(e){let t=O(e);if(u=e.scrollHeight,d=e.clientHeight,!(c||f)){if(s&&t&&!l){x();return}l=!1,s=m(e)}}function A(){let t=p();t&&(k(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function j(){if(!t)if(f){let e=n;_(e,()=>C(e,1))}else s&&x()}(0,i.watch)(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(o?.disconnect(),o=void 0,e&&typeof ResizeObserver<`u`){o=new ResizeObserver(j),o.observe(e);let t=p();t&&t!==e&&o.observe(t)}},{flush:`post`});let M=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},N=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),P=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function F(e,t,n){let r=e[6]||t[6]?S(n):void 0;r?w(r):T(n.scrollTop,n.scrollHeight)}let I=(e,t,n)=>P(e,t)||t[1]===0||!l&&(m(n)||s&&O(n));function L(e,t,n){I(e,t,n)?x():F(e,t,n)}return(0,i.watch)(M,(e,t)=>{let n=p();if(!t||e[0]!==t[0]||!n){x();return}N(e,t)||e[5]!==t[5]?F(e,t,n):e[6]===t[6]?I(e,t,n)?x():f||E():L(e,t,n)},{immediate:!0,flush:`pre`}),(0,i.onBeforeUnmount)(()=>{t=!0,n++,g(),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}),{scrollToBottom:x,handleMessagesScroll:A,handleScrollIntent:D}}const I={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},L={class:`c-chat`},R={key:0,class:`c-chat__sidebar`},z={class:`c-chat__sidebar-header`},B={class:`c-chat__search`},V={key:1,class:`c-chat__contact-list`},H={key:1,class:`c-chat__main`},U={class:`c-chat__header`},W={key:0,class:`c-chat__header-status`},G={key:0,class:`c-chat__load-more`},K={class:`c-chat__message-items`},q={key:0,class:`c-chat__load-more`},J={key:1,class:`c-chat__empty`},Y={class:`c-chat__input-area`},X={class:`c-chat__input-actions`},Z={class:`c-chat__input-wrap`},Q={class:`c-chat__main c-chat__no-chat`},$=(0,i.defineComponent)({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:I.showContacts},showTimestamp:{type:Boolean,default:I.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:I.showSendBtn},loadingHistory:{type:Boolean,default:I.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:o,emit:s}){let{t:c}=e.t(),l=n,u=s,d=(0,i.computed)(()=>({...I,...l,placeholder:l.placeholder??c(`chat.placeholder`),title:l.title??c(`chat.title`)})),f=(0,i.ref)(``),p=(0,i.ref)(``),m=(0,i.ref)(null),h=(0,i.ref)(null),g=(0,i.computed)(()=>l.contacts??[]),_=(0,i.computed)(()=>l.messages??[]),v=(0,i.computed)(()=>l.currentContactId||g.value[0]?.id||``),y=new Map;(0,i.watch)(v,(e,t)=>{let n=f.value,r=y.get(e)??``;for(y.delete(e),y.delete(t),n&&(l.contacts?.some(e=>e.id===t)||!l.showContacts)&&y.set(t,n);y.size>50;)y.delete(y.keys().next().value);f.value=r},{flush:`sync`}),(0,i.watch)(()=>l.contacts?.map(e=>e.id),e=>{if(!l.showContacts)return;let t=new Set(e);t.has(v.value)||(f.value=``);for(let e of y.keys())t.has(e)||y.delete(e)});let b=(0,i.computed)(()=>g.value.find(e=>e.id===v.value)),x=(0,i.computed)(()=>{if(!p.value)return g.value;let e=p.value.toLowerCase();return g.value.filter(t=>t.name.toLowerCase().includes(e))}),C=(0,i.computed)(()=>l.virtualScroll&&_.value.length>=200),w=(0,i.computed)(()=>l.virtualScroll&&x.value.length>=100),T=e=>{u(`select-contact`,e)},E=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=f.value.trim();t&&(u(`send`,t),f.value=``)},{scrollToBottom:D,handleMessagesScroll:O,handleScrollIntent:k}=F({messages:_,contactId:v,virtual:C,loadingHistory:(0,i.computed)(()=>d.value.loadingHistory),normalRef:m,virtualRef:h,onLoadMore:()=>u(`load-more`)});return o({scrollToBottom:D}),(e,o)=>{let s=a.NInput,l=a.NSpin,y=a.NButton;return(0,i.openBlock)(),(0,i.createElementBlock)(`div`,L,[(0,i.createCommentVNode)(` ===== 联系人侧栏 ===== `),d.value.showContacts&&g.value.length?((0,i.openBlock)(),(0,i.createElementBlock)(`aside`,R,[(0,i.createElementVNode)(`div`,z,[(0,i.createVNode)(t.t,{name:`mdi:chat-outline`,size:20}),(0,i.createTextVNode)(` `+(0,i.toDisplayString)((0,i.unref)(c)(`chat.sessions`)),1)]),(0,i.createCommentVNode)(` 搜索框 `),(0,i.createElementVNode)(`div`,B,[(0,i.createVNode)(s,{value:p.value,"onUpdate:value":o[0]||=e=>p.value=e,placeholder:(0,i.unref)(c)(`chat.search`),clearable:``,size:`small`},{prefix:(0,i.withCtx)(()=>[(0,i.createVNode)(t.t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),w.value?((0,i.openBlock)(),(0,i.createBlock)((0,i.unref)(r.t),{key:0,class:`c-chat__contact-list`,items:x.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:(0,i.withCtx)(({index:e})=>[(0,i.createVNode)(P,{contact:x.value[e],active:x.value[e].id===v.value,onSelect:T},null,8,[`contact`,`active`])]),_:1},8,[`items`])):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,V,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(x.value,e=>((0,i.openBlock)(),(0,i.createBlock)(P,{key:e.id,contact:e,active:e.id===v.value,onSelect:T},null,8,[`contact`,`active`]))),128))]))])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createCommentVNode)(` ===== 主聊天区域 ===== `),b.value||!d.value.showContacts?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,H,[(0,i.createCommentVNode)(` 顶栏 `),(0,i.createElementVNode)(`div`,U,[(0,i.renderSlot)(e.$slots,`header`,{},()=>[(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)(b.value?.name||d.value.title),1),b.value?.online?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,W,(0,i.toDisplayString)((0,i.unref)(c)(`chat.online`)),1)):(0,i.createCommentVNode)(`v-if`,!0)],!0)]),C.value?((0,i.openBlock)(),(0,i.createBlock)((0,i.unref)(r.t),{key:v.value,ref_key:`virtualMessagesRef`,ref:h,class:`c-chat__messages c-chat__messages--virtual`,items:_.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:(0,i.unref)(O),onWheel:(0,i.unref)(k),onPointerdown:(0,i.unref)(k),onKeydown:(0,i.unref)(k)},{default:(0,i.withCtx)(({index:e})=>[(0,i.createElementVNode)(`div`,null,[e===0&&d.value.loadingHistory?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,G,[(0,i.createVNode)(l,{size:`small`})])):(0,i.createCommentVNode)(`v-if`,!0),(0,i.createVNode)(S,{msg:_.value[e],previous:_.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":d.value.showTimestamp,onImagePreview:o[1]||=e=>u(`image-preview`,e),onFileClick:o[2]||=e=>u(`file-click`,e),onResend:o[3]||=e=>u(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,ref_key:`messagesRef`,ref:m,class:`c-chat__messages`,onScroll:o[7]||=(...e)=>(0,i.unref)(O)&&(0,i.unref)(O)(...e),onWheel:o[8]||=(...e)=>(0,i.unref)(k)&&(0,i.unref)(k)(...e),onPointerdown:o[9]||=(...e)=>(0,i.unref)(k)&&(0,i.unref)(k)(...e),onKeydown:o[10]||=(...e)=>(0,i.unref)(k)&&(0,i.unref)(k)(...e)},[(0,i.createElementVNode)(`div`,K,[d.value.loadingHistory?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,q,[(0,i.createVNode)(l,{size:`small`})])):(0,i.createCommentVNode)(`v-if`,!0),!_.value.length&&!d.value.loadingHistory?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,J,(0,i.toDisplayString)((0,i.unref)(c)(`chat.empty`)),1)):(0,i.createCommentVNode)(`v-if`,!0),((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(_.value,(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(S,{key:e.id,msg:e,previous:_.value[t-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":d.value.showTimestamp,onImagePreview:o[4]||=e=>u(`image-preview`,e),onFileClick:o[5]||=e=>u(`file-click`,e),onResend:o[6]||=e=>u(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),(0,i.createCommentVNode)(` 输入区域 `),(0,i.createElementVNode)(`div`,Y,[(0,i.createElementVNode)(`div`,X,[(0,i.renderSlot)(e.$slots,`input-actions`,{},()=>[(0,i.createVNode)(y,{quaternary:``,circle:``,size:`small`,"aria-label":(0,i.unref)(c)(`chat.emoji`),onClick:o[11]||=e=>u(`emoji-click`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(t.t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),(0,i.createVNode)(y,{quaternary:``,circle:``,size:`small`,"aria-label":(0,i.unref)(c)(`chat.attach`),onClick:o[12]||=e=>u(`file-upload`)},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(t.t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),(0,i.createElementVNode)(`div`,Z,[(0,i.createVNode)(s,{value:f.value,"onUpdate:value":o[13]||=e=>f.value=e,placeholder:d.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:(0,i.withKeys)((0,i.withModifiers)(E,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),d.value.showSendBtn?((0,i.openBlock)(),(0,i.createBlock)(y,{key:0,type:`primary`,disabled:!f.value.trim(),class:`c-chat__send-btn`,"aria-label":(0,i.unref)(c)(`chat.send`),onClick:E},{icon:(0,i.withCtx)(()=>[(0,i.createVNode)(t.t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):(0,i.createCommentVNode)(`v-if`,!0)])])):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:2},[(0,i.createCommentVNode)(` ===== 未选中联系人空态 ===== `),(0,i.createElementVNode)(`div`,Q,[(0,i.createVNode)(t.t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),(0,i.createElementVNode)(`span`,null,(0,i.toDisplayString)((0,i.unref)(c)(`chat.choose`)),1)])],2112))])}}});var ee=n.t($,[[`__scopeId`,`data-v-34763202`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ee}});
|
package/dist/C_Chat2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./useComponentLocale.js";import{t}from"./C_Icon2.js";import{t as n}from"./export-helper.js";import{Fragment as r,computed as i,createBlock as a,createCommentVNode as o,createElementBlock as s,createElementVNode as c,createTextVNode as l,createVNode as u,defineComponent as d,nextTick as f,normalizeClass as p,onBeforeUnmount as m,openBlock as h,ref as g,renderList as _,renderSlot as v,resolveComponent as y,toDisplayString as b,unref as x,watch as S,withCtx as C,withKeys as w,withModifiers as T}from"vue";import{NButton as E,NInput as D,NSpin as O}from"naive-ui";import{VVirtualList as k}from"vueuc";const A=[`data-message-id`],j={key:0,class:`c-chat__time-divider`},M={key:0,class:`c-chat__msg-avatar`},N=[`src`],P={key:1,class:`c-chat__avatar-fallback`},F={class:`c-chat__msg-body`},I={key:0,class:`c-chat__msg-username`},L={key:1,class:`c-chat__bubble`},R=[`aria-label`],z=[`src`,`alt`],B={class:`c-chat__file-info`},V={class:`c-chat__file-name`},H={key:0,class:`c-chat__file-size`},U={key:4,class:`c-chat__msg-time`},W={key:6,class:`c-chat__msg-status is-sending`};var G=n(d({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(n,{emit:a}){let{t:l}=e(),d=n,f=a,m=i(()=>!d.previous||new Date(d.msg.timestamp).getTime()-new Date(d.previous.timestamp).getTime()>3e5),g=e=>e.sender===`self`&&d.selfAvatar||e.avatar,_=e=>e.sender===`self`?d.selfName||e.username||l(`chat.self`):e.username||l(`common.unknown`);function v(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function y(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?v(e):`${t.getMonth()+1}/${t.getDate()} ${v(e)}`}function S(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,i)=>(h(),s(`div`,{class:`c-chat__message-row`,"data-message-id":n.msg.id},[o(` 时间分割 `),m.value?(h(),s(`div`,j,b(y(n.msg.timestamp)),1)):o(`v-if`,!0),o(` 消息条目 `),c(`div`,{class:p([`c-chat__msg`,`is-${n.msg.sender}`])},[o(` 头像 `),n.msg.sender===`system`?o(`v-if`,!0):(h(),s(`div`,M,[g(n.msg)?(h(),s(`img`,{key:0,src:g(n.msg),class:`c-chat__avatar`},null,8,N)):(h(),s(`div`,P,b(_(n.msg).charAt(0)),1))])),o(` 消息体 `),c(`div`,F,[n.msg.sender===`other`&&n.msg.username?(h(),s(`span`,I,b(n.msg.username),1)):o(`v-if`,!0),o(` 文本消息 `),n.msg.type===`text`||n.msg.type===`system`?(h(),s(`div`,L,b(n.msg.content),1)):n.msg.type===`image`?(h(),s(r,{key:2},[o(` 图片消息 `),c(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":x(l)(`chat.imagePreview`,{name:n.msg.username||x(l)(`chat.title`)}),onClick:i[0]||=e=>f(`image-preview`,n.msg.content)},[c(`img`,{src:n.msg.content,alt:n.msg.fileName||x(l)(`chat.image`),class:`c-chat__msg-image`},null,8,z)],8,R)],2112)):n.msg.type===`file`?(h(),s(r,{key:3},[o(` 文件消息 `),c(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:i[1]||=e=>f(`file-click`,n.msg)},[u(t,{name:`mdi:file-document-outline`,size:28}),c(`div`,B,[c(`span`,V,b(n.msg.fileName||x(l)(`chat.file`)),1),n.msg.fileSize?(h(),s(`span`,H,b(S(n.msg.fileSize)),1)):o(`v-if`,!0)])])],2112)):o(`v-if`,!0),o(` 时间戳 `),n.showTimestamp&&n.msg.sender!==`system`?(h(),s(`span`,U,b(v(n.msg.timestamp)),1)):o(`v-if`,!0),o(` 发送状态 `),n.msg.sender===`self`&&n.msg.status===`failed`?(h(),s(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:i[2]||=e=>f(`resend`,n.msg)},b(x(l)(`chat.failed`)),1)):n.msg.sender===`self`&&n.msg.status===`sending`?(h(),s(`span`,W,b(x(l)(`chat.sending`)),1)):o(`v-if`,!0)])],2)],8,A))}}),[[`__scopeId`,`data-v-47cd7e6f`]]);const K=[`data-contact-id`],q={class:`c-chat__contact-avatar`},J=[`src`,`alt`],ee={key:1,class:`c-chat__avatar-fallback`},te={key:2,class:`c-chat__online-dot`},ne={class:`c-chat__contact-info`},Y={class:`c-chat__contact-name`},X={key:0,class:`c-chat__contact-time`},re={key:0,class:`c-chat__contact-last`},ie={key:0,class:`c-chat__unread`};var Z=n(d({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e(),i=n;function a(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>(h(),s(`button`,{type:`button`,class:p([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[c(`div`,q,[t.contact.avatar?(h(),s(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,J)):(h(),s(`div`,ee,b(t.contact.name.charAt(0)),1)),t.contact.online?(h(),s(`span`,te)):o(`v-if`,!0)]),c(`div`,ne,[c(`div`,Y,[c(`span`,null,b(t.contact.name),1),t.contact.lastTime?(h(),s(`span`,X,b(a(t.contact.lastTime)),1)):o(`v-if`,!0)]),t.contact.lastMessage?(h(),s(`div`,re,b(t.contact.lastMessage),1)):o(`v-if`,!0)]),t.contact.unread?(h(),s(`span`,ie,b(t.contact.unread>99?`99+`:t.contact.unread),1)):o(`v-if`,!0)],10,K))}}),[[`__scopeId`,`data-v-66c19394`]]);function ae(e){let t=!1,n=0,r,i,a,o=!0,s=!1,c=!1,l=0,u=0,d,p=()=>e.virtualRef.value?.listElRef??e.normalRef.value,h=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,g=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function _(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function v(e,i){if(_(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function y(e){let r=++n;_(),f(()=>{!t&&r===n&&e(r)})}function b(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function x(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function C(){o=!0,c=!1,s=!0,d=void 0,y(e=>{x(),v(e,()=>{x(),s=!1})})}function w(e){let{top:t}=e.getBoundingClientRect(),n=g(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function T(e,t){let n=p();if(!n||!d)return;let r=g(n).find(e=>e.dataset.messageId===d?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;b(Math.max(0,n.scrollTop+e-d.offset))}t>0?v(e,()=>T(e,t-1)):d=void 0}function E(t){d=t,o=!1,s=!1,y(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),T(n,3)})}function D(e,t){o=!1,s=!1,d=void 0,y(()=>{let n=p();n&&b(Math.max(0,e+n.scrollHeight-t))})}function O(){o=!1,s=!1,n++,_()}function k(){c=!0,d=void 0,O(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!c)return;c=!1;let e=p();e&&!d&&(o=h(e))})}function A(e){return l>0&&(l!==e.scrollHeight||u!==e.clientHeight)}function j(e){let t=A(e);if(l=e.scrollHeight,u=e.clientHeight,!(s||d)){if(o&&t&&!c){C();return}c=!1,o=h(e)}}function M(){let t=p();t&&(j(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function N(){if(!t)if(d){let e=n;v(e,()=>T(e,1))}else o&&C()}S(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(a?.disconnect(),a=void 0,e&&typeof ResizeObserver<`u`){a=new ResizeObserver(N),a.observe(e);let t=p();t&&t!==e&&a.observe(t)}},{flush:`post`});let P=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},F=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),I=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function L(e,t,n){let r=e[6]||t[6]?w(n):void 0;r?E(r):D(n.scrollTop,n.scrollHeight)}let R=(e,t,n)=>I(e,t)||t[1]===0||!c&&(h(n)||o&&A(n));function z(e,t,n){R(e,t,n)?C():L(e,t,n)}return S(P,(e,t)=>{let n=p();if(!t||e[0]!==t[0]||!n){C();return}F(e,t)||e[5]!==t[5]?L(e,t,n):e[6]===t[6]?R(e,t,n)?C():d||O():z(e,t,n)},{immediate:!0,flush:`pre`}),m(()=>{t=!0,n++,_(),i!==void 0&&cancelAnimationFrame(i),a?.disconnect()}),{scrollToBottom:C,handleMessagesScroll:M,handleScrollIntent:k}}const Q={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},oe={class:`c-chat`},se={key:0,class:`c-chat__sidebar`},ce={class:`c-chat__sidebar-header`},le={class:`c-chat__search`},ue={key:1,class:`c-chat__contact-list`},de={key:1,class:`c-chat__main`},fe={class:`c-chat__header`},$={key:0,class:`c-chat__header-status`},pe={key:0,class:`c-chat__load-more`},me={class:`c-chat__message-items`},he={key:0,class:`c-chat__load-more`},ge={key:1,class:`c-chat__empty`},_e={class:`c-chat__input-area`},ve={class:`c-chat__input-actions`},ye={class:`c-chat__input-wrap`},be={class:`c-chat__main c-chat__no-chat`};var xe=n(d({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:Q.showContacts},showTimestamp:{type:Boolean,default:Q.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:Q.showSendBtn},loadingHistory:{type:Boolean,default:Q.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:d,emit:f}){let{t:p}=e(),m=n,y=f,A=i(()=>({...Q,...m,placeholder:m.placeholder??p(`chat.placeholder`),title:m.title??p(`chat.title`)})),j=g(``),M=g(``),N=g(null),P=g(null),F=i(()=>m.contacts??[]),I=i(()=>m.messages??[]),L=i(()=>m.currentContactId||F.value[0]?.id||``),R=new Map;S(L,(e,t)=>{let n=j.value,r=R.get(e)??``;for(R.delete(e),R.delete(t),n&&(m.contacts?.some(e=>e.id===t)||!m.showContacts)&&R.set(t,n);R.size>50;)R.delete(R.keys().next().value);j.value=r},{flush:`sync`}),S(()=>m.contacts?.map(e=>e.id),e=>{if(!m.showContacts)return;let t=new Set(e);t.has(L.value)||(j.value=``);for(let e of R.keys())t.has(e)||R.delete(e)});let z=i(()=>F.value.find(e=>e.id===L.value)),B=i(()=>{if(!M.value)return F.value;let e=M.value.toLowerCase();return F.value.filter(t=>t.name.toLowerCase().includes(e))}),V=i(()=>m.virtualScroll&&I.value.length>=200),H=i(()=>m.virtualScroll&&B.value.length>=100),U=e=>{y(`select-contact`,e)},W=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=j.value.trim();t&&(y(`send`,t),j.value=``)},{scrollToBottom:K,handleMessagesScroll:q,handleScrollIntent:J}=ae({messages:I,contactId:L,virtual:V,loadingHistory:i(()=>A.value.loadingHistory),normalRef:N,virtualRef:P,onLoadMore:()=>y(`load-more`)});return d({scrollToBottom:K}),(e,i)=>{let d=D,f=O,m=E;return h(),s(`div`,oe,[o(` ===== 联系人侧栏 ===== `),A.value.showContacts&&F.value.length?(h(),s(`aside`,se,[c(`div`,ce,[u(t,{name:`mdi:chat-outline`,size:20}),l(` `+b(x(p)(`chat.sessions`)),1)]),o(` 搜索框 `),c(`div`,le,[u(d,{value:M.value,"onUpdate:value":i[0]||=e=>M.value=e,placeholder:x(p)(`chat.search`),clearable:``,size:`small`},{prefix:C(()=>[u(t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),H.value?(h(),a(x(k),{key:0,class:`c-chat__contact-list`,items:B.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:C(({index:e})=>[u(Z,{contact:B.value[e],active:B.value[e].id===L.value,onSelect:U},null,8,[`contact`,`active`])]),_:1},8,[`items`])):(h(),s(`div`,ue,[(h(!0),s(r,null,_(B.value,e=>(h(),a(Z,{key:e.id,contact:e,active:e.id===L.value,onSelect:U},null,8,[`contact`,`active`]))),128))]))])):o(`v-if`,!0),o(` ===== 主聊天区域 ===== `),z.value||!A.value.showContacts?(h(),s(`div`,de,[o(` 顶栏 `),c(`div`,fe,[v(e.$slots,`header`,{},()=>[c(`span`,null,b(z.value?.name||A.value.title),1),z.value?.online?(h(),s(`span`,$,b(x(p)(`chat.online`)),1)):o(`v-if`,!0)],!0)]),V.value?(h(),a(x(k),{key:L.value,ref_key:`virtualMessagesRef`,ref:P,class:`c-chat__messages c-chat__messages--virtual`,items:I.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:x(q),onWheel:x(J),onPointerdown:x(J),onKeydown:x(J)},{default:C(({index:e})=>[c(`div`,null,[e===0&&A.value.loadingHistory?(h(),s(`div`,pe,[u(f,{size:`small`})])):o(`v-if`,!0),u(G,{msg:I.value[e],previous:I.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":A.value.showTimestamp,onImagePreview:i[1]||=e=>y(`image-preview`,e),onFileClick:i[2]||=e=>y(`file-click`,e),onResend:i[3]||=e=>y(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):(h(),s(`div`,{key:1,ref_key:`messagesRef`,ref:N,class:`c-chat__messages`,onScroll:i[7]||=(...e)=>x(q)&&x(q)(...e),onWheel:i[8]||=(...e)=>x(J)&&x(J)(...e),onPointerdown:i[9]||=(...e)=>x(J)&&x(J)(...e),onKeydown:i[10]||=(...e)=>x(J)&&x(J)(...e)},[c(`div`,me,[A.value.loadingHistory?(h(),s(`div`,he,[u(f,{size:`small`})])):o(`v-if`,!0),!I.value.length&&!A.value.loadingHistory?(h(),s(`div`,ge,b(x(p)(`chat.empty`)),1)):o(`v-if`,!0),(h(!0),s(r,null,_(I.value,(e,t)=>(h(),a(G,{key:e.id,msg:e,previous:I.value[t-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":A.value.showTimestamp,onImagePreview:i[4]||=e=>y(`image-preview`,e),onFileClick:i[5]||=e=>y(`file-click`,e),onResend:i[6]||=e=>y(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),o(` 输入区域 `),c(`div`,_e,[c(`div`,ve,[v(e.$slots,`input-actions`,{},()=>[u(m,{quaternary:``,circle:``,size:`small`,"aria-label":x(p)(`chat.emoji`),onClick:i[11]||=e=>y(`emoji-click`)},{icon:C(()=>[u(t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),u(m,{quaternary:``,circle:``,size:`small`,"aria-label":x(p)(`chat.attach`),onClick:i[12]||=e=>y(`file-upload`)},{icon:C(()=>[u(t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),c(`div`,ye,[u(d,{value:j.value,"onUpdate:value":i[13]||=e=>j.value=e,placeholder:A.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:w(T(W,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),A.value.showSendBtn?(h(),a(m,{key:0,type:`primary`,disabled:!j.value.trim(),class:`c-chat__send-btn`,"aria-label":x(p)(`chat.send`),onClick:W},{icon:C(()=>[u(t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):o(`v-if`,!0)])])):(h(),s(r,{key:2},[o(` ===== 未选中联系人空态 ===== `),c(`div`,be,[u(t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),c(`span`,null,b(x(p)(`chat.choose`)),1)])],2112))])}}}),[[`__scopeId`,`data-v-96dfa0d2`]]);export{Q as n,xe as t};
|
|
1
|
+
import{t as e}from"./useComponentLocale.js";import{t}from"./C_Icon2.js";import{t as n}from"./export-helper.js";import{t as r}from"./virtualList.js";import{Fragment as i,computed as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createElementVNode as l,createTextVNode as u,createVNode as d,defineComponent as f,nextTick as p,normalizeClass as m,onBeforeUnmount as h,openBlock as g,ref as _,renderList as v,renderSlot as y,resolveComponent as b,toDisplayString as x,unref as S,watch as C,withCtx as w,withKeys as T,withModifiers as E}from"vue";import{NButton as D,NInput as O,NSpin as k}from"naive-ui";const A=[`data-message-id`],j={key:0,class:`c-chat__time-divider`},M={key:0,class:`c-chat__msg-avatar`},N=[`src`],P={key:1,class:`c-chat__avatar-fallback`},F={class:`c-chat__msg-body`},I={key:0,class:`c-chat__msg-username`},L={key:1,class:`c-chat__bubble`},R=[`aria-label`],z=[`src`,`alt`],B={class:`c-chat__file-info`},V={class:`c-chat__file-name`},H={key:0,class:`c-chat__file-size`},U={key:4,class:`c-chat__msg-time`},W={key:6,class:`c-chat__msg-status is-sending`};var G=n(f({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(n,{emit:r}){let{t:o}=e(),u=n,f=r,p=a(()=>!u.previous||new Date(u.msg.timestamp).getTime()-new Date(u.previous.timestamp).getTime()>3e5),h=e=>e.sender===`self`&&u.selfAvatar||e.avatar,_=e=>e.sender===`self`?u.selfName||e.username||o(`chat.self`):e.username||o(`common.unknown`);function v(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function y(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?v(e):`${t.getMonth()+1}/${t.getDate()} ${v(e)}`}function b(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,r)=>(g(),c(`div`,{class:`c-chat__message-row`,"data-message-id":n.msg.id},[s(` 时间分割 `),p.value?(g(),c(`div`,j,x(y(n.msg.timestamp)),1)):s(`v-if`,!0),s(` 消息条目 `),l(`div`,{class:m([`c-chat__msg`,`is-${n.msg.sender}`])},[s(` 头像 `),n.msg.sender===`system`?s(`v-if`,!0):(g(),c(`div`,M,[h(n.msg)?(g(),c(`img`,{key:0,src:h(n.msg),class:`c-chat__avatar`},null,8,N)):(g(),c(`div`,P,x(_(n.msg).charAt(0)),1))])),s(` 消息体 `),l(`div`,F,[n.msg.sender===`other`&&n.msg.username?(g(),c(`span`,I,x(n.msg.username),1)):s(`v-if`,!0),s(` 文本消息 `),n.msg.type===`text`||n.msg.type===`system`?(g(),c(`div`,L,x(n.msg.content),1)):n.msg.type===`image`?(g(),c(i,{key:2},[s(` 图片消息 `),l(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":S(o)(`chat.imagePreview`,{name:n.msg.username||S(o)(`chat.title`)}),onClick:r[0]||=e=>f(`image-preview`,n.msg.content)},[l(`img`,{src:n.msg.content,alt:n.msg.fileName||S(o)(`chat.image`),class:`c-chat__msg-image`},null,8,z)],8,R)],2112)):n.msg.type===`file`?(g(),c(i,{key:3},[s(` 文件消息 `),l(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:r[1]||=e=>f(`file-click`,n.msg)},[d(t,{name:`mdi:file-document-outline`,size:28}),l(`div`,B,[l(`span`,V,x(n.msg.fileName||S(o)(`chat.file`)),1),n.msg.fileSize?(g(),c(`span`,H,x(b(n.msg.fileSize)),1)):s(`v-if`,!0)])])],2112)):s(`v-if`,!0),s(` 时间戳 `),n.showTimestamp&&n.msg.sender!==`system`?(g(),c(`span`,U,x(v(n.msg.timestamp)),1)):s(`v-if`,!0),s(` 发送状态 `),n.msg.sender===`self`&&n.msg.status===`failed`?(g(),c(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:r[2]||=e=>f(`resend`,n.msg)},x(S(o)(`chat.failed`)),1)):n.msg.sender===`self`&&n.msg.status===`sending`?(g(),c(`span`,W,x(S(o)(`chat.sending`)),1)):s(`v-if`,!0)])],2)],8,A))}}),[[`__scopeId`,`data-v-47cd7e6f`]]);const K=[`data-contact-id`],q={class:`c-chat__contact-avatar`},J=[`src`,`alt`],ee={key:1,class:`c-chat__avatar-fallback`},te={key:2,class:`c-chat__online-dot`},ne={class:`c-chat__contact-info`},Y={class:`c-chat__contact-name`},X={key:0,class:`c-chat__contact-time`},re={key:0,class:`c-chat__contact-last`},ie={key:0,class:`c-chat__unread`};var Z=n(f({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e(),i=n;function a(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>(g(),c(`button`,{type:`button`,class:m([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[l(`div`,q,[t.contact.avatar?(g(),c(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,J)):(g(),c(`div`,ee,x(t.contact.name.charAt(0)),1)),t.contact.online?(g(),c(`span`,te)):s(`v-if`,!0)]),l(`div`,ne,[l(`div`,Y,[l(`span`,null,x(t.contact.name),1),t.contact.lastTime?(g(),c(`span`,X,x(a(t.contact.lastTime)),1)):s(`v-if`,!0)]),t.contact.lastMessage?(g(),c(`div`,re,x(t.contact.lastMessage),1)):s(`v-if`,!0)]),t.contact.unread?(g(),c(`span`,ie,x(t.contact.unread>99?`99+`:t.contact.unread),1)):s(`v-if`,!0)],10,K))}}),[[`__scopeId`,`data-v-66c19394`]]);function ae(e){let t=!1,n=0,r,i,a,o=!0,s=!1,c=!1,l=0,u=0,d,f=()=>e.virtualRef.value?.listElRef??e.normalRef.value,m=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,g=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function _(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function v(e,i){if(_(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function y(e){let r=++n;_(),p(()=>{!t&&r===n&&e(r)})}function b(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function x(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function S(){o=!0,c=!1,s=!0,d=void 0,y(e=>{x(),v(e,()=>{x(),s=!1})})}function w(e){let{top:t}=e.getBoundingClientRect(),n=g(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function T(e,t){let n=f();if(!n||!d)return;let r=g(n).find(e=>e.dataset.messageId===d?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;b(Math.max(0,n.scrollTop+e-d.offset))}t>0?v(e,()=>T(e,t-1)):d=void 0}function E(t){d=t,o=!1,s=!1,y(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),T(n,3)})}function D(e,t){o=!1,s=!1,d=void 0,y(()=>{let n=f();n&&b(Math.max(0,e+n.scrollHeight-t))})}function O(){o=!1,s=!1,n++,_()}function k(){c=!0,d=void 0,O(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!c)return;c=!1;let e=f();e&&!d&&(o=m(e))})}function A(e){return l>0&&(l!==e.scrollHeight||u!==e.clientHeight)}function j(e){let t=A(e);if(l=e.scrollHeight,u=e.clientHeight,!(s||d)){if(o&&t&&!c){S();return}c=!1,o=m(e)}}function M(){let t=f();t&&(j(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function N(){if(!t)if(d){let e=n;v(e,()=>T(e,1))}else o&&S()}C(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(a?.disconnect(),a=void 0,e&&typeof ResizeObserver<`u`){a=new ResizeObserver(N),a.observe(e);let t=f();t&&t!==e&&a.observe(t)}},{flush:`post`});let P=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},F=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),I=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function L(e,t,n){let r=e[6]||t[6]?w(n):void 0;r?E(r):D(n.scrollTop,n.scrollHeight)}let R=(e,t,n)=>I(e,t)||t[1]===0||!c&&(m(n)||o&&A(n));function z(e,t,n){R(e,t,n)?S():L(e,t,n)}return C(P,(e,t)=>{let n=f();if(!t||e[0]!==t[0]||!n){S();return}F(e,t)||e[5]!==t[5]?L(e,t,n):e[6]===t[6]?R(e,t,n)?S():d||O():z(e,t,n)},{immediate:!0,flush:`pre`}),h(()=>{t=!0,n++,_(),i!==void 0&&cancelAnimationFrame(i),a?.disconnect()}),{scrollToBottom:S,handleMessagesScroll:M,handleScrollIntent:k}}const Q={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},oe={class:`c-chat`},se={key:0,class:`c-chat__sidebar`},ce={class:`c-chat__sidebar-header`},le={class:`c-chat__search`},ue={key:1,class:`c-chat__contact-list`},de={key:1,class:`c-chat__main`},$={class:`c-chat__header`},fe={key:0,class:`c-chat__header-status`},pe={key:0,class:`c-chat__load-more`},me={class:`c-chat__message-items`},he={key:0,class:`c-chat__load-more`},ge={key:1,class:`c-chat__empty`},_e={class:`c-chat__input-area`},ve={class:`c-chat__input-actions`},ye={class:`c-chat__input-wrap`},be={class:`c-chat__main c-chat__no-chat`};var xe=n(f({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:Q.showContacts},showTimestamp:{type:Boolean,default:Q.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:Q.showSendBtn},loadingHistory:{type:Boolean,default:Q.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:f,emit:p}){let{t:m}=e(),h=n,b=p,A=a(()=>({...Q,...h,placeholder:h.placeholder??m(`chat.placeholder`),title:h.title??m(`chat.title`)})),j=_(``),M=_(``),N=_(null),P=_(null),F=a(()=>h.contacts??[]),I=a(()=>h.messages??[]),L=a(()=>h.currentContactId||F.value[0]?.id||``),R=new Map;C(L,(e,t)=>{let n=j.value,r=R.get(e)??``;for(R.delete(e),R.delete(t),n&&(h.contacts?.some(e=>e.id===t)||!h.showContacts)&&R.set(t,n);R.size>50;)R.delete(R.keys().next().value);j.value=r},{flush:`sync`}),C(()=>h.contacts?.map(e=>e.id),e=>{if(!h.showContacts)return;let t=new Set(e);t.has(L.value)||(j.value=``);for(let e of R.keys())t.has(e)||R.delete(e)});let z=a(()=>F.value.find(e=>e.id===L.value)),B=a(()=>{if(!M.value)return F.value;let e=M.value.toLowerCase();return F.value.filter(t=>t.name.toLowerCase().includes(e))}),V=a(()=>h.virtualScroll&&I.value.length>=200),H=a(()=>h.virtualScroll&&B.value.length>=100),U=e=>{b(`select-contact`,e)},W=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=j.value.trim();t&&(b(`send`,t),j.value=``)},{scrollToBottom:K,handleMessagesScroll:q,handleScrollIntent:J}=ae({messages:I,contactId:L,virtual:V,loadingHistory:a(()=>A.value.loadingHistory),normalRef:N,virtualRef:P,onLoadMore:()=>b(`load-more`)});return f({scrollToBottom:K}),(e,a)=>{let f=O,p=k,h=D;return g(),c(`div`,oe,[s(` ===== 联系人侧栏 ===== `),A.value.showContacts&&F.value.length?(g(),c(`aside`,se,[l(`div`,ce,[d(t,{name:`mdi:chat-outline`,size:20}),u(` `+x(S(m)(`chat.sessions`)),1)]),s(` 搜索框 `),l(`div`,le,[d(f,{value:M.value,"onUpdate:value":a[0]||=e=>M.value=e,placeholder:S(m)(`chat.search`),clearable:``,size:`small`},{prefix:w(()=>[d(t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),H.value?(g(),o(S(r),{key:0,class:`c-chat__contact-list`,items:B.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:w(({index:e})=>[d(Z,{contact:B.value[e],active:B.value[e].id===L.value,onSelect:U},null,8,[`contact`,`active`])]),_:1},8,[`items`])):(g(),c(`div`,ue,[(g(!0),c(i,null,v(B.value,e=>(g(),o(Z,{key:e.id,contact:e,active:e.id===L.value,onSelect:U},null,8,[`contact`,`active`]))),128))]))])):s(`v-if`,!0),s(` ===== 主聊天区域 ===== `),z.value||!A.value.showContacts?(g(),c(`div`,de,[s(` 顶栏 `),l(`div`,$,[y(e.$slots,`header`,{},()=>[l(`span`,null,x(z.value?.name||A.value.title),1),z.value?.online?(g(),c(`span`,fe,x(S(m)(`chat.online`)),1)):s(`v-if`,!0)],!0)]),V.value?(g(),o(S(r),{key:L.value,ref_key:`virtualMessagesRef`,ref:P,class:`c-chat__messages c-chat__messages--virtual`,items:I.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:S(q),onWheel:S(J),onPointerdown:S(J),onKeydown:S(J)},{default:w(({index:e})=>[l(`div`,null,[e===0&&A.value.loadingHistory?(g(),c(`div`,pe,[d(p,{size:`small`})])):s(`v-if`,!0),d(G,{msg:I.value[e],previous:I.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":A.value.showTimestamp,onImagePreview:a[1]||=e=>b(`image-preview`,e),onFileClick:a[2]||=e=>b(`file-click`,e),onResend:a[3]||=e=>b(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):(g(),c(`div`,{key:1,ref_key:`messagesRef`,ref:N,class:`c-chat__messages`,onScroll:a[7]||=(...e)=>S(q)&&S(q)(...e),onWheel:a[8]||=(...e)=>S(J)&&S(J)(...e),onPointerdown:a[9]||=(...e)=>S(J)&&S(J)(...e),onKeydown:a[10]||=(...e)=>S(J)&&S(J)(...e)},[l(`div`,me,[A.value.loadingHistory?(g(),c(`div`,he,[d(p,{size:`small`})])):s(`v-if`,!0),!I.value.length&&!A.value.loadingHistory?(g(),c(`div`,ge,x(S(m)(`chat.empty`)),1)):s(`v-if`,!0),(g(!0),c(i,null,v(I.value,(e,t)=>(g(),o(G,{key:e.id,msg:e,previous:I.value[t-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":A.value.showTimestamp,onImagePreview:a[4]||=e=>b(`image-preview`,e),onFileClick:a[5]||=e=>b(`file-click`,e),onResend:a[6]||=e=>b(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),s(` 输入区域 `),l(`div`,_e,[l(`div`,ve,[y(e.$slots,`input-actions`,{},()=>[d(h,{quaternary:``,circle:``,size:`small`,"aria-label":S(m)(`chat.emoji`),onClick:a[11]||=e=>b(`emoji-click`)},{icon:w(()=>[d(t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),d(h,{quaternary:``,circle:``,size:`small`,"aria-label":S(m)(`chat.attach`),onClick:a[12]||=e=>b(`file-upload`)},{icon:w(()=>[d(t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),l(`div`,ye,[d(f,{value:j.value,"onUpdate:value":a[13]||=e=>j.value=e,placeholder:A.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:T(E(W,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),A.value.showSendBtn?(g(),o(h,{key:0,type:`primary`,disabled:!j.value.trim(),class:`c-chat__send-btn`,"aria-label":S(m)(`chat.send`),onClick:W},{icon:w(()=>[d(t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):s(`v-if`,!0)])])):(g(),c(i,{key:2},[s(` ===== 未选中联系人空态 ===== `),l(`div`,be,[d(t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),l(`span`,null,x(S(m)(`chat.choose`)),1)])],2112))])}}}),[[`__scopeId`,`data-v-34763202`]]);export{Q as n,xe as t};
|
package/dist/C_FilePreview.css
CHANGED
|
@@ -481,10 +481,10 @@
|
|
|
481
481
|
.text-gray-600[data-v-dae08a5f]{--un-text-opacity:1;color:rgb(75 85 99 / var(--un-text-opacity));}
|
|
482
482
|
.font-semibold[data-v-dae08a5f]{font-weight:600;}
|
|
483
483
|
|
|
484
|
-
.c-file-preview-wrapper[data-v-
|
|
484
|
+
.c-file-preview-wrapper[data-v-ab225f2d] {
|
|
485
485
|
width: 100%;
|
|
486
486
|
}
|
|
487
|
-
.c-file-preview-wrapper .file-info-card .file-info[data-v-
|
|
487
|
+
.c-file-preview-wrapper .file-info-card .file-info[data-v-ab225f2d] {
|
|
488
488
|
display: flex;
|
|
489
489
|
align-items: center;
|
|
490
490
|
gap: 16px;
|
|
@@ -495,12 +495,12 @@
|
|
|
495
495
|
transition: var(--c-transition, 0.2s ease);
|
|
496
496
|
cursor: pointer;
|
|
497
497
|
}
|
|
498
|
-
.c-file-preview-wrapper .file-info-card .file-info[data-v-
|
|
498
|
+
.c-file-preview-wrapper .file-info-card .file-info[data-v-ab225f2d]:hover {
|
|
499
499
|
border-color: var(--c-primary, #40a9ff);
|
|
500
500
|
box-shadow: 0 4px 12px rgba(64, 169, 255, 0.15);
|
|
501
501
|
transform: translateY(-1px);
|
|
502
502
|
}
|
|
503
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-icon[data-v-
|
|
503
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-icon[data-v-ab225f2d] {
|
|
504
504
|
flex-shrink: 0;
|
|
505
505
|
width: 56px;
|
|
506
506
|
height: 56px;
|
|
@@ -511,11 +511,11 @@
|
|
|
511
511
|
border-radius: 12px;
|
|
512
512
|
border: 1px solid #dee2e6;
|
|
513
513
|
}
|
|
514
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-details[data-v-
|
|
514
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-details[data-v-ab225f2d] {
|
|
515
515
|
flex: 1;
|
|
516
516
|
min-width: 0;
|
|
517
517
|
}
|
|
518
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-name[data-v-
|
|
518
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-name[data-v-ab225f2d] {
|
|
519
519
|
display: flex;
|
|
520
520
|
align-items: center;
|
|
521
521
|
gap: 12px;
|
|
@@ -524,22 +524,22 @@
|
|
|
524
524
|
font-size: 16px;
|
|
525
525
|
color: var(--c-text-1, #1f2937);
|
|
526
526
|
}
|
|
527
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-meta[data-v-
|
|
527
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-meta[data-v-ab225f2d] {
|
|
528
528
|
display: flex;
|
|
529
529
|
gap: 16px;
|
|
530
530
|
font-size: 13px;
|
|
531
531
|
color: var(--c-text-2, #6b7280);
|
|
532
532
|
}
|
|
533
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-meta .file-size[data-v-
|
|
533
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-details .file-meta .file-size[data-v-ab225f2d] {
|
|
534
534
|
font-weight: 500;
|
|
535
535
|
color: var(--c-text-1, #374151);
|
|
536
536
|
}
|
|
537
|
-
.c-file-preview-wrapper .file-info-card .file-info .file-actions[data-v-
|
|
537
|
+
.c-file-preview-wrapper .file-info-card .file-info .file-actions[data-v-ab225f2d] {
|
|
538
538
|
flex-shrink: 0;
|
|
539
539
|
display: flex;
|
|
540
540
|
gap: 8px;
|
|
541
541
|
}
|
|
542
|
-
.modal-container[data-v-
|
|
542
|
+
.modal-container[data-v-ab225f2d] {
|
|
543
543
|
container-type: inline-size;
|
|
544
544
|
background: var(--c-bg-card, white);
|
|
545
545
|
border-radius: 8px;
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
height: min(700px, 85dvh);
|
|
552
552
|
overflow: hidden;
|
|
553
553
|
}
|
|
554
|
-
.modal-container .modal-header[data-v-
|
|
554
|
+
.modal-container .modal-header[data-v-ab225f2d] {
|
|
555
555
|
display: flex;
|
|
556
556
|
justify-content: space-between;
|
|
557
557
|
align-items: center;
|
|
@@ -562,7 +562,7 @@
|
|
|
562
562
|
z-index: 10;
|
|
563
563
|
position: relative;
|
|
564
564
|
}
|
|
565
|
-
.modal-container .modal-header .modal-title[data-v-
|
|
565
|
+
.modal-container .modal-header .modal-title[data-v-ab225f2d] {
|
|
566
566
|
display: flex;
|
|
567
567
|
align-items: center;
|
|
568
568
|
gap: 8px;
|
|
@@ -571,26 +571,26 @@
|
|
|
571
571
|
color: var(--c-text-1, #333);
|
|
572
572
|
min-width: 0;
|
|
573
573
|
}
|
|
574
|
-
.modal-container .modal-header .modal-title span[data-v-
|
|
574
|
+
.modal-container .modal-header .modal-title span[data-v-ab225f2d] {
|
|
575
575
|
max-width: 400px;
|
|
576
576
|
overflow: hidden;
|
|
577
577
|
text-overflow: ellipsis;
|
|
578
578
|
white-space: nowrap;
|
|
579
579
|
}
|
|
580
|
-
.modal-container .modal-header .modal-actions[data-v-
|
|
580
|
+
.modal-container .modal-header .modal-actions[data-v-ab225f2d] {
|
|
581
581
|
display: flex;
|
|
582
582
|
gap: 8px;
|
|
583
583
|
align-items: center;
|
|
584
584
|
flex-shrink: 0;
|
|
585
585
|
}
|
|
586
|
-
.modal-container .modal-content[data-v-
|
|
586
|
+
.modal-container .modal-content[data-v-ab225f2d] {
|
|
587
587
|
flex: 1;
|
|
588
588
|
display: flex;
|
|
589
589
|
flex-direction: column;
|
|
590
590
|
overflow: visible;
|
|
591
591
|
min-height: 0;
|
|
592
592
|
}
|
|
593
|
-
.modal-container .preview-header[data-v-
|
|
593
|
+
.modal-container .preview-header[data-v-ab225f2d] {
|
|
594
594
|
padding: 16px;
|
|
595
595
|
border-bottom: 1px solid var(--c-border, #e0e0e0);
|
|
596
596
|
background-color: var(--c-bg-card, #f9f9f9);
|
|
@@ -598,88 +598,88 @@
|
|
|
598
598
|
z-index: 9;
|
|
599
599
|
position: relative;
|
|
600
600
|
}
|
|
601
|
-
.modal-container .preview-header-row[data-v-
|
|
602
|
-
.modal-container .preview-meta[data-v-
|
|
601
|
+
.modal-container .preview-header-row[data-v-ab225f2d],
|
|
602
|
+
.modal-container .preview-meta[data-v-ab225f2d] {
|
|
603
603
|
display: flex;
|
|
604
604
|
align-items: center;
|
|
605
605
|
gap: 8px;
|
|
606
606
|
min-width: 0;
|
|
607
607
|
}
|
|
608
|
-
.modal-container .preview-header-row[data-v-
|
|
608
|
+
.modal-container .preview-header-row[data-v-ab225f2d] {
|
|
609
609
|
justify-content: space-between;
|
|
610
610
|
flex-wrap: wrap;
|
|
611
611
|
}
|
|
612
|
-
.modal-container .preview-meta[data-v-
|
|
612
|
+
.modal-container .preview-meta[data-v-ab225f2d] {
|
|
613
613
|
flex-wrap: wrap;
|
|
614
614
|
}
|
|
615
|
-
.modal-container .preview-meta[data-v-
|
|
615
|
+
.modal-container .preview-meta[data-v-ab225f2d] > .n-ellipsis {
|
|
616
616
|
max-width: min(300px, 100%);
|
|
617
617
|
}
|
|
618
618
|
@container (max-width: 600px) {
|
|
619
|
-
.modal-container .modal-header[data-v-
|
|
620
|
-
.modal-container .preview-header[data-v-
|
|
619
|
+
.modal-container .modal-header[data-v-ab225f2d],
|
|
620
|
+
.modal-container .preview-header[data-v-ab225f2d] {
|
|
621
621
|
padding: 10px 12px;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
.modal-container .preview-content[data-v-
|
|
624
|
+
.modal-container .preview-content[data-v-ab225f2d] {
|
|
625
625
|
flex: 1;
|
|
626
626
|
overflow: auto;
|
|
627
627
|
min-height: 0;
|
|
628
628
|
position: relative;
|
|
629
629
|
}
|
|
630
|
-
.modal-container .preview-content .status-container[data-v-
|
|
630
|
+
.modal-container .preview-content .status-container[data-v-ab225f2d] {
|
|
631
631
|
height: 300px;
|
|
632
632
|
display: flex;
|
|
633
633
|
align-items: center;
|
|
634
634
|
justify-content: center;
|
|
635
635
|
}
|
|
636
|
-
.c-file-preview-inline[data-v-
|
|
636
|
+
.c-file-preview-inline[data-v-ab225f2d] {
|
|
637
637
|
container-type: inline-size;
|
|
638
638
|
height: 580px;
|
|
639
639
|
min-width: 0;
|
|
640
640
|
overflow: hidden;
|
|
641
641
|
}
|
|
642
|
-
.c-file-preview-inline .status-container[data-v-
|
|
642
|
+
.c-file-preview-inline .status-container[data-v-ab225f2d] {
|
|
643
643
|
display: flex;
|
|
644
644
|
align-items: center;
|
|
645
645
|
justify-content: center;
|
|
646
646
|
height: 100%;
|
|
647
647
|
padding: 24px;
|
|
648
648
|
}
|
|
649
|
-
.modal-container[data-v-
|
|
650
|
-
.c-file-preview-inline[data-v-
|
|
649
|
+
.modal-container[data-v-ab225f2d] .file-container,
|
|
650
|
+
.c-file-preview-inline[data-v-ab225f2d] .file-container {
|
|
651
651
|
min-width: 0;
|
|
652
652
|
}
|
|
653
|
-
.modal-container[data-v-
|
|
654
|
-
.modal-container[data-v-
|
|
655
|
-
.c-file-preview-inline[data-v-
|
|
656
|
-
.c-file-preview-inline[data-v-
|
|
653
|
+
.modal-container[data-v-ab225f2d] .word-main,
|
|
654
|
+
.modal-container[data-v-ab225f2d] .word-content,
|
|
655
|
+
.c-file-preview-inline[data-v-ab225f2d] .word-main,
|
|
656
|
+
.c-file-preview-inline[data-v-ab225f2d] .word-content {
|
|
657
657
|
min-width: 0;
|
|
658
658
|
}
|
|
659
659
|
@container (max-width:600px) {
|
|
660
|
-
.modal-container[data-v-
|
|
661
|
-
.c-file-preview-inline[data-v-
|
|
660
|
+
.modal-container[data-v-ab225f2d] .word-outline,
|
|
661
|
+
.c-file-preview-inline[data-v-ab225f2d] .word-outline {
|
|
662
662
|
display: none;
|
|
663
663
|
}
|
|
664
|
-
.modal-container[data-v-
|
|
665
|
-
.c-file-preview-inline[data-v-
|
|
664
|
+
.modal-container[data-v-ab225f2d] .file-toolbar > div,
|
|
665
|
+
.c-file-preview-inline[data-v-ab225f2d] .file-toolbar > div {
|
|
666
666
|
flex-wrap: wrap;
|
|
667
667
|
gap: 8px;
|
|
668
668
|
}
|
|
669
|
-
.modal-container[data-v-
|
|
670
|
-
.c-file-preview-inline[data-v-
|
|
669
|
+
.modal-container[data-v-ab225f2d] .excel-info,
|
|
670
|
+
.c-file-preview-inline[data-v-ab225f2d] .excel-info {
|
|
671
671
|
overflow: auto;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
/* layer: default */
|
|
676
|
-
.visible[data-v-
|
|
677
|
-
.\!inline[data-v-
|
|
678
|
-
.inline[data-v-
|
|
679
|
-
.hidden[data-v-
|
|
680
|
-
.h6[data-v-
|
|
681
|
-
.flex[data-v-
|
|
682
|
-
.gap-2[data-v-
|
|
683
|
-
.p\[style-name\=\'Title\'\][data-v-
|
|
684
|
-
.text-sm[data-v-
|
|
685
|
-
.text-gray-500[data-v-
|
|
676
|
+
.visible[data-v-ab225f2d]{visibility:visible;}
|
|
677
|
+
.\!inline[data-v-ab225f2d]{display:inline !important;}
|
|
678
|
+
.inline[data-v-ab225f2d]{display:inline;}
|
|
679
|
+
.hidden[data-v-ab225f2d]{display:none;}
|
|
680
|
+
.h6[data-v-ab225f2d]{height:1.5rem;}
|
|
681
|
+
.flex[data-v-ab225f2d]{display:flex;}
|
|
682
|
+
.gap-2[data-v-ab225f2d]{gap:0.5rem;}
|
|
683
|
+
.p\[style-name\=\'Title\'\][data-v-ab225f2d]{padding:style-name='Title';}
|
|
684
|
+
.text-sm[data-v-ab225f2d]{font-size:0.875rem;line-height:1.25rem;}
|
|
685
|
+
.text-gray-500[data-v-ab225f2d]{--un-text-opacity:1;color:rgb(107 114 128 / var(--un-text-opacity));}
|