@acorex/components 21.0.3-next.39 → 21.0.3-next.40
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/{conversation2 → conversation}/README.md +23 -23
- package/fesm2022/acorex-components-button.mjs +4 -4
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs +13711 -0
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs +119 -0
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs +59 -0
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs +432 -0
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs +177 -0
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs +54 -0
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-composer-action-choice-dialog.component-C28hl7iD.mjs +101 -0
- package/fesm2022/acorex-components-conversation-composer-action-choice-dialog.component-C28hl7iD.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs +100 -0
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs +121 -0
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs +84 -0
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs +238 -0
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs +1080 -0
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs +102 -0
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs +90 -0
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-emoji-categories-C7Gm95V0.mjs +1840 -0
- package/fesm2022/acorex-components-conversation-emoji-categories-C7Gm95V0.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs +44 -0
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs +64 -0
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs +468 -0
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs +125 -0
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs +50 -0
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs +21 -0
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs +77 -0
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs +407 -0
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs +83 -0
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs +184 -0
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs +266 -0
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs +149 -0
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs +118 -0
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs +17 -0
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs +140 -0
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs +33 -0
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs +172 -0
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs +224 -0
- package/fesm2022/acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs +81 -0
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs +91 -0
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs +537 -0
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs +163 -0
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs +68 -0
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs +95 -0
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs +187 -0
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs +170 -0
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs +750 -0
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs +103 -0
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs +55 -0
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs +109 -0
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs +105 -0
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs +62 -0
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs +446 -0
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs +181 -0
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs +54 -0
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs +17 -0
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs +344 -0
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs +270 -0
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs.map +1 -0
- package/fesm2022/acorex-components-conversation.mjs +2 -0
- package/fesm2022/acorex-components-conversation.mjs.map +1 -0
- package/fesm2022/acorex-components-kbd.mjs +2 -2
- package/fesm2022/acorex-components-kbd.mjs.map +1 -1
- package/fesm2022/acorex-components-scheduler-picker.mjs +22 -14
- package/fesm2022/acorex-components-scheduler-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +4 -13
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-tree-view.mjs +2 -2
- package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
- package/package.json +6 -10
- package/types/{acorex-components-conversation2.d.ts → acorex-components-conversation.d.ts} +1127 -1928
- package/types/acorex-components-scheduler-picker.d.ts +2 -0
- package/types/acorex-components-side-menu.d.ts +1 -3
- package/fesm2022/acorex-components-conversation2.mjs +0 -22347
- package/fesm2022/acorex-components-conversation2.mjs.map +0 -1
- package/fesm2022/acorex-components-sidebar.mjs +0 -275
- package/fesm2022/acorex-components-sidebar.mjs.map +0 -1
- package/sidebar/README.md +0 -5
- package/types/acorex-components-sidebar.d.ts +0 -132
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createFileTypeMetadata, AXFileTypeInfoProvider } from '@acorex/core/file';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable } from '@angular/core';
|
|
5
|
+
import { t as AX_CONVERSATION_IMAGE_CATALOG, u as AX_CONVERSATION_VIDEO_CATALOG, p as AX_CONVERSATION_AUDIO_CATALOG, q as AX_CONVERSATION_FILE_CATALOG } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
6
|
+
import { normalizeFilePayload } from './acorex-components-conversation-file.payload-DyFxTQYn.mjs';
|
|
7
|
+
import { a as formatFileSize } from './acorex-components-conversation-media-formatters-DV3wEEno.mjs';
|
|
8
|
+
|
|
9
|
+
const MB = 1024 * 1024;
|
|
10
|
+
const AX_CONVERSATION_FILE_PRESENTATION = {
|
|
11
|
+
icon: 'fa-light fa-file text-neutral-500',
|
|
12
|
+
title: 'File',
|
|
13
|
+
};
|
|
14
|
+
const AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES = [
|
|
15
|
+
'image/*',
|
|
16
|
+
'video/*',
|
|
17
|
+
'audio/*',
|
|
18
|
+
'application/pdf',
|
|
19
|
+
'application/msword',
|
|
20
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
21
|
+
'application/vnd.ms-excel',
|
|
22
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
23
|
+
'application/zip',
|
|
24
|
+
'application/x-zip-compressed',
|
|
25
|
+
'application/x-7z-compressed',
|
|
26
|
+
'application/vnd.rar',
|
|
27
|
+
'application/octet-stream',
|
|
28
|
+
'text/plain',
|
|
29
|
+
];
|
|
30
|
+
const AX_CONVERSATION_FILE_UTILITY = {
|
|
31
|
+
preview: 'preview',
|
|
32
|
+
formatSize: 'formatSize',
|
|
33
|
+
createLocalPreviewUrl: 'createLocalPreviewUrl',
|
|
34
|
+
pickerCatalog: 'pickerCatalog',
|
|
35
|
+
};
|
|
36
|
+
function blobUrl(ctx, blob) {
|
|
37
|
+
if (!isPlatformBrowser(ctx.platformId)) {
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
return URL.createObjectURL(blob);
|
|
41
|
+
}
|
|
42
|
+
function conversationFileUtilities() {
|
|
43
|
+
return {
|
|
44
|
+
[AX_CONVERSATION_FILE_UTILITY.preview]: async (ctx, file) => {
|
|
45
|
+
const f = file;
|
|
46
|
+
if (f.type.startsWith('image/')) {
|
|
47
|
+
return ctx.readAsDataUrl(f);
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
},
|
|
51
|
+
[AX_CONVERSATION_FILE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes),
|
|
52
|
+
[AX_CONVERSATION_FILE_UTILITY.createLocalPreviewUrl]: (ctx, source) => blobUrl(ctx, source),
|
|
53
|
+
[AX_CONVERSATION_FILE_UTILITY.pickerCatalog]: (_ctx, file) => {
|
|
54
|
+
const f = file;
|
|
55
|
+
if (f.type.startsWith('image/'))
|
|
56
|
+
return AX_CONVERSATION_IMAGE_CATALOG;
|
|
57
|
+
if (f.type.startsWith('video/'))
|
|
58
|
+
return AX_CONVERSATION_VIDEO_CATALOG;
|
|
59
|
+
if (f.type.startsWith('audio/'))
|
|
60
|
+
return AX_CONVERSATION_AUDIO_CATALOG;
|
|
61
|
+
return AX_CONVERSATION_FILE_CATALOG;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function createConversationFileFileType() {
|
|
66
|
+
const presentation = AX_CONVERSATION_FILE_PRESENTATION;
|
|
67
|
+
return {
|
|
68
|
+
name: AX_CONVERSATION_FILE_CATALOG,
|
|
69
|
+
metadata: createFileTypeMetadata('conversation'),
|
|
70
|
+
title: presentation.title,
|
|
71
|
+
icon: presentation.icon,
|
|
72
|
+
validations: {
|
|
73
|
+
mimeTypes: [...AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES],
|
|
74
|
+
minSize: 1,
|
|
75
|
+
maxSize: 100 * MB,
|
|
76
|
+
},
|
|
77
|
+
extensions: [
|
|
78
|
+
{ name: 'pdf', title: 'PDF', validations: { mimeTypes: ['application/pdf'], maxSize: 25 * MB } },
|
|
79
|
+
{ name: 'doc', title: 'Word' },
|
|
80
|
+
{ name: 'docx', title: 'Word' },
|
|
81
|
+
{ name: 'txt', title: 'Text', validations: { mimeTypes: ['text/plain'], maxSize: 5 * MB } },
|
|
82
|
+
{
|
|
83
|
+
name: 'zip',
|
|
84
|
+
title: 'ZIP',
|
|
85
|
+
validations: {
|
|
86
|
+
mimeTypes: ['application/zip', 'application/x-zip-compressed', 'application/octet-stream'],
|
|
87
|
+
maxSize: 50 * MB,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
utilities: conversationFileUtilities(),
|
|
92
|
+
copy: (payload) => {
|
|
93
|
+
const file = normalizeFilePayload(payload);
|
|
94
|
+
const caption = file.caption?.trim();
|
|
95
|
+
const items = file.files.map((item) => {
|
|
96
|
+
const name = item.name?.trim();
|
|
97
|
+
const url = item.url?.trim();
|
|
98
|
+
const line = name && url ? `${name} — ${url}` : url || name;
|
|
99
|
+
return { name, url, line };
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
text: caption ?? '',
|
|
103
|
+
meta: { kind: 'file', caption, items, count: file.files.length },
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
class AXConversationFileFileTypeProvider extends AXFileTypeInfoProvider {
|
|
109
|
+
items() {
|
|
110
|
+
return Promise.resolve([createConversationFileFileType()]);
|
|
111
|
+
}
|
|
112
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
113
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, providedIn: 'root' }); }
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, decorators: [{
|
|
116
|
+
type: Injectable,
|
|
117
|
+
args: [{ providedIn: 'root' }]
|
|
118
|
+
}] });
|
|
119
|
+
|
|
120
|
+
export { AXConversationFileFileTypeProvider, AX_CONVERSATION_FILE_CATALOG, AX_CONVERSATION_FILE_PRESENTATION, conversationFileUtilities, createConversationFileFileType };
|
|
121
|
+
//# sourceMappingURL=acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/composer/components/file-picker/conversation-file.file-type.ts"],"sourcesContent":["import type { AXFileCopyData, AXFileType } from '@acorex/core/file';\nimport { AXFileTypeInfoProvider, createFileTypeMetadata } from '@acorex/core/file';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport type { AXConversationFilePayload } from '../../../../models';\nimport {\n AX_CONVERSATION_AUDIO_CATALOG,\n AX_CONVERSATION_FILE_CATALOG,\n AX_CONVERSATION_IMAGE_CATALOG,\n AX_CONVERSATION_VIDEO_CATALOG,\n} from '../../../../models/message-file-type-catalog';\nimport { normalizeFilePayload } from '../../../message-list/components/file-renderer/file.payload';\nimport { formatFileSize } from '../shared/media-formatters';\n\nexport { AX_CONVERSATION_FILE_CATALOG };\n\nconst MB = 1024 * 1024;\n\nexport const AX_CONVERSATION_FILE_PRESENTATION = {\n icon: 'fa-light fa-file text-neutral-500',\n title: 'File',\n} as const;\n\nconst AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES = [\n 'image/*',\n 'video/*',\n 'audio/*',\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/zip',\n 'application/x-zip-compressed',\n 'application/x-7z-compressed',\n 'application/vnd.rar',\n 'application/octet-stream',\n 'text/plain',\n] as const;\n\ntype AXConversationFileTypeUtilityContext = {\n readAsDataUrl: (file: File | Blob) => Promise<string>;\n platformId: object;\n};\n\nconst AX_CONVERSATION_FILE_UTILITY = {\n preview: 'preview',\n formatSize: 'formatSize',\n createLocalPreviewUrl: 'createLocalPreviewUrl',\n pickerCatalog: 'pickerCatalog',\n} as const;\n\nfunction blobUrl(ctx: AXConversationFileTypeUtilityContext, blob: Blob): string {\n if (!isPlatformBrowser(ctx.platformId)) {\n return '';\n }\n return URL.createObjectURL(blob);\n}\n\nexport function conversationFileUtilities(): NonNullable<AXFileType['utilities']> {\n return {\n [AX_CONVERSATION_FILE_UTILITY.preview]: async (ctx, file) => {\n const f = file as File;\n if (f.type.startsWith('image/')) {\n return (ctx as AXConversationFileTypeUtilityContext).readAsDataUrl(f);\n }\n return undefined;\n },\n [AX_CONVERSATION_FILE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes as number),\n [AX_CONVERSATION_FILE_UTILITY.createLocalPreviewUrl]: (ctx, source) => blobUrl(ctx as AXConversationFileTypeUtilityContext, source as Blob),\n [AX_CONVERSATION_FILE_UTILITY.pickerCatalog]: (_ctx, file) => {\n const f = file as File;\n if (f.type.startsWith('image/')) return AX_CONVERSATION_IMAGE_CATALOG;\n if (f.type.startsWith('video/')) return AX_CONVERSATION_VIDEO_CATALOG;\n if (f.type.startsWith('audio/')) return AX_CONVERSATION_AUDIO_CATALOG;\n return AX_CONVERSATION_FILE_CATALOG;\n },\n };\n}\n\nexport function createConversationFileFileType(): import('@acorex/core/file').AXFileType {\n const presentation = AX_CONVERSATION_FILE_PRESENTATION;\n return {\n name: AX_CONVERSATION_FILE_CATALOG,\n metadata: createFileTypeMetadata('conversation'),\n title: presentation.title,\n icon: presentation.icon,\n validations: {\n mimeTypes: [...AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES],\n minSize: 1,\n maxSize: 100 * MB,\n },\n extensions: [\n { name: 'pdf', title: 'PDF', validations: { mimeTypes: ['application/pdf'], maxSize: 25 * MB } },\n { name: 'doc', title: 'Word' },\n { name: 'docx', title: 'Word' },\n { name: 'txt', title: 'Text', validations: { mimeTypes: ['text/plain'], maxSize: 5 * MB } },\n {\n name: 'zip',\n title: 'ZIP',\n validations: {\n mimeTypes: ['application/zip', 'application/x-zip-compressed', 'application/octet-stream'],\n maxSize: 50 * MB,\n },\n },\n ],\n utilities: conversationFileUtilities(),\n copy: (payload): AXFileCopyData => {\n const file = normalizeFilePayload(payload as AXConversationFilePayload);\n const caption = file.caption?.trim();\n const items = file.files.map((item) => {\n const name = item.name?.trim();\n const url = item.url?.trim();\n const line = name && url ? `${name} — ${url}` : url || name;\n return { name, url, line };\n });\n return {\n text: caption ?? '',\n meta: { kind: 'file', caption, items, count: file.files.length },\n };\n },\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXConversationFileFileTypeProvider extends AXFileTypeInfoProvider {\n items() {\n return Promise.resolve([createConversationFileFileType()]);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAgBA,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI;AAEf,MAAM,iCAAiC,GAAG;AAC/C,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,KAAK,EAAE,MAAM;;AAGf,MAAM,uCAAuC,GAAG;IAC9C,SAAS;IACT,SAAS;IACT,SAAS;IACT,iBAAiB;IACjB,oBAAoB;IACpB,yEAAyE;IACzE,0BAA0B;IAC1B,mEAAmE;IACnE,iBAAiB;IACjB,8BAA8B;IAC9B,6BAA6B;IAC7B,qBAAqB;IACrB,0BAA0B;IAC1B,YAAY;CACJ;AAOV,MAAM,4BAA4B,GAAG;AACnC,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,eAAe;CACtB;AAEV,SAAS,OAAO,CAAC,GAAyC,EAAE,IAAU,EAAA;IACpE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACtC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;AAClC;SAEgB,yBAAyB,GAAA;IACvC,OAAO;QACL,CAAC,4BAA4B,CAAC,OAAO,GAAG,OAAO,GAAG,EAAE,IAAI,KAAI;YAC1D,MAAM,CAAC,GAAG,IAAY;YACtB,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;AAC/B,gBAAA,OAAQ,GAA4C,CAAC,aAAa,CAAC,CAAC,CAAC;YACvE;AACA,YAAA,O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AM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;aACjE;QACH,CAAC;KACF;AACH;AAGM,MAAO,kCAAmC,SAAQ,sBAAsB,CAAA;IAC5E,KAAK,GAAA;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAC5D;8GAHW,kCAAkC,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createFileTypeMetadata, AXFileTypeInfoProvider } from '@acorex/core/file';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable } from '@angular/core';
|
|
5
|
+
import { t as AX_CONVERSATION_IMAGE_CATALOG, n as normalizeImagePayload } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
6
|
+
import { a as formatFileSize } from './acorex-components-conversation-media-formatters-DV3wEEno.mjs';
|
|
7
|
+
|
|
8
|
+
const MB = 1024 * 1024;
|
|
9
|
+
const AX_CONVERSATION_IMAGE_PRESENTATION = {
|
|
10
|
+
icon: 'fa-light fa-image text-purple-500',
|
|
11
|
+
title: 'Image',
|
|
12
|
+
};
|
|
13
|
+
const AX_CONVERSATION_IMAGE_UTILITY = {
|
|
14
|
+
preview: 'preview',
|
|
15
|
+
formatSize: 'formatSize',
|
|
16
|
+
createLocalPreviewUrl: 'createLocalPreviewUrl',
|
|
17
|
+
};
|
|
18
|
+
function blobUrl(ctx, blob) {
|
|
19
|
+
if (!isPlatformBrowser(ctx.platformId)) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
return URL.createObjectURL(blob);
|
|
23
|
+
}
|
|
24
|
+
function conversationImageUtilities() {
|
|
25
|
+
return {
|
|
26
|
+
[AX_CONVERSATION_IMAGE_UTILITY.preview]: (ctx, file) => ctx.readAsDataUrl(file),
|
|
27
|
+
[AX_CONVERSATION_IMAGE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes),
|
|
28
|
+
[AX_CONVERSATION_IMAGE_UTILITY.createLocalPreviewUrl]: (ctx, source) => {
|
|
29
|
+
const blob = source;
|
|
30
|
+
if (blob.type.startsWith('image/')) {
|
|
31
|
+
return ctx.readAsDataUrl(blob);
|
|
32
|
+
}
|
|
33
|
+
return blobUrl(ctx, blob);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createConversationImageFileType() {
|
|
38
|
+
const presentation = AX_CONVERSATION_IMAGE_PRESENTATION;
|
|
39
|
+
return {
|
|
40
|
+
name: AX_CONVERSATION_IMAGE_CATALOG,
|
|
41
|
+
metadata: createFileTypeMetadata('conversation'),
|
|
42
|
+
title: presentation.title,
|
|
43
|
+
icon: presentation.icon,
|
|
44
|
+
validations: {
|
|
45
|
+
mimeTypes: ['image/*'],
|
|
46
|
+
minSize: 1,
|
|
47
|
+
maxSize: 100 * MB,
|
|
48
|
+
},
|
|
49
|
+
extensions: [
|
|
50
|
+
{ name: 'jpg', title: 'JPEG' },
|
|
51
|
+
{ name: 'jpeg', title: 'JPEG', validations: { maxSize: 5 * MB } },
|
|
52
|
+
{ name: 'png', title: 'PNG' },
|
|
53
|
+
{ name: 'gif', title: 'GIF' },
|
|
54
|
+
{ name: 'webp', title: 'WebP' },
|
|
55
|
+
{ name: 'svg', title: 'SVG', validations: { maxSize: 2 * MB } },
|
|
56
|
+
],
|
|
57
|
+
utilities: conversationImageUtilities(),
|
|
58
|
+
copy: (payload) => {
|
|
59
|
+
const image = normalizeImagePayload(payload);
|
|
60
|
+
const caption = image.caption?.trim();
|
|
61
|
+
const urls = image.images
|
|
62
|
+
.map((item) => item.url?.trim() || item.thumbnailUrl?.trim())
|
|
63
|
+
.filter((url) => !!url);
|
|
64
|
+
return {
|
|
65
|
+
text: caption ?? '',
|
|
66
|
+
meta: { kind: 'image', caption, urls, count: image.images.length },
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
class AXConversationImageFileTypeProvider extends AXFileTypeInfoProvider {
|
|
72
|
+
items() {
|
|
73
|
+
return Promise.resolve([createConversationImageFileType()]);
|
|
74
|
+
}
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
76
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, providedIn: 'root' }); }
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, decorators: [{
|
|
79
|
+
type: Injectable,
|
|
80
|
+
args: [{ providedIn: 'root' }]
|
|
81
|
+
}] });
|
|
82
|
+
|
|
83
|
+
export { AXConversationImageFileTypeProvider, AX_CONVERSATION_IMAGE_CATALOG, AX_CONVERSATION_IMAGE_PRESENTATION, conversationImageUtilities, createConversationImageFileType };
|
|
84
|
+
//# sourceMappingURL=acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/composer/components/image-picker/conversation-image.file-type.ts"],"sourcesContent":["import type { AXFileCopyData, AXFileType } from '@acorex/core/file';\nimport { AXFileTypeInfoProvider, createFileTypeMetadata } from '@acorex/core/file';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport type { AXConversationImagePayload } from '../../../../models';\nimport { AX_CONVERSATION_IMAGE_CATALOG } from '../../../../models/message-file-type-catalog';\nimport { normalizeImagePayload } from '../../../message-list/components/image-renderer/image.payload';\nimport { formatFileSize } from '../shared/media-formatters';\n\nexport { AX_CONVERSATION_IMAGE_CATALOG };\n\nconst MB = 1024 * 1024;\n\nexport const AX_CONVERSATION_IMAGE_PRESENTATION = {\n icon: 'fa-light fa-image text-purple-500',\n title: 'Image',\n} as const;\n\ntype AXConversationFileTypeUtilityContext = {\n readAsDataUrl: (file: File | Blob) => Promise<string>;\n platformId: object;\n};\n\nconst AX_CONVERSATION_IMAGE_UTILITY = {\n preview: 'preview',\n formatSize: 'formatSize',\n createLocalPreviewUrl: 'createLocalPreviewUrl',\n} as const;\n\nfunction blobUrl(ctx: AXConversationFileTypeUtilityContext, blob: Blob): string {\n if (!isPlatformBrowser(ctx.platformId)) {\n return '';\n }\n return URL.createObjectURL(blob);\n}\n\nexport function conversationImageUtilities(): NonNullable<AXFileType['utilities']> {\n return {\n [AX_CONVERSATION_IMAGE_UTILITY.preview]: (ctx, file) =>\n (ctx as AXConversationFileTypeUtilityContext).readAsDataUrl(file as File),\n [AX_CONVERSATION_IMAGE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes as number),\n [AX_CONVERSATION_IMAGE_UTILITY.createLocalPreviewUrl]: (ctx, source) => {\n const blob = source as File | Blob;\n if (blob.type.startsWith('image/')) {\n return (ctx as AXConversationFileTypeUtilityContext).readAsDataUrl(blob);\n }\n return blobUrl(ctx as AXConversationFileTypeUtilityContext, blob);\n },\n };\n}\n\nexport function createConversationImageFileType(): AXFileType {\n const presentation = AX_CONVERSATION_IMAGE_PRESENTATION;\n return {\n name: AX_CONVERSATION_IMAGE_CATALOG,\n metadata: createFileTypeMetadata('conversation'),\n title: presentation.title,\n icon: presentation.icon,\n validations: {\n mimeTypes: ['image/*'],\n minSize: 1,\n maxSize: 100 * MB,\n },\n extensions: [\n { name: 'jpg', title: 'JPEG' },\n { name: 'jpeg', title: 'JPEG', validations: { maxSize: 5 * MB } },\n { name: 'png', title: 'PNG' },\n { name: 'gif', title: 'GIF' },\n { name: 'webp', title: 'WebP' },\n { name: 'svg', title: 'SVG', validations: { maxSize: 2 * MB } },\n ],\n utilities: conversationImageUtilities(),\n copy: (payload): AXFileCopyData => {\n const image = normalizeImagePayload(payload as AXConversationImagePayload);\n const caption = image.caption?.trim();\n const urls = image.images\n .map((item) => item.url?.trim() || item.thumbnailUrl?.trim())\n .filter((url): url is string => !!url);\n return {\n text: caption ?? '',\n meta: { kind: 'image', caption, urls, count: image.images.length },\n };\n },\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXConversationImageFileTypeProvider extends AXFileTypeInfoProvider {\n items() {\n return Promise.resolve([createConversationImageFileType()]);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI;AAEf,MAAM,kCAAkC,GAAG;AAChD,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,KAAK,EAAE,OAAO;;AAQhB,MAAM,6BAA6B,GAAG;AACpC,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,qBAAqB,EAAE,uBAAuB;CACtC;AAEV,SAAS,OAAO,CAAC,GAAyC,EAAE,IAAU,EAAA;IACpE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACtC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;AAClC;SA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AA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
2
|
+
import * as i3 from '@acorex/core/translation';
|
|
3
|
+
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
4
|
+
import * as i2 from '@angular/common';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, Injector, input, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
8
|
+
import { A as AXConversationService, h as AXConversationRegistryComponentOutletComponent } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
9
|
+
import { A as AXConversationAudioAttachmentComponent } from './acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs';
|
|
10
|
+
import { A as AXConversationImageAttachmentComponent } from './acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs';
|
|
11
|
+
import { A as AXConversationVideoAttachmentComponent } from './acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs';
|
|
12
|
+
import { f as filterMessagesByMediaCategory, i as isGridMediaCategory, a as isAttachmentListCategory, b as buildMediaGalleryTiles, g as getMessageVideoItems, c as getMessageAudioItems } from './acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Shared media browser inside the conversation info panel.
|
|
16
|
+
*/
|
|
17
|
+
class AXConversationInfoMediaViewComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.translation = inject(AXTranslationService);
|
|
20
|
+
this.parentInjector = inject(Injector);
|
|
21
|
+
this.category = input.required(...(ngDevMode ? [{ debugName: "category" }] : /* istanbul ignore next */ []));
|
|
22
|
+
this.messages = input.required(...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.conversation = input.required(...(ngDevMode ? [{ debugName: "conversation" }] : /* istanbul ignore next */ []));
|
|
24
|
+
this.conversationServiceInput = input.required({ ...(ngDevMode ? { debugName: "conversationServiceInput" } : /* istanbul ignore next */ {}), alias: 'conversationService' });
|
|
25
|
+
/** Callback for lazy outlet wiring (alternative to the `back` output). */
|
|
26
|
+
this.onBack = input(undefined, ...(ngDevMode ? [{ debugName: "onBack" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.back = output();
|
|
28
|
+
this.items = computed(() => filterMessagesByMediaCategory(this.messages(), this.category().id), ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
29
|
+
this.isGrid = computed(() => isGridMediaCategory(this.category().id), ...(ngDevMode ? [{ debugName: "isGrid" }] : /* istanbul ignore next */ []));
|
|
30
|
+
this.isAttachmentList = computed(() => isAttachmentListCategory(this.category().id), ...(ngDevMode ? [{ debugName: "isAttachmentList" }] : /* istanbul ignore next */ []));
|
|
31
|
+
this.galleryTiles = computed(() => buildMediaGalleryTiles(this.messages(), this.category().id), ...(ngDevMode ? [{ debugName: "galleryTiles" }] : /* istanbul ignore next */ []));
|
|
32
|
+
this.rendererInjector = computed(() => Injector.create({
|
|
33
|
+
providers: [{ provide: AXConversationService, useValue: this.conversationServiceInput() }],
|
|
34
|
+
parent: this.parentInjector,
|
|
35
|
+
}), ...(ngDevMode ? [{ debugName: "rendererInjector" }] : /* istanbul ignore next */ []));
|
|
36
|
+
this.titleLabel = computed(() => this.translation.translateSync(this.category().countLabelKey, {
|
|
37
|
+
params: { count: this.category().count },
|
|
38
|
+
}), ...(ngDevMode ? [{ debugName: "titleLabel" }] : /* istanbul ignore next */ []));
|
|
39
|
+
this.getMessageVideoItems = getMessageVideoItems;
|
|
40
|
+
this.getMessageAudioItems = getMessageAudioItems;
|
|
41
|
+
}
|
|
42
|
+
getRendererComponent(message) {
|
|
43
|
+
const renderer = this.conversationServiceInput().registry.messageRenderers.getRenderer(message);
|
|
44
|
+
return renderer?.component;
|
|
45
|
+
}
|
|
46
|
+
getRendererComponentLoader(message) {
|
|
47
|
+
const renderer = this.conversationServiceInput().registry.messageRenderers.getRenderer(message);
|
|
48
|
+
if (renderer?.componentLoader) {
|
|
49
|
+
return renderer.componentLoader;
|
|
50
|
+
}
|
|
51
|
+
if (!renderer?.component) {
|
|
52
|
+
return () => import('./acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs').then((m) => m.AXConversationFallbackRendererComponent);
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
getRendererInputs(message) {
|
|
57
|
+
return { message };
|
|
58
|
+
}
|
|
59
|
+
formatTimestamp(message) {
|
|
60
|
+
return new Intl.DateTimeFormat(undefined, {
|
|
61
|
+
dateStyle: 'medium',
|
|
62
|
+
timeStyle: 'short',
|
|
63
|
+
}).format(message.timestamp);
|
|
64
|
+
}
|
|
65
|
+
handleBack() {
|
|
66
|
+
this.onBack()?.();
|
|
67
|
+
this.back.emit();
|
|
68
|
+
}
|
|
69
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationInfoMediaViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
70
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXConversationInfoMediaViewComponent, isStandalone: true, selector: "ax-conversation-info-media-view", inputs: { category: { classPropertyName: "category", publicName: "category", isSignal: true, isRequired: true, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: true, transformFunction: null }, conversation: { classPropertyName: "conversation", publicName: "conversation", isSignal: true, isRequired: true, transformFunction: null }, conversationServiceInput: { classPropertyName: "conversationServiceInput", publicName: "conversationService", isSignal: true, isRequired: true, transformFunction: null }, onBack: { classPropertyName: "onBack", publicName: "onBack", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { back: "back" }, ngImport: i0, template: `
|
|
71
|
+
<div class="tg-media-view">
|
|
72
|
+
<header class="tg-media-view__header">
|
|
73
|
+
<button type="button" class="tg-media-view__back" (click)="handleBack()" [attr.aria-label]="'Back'">
|
|
74
|
+
<i class="fa-light fa-arrow-left"></i>
|
|
75
|
+
</button>
|
|
76
|
+
<h3 class="tg-media-view__title">{{ titleLabel() }}</h3>
|
|
77
|
+
</header>
|
|
78
|
+
|
|
79
|
+
@if (items().length === 0) {
|
|
80
|
+
<div class="tg-media-view__empty">
|
|
81
|
+
{{ '@acorex:chat.info-panel.media.empty' | translate | async }}
|
|
82
|
+
</div>
|
|
83
|
+
} @else if (isGrid()) {
|
|
84
|
+
<div class="tg-media-view__grid">
|
|
85
|
+
@for (tile of galleryTiles(); track tile.key) {
|
|
86
|
+
<article
|
|
87
|
+
class="tg-media-view__grid-cell"
|
|
88
|
+
[class.tg-media-view__grid-cell--sticker]="tile.kind === 'sticker'"
|
|
89
|
+
>
|
|
90
|
+
@switch (tile.kind) {
|
|
91
|
+
@case ('image') {
|
|
92
|
+
@if (tile.image; as image) {
|
|
93
|
+
<ax-conversation-image-attachment [item]="image" [alt]="'Photo'" />
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
@case ('sticker') {
|
|
97
|
+
@if (tile.stickerUrl) {
|
|
98
|
+
<img
|
|
99
|
+
class="tg-media-view__sticker"
|
|
100
|
+
[src]="tile.stickerUrl"
|
|
101
|
+
[alt]="tile.stickerAlt ?? 'Sticker'"
|
|
102
|
+
loading="lazy"
|
|
103
|
+
/>
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</article>
|
|
108
|
+
}
|
|
109
|
+
</div>
|
|
110
|
+
} @else if (isAttachmentList()) {
|
|
111
|
+
<div class="tg-media-view__list">
|
|
112
|
+
@for (message of items(); track message.id) {
|
|
113
|
+
<article class="tg-media-view__list-item">
|
|
114
|
+
<div class="tg-media-view__list-body">
|
|
115
|
+
@if (category().id === 'video') {
|
|
116
|
+
@for (video of getMessageVideoItems(message); track video.mediaId ?? video.url) {
|
|
117
|
+
<ax-conversation-video-attachment [item]="video" />
|
|
118
|
+
}
|
|
119
|
+
} @else {
|
|
120
|
+
@for (audio of getMessageAudioItems(message); track audio.mediaId ?? audio.url) {
|
|
121
|
+
<ax-conversation-audio-attachment [item]="audio" />
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
</div>
|
|
125
|
+
<time class="tg-media-view__list-meta">{{ formatTimestamp(message) }}</time>
|
|
126
|
+
</article>
|
|
127
|
+
}
|
|
128
|
+
</div>
|
|
129
|
+
} @else {
|
|
130
|
+
<div class="tg-media-view__list">
|
|
131
|
+
@for (message of items(); track message.id) {
|
|
132
|
+
<article class="tg-media-view__list-item">
|
|
133
|
+
<div class="tg-media-view__list-body">
|
|
134
|
+
<ax-conversation-registry-component-outlet
|
|
135
|
+
[component]="getRendererComponent(message)"
|
|
136
|
+
[componentLoader]="getRendererComponentLoader(message)"
|
|
137
|
+
[inputs]="getRendererInputs(message)"
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
<time class="tg-media-view__list-meta">{{ formatTimestamp(message) }}</time>
|
|
141
|
+
</article>
|
|
142
|
+
}
|
|
143
|
+
</div>
|
|
144
|
+
}
|
|
145
|
+
</div>
|
|
146
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.tg-media-view{display:flex;flex-direction:column;min-height:12rem;max-height:min(85vh,40rem)}.tg-media-view__header{display:flex;align-items:center;gap:.5rem;padding:.65rem .75rem;border-bottom:1px solid rgb(var(--ax-sys-color-border-light-surface));flex-shrink:0}.tg-media-view__back{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;border-radius:999px;background:transparent;color:rgb(var(--ax-sys-color-primary-500));cursor:pointer}.tg-media-view__back:hover{background:rgb(var(--ax-sys-color-lighter-surface))}.tg-media-view__title{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--ax-sys-color-on-surface))}.tg-media-view__empty{padding:2rem 1rem;text-align:center;font-size:.875rem;color:rgb(var(--ax-sys-color-on-surface));opacity:.65}.tg-media-view__grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;padding:2px;overflow-y:auto;overscroll-behavior:contain;background:rgb(var(--ax-sys-color-border-light-surface))}.tg-media-view__grid-cell{position:relative;aspect-ratio:1;overflow:hidden;background:rgb(var(--ax-sys-color-lighter-surface))}.tg-media-view__grid-cell--sticker{display:flex;align-items:center;justify-content:center;padding:.35rem}.tg-media-view__grid-cell ::ng-deep ax-conversation-image-attachment,.tg-media-view__grid-cell ::ng-deep .ax-conversation-image-attachment{width:100%;height:100%;min-height:0;border-radius:0}.tg-media-view__grid-cell ::ng-deep img{width:100%;height:100%;object-fit:cover}.tg-media-view__sticker{max-width:100%;max-height:100%;object-fit:contain}.tg-media-view__list{display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain}.tg-media-view__list-item{display:flex;flex-direction:column;gap:.35rem;padding:.75rem 1rem;border-bottom:1px solid rgb(var(--ax-sys-color-border-light-surface))}.tg-media-view__list-item:last-child{border-bottom:none}.tg-media-view__list-body{min-width:0;display:flex;flex-direction:column;gap:.5rem}.tg-media-view__list-body ::ng-deep .ax-conversation-msg{max-width:100%}.tg-media-view__list-body ::ng-deep ax-conversation-message-renderer-state{display:none}.tg-media-view__list-body ::ng-deep .ax-conversation-video__player{max-height:min(50vh,16rem)}.tg-media-view__list-meta{font-size:.75rem;color:rgb(var(--ax-sys-color-on-surface));opacity:.55}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AXConversationRegistryComponentOutletComponent, selector: "ax-conversation-registry-component-outlet", inputs: ["component", "componentLoader", "inputs"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXConversationImageAttachmentComponent, selector: "ax-conversation-image-attachment", inputs: ["item", "alt"] }, { kind: "component", type: AXConversationVideoAttachmentComponent, selector: "ax-conversation-video-attachment", inputs: ["item"], outputs: ["playingChange", "timeUpdate", "durationChange", "playbackEnded", "playbackError"] }, { kind: "component", type: AXConversationAudioAttachmentComponent, selector: "ax-conversation-audio-attachment", inputs: ["item"], outputs: ["playingChange", "timeUpdate", "durationChange", "playbackEnded", "playbackError"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
147
|
+
}
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationInfoMediaViewComponent, decorators: [{
|
|
149
|
+
type: Component,
|
|
150
|
+
args: [{ selector: 'ax-conversation-info-media-view', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
151
|
+
CommonModule,
|
|
152
|
+
AXConversationRegistryComponentOutletComponent,
|
|
153
|
+
AXDecoratorModule,
|
|
154
|
+
AXTranslationModule,
|
|
155
|
+
AXConversationImageAttachmentComponent,
|
|
156
|
+
AXConversationVideoAttachmentComponent,
|
|
157
|
+
AXConversationAudioAttachmentComponent,
|
|
158
|
+
], template: `
|
|
159
|
+
<div class="tg-media-view">
|
|
160
|
+
<header class="tg-media-view__header">
|
|
161
|
+
<button type="button" class="tg-media-view__back" (click)="handleBack()" [attr.aria-label]="'Back'">
|
|
162
|
+
<i class="fa-light fa-arrow-left"></i>
|
|
163
|
+
</button>
|
|
164
|
+
<h3 class="tg-media-view__title">{{ titleLabel() }}</h3>
|
|
165
|
+
</header>
|
|
166
|
+
|
|
167
|
+
@if (items().length === 0) {
|
|
168
|
+
<div class="tg-media-view__empty">
|
|
169
|
+
{{ '@acorex:chat.info-panel.media.empty' | translate | async }}
|
|
170
|
+
</div>
|
|
171
|
+
} @else if (isGrid()) {
|
|
172
|
+
<div class="tg-media-view__grid">
|
|
173
|
+
@for (tile of galleryTiles(); track tile.key) {
|
|
174
|
+
<article
|
|
175
|
+
class="tg-media-view__grid-cell"
|
|
176
|
+
[class.tg-media-view__grid-cell--sticker]="tile.kind === 'sticker'"
|
|
177
|
+
>
|
|
178
|
+
@switch (tile.kind) {
|
|
179
|
+
@case ('image') {
|
|
180
|
+
@if (tile.image; as image) {
|
|
181
|
+
<ax-conversation-image-attachment [item]="image" [alt]="'Photo'" />
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
@case ('sticker') {
|
|
185
|
+
@if (tile.stickerUrl) {
|
|
186
|
+
<img
|
|
187
|
+
class="tg-media-view__sticker"
|
|
188
|
+
[src]="tile.stickerUrl"
|
|
189
|
+
[alt]="tile.stickerAlt ?? 'Sticker'"
|
|
190
|
+
loading="lazy"
|
|
191
|
+
/>
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</article>
|
|
196
|
+
}
|
|
197
|
+
</div>
|
|
198
|
+
} @else if (isAttachmentList()) {
|
|
199
|
+
<div class="tg-media-view__list">
|
|
200
|
+
@for (message of items(); track message.id) {
|
|
201
|
+
<article class="tg-media-view__list-item">
|
|
202
|
+
<div class="tg-media-view__list-body">
|
|
203
|
+
@if (category().id === 'video') {
|
|
204
|
+
@for (video of getMessageVideoItems(message); track video.mediaId ?? video.url) {
|
|
205
|
+
<ax-conversation-video-attachment [item]="video" />
|
|
206
|
+
}
|
|
207
|
+
} @else {
|
|
208
|
+
@for (audio of getMessageAudioItems(message); track audio.mediaId ?? audio.url) {
|
|
209
|
+
<ax-conversation-audio-attachment [item]="audio" />
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</div>
|
|
213
|
+
<time class="tg-media-view__list-meta">{{ formatTimestamp(message) }}</time>
|
|
214
|
+
</article>
|
|
215
|
+
}
|
|
216
|
+
</div>
|
|
217
|
+
} @else {
|
|
218
|
+
<div class="tg-media-view__list">
|
|
219
|
+
@for (message of items(); track message.id) {
|
|
220
|
+
<article class="tg-media-view__list-item">
|
|
221
|
+
<div class="tg-media-view__list-body">
|
|
222
|
+
<ax-conversation-registry-component-outlet
|
|
223
|
+
[component]="getRendererComponent(message)"
|
|
224
|
+
[componentLoader]="getRendererComponentLoader(message)"
|
|
225
|
+
[inputs]="getRendererInputs(message)"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
<time class="tg-media-view__list-meta">{{ formatTimestamp(message) }}</time>
|
|
229
|
+
</article>
|
|
230
|
+
}
|
|
231
|
+
</div>
|
|
232
|
+
}
|
|
233
|
+
</div>
|
|
234
|
+
`, styles: [":host{display:block;width:100%}.tg-media-view{display:flex;flex-direction:column;min-height:12rem;max-height:min(85vh,40rem)}.tg-media-view__header{display:flex;align-items:center;gap:.5rem;padding:.65rem .75rem;border-bottom:1px solid rgb(var(--ax-sys-color-border-light-surface));flex-shrink:0}.tg-media-view__back{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border:none;border-radius:999px;background:transparent;color:rgb(var(--ax-sys-color-primary-500));cursor:pointer}.tg-media-view__back:hover{background:rgb(var(--ax-sys-color-lighter-surface))}.tg-media-view__title{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--ax-sys-color-on-surface))}.tg-media-view__empty{padding:2rem 1rem;text-align:center;font-size:.875rem;color:rgb(var(--ax-sys-color-on-surface));opacity:.65}.tg-media-view__grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;padding:2px;overflow-y:auto;overscroll-behavior:contain;background:rgb(var(--ax-sys-color-border-light-surface))}.tg-media-view__grid-cell{position:relative;aspect-ratio:1;overflow:hidden;background:rgb(var(--ax-sys-color-lighter-surface))}.tg-media-view__grid-cell--sticker{display:flex;align-items:center;justify-content:center;padding:.35rem}.tg-media-view__grid-cell ::ng-deep ax-conversation-image-attachment,.tg-media-view__grid-cell ::ng-deep .ax-conversation-image-attachment{width:100%;height:100%;min-height:0;border-radius:0}.tg-media-view__grid-cell ::ng-deep img{width:100%;height:100%;object-fit:cover}.tg-media-view__sticker{max-width:100%;max-height:100%;object-fit:contain}.tg-media-view__list{display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain}.tg-media-view__list-item{display:flex;flex-direction:column;gap:.35rem;padding:.75rem 1rem;border-bottom:1px solid rgb(var(--ax-sys-color-border-light-surface))}.tg-media-view__list-item:last-child{border-bottom:none}.tg-media-view__list-body{min-width:0;display:flex;flex-direction:column;gap:.5rem}.tg-media-view__list-body ::ng-deep .ax-conversation-msg{max-width:100%}.tg-media-view__list-body ::ng-deep ax-conversation-message-renderer-state{display:none}.tg-media-view__list-body ::ng-deep .ax-conversation-video__player{max-height:min(50vh,16rem)}.tg-media-view__list-meta{font-size:.75rem;color:rgb(var(--ax-sys-color-on-surface));opacity:.55}\n"] }]
|
|
235
|
+
}], propDecorators: { category: [{ type: i0.Input, args: [{ isSignal: true, alias: "category", required: true }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: true }] }], conversation: [{ type: i0.Input, args: [{ isSignal: true, alias: "conversation", required: true }] }], conversationServiceInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "conversationService", required: true }] }], onBack: [{ type: i0.Input, args: [{ isSignal: true, alias: "onBack", required: false }] }], back: [{ type: i0.Output, args: ["back"] }] } });
|
|
236
|
+
|
|
237
|
+
export { AXConversationInfoMediaViewComponent };
|
|
238
|
+
//# sourceMappingURL=acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/info-bar/components/conversation-info-media-view.component.ts"],"sourcesContent":["/**\n * Shared media browser inside the conversation info panel.\n */\n\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, Injector, input, output } from '@angular/core';\nimport { AXConversationRegistryComponentOutletComponent } from '../../../components/shared/registry-component-outlet.component';\nimport type { AXConversation, AXConversationMessage } from '../../../models';\nimport { AXConversationService } from '../../../services';\nimport { AXConversationAudioAttachmentComponent } from '../../message-list/components/shared/audio-attachment.component';\nimport { AXConversationImageAttachmentComponent } from '../../message-list/components/shared/image-attachment.component';\nimport { AXConversationVideoAttachmentComponent } from '../../message-list/components/shared/video-attachment.component';\nimport {\n buildMediaGalleryTiles,\n filterMessagesByMediaCategory,\n getMessageAudioItems,\n getMessageVideoItems,\n isAttachmentListCategory,\n isGridMediaCategory,\n type AXConversationMediaCategory,\n} from './conversation-info-panel.utils';\n\n@Component({\n selector: 'ax-conversation-info-media-view',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n CommonModule,\n AXConversationRegistryComponentOutletComponent,\n AXDecoratorModule,\n AXTranslationModule,\n AXConversationImageAttachmentComponent,\n AXConversationVideoAttachmentComponent,\n AXConversationAudioAttachmentComponent,\n ],\n template: `\n <div class=\"tg-media-view\">\n <header class=\"tg-media-view__header\">\n <button type=\"button\" class=\"tg-media-view__back\" (click)=\"handleBack()\" [attr.aria-label]=\"'Back'\">\n <i class=\"fa-light fa-arrow-left\"></i>\n </button>\n <h3 class=\"tg-media-view__title\">{{ titleLabel() }}</h3>\n </header>\n\n @if (items().length === 0) {\n <div class=\"tg-media-view__empty\">\n {{ '@acorex:chat.info-panel.media.empty' | translate | async }}\n </div>\n } @else if (isGrid()) {\n <div class=\"tg-media-view__grid\">\n @for (tile of galleryTiles(); track tile.key) {\n <article\n class=\"tg-media-view__grid-cell\"\n [class.tg-media-view__grid-cell--sticker]=\"tile.kind === 'sticker'\"\n >\n @switch (tile.kind) {\n @case ('image') {\n @if (tile.image; as image) {\n <ax-conversation-image-attachment [item]=\"image\" [alt]=\"'Photo'\" />\n }\n }\n @case ('sticker') {\n @if (tile.stickerUrl) {\n <img\n class=\"tg-media-view__sticker\"\n [src]=\"tile.stickerUrl\"\n [alt]=\"tile.stickerAlt ?? 'Sticker'\"\n loading=\"lazy\"\n />\n }\n }\n }\n </article>\n }\n </div>\n } @else if (isAttachmentList()) {\n <div class=\"tg-media-view__list\">\n @for (message of items(); track message.id) {\n <article class=\"tg-media-view__list-item\">\n <div class=\"tg-media-view__list-body\">\n @if (category().id === 'video') {\n @for (video of getMessageVideoItems(message); track video.mediaId ?? video.url) {\n <ax-conversation-video-attachment [item]=\"video\" />\n }\n } @else {\n @for (audio of getMessageAudioItems(message); track audio.mediaId ?? audio.url) {\n <ax-conversation-audio-attachment [item]=\"audio\" />\n }\n }\n </div>\n <time class=\"tg-media-view__list-meta\">{{ formatTimestamp(message) }}</time>\n </article>\n }\n </div>\n } @else {\n <div class=\"tg-media-view__list\">\n @for (message of items(); track message.id) {\n <article class=\"tg-media-view__list-item\">\n <div class=\"tg-media-view__list-body\">\n <ax-conversation-registry-component-outlet\n [component]=\"getRendererComponent(message)\"\n [componentLoader]=\"getRendererComponentLoader(message)\"\n [inputs]=\"getRendererInputs(message)\"\n />\n </div>\n <time class=\"tg-media-view__list-meta\">{{ formatTimestamp(message) }}</time>\n </article>\n }\n </div>\n }\n </div>\n `,\n styles: [\n `\n :host {\n display: block;\n width: 100%;\n }\n\n .tg-media-view {\n display: flex;\n flex-direction: column;\n min-height: 12rem;\n max-height: min(85vh, 40rem);\n }\n\n .tg-media-view__header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.65rem 0.75rem;\n border-bottom: 1px solid rgb(var(--ax-sys-color-border-light-surface));\n flex-shrink: 0;\n }\n\n .tg-media-view__back {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border: none;\n border-radius: 999px;\n background: transparent;\n color: rgb(var(--ax-sys-color-primary-500));\n cursor: pointer;\n }\n\n .tg-media-view__back:hover {\n background: rgb(var(--ax-sys-color-lighter-surface));\n }\n\n .tg-media-view__title {\n margin: 0;\n font-size: 1rem;\n font-weight: 600;\n color: rgb(var(--ax-sys-color-on-surface));\n }\n\n .tg-media-view__empty {\n padding: 2rem 1rem;\n text-align: center;\n font-size: 0.875rem;\n color: rgb(var(--ax-sys-color-on-surface));\n opacity: 0.65;\n }\n\n .tg-media-view__grid {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 2px;\n padding: 2px;\n overflow-y: auto;\n overscroll-behavior: contain;\n background: rgb(var(--ax-sys-color-border-light-surface));\n }\n\n .tg-media-view__grid-cell {\n position: relative;\n aspect-ratio: 1;\n overflow: hidden;\n background: rgb(var(--ax-sys-color-lighter-surface));\n }\n\n .tg-media-view__grid-cell--sticker {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.35rem;\n }\n\n .tg-media-view__grid-cell ::ng-deep ax-conversation-image-attachment,\n .tg-media-view__grid-cell ::ng-deep .ax-conversation-image-attachment {\n width: 100%;\n height: 100%;\n min-height: 0;\n border-radius: 0;\n }\n\n .tg-media-view__grid-cell ::ng-deep img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .tg-media-view__sticker {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .tg-media-view__list {\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overscroll-behavior: contain;\n }\n\n .tg-media-view__list-item {\n display: flex;\n flex-direction: column;\n gap: 0.35rem;\n padding: 0.75rem 1rem;\n border-bottom: 1px solid rgb(var(--ax-sys-color-border-light-surface));\n }\n\n .tg-media-view__list-item:last-child {\n border-bottom: none;\n }\n\n .tg-media-view__list-body {\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n }\n\n .tg-media-view__list-body ::ng-deep .ax-conversation-msg {\n max-width: 100%;\n }\n\n .tg-media-view__list-body ::ng-deep ax-conversation-message-renderer-state {\n display: none;\n }\n\n .tg-media-view__list-body ::ng-deep .ax-conversation-video__player {\n max-height: min(50vh, 16rem);\n }\n\n .tg-media-view__list-meta {\n font-size: 0.75rem;\n color: rgb(var(--ax-sys-color-on-surface));\n opacity: 0.55;\n }\n `,\n ],\n})\nexport class AXConversationInfoMediaViewComponent {\n private readonly translation = inject(AXTranslationService);\n private readonly parentInjector = inject(Injector);\n\n readonly category = input.required<AXConversationMediaCategory>();\n readonly messages = input.required<AXConversationMessage[]>();\n readonly conversation = input.required<AXConversation>();\n readonly conversationServiceInput = input.required<AXConversationService>({ alias: 'conversationService' });\n /** Callback for lazy outlet wiring (alternative to the `back` output). */\n readonly onBack = input<(() => void) | undefined>(undefined);\n\n readonly back = output<void>();\n\n readonly items = computed(() => filterMessagesByMediaCategory(this.messages(), this.category().id));\n readonly isGrid = computed(() => isGridMediaCategory(this.category().id));\n readonly isAttachmentList = computed(() => isAttachmentListCategory(this.category().id));\n readonly galleryTiles = computed(() => buildMediaGalleryTiles(this.messages(), this.category().id));\n\n readonly rendererInjector = computed(() =>\n Injector.create({\n providers: [{ provide: AXConversationService, useValue: this.conversationServiceInput() }],\n parent: this.parentInjector,\n }),\n );\n\n readonly titleLabel = computed(() =>\n this.translation.translateSync(this.category().countLabelKey, {\n params: { count: this.category().count },\n }),\n );\n\n readonly getMessageVideoItems = getMessageVideoItems;\n readonly getMessageAudioItems = getMessageAudioItems;\n\n getRendererComponent(message: AXConversationMessage) {\n const renderer = this.conversationServiceInput().registry.messageRenderers.getRenderer(message);\n return renderer?.component;\n }\n\n getRendererComponentLoader(message: AXConversationMessage) {\n const renderer = this.conversationServiceInput().registry.messageRenderers.getRenderer(message);\n if (renderer?.componentLoader) {\n return renderer.componentLoader;\n }\n if (!renderer?.component) {\n return () =>\n import('../../message-list/components/fallback-renderer/fallback-renderer.component').then(\n (m) => m.AXConversationFallbackRendererComponent,\n );\n }\n return undefined;\n }\n\n getRendererInputs(message: AXConversationMessage) {\n return { message };\n }\n\n formatTimestamp(message: AXConversationMessage): string {\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: 'medium',\n time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