@acorex/components 18.5.16 → 18.5.17
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/action-sheet/lib/action-sheet.component.d.ts +26 -0
- package/alert/lib/alert.component.d.ts +50 -2
- package/audio-wave/lib/audio-wave.component.d.ts +48 -0
- package/avatar/lib/avatar.component.d.ts +20 -1
- package/badge/lib/badge.component.d.ts +8 -0
- package/bottom-navigation/lib/bottom-navigation.component.d.ts +16 -0
- package/breadcrumbs/lib/breadcrumbs-item.component.d.ts +11 -0
- package/breadcrumbs/lib/breadcrumbs.component.d.ts +11 -0
- package/button/lib/button-item-list.component.d.ts +34 -0
- package/button/lib/button-item.component.d.ts +47 -0
- package/button/lib/button.component.d.ts +36 -0
- package/button-group/lib/button-group.component.d.ts +53 -0
- package/calendar/lib/calendar-range.component.d.ts +48 -0
- package/calendar/lib/calendar.component.d.ts +114 -0
- package/check-box/lib/check-box.component.d.ts +36 -0
- package/chips/lib/chips.component.d.ts +13 -0
- package/circular-progress/lib/circular-progress.component.d.ts +67 -1
- package/collapse/lib/collapse-group.component.d.ts +38 -0
- package/collapse/lib/collapse.component.d.ts +55 -0
- package/color-box/lib/color-box.component.d.ts +28 -1
- package/color-palette/lib/color-palette-input.component.d.ts +35 -0
- package/color-palette/lib/color-palette-picker.component.d.ts +53 -0
- package/color-palette/lib/color-palette-preview.component.d.ts +17 -0
- package/color-palette/lib/color-palette-swatches.component.d.ts +30 -0
- package/color-palette/lib/color-palette.component.d.ts +8 -0
- package/comment/lib/comment-container/comment-container.component.d.ts +5 -0
- package/comment/lib/comment-item/comment-item.component.d.ts +16 -2
- package/comment/lib/comment-like/comment-like.component.d.ts +8 -0
- package/comment/lib/comment-reply/comment-reply.component.d.ts +4 -0
- package/comment/lib/comment-view/comment-view.component.d.ts +4 -0
- package/common/lib/components/base-component.class.d.ts +8 -0
- package/common/lib/components/button-base-component.class.d.ts +21 -0
- package/common/lib/components/interactive-component.class.d.ts +15 -0
- package/conversation/lib/conversation-container/conversation-container.component.d.ts +4 -0
- package/conversation/lib/conversation-input/conversation-input.component.d.ts +79 -2
- package/conversation/lib/conversation-message/conversation-message.component.d.ts +41 -0
- package/conversation/lib/conversation-messages/conversation-message-audio/conversation-message-audio.component.d.ts +62 -0
- package/conversation/lib/conversation-messages/conversation-message-file/conversation-message-file.component.d.ts +34 -0
- package/conversation/lib/conversation-messages/conversation-message-image/conversation-message-image.component.d.ts +21 -0
- package/conversation/lib/conversation-messages/conversation-message-image-popup/conversation-message-image-popup.component.d.ts +11 -0
- package/conversation/lib/conversation-messages/conversation-message-text/conversation-message-text.component.d.ts +29 -0
- package/conversation/lib/conversation-messages/conversation-message-video/conversation-message-video.component.d.ts +11 -0
- package/conversation/lib/conversation-messages/conversation-message-voice/conversation-message-voice.component.d.ts +72 -0
- package/conversation/lib/conversation-view/conversation-view.component.d.ts +22 -0
- package/data-pager/lib/data-pager-base.component.d.ts +9 -0
- package/data-pager/lib/data-pager-info.component.d.ts +14 -0
- package/data-pager/lib/data-pager-input-selector.component.d.ts +17 -0
- package/data-pager/lib/data-pager-next-buttons.components.d.ts +20 -0
- package/data-pager/lib/data-pager-numeric-selector.component.d.ts +14 -0
- package/esm2022/action-sheet/lib/action-sheet.component.mjs +21 -1
- package/esm2022/alert/lib/alert.component.mjs +48 -3
- package/esm2022/audio-wave/lib/audio-wave.component.mjs +43 -1
- package/esm2022/avatar/lib/avatar.component.mjs +21 -2
- package/esm2022/badge/lib/badge.component.mjs +9 -1
- package/esm2022/bottom-navigation/lib/bottom-navigation.component.mjs +14 -1
- package/esm2022/breadcrumbs/lib/breadcrumbs-item.component.mjs +9 -1
- package/esm2022/breadcrumbs/lib/breadcrumbs.component.mjs +6 -1
- package/esm2022/button/lib/button-item-list.component.mjs +35 -1
- package/esm2022/button/lib/button-item.component.mjs +36 -1
- package/esm2022/button/lib/button.component.mjs +37 -1
- package/esm2022/button-group/lib/button-group.component.mjs +48 -1
- package/esm2022/calendar/lib/calendar-range.component.mjs +46 -1
- package/esm2022/calendar/lib/calendar.component.mjs +112 -1
- package/esm2022/check-box/lib/check-box.component.mjs +34 -1
- package/esm2022/chips/lib/chips.component.mjs +14 -1
- package/esm2022/circular-progress/lib/circular-progress.component.mjs +69 -1
- package/esm2022/collapse/lib/collapse-group.component.mjs +39 -1
- package/esm2022/collapse/lib/collapse.component.mjs +53 -1
- package/esm2022/color-box/lib/color-box.component.mjs +23 -2
- package/esm2022/color-palette/lib/color-palette-input.component.mjs +36 -1
- package/esm2022/color-palette/lib/color-palette-picker.component.mjs +54 -1
- package/esm2022/color-palette/lib/color-palette-preview.component.mjs +18 -1
- package/esm2022/color-palette/lib/color-palette-swatches.component.mjs +28 -1
- package/esm2022/color-palette/lib/color-palette.component.mjs +9 -1
- package/esm2022/comment/lib/comment-container/comment-container.component.mjs +6 -1
- package/esm2022/comment/lib/comment-item/comment-item.component.mjs +15 -1
- package/esm2022/comment/lib/comment-like/comment-like.component.mjs +9 -1
- package/esm2022/comment/lib/comment-reply/comment-reply.component.mjs +5 -1
- package/esm2022/comment/lib/comment-view/comment-view.component.mjs +5 -1
- package/esm2022/common/lib/components/base-component.class.mjs +9 -1
- package/esm2022/common/lib/components/button-base-component.class.mjs +22 -1
- package/esm2022/common/lib/components/interactive-component.class.mjs +16 -1
- package/esm2022/conversation/lib/conversation-container/conversation-container.component.mjs +5 -1
- package/esm2022/conversation/lib/conversation-input/conversation-input.component.mjs +75 -1
- package/esm2022/conversation/lib/conversation-message/conversation-message.component.mjs +39 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-audio/conversation-message-audio.component.mjs +63 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-file/conversation-message-file.component.mjs +35 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-image/conversation-message-image.component.mjs +22 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-image-popup/conversation-message-image-popup.component.mjs +9 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-text/conversation-message-text.component.mjs +30 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-video/conversation-message-video.component.mjs +12 -1
- package/esm2022/conversation/lib/conversation-messages/conversation-message-voice/conversation-message-voice.component.mjs +70 -1
- package/esm2022/conversation/lib/conversation-view/conversation-view.component.mjs +23 -1
- package/esm2022/data-pager/lib/data-pager-base.component.mjs +7 -1
- package/esm2022/data-pager/lib/data-pager-info.component.mjs +9 -1
- package/esm2022/data-pager/lib/data-pager-input-selector.component.mjs +18 -1
- package/esm2022/data-pager/lib/data-pager-next-buttons.components.mjs +18 -1
- package/esm2022/data-pager/lib/data-pager-numeric-selector.component.mjs +15 -1
- package/esm2022/scheduler/lib/scheduler-month-view.component.mjs +20 -1
- package/esm2022/scheduler/lib/scheduler-week-view.component.mjs +5 -1
- package/esm2022/scheduler/lib/scheduler.component.mjs +10 -1
- package/esm2022/search-box/lib/search-box.component.mjs +19 -2
- package/esm2022/select-box/lib/select-box.component.mjs +50 -2
- package/esm2022/selection-list/lib/selection-list.component.mjs +51 -1
- package/esm2022/side-menu/lib/side-menu.component.mjs +5 -1
- package/esm2022/skeleton/lib/skeleton.component.mjs +11 -1
- package/esm2022/slider/lib/slider.component.mjs +52 -2
- package/esm2022/step-wizard/lib/step-wizard.component.mjs +23 -1
- package/esm2022/switch/lib/switch-content.component.mjs +5 -1
- package/esm2022/switch/lib/switch.component.mjs +11 -1
- package/esm2022/tabs/lib/tab-item.component.mjs +24 -1
- package/esm2022/tabs/lib/tabs.component.mjs +36 -1
- package/esm2022/tag/lib/tag.component.mjs +2 -1
- package/esm2022/text-area/lib/text-area.component.mjs +8 -1
- package/esm2022/text-box/lib/text-box.component.mjs +13 -1
- package/esm2022/toast/lib/toast.component.mjs +6 -1
- package/esm2022/tooltip/lib/tooltip.component.mjs +5 -1
- package/esm2022/uploader/lib/uploader-dialog-container.component.mjs +16 -1
- package/esm2022/uploader/lib/uploader-drop-zone.component.mjs +5 -1
- package/esm2022/uploader/lib/uploader-list.component.mjs +8 -3
- package/esm2022/uploader/lib/uploader.models.mjs +14 -1
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.mjs +18 -1
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-toolbar/wysiwyg-toolbar.component.mjs +106 -36
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-view/wysiwyg-view.component.mjs +9 -1
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg.service.mjs +4 -1
- package/fesm2022/acorex-components-action-sheet.mjs +20 -0
- package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
- package/fesm2022/acorex-components-alert.mjs +47 -2
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-audio-wave.mjs +42 -0
- package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
- package/fesm2022/acorex-components-avatar.mjs +20 -1
- package/fesm2022/acorex-components-avatar.mjs.map +1 -1
- package/fesm2022/acorex-components-badge.mjs +8 -0
- package/fesm2022/acorex-components-badge.mjs.map +1 -1
- package/fesm2022/acorex-components-bottom-navigation.mjs +13 -0
- package/fesm2022/acorex-components-bottom-navigation.mjs.map +1 -1
- package/fesm2022/acorex-components-breadcrumbs.mjs +13 -0
- package/fesm2022/acorex-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/acorex-components-button-group.mjs +47 -0
- package/fesm2022/acorex-components-button-group.mjs.map +1 -1
- package/fesm2022/acorex-components-button.mjs +105 -0
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-calendar.mjs +156 -0
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-check-box.mjs +33 -0
- package/fesm2022/acorex-components-check-box.mjs.map +1 -1
- package/fesm2022/acorex-components-chips.mjs +13 -0
- package/fesm2022/acorex-components-chips.mjs.map +1 -1
- package/fesm2022/acorex-components-circular-progress.mjs +68 -0
- package/fesm2022/acorex-components-circular-progress.mjs.map +1 -1
- package/fesm2022/acorex-components-collapse.mjs +90 -0
- package/fesm2022/acorex-components-collapse.mjs.map +1 -1
- package/fesm2022/acorex-components-color-box.mjs +22 -1
- package/fesm2022/acorex-components-color-box.mjs.map +1 -1
- package/fesm2022/acorex-components-color-palette.mjs +140 -0
- package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
- package/fesm2022/acorex-components-comment.mjs +35 -0
- package/fesm2022/acorex-components-comment.mjs.map +1 -1
- package/fesm2022/acorex-components-common.mjs +44 -0
- package/fesm2022/acorex-components-common.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation.mjs +372 -0
- package/fesm2022/acorex-components-conversation.mjs.map +1 -1
- package/fesm2022/acorex-components-data-pager.mjs +62 -0
- package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
- package/fesm2022/acorex-components-scheduler.mjs +32 -0
- package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
- package/fesm2022/acorex-components-search-box.mjs +18 -1
- package/fesm2022/acorex-components-search-box.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +49 -1
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list.mjs +50 -0
- package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +4 -0
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-skeleton.mjs +10 -0
- package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
- package/fesm2022/acorex-components-slider.mjs +51 -1
- package/fesm2022/acorex-components-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-step-wizard.mjs +22 -0
- package/fesm2022/acorex-components-step-wizard.mjs.map +1 -1
- package/fesm2022/acorex-components-switch.mjs +14 -0
- package/fesm2022/acorex-components-switch.mjs.map +1 -1
- package/fesm2022/acorex-components-tabs.mjs +58 -0
- package/fesm2022/acorex-components-tabs.mjs.map +1 -1
- package/fesm2022/acorex-components-tag.mjs +1 -0
- package/fesm2022/acorex-components-tag.mjs.map +1 -1
- package/fesm2022/acorex-components-text-area.mjs +7 -0
- package/fesm2022/acorex-components-text-area.mjs.map +1 -1
- package/fesm2022/acorex-components-text-box.mjs +12 -0
- package/fesm2022/acorex-components-text-box.mjs.map +1 -1
- package/fesm2022/acorex-components-toast.mjs +5 -0
- package/fesm2022/acorex-components-toast.mjs.map +1 -1
- package/fesm2022/acorex-components-tooltip.mjs +4 -0
- package/fesm2022/acorex-components-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +39 -2
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/fesm2022/acorex-components-wysiwyg.mjs +134 -35
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/package.json +31 -31
- package/scheduler/lib/scheduler-month-view.component.d.ts +20 -0
- package/scheduler/lib/scheduler-week-view.component.d.ts +4 -0
- package/scheduler/lib/scheduler.component.d.ts +10 -0
- package/search-box/lib/search-box.component.d.ts +19 -1
- package/select-box/lib/select-box.component.d.ts +78 -1
- package/selection-list/lib/selection-list.component.d.ts +55 -0
- package/side-menu/lib/side-menu.component.d.ts +4 -0
- package/skeleton/lib/skeleton.component.d.ts +10 -0
- package/slider/lib/slider.component.d.ts +51 -1
- package/step-wizard/lib/step-wizard.component.d.ts +23 -0
- package/switch/lib/switch-content.component.d.ts +4 -0
- package/switch/lib/switch.component.d.ts +14 -0
- package/tabs/lib/tab-item.component.d.ts +32 -0
- package/tabs/lib/tabs.component.d.ts +42 -0
- package/tag/lib/tag.component.d.ts +4 -0
- package/text-area/lib/text-area.component.d.ts +13 -0
- package/text-box/lib/text-box.component.d.ts +27 -0
- package/toast/lib/toast.component.d.ts +6 -0
- package/tooltip/lib/tooltip.component.d.ts +13 -0
- package/uploader/lib/uploader-dialog-container.component.d.ts +15 -0
- package/uploader/lib/uploader-drop-zone.component.d.ts +4 -0
- package/uploader/lib/uploader-list.component.d.ts +5 -0
- package/uploader/lib/uploader.models.d.ts +4 -0
- package/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.d.ts +19 -3
- package/wysiwyg/lib/wysiwyg/wysiwyg-toolbar/wysiwyg-toolbar.component.d.ts +61 -20
- package/wysiwyg/lib/wysiwyg/wysiwyg-view/wysiwyg-view.component.d.ts +4 -0
- package/wysiwyg/lib/wysiwyg/wysiwyg.service.d.ts +3 -0
|
@@ -39,6 +39,10 @@ import { AXDateTimeModule } from '@acorex/core/date-time';
|
|
|
39
39
|
class AXConversationActionEvent extends AXEvent {
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* A container for displaying and managing conversations.
|
|
44
|
+
* @category Components
|
|
45
|
+
*/
|
|
42
46
|
class AXConversationContainerComponent {
|
|
43
47
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXConversationContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
48
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.2", type: AXConversationContainerComponent, selector: "ax-conversation-container", ngImport: i0, template: "<div class=\"ax-conversation-container\">\n <ng-content> </ng-content>\n</div>\n", styles: ["ax-conversation-container{width:100%}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
@@ -134,31 +138,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
134
138
|
type: Injectable
|
|
135
139
|
}] });
|
|
136
140
|
|
|
141
|
+
/**
|
|
142
|
+
* An input component for entering conversation messages.
|
|
143
|
+
*
|
|
144
|
+
* @category Components
|
|
145
|
+
*/
|
|
137
146
|
class AXConversationInputComponent extends classes((MXInputBaseValueComponent), MXLookComponent) {
|
|
138
147
|
constructor() {
|
|
139
148
|
super(...arguments);
|
|
149
|
+
/**
|
|
150
|
+
* @ignore
|
|
151
|
+
*/
|
|
140
152
|
this.conversationService = inject(AXConversationService);
|
|
153
|
+
/**
|
|
154
|
+
* @ignore
|
|
155
|
+
*/
|
|
141
156
|
this.chats = computed(() => {
|
|
142
157
|
return this.conversationService.chats();
|
|
143
158
|
});
|
|
159
|
+
/**
|
|
160
|
+
* @ignore
|
|
161
|
+
*/
|
|
144
162
|
this.replyChat = computed(() => {
|
|
145
163
|
const findMessage = this.chats().find((item) => item.id === this.conversationService.replyId());
|
|
146
164
|
return findMessage;
|
|
147
165
|
});
|
|
166
|
+
/** Maximum length of input text */
|
|
148
167
|
this.maxLength = input();
|
|
168
|
+
/** Indicates if an attachment is present */
|
|
149
169
|
this.hasAttachment = input();
|
|
170
|
+
/** Indicates if voice recording is enabled */
|
|
150
171
|
this.haVoice = input();
|
|
172
|
+
/** Acceptable file types for attachment */
|
|
151
173
|
this.acceptFileType = input('*');
|
|
174
|
+
/**
|
|
175
|
+
* Emitted when the send button is clicked.
|
|
176
|
+
*
|
|
177
|
+
* @event
|
|
178
|
+
*/
|
|
152
179
|
this.onSendClick = output();
|
|
180
|
+
/**
|
|
181
|
+
* Emitted when recording starts.
|
|
182
|
+
*
|
|
183
|
+
* @event
|
|
184
|
+
*/
|
|
153
185
|
this.onStartRecording = output();
|
|
186
|
+
/**
|
|
187
|
+
* Emitted when recording is canceled.
|
|
188
|
+
*
|
|
189
|
+
* @event
|
|
190
|
+
*/
|
|
154
191
|
this.onCancelRecording = output();
|
|
192
|
+
/**
|
|
193
|
+
* @ignore
|
|
194
|
+
*/
|
|
155
195
|
this.recording = signal(false);
|
|
196
|
+
/**
|
|
197
|
+
* @ignore
|
|
198
|
+
*/
|
|
156
199
|
this.recordingService = inject(AXRecordingService);
|
|
200
|
+
/**
|
|
201
|
+
* @ignore
|
|
202
|
+
*/
|
|
157
203
|
this._updateOn = 'change';
|
|
158
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* @ignore
|
|
207
|
+
*/
|
|
159
208
|
_handleModelChange(value) {
|
|
160
209
|
this.commitValue(value, true);
|
|
161
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Initiates recording when the record button is clicked.
|
|
213
|
+
* Emits an event when recording starts.
|
|
214
|
+
* @ignore
|
|
215
|
+
*/
|
|
162
216
|
handleRecordClick() {
|
|
163
217
|
this.recording.set(true);
|
|
164
218
|
this.recordingService
|
|
@@ -174,6 +228,10 @@ class AXConversationInputComponent extends classes((MXInputBaseValueComponent),
|
|
|
174
228
|
throw e;
|
|
175
229
|
});
|
|
176
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Cancels the recording and emits an event to indicate cancellation.
|
|
233
|
+
* @ignore
|
|
234
|
+
*/
|
|
177
235
|
handleCancelRecordingClick() {
|
|
178
236
|
this.recording.set(false);
|
|
179
237
|
this.onCancelRecording.emit({
|
|
@@ -181,15 +239,27 @@ class AXConversationInputComponent extends classes((MXInputBaseValueComponent),
|
|
|
181
239
|
data: { value: null },
|
|
182
240
|
});
|
|
183
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Opens the file picker for attachment.
|
|
244
|
+
* @ignore
|
|
245
|
+
*/
|
|
184
246
|
handleAttachClick() {
|
|
185
247
|
this.inputFile.nativeElement.click();
|
|
186
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Emits the selected files when the file input changes.
|
|
251
|
+
* @ignore
|
|
252
|
+
*/
|
|
187
253
|
handleChangeFile(event) {
|
|
188
254
|
this.onSendClick.emit({
|
|
189
255
|
component: this,
|
|
190
256
|
data: { value: event.target.files, type: 'file' },
|
|
191
257
|
});
|
|
192
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Emits the text value and optional replyChat when the send button is clicked.
|
|
261
|
+
* @ignore
|
|
262
|
+
*/
|
|
193
263
|
handleSendClick() {
|
|
194
264
|
this.onSendClick.emit({
|
|
195
265
|
component: this,
|
|
@@ -198,6 +268,10 @@ class AXConversationInputComponent extends classes((MXInputBaseValueComponent),
|
|
|
198
268
|
});
|
|
199
269
|
this.conversationService.replyId.set('');
|
|
200
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Ends recording and emits the recorded voice data when the send voice button is clicked.
|
|
273
|
+
* @ignore
|
|
274
|
+
*/
|
|
201
275
|
handleSendVoiceClick() {
|
|
202
276
|
this.recordingService.endRecording().then((c) => {
|
|
203
277
|
this.recording.set(false);
|
|
@@ -208,6 +282,10 @@ class AXConversationInputComponent extends classes((MXInputBaseValueComponent),
|
|
|
208
282
|
});
|
|
209
283
|
});
|
|
210
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Clears the reply ID when closing a reply.
|
|
287
|
+
* @ignore
|
|
288
|
+
*/
|
|
211
289
|
closeReplyHandler() {
|
|
212
290
|
this.conversationService.replyId.set('');
|
|
213
291
|
}
|
|
@@ -258,23 +336,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
258
336
|
args: [{ providedIn: 'root' }]
|
|
259
337
|
}] });
|
|
260
338
|
|
|
339
|
+
/**
|
|
340
|
+
* A component for displaying individual conversation messages.
|
|
341
|
+
*
|
|
342
|
+
* @category Components
|
|
343
|
+
*/
|
|
261
344
|
class AXConversationMessageComponent extends MXBaseComponent {
|
|
262
345
|
constructor() {
|
|
263
346
|
super(...arguments);
|
|
347
|
+
/**
|
|
348
|
+
* @ignore
|
|
349
|
+
*/
|
|
264
350
|
this.popover = viewChild('popover');
|
|
351
|
+
/**
|
|
352
|
+
* @ignore
|
|
353
|
+
*/
|
|
265
354
|
this.conversationService = inject(AXConversationService);
|
|
355
|
+
/**
|
|
356
|
+
* The message data to display in the conversation.
|
|
357
|
+
*/
|
|
266
358
|
this.chatMessage = input();
|
|
359
|
+
/**
|
|
360
|
+
* @ignore
|
|
361
|
+
*/
|
|
267
362
|
this.registryService = inject(AXConversationMessageTypeRegistryService);
|
|
268
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* @ignore
|
|
366
|
+
*/
|
|
269
367
|
get isOwn() {
|
|
270
368
|
return !this.chatMessage().fromId;
|
|
271
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* @ignore
|
|
372
|
+
*/
|
|
272
373
|
get __hostClass() {
|
|
273
374
|
return `${this.isOwn ? 'ax-state-own' : ''} ${!this.isOwn ? 'ax-state-other' : ''}`;
|
|
274
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* @ignore
|
|
378
|
+
*/
|
|
275
379
|
ngOnInit() {
|
|
276
380
|
this._portal = new ComponentPortal(this.registryService.resolve(this.chatMessage().type).component);
|
|
277
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* @ignore
|
|
384
|
+
*/
|
|
278
385
|
_handleAttached(ref) {
|
|
279
386
|
ref = ref;
|
|
280
387
|
if (ref.instance && isBrowser()) {
|
|
@@ -294,14 +401,23 @@ class AXConversationMessageComponent extends MXBaseComponent {
|
|
|
294
401
|
}
|
|
295
402
|
}
|
|
296
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* @ignore
|
|
406
|
+
*/
|
|
297
407
|
handleResendClick() {
|
|
298
408
|
this.popover()?.close();
|
|
299
409
|
this.chatMessage().onResendClick();
|
|
300
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* @ignore
|
|
413
|
+
*/
|
|
301
414
|
handleDeleteClick() {
|
|
302
415
|
this.popover()?.close();
|
|
303
416
|
this.chatMessage().onDeleteClick();
|
|
304
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* @ignore
|
|
420
|
+
*/
|
|
305
421
|
replyHandler(e) {
|
|
306
422
|
this.conversationService.replyId.set(e);
|
|
307
423
|
}
|
|
@@ -324,40 +440,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
324
440
|
type: Injectable
|
|
325
441
|
}] });
|
|
326
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Component for displaying audio messages in a conversation.
|
|
445
|
+
*
|
|
446
|
+
* @category Components
|
|
447
|
+
*/
|
|
327
448
|
class AXConversationMessageAudioComponent extends AXConversationMessageBaseComponent {
|
|
449
|
+
/**
|
|
450
|
+
* @ignore
|
|
451
|
+
*/
|
|
328
452
|
constructor() {
|
|
329
453
|
super();
|
|
454
|
+
/**
|
|
455
|
+
* @ignore
|
|
456
|
+
*/
|
|
330
457
|
this.audioState = signal('paused');
|
|
458
|
+
/**
|
|
459
|
+
* @ignore
|
|
460
|
+
*/
|
|
331
461
|
this.audioTag = viewChild('a');
|
|
462
|
+
/**
|
|
463
|
+
* @ignore
|
|
464
|
+
*/
|
|
332
465
|
this.renderer = inject(Renderer2);
|
|
466
|
+
/**
|
|
467
|
+
* @ignore
|
|
468
|
+
*/
|
|
333
469
|
this.audioRate = signal(1);
|
|
470
|
+
/**
|
|
471
|
+
* @ignore
|
|
472
|
+
*/
|
|
334
473
|
this.currentTime = signal(0);
|
|
474
|
+
/**
|
|
475
|
+
* @ignore
|
|
476
|
+
*/
|
|
335
477
|
this.duration = signal(0);
|
|
478
|
+
/**
|
|
479
|
+
* @ignore
|
|
480
|
+
*/
|
|
336
481
|
this.currentTimeFormat = signal(0);
|
|
482
|
+
/**
|
|
483
|
+
* @ignore
|
|
484
|
+
*/
|
|
337
485
|
this.durationFormat = signal(0);
|
|
338
486
|
afterNextRender(() => {
|
|
339
487
|
this.renderer.setAttribute(this.audioTag().nativeElement, 'src', this.message.content);
|
|
340
488
|
this.eventListeners();
|
|
341
489
|
});
|
|
342
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* @ignore
|
|
493
|
+
*/
|
|
343
494
|
eventListeners() {
|
|
344
495
|
this.ended();
|
|
345
496
|
this.durationChange();
|
|
346
497
|
this.timeUpdate();
|
|
347
498
|
}
|
|
499
|
+
/**
|
|
500
|
+
* Seeks to the specified time and resumes audio playback.
|
|
501
|
+
*
|
|
502
|
+
* @param e - Time in seconds to seek to.
|
|
503
|
+
* @ignore
|
|
504
|
+
*/
|
|
348
505
|
clickHandler(e) {
|
|
349
506
|
this.audioTag().nativeElement.pause();
|
|
350
507
|
this.audioTag().nativeElement.currentTime = e;
|
|
351
508
|
this.audioTag().nativeElement.play();
|
|
352
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* Pauses the audio and updates the state to 'paused'.
|
|
512
|
+
* @ignore
|
|
513
|
+
*/
|
|
353
514
|
handlePauseClick() {
|
|
354
515
|
this.audioState.set('paused');
|
|
355
516
|
this.audioTag().nativeElement.pause();
|
|
356
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Plays the audio and updates the state to 'playing'.\
|
|
520
|
+
* @ignore
|
|
521
|
+
*/
|
|
357
522
|
handlePlayClick() {
|
|
358
523
|
this.audioState.set('playing');
|
|
359
524
|
this.audioTag().nativeElement.play();
|
|
360
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Toggles the playback rate of the audio between 1x, 1.5x, and 2x.
|
|
528
|
+
* @ignore
|
|
529
|
+
*/
|
|
361
530
|
handleRateClick() {
|
|
362
531
|
if (this.audioRate() === 1) {
|
|
363
532
|
this.audioRate.set(1.5);
|
|
@@ -372,6 +541,9 @@ class AXConversationMessageAudioComponent extends AXConversationMessageBaseCompo
|
|
|
372
541
|
this.audioTag().nativeElement.playbackRate = 1;
|
|
373
542
|
}
|
|
374
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* @ignore
|
|
546
|
+
*/
|
|
375
547
|
ended() {
|
|
376
548
|
fromEvent(this.audioTag().nativeElement, 'ended').subscribe((e) => {
|
|
377
549
|
this.audioState.set('paused');
|
|
@@ -379,6 +551,9 @@ class AXConversationMessageAudioComponent extends AXConversationMessageBaseCompo
|
|
|
379
551
|
this.audioTag().nativeElement.currentTime = 0;
|
|
380
552
|
});
|
|
381
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* @ignore
|
|
556
|
+
*/
|
|
382
557
|
durationChange() {
|
|
383
558
|
fromEvent(this.audioTag().nativeElement, 'durationchange').subscribe((e) => {
|
|
384
559
|
if (this.audioTag().nativeElement.duration === Infinity)
|
|
@@ -387,6 +562,9 @@ class AXConversationMessageAudioComponent extends AXConversationMessageBaseCompo
|
|
|
387
562
|
this.durationFormat.set(Math.ceil(this.audioTag().nativeElement.duration) * 1000);
|
|
388
563
|
});
|
|
389
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* @ignore
|
|
567
|
+
*/
|
|
390
568
|
timeUpdate() {
|
|
391
569
|
fromEvent(this.audioTag().nativeElement, 'timeupdate').subscribe((e) => {
|
|
392
570
|
this.currentTime.set(this.audioTag().nativeElement.currentTime);
|
|
@@ -401,11 +579,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
401
579
|
args: [{ selector: 'ax-conversation-message-audio', encapsulation: ViewEncapsulation.None, template: "<audio #a></audio>\n<ax-prefix>\n <div class=\"ax-time-rate\">\n @switch (audioState()) {\n @case ('paused') {\n {{ currentTimeFormat() | format: 'time-duration' | async }}\n }\n @case ('playing') {\n {{ currentTimeFormat() | format: 'time-duration' | async }}\n }\n @default {\n {{ durationFormat() | format: 'time-duration' | async }}\n }\n }\n <button class=\"ax-audio-speed\" (click)=\"handleRateClick()\">{{ audioRate() }}X</button>\n </div>\n</ax-prefix>\n<div class=\"ax-conversation-controller\">\n @switch (audioState()) {\n @case ('playing') {\n <button (click)=\"handlePauseClick()\">\n <i class=\"ax-icon ax-icon-pause\"></i>\n </button>\n }\n @case ('paused') {\n <button (click)=\"handlePlayClick()\">\n <i class=\"ax-icon ax-icon-play\"></i>\n </button>\n }\n }\n</div>\n<ax-slider\n class=\"ax-modify-bgSlider\"\n (onClick)=\"clickHandler($event)\"\n [maxValue]=\"duration()\"\n [minValue]=\"0\"\n [ngModel]=\"currentTime()\"\n color=\"secondary\"\n>\n</ax-slider>\n", styles: [".ax-time-rate button{margin-inline-start:.3rem;background-color:rgba(var(--ax-color-primary-fore));color:rgba(var(--ax-color-neutral-950));border-radius:.2rem;min-width:2rem}.ax-modify-bgSlider input[type=range]::-webkit-slider-runnable-track{background:rgba(var(--ax-color-primary-400));height:.5rem}.ax-modify-bgSlider input[type=range]::-moz-range-track{background:rgba(var(--ax-color-primary-400));height:.5rem}.ax-modify-bgSlider input[type=range]::-webkit-slider-thumb{margin-top:-.5rem}\n"] }]
|
|
402
580
|
}], ctorParameters: () => [] });
|
|
403
581
|
|
|
582
|
+
/**
|
|
583
|
+
* Displays the conversation view with messages and interactions.
|
|
584
|
+
*
|
|
585
|
+
* @category Components
|
|
586
|
+
*/
|
|
404
587
|
class AXConversationViewComponent extends MXBaseComponent {
|
|
588
|
+
/**
|
|
589
|
+
* @ignore
|
|
590
|
+
*/
|
|
405
591
|
constructor() {
|
|
406
592
|
super();
|
|
593
|
+
/**
|
|
594
|
+
* @ignore
|
|
595
|
+
*/
|
|
407
596
|
this.conversationService = inject(AXConversationService);
|
|
597
|
+
/**
|
|
598
|
+
* Emits an event when an action is performed within the conversation view.
|
|
599
|
+
*
|
|
600
|
+
* @event
|
|
601
|
+
*/
|
|
408
602
|
this.onAction = output();
|
|
603
|
+
/**
|
|
604
|
+
* @ignore
|
|
605
|
+
*/
|
|
409
606
|
this.conversations = computed(() => {
|
|
410
607
|
return this.conversationService.chats();
|
|
411
608
|
});
|
|
@@ -414,6 +611,9 @@ class AXConversationViewComponent extends MXBaseComponent {
|
|
|
414
611
|
this.scrollIntoEndOfView();
|
|
415
612
|
});
|
|
416
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* @ignore
|
|
616
|
+
*/
|
|
417
617
|
scrollIntoEndOfView() {
|
|
418
618
|
const el = this.viewRef.element.nativeElement;
|
|
419
619
|
el.scroll({ top: el.scrollHeight });
|
|
@@ -427,14 +627,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
427
627
|
}], ctorParameters: () => [] });
|
|
428
628
|
|
|
429
629
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
630
|
+
/**
|
|
631
|
+
* Component for displaying file messages in a conversation.
|
|
632
|
+
*
|
|
633
|
+
* @category Components
|
|
634
|
+
*/
|
|
430
635
|
class AXConversationFileMessageComponent extends AXConversationMessageBaseComponent {
|
|
636
|
+
/**
|
|
637
|
+
* @ignore
|
|
638
|
+
*/
|
|
431
639
|
constructor() {
|
|
432
640
|
super();
|
|
641
|
+
/**
|
|
642
|
+
* @ignore
|
|
643
|
+
*/
|
|
433
644
|
this.fileState = signal('ready');
|
|
645
|
+
/**
|
|
646
|
+
* @ignore
|
|
647
|
+
*/
|
|
434
648
|
this.fileSize = signal(null);
|
|
649
|
+
/**
|
|
650
|
+
* @ignore
|
|
651
|
+
*/
|
|
435
652
|
this.fileName = signal('');
|
|
653
|
+
/**
|
|
654
|
+
* @ignore
|
|
655
|
+
*/
|
|
436
656
|
this.fileService = inject(AXFileService);
|
|
657
|
+
/**
|
|
658
|
+
* @ignore
|
|
659
|
+
*/
|
|
437
660
|
this.http = inject(HttpClient);
|
|
661
|
+
/**
|
|
662
|
+
* @ignore
|
|
663
|
+
*/
|
|
438
664
|
this.parent = inject(AXConversationViewComponent);
|
|
439
665
|
afterNextRender(() => {
|
|
440
666
|
if (this.message.name) {
|
|
@@ -447,9 +673,17 @@ class AXConversationFileMessageComponent extends AXConversationMessageBaseCompon
|
|
|
447
673
|
}
|
|
448
674
|
});
|
|
449
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* Emits a download action event for the file.
|
|
678
|
+
* @ignore
|
|
679
|
+
*/
|
|
450
680
|
handleDownloadFile() {
|
|
451
681
|
this.parent.onAction.emit({ component: this, data: this.message, isUserInteraction: true });
|
|
452
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Emits a cancel action event for the file loading.
|
|
685
|
+
* @ignore
|
|
686
|
+
*/
|
|
453
687
|
handleCancelLoading() {
|
|
454
688
|
this.parent.onAction.emit({ component: this, data: this.message, isUserInteraction: true });
|
|
455
689
|
}
|
|
@@ -461,7 +695,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
461
695
|
args: [{ selector: 'ax-conversation-message-file', encapsulation: ViewEncapsulation.None, template: "<ax-prefix>\n {{ fileSize() | format: 'filesize' | async }}\n</ax-prefix>\n<div class=\"ax-file-container\">\n <div class=\"ax-conversation-controller\">\n @switch (fileState()) {\n @case ('ready') {\n <button (click)=\"handleDownloadFile()\">\n <i class=\"ax-icon ax-icon-download\"></i>\n </button>\n }\n\n @default {\n <button (click)=\"handleCancelLoading()\">\n <ax-loading-spinner\n [size]=\"24\"\n [stroke]=\"2\"\n [color]=\"message.fromId ? 'var(--ax-other-color)' : 'var(--ax-own-color)'\"\n ></ax-loading-spinner>\n </button>\n }\n }\n </div>\n\n <div class=\"ax-file-name\">{{ fileName() }}</div>\n</div>\n", styles: ["ax-conversation-message-file .ax-file-container{display:flex;align-items:center;justify-content:center;gap:.5rem}ax-conversation-message-file .ax-file-container .ax-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
462
696
|
}], ctorParameters: () => [] });
|
|
463
697
|
|
|
698
|
+
/**
|
|
699
|
+
* A popup component for displaying an image in full view.
|
|
700
|
+
*
|
|
701
|
+
* @category Components
|
|
702
|
+
*/
|
|
464
703
|
class ConversationMessageImagePopupComponent {
|
|
704
|
+
/**
|
|
705
|
+
* @ignore
|
|
706
|
+
*/
|
|
465
707
|
constructor() {
|
|
466
708
|
afterNextRender(() => {
|
|
467
709
|
console.log(this.url);
|
|
@@ -475,11 +717,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
475
717
|
args: [{ selector: 'ax-conversation-message-image-popup', template: ` <div class="ax-image-popup-container"><img class="ax-image-popup" [src]="url" alt="" /></div>`, styles: [".ax-image-popup-container{display:flex;justify-content:center;align-items:center}.ax-image-popup{width:100%;height:auto;object-fit:cover}\n"] }]
|
|
476
718
|
}], ctorParameters: () => [] });
|
|
477
719
|
|
|
720
|
+
/**
|
|
721
|
+
* A component for displaying an image within a conversation message.
|
|
722
|
+
*
|
|
723
|
+
* @category Components
|
|
724
|
+
*/
|
|
478
725
|
class AXConversationMessageImageComponent extends AXConversationMessageBaseComponent {
|
|
726
|
+
/**
|
|
727
|
+
* @ignore
|
|
728
|
+
*/
|
|
479
729
|
constructor() {
|
|
480
730
|
super();
|
|
731
|
+
/**
|
|
732
|
+
* @ignore
|
|
733
|
+
*/
|
|
481
734
|
this._imageUrl = signal('');
|
|
735
|
+
/**
|
|
736
|
+
* @ignore
|
|
737
|
+
*/
|
|
482
738
|
this.popup = inject(AXPopupService);
|
|
739
|
+
/**
|
|
740
|
+
* @ignore
|
|
741
|
+
*/
|
|
483
742
|
this._options = {
|
|
484
743
|
header: true,
|
|
485
744
|
footer: false,
|
|
@@ -493,6 +752,10 @@ class AXConversationMessageImageComponent extends AXConversationMessageBaseCompo
|
|
|
493
752
|
this._imageUrl.set(this.message?.content);
|
|
494
753
|
});
|
|
495
754
|
}
|
|
755
|
+
/**
|
|
756
|
+
* Opens a popup displaying the image with options for draggable, size, and backdrop.
|
|
757
|
+
* @ignore
|
|
758
|
+
*/
|
|
496
759
|
openPopup() {
|
|
497
760
|
this.popup
|
|
498
761
|
.open(ConversationMessageImagePopupComponent, {
|
|
@@ -518,17 +781,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
518
781
|
args: [{ selector: 'ax-conversation-message-image', template: `<img (click)="openPopup()" [src]="_imageUrl()" alt="" /> `, inputs: ['message'], styles: ["img{cursor:pointer;margin-bottom:.5rem;width:100%;border-radius:.75rem}\n"] }]
|
|
519
782
|
}], ctorParameters: () => [] });
|
|
520
783
|
|
|
784
|
+
/**
|
|
785
|
+
* A component for displaying a text message with optional reply content, including text, images, videos, files, and audio.
|
|
786
|
+
*
|
|
787
|
+
* @category Components
|
|
788
|
+
*/
|
|
521
789
|
class AXConversationTextMessageComponent extends AXConversationMessageBaseComponent {
|
|
522
790
|
constructor() {
|
|
523
791
|
super(...arguments);
|
|
792
|
+
/**
|
|
793
|
+
* @ignore
|
|
794
|
+
*/
|
|
524
795
|
this._text = signal('');
|
|
796
|
+
/**
|
|
797
|
+
* @ignore
|
|
798
|
+
*/
|
|
525
799
|
this.replyText = signal(null);
|
|
800
|
+
/**
|
|
801
|
+
* @ignore
|
|
802
|
+
*/
|
|
526
803
|
this.replyImage = signal(null);
|
|
804
|
+
/**
|
|
805
|
+
* @ignore
|
|
806
|
+
*/
|
|
527
807
|
this.replyVideo = signal(null);
|
|
808
|
+
/**
|
|
809
|
+
* @ignore
|
|
810
|
+
*/
|
|
528
811
|
this.replyAudio = signal(null);
|
|
812
|
+
/**
|
|
813
|
+
* @ignore
|
|
814
|
+
*/
|
|
529
815
|
this.replyVoice = signal(null);
|
|
816
|
+
/**
|
|
817
|
+
* @ignore
|
|
818
|
+
*/
|
|
530
819
|
this.replyFile = signal(null);
|
|
531
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* @ignore
|
|
823
|
+
*/
|
|
532
824
|
ngOnInit() {
|
|
533
825
|
this._text.set(this.message?.content);
|
|
534
826
|
if (!this.message?.replyTo)
|
|
@@ -616,11 +908,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
616
908
|
`, encapsulation: ViewEncapsulation.None, inputs: ['message'], styles: [".ax-text-message{word-break:break-all;white-space:break-spaces}\n"] }]
|
|
617
909
|
}] });
|
|
618
910
|
|
|
911
|
+
/**
|
|
912
|
+
* A component for displaying a video message with playback controls.
|
|
913
|
+
*
|
|
914
|
+
* @category Components
|
|
915
|
+
*/
|
|
619
916
|
class AXConversationMessageVideoComponent extends AXConversationMessageBaseComponent {
|
|
620
917
|
constructor() {
|
|
621
918
|
super(...arguments);
|
|
919
|
+
/**
|
|
920
|
+
* @ignore
|
|
921
|
+
*/
|
|
622
922
|
this._videoUrl = signal('');
|
|
623
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* @ignore
|
|
926
|
+
*/
|
|
624
927
|
ngOnInit() {
|
|
625
928
|
this._videoUrl.set(this.message?.content);
|
|
626
929
|
console.log(this._videoUrl());
|
|
@@ -633,17 +936,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
633
936
|
args: [{ selector: 'ax-conversation-message-video', template: `<video controls [src]="_videoUrl()"></video>`, styles: ["video{margin-bottom:.5rem;width:100%;border-radius:.75rem}\n"] }]
|
|
634
937
|
}] });
|
|
635
938
|
|
|
939
|
+
/**
|
|
940
|
+
* A component for displaying and handling audio messages in a conversation.
|
|
941
|
+
*
|
|
942
|
+
* @category Components
|
|
943
|
+
*/
|
|
636
944
|
class AXConversationVoiceMessageComponent extends AXConversationMessageBaseComponent {
|
|
945
|
+
/**
|
|
946
|
+
* @ignore
|
|
947
|
+
*/
|
|
637
948
|
constructor() {
|
|
638
949
|
super();
|
|
950
|
+
/**
|
|
951
|
+
* @ignore
|
|
952
|
+
*/
|
|
639
953
|
this.config = { url: '' };
|
|
954
|
+
/**
|
|
955
|
+
* @ignore
|
|
956
|
+
*/
|
|
640
957
|
this.audioState = signal('paused');
|
|
958
|
+
/**
|
|
959
|
+
* @ignore
|
|
960
|
+
*/
|
|
641
961
|
this.parent = inject(AXConversationViewComponent);
|
|
962
|
+
/**
|
|
963
|
+
* @ignore
|
|
964
|
+
*/
|
|
642
965
|
this.selectedRate = signal(1);
|
|
966
|
+
/**
|
|
967
|
+
* @ignore
|
|
968
|
+
*/
|
|
643
969
|
this.selectedRateIndex = signal(1);
|
|
970
|
+
/**
|
|
971
|
+
* @ignore
|
|
972
|
+
*/
|
|
644
973
|
this.audioProgress = signal(0);
|
|
974
|
+
/**
|
|
975
|
+
* @ignore
|
|
976
|
+
*/
|
|
645
977
|
this.timeLeft = signal(0);
|
|
978
|
+
/**
|
|
979
|
+
* @ignore
|
|
980
|
+
*/
|
|
646
981
|
this.currentTime = signal(0);
|
|
982
|
+
/**
|
|
983
|
+
* @ignore
|
|
984
|
+
*/
|
|
647
985
|
this.duration = signal(0);
|
|
648
986
|
afterNextRender(() => {
|
|
649
987
|
this.config.url = this.message?.content;
|
|
@@ -655,6 +993,9 @@ class AXConversationVoiceMessageComponent extends AXConversationMessageBaseCompo
|
|
|
655
993
|
this.handleLoadingProgress();
|
|
656
994
|
});
|
|
657
995
|
}
|
|
996
|
+
/**
|
|
997
|
+
* @ignore
|
|
998
|
+
*/
|
|
658
999
|
setWaveColor() {
|
|
659
1000
|
let waveColor = '';
|
|
660
1001
|
let progressColor = '';
|
|
@@ -669,15 +1010,28 @@ class AXConversationVoiceMessageComponent extends AXConversationMessageBaseCompo
|
|
|
669
1010
|
this.config.waveColor = waveColor;
|
|
670
1011
|
this.config.progressColor = progressColor;
|
|
671
1012
|
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Pauses the audio playback and updates the audio state to 'paused'.
|
|
1015
|
+
* @ignore
|
|
1016
|
+
*/
|
|
672
1017
|
handlePauseClick() {
|
|
673
1018
|
this.audio?.pause();
|
|
674
1019
|
this.audioState.set('paused');
|
|
675
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Plays the audio and updates the audio state to 'playing'.
|
|
1023
|
+
* @ignore
|
|
1024
|
+
*/
|
|
676
1025
|
handlePlayClick() {
|
|
677
1026
|
this.audio?.play()?.then(() => {
|
|
678
1027
|
this.audioState.set('playing');
|
|
679
1028
|
});
|
|
680
1029
|
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Updates audio state and progress based on status changes from the audio wave.
|
|
1032
|
+
* @param e - The event containing status and data related to the audio.
|
|
1033
|
+
* @ignore
|
|
1034
|
+
*/
|
|
681
1035
|
handleOnStatusChanged(e) {
|
|
682
1036
|
if (e.status === 'load' || e.status === 'loading') {
|
|
683
1037
|
this.audioState.set('loading');
|
|
@@ -701,17 +1055,32 @@ class AXConversationVoiceMessageComponent extends AXConversationMessageBaseCompo
|
|
|
701
1055
|
this.audioState.set('error');
|
|
702
1056
|
}
|
|
703
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* @ignore
|
|
1060
|
+
*/
|
|
704
1061
|
handleLoadingProgress() {
|
|
705
1062
|
// this.audioLoaderProgress?.nativeElement.style.cssText = `--ax-audio-progress: ${this.audioProgress()}`;
|
|
706
1063
|
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Handles the cancellation of a loading operation.
|
|
1066
|
+
* @ignore
|
|
1067
|
+
*/
|
|
707
1068
|
handleCancelLoading() {
|
|
708
1069
|
//
|
|
709
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Reloads the audio and updates the state to 'loading'.
|
|
1073
|
+
* @ignore
|
|
1074
|
+
*/
|
|
710
1075
|
handleReloadClick() {
|
|
711
1076
|
//
|
|
712
1077
|
this.audioState.set('loading');
|
|
713
1078
|
this.audio.load();
|
|
714
1079
|
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Cycles through predefined audio playback rates and updates the rate.
|
|
1082
|
+
* @ignore
|
|
1083
|
+
*/
|
|
715
1084
|
handleRateClick() {
|
|
716
1085
|
const rates = [0.5, 1, 2, 4];
|
|
717
1086
|
if (this.selectedRateIndex() == rates.length - 1) {
|
|
@@ -723,6 +1092,9 @@ class AXConversationVoiceMessageComponent extends AXConversationMessageBaseCompo
|
|
|
723
1092
|
this.selectedRate.set(rates[this.selectedRateIndex()]);
|
|
724
1093
|
this.audio.setRate(this.selectedRate());
|
|
725
1094
|
}
|
|
1095
|
+
/**
|
|
1096
|
+
* @ignore
|
|
1097
|
+
*/
|
|
726
1098
|
get __hostClass() {
|
|
727
1099
|
return `${this.message.fromId ? 'ax-state-other' : 'ax-state-own'}`;
|
|
728
1100
|
}
|