@acorex/components 17.0.15 → 17.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/calendar/lib/calendar.module.d.ts +2 -1
- package/conversation/index.d.ts +12 -0
- package/conversation/lib/conversation-input/conversation-input.component.d.ts +35 -0
- package/conversation/lib/conversation-message/conversation-message.component.d.ts +20 -0
- package/conversation/lib/conversation-messages/conversation-message-text.component.d.ts +9 -0
- package/{chat/lib/chat-messages/chat-messages-voice/chat-message-voice.component.d.ts → conversation/lib/conversation-messages/conversation-messages-voice/conversation-message-voice.component.d.ts} +6 -4
- package/conversation/lib/conversation-view/conversation-view.component.d.ts +13 -0
- package/conversation/lib/conversation.module.d.ts +37 -0
- package/conversation/lib/conversation.types.d.ts +23 -0
- package/conversation/lib/services/conversation-message-type-registry.service.d.ts +9 -0
- package/conversation/lib/services/conversation.service.d.ts +5 -0
- package/esm2022/audio-wave/lib/audio-wave.component.mjs +4 -4
- package/esm2022/calendar/lib/calendar.component.mjs +5 -4
- package/esm2022/calendar/lib/calendar.module.mjs +5 -4
- package/esm2022/conversation/acorex-components-conversation.mjs +5 -0
- package/esm2022/conversation/index.mjs +14 -0
- package/esm2022/conversation/lib/classes/events.interface.mjs +2 -0
- package/esm2022/conversation/lib/conversation-input/conversation-input.component.mjs +117 -0
- package/esm2022/conversation/lib/conversation-input/conversation-input.interface.mjs +2 -0
- package/esm2022/conversation/lib/conversation-message/conversation-message.component.mjs +70 -0
- package/esm2022/conversation/lib/conversation-messages/conversation-message-text.component.mjs +23 -0
- package/esm2022/conversation/lib/conversation-messages/conversation-messages-voice/conversation-message-voice.component.mjs +112 -0
- package/esm2022/conversation/lib/conversation-view/conversation-view.component.mjs +31 -0
- package/esm2022/conversation/lib/conversation.module.mjs +154 -0
- package/esm2022/conversation/lib/conversation.types.mjs +10 -0
- package/esm2022/conversation/lib/services/conversation-message-type-registry.service.mjs +20 -0
- package/esm2022/conversation/lib/services/conversation.service.mjs +10 -0
- package/esm2022/conversation/lib/services/recording.service.mjs +78 -0
- package/fesm2022/acorex-components-audio-wave.mjs +3 -3
- package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
- package/fesm2022/acorex-components-calendar.mjs +7 -5
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation.mjs +589 -0
- package/fesm2022/acorex-components-conversation.mjs.map +1 -0
- package/package.json +13 -13
- package/chat/index.d.ts +0 -12
- package/chat/lib/chat-input/chat-input.component.d.ts +0 -35
- package/chat/lib/chat-message/chat-message.component.d.ts +0 -16
- package/chat/lib/chat-messages/chat-message-text.component.d.ts +0 -8
- package/chat/lib/chat-view/chat-view.component.d.ts +0 -10
- package/chat/lib/chat.module.d.ts +0 -35
- package/chat/lib/chat.types.d.ts +0 -21
- package/chat/lib/services/chat-message-type-registry.service.d.ts +0 -9
- package/chat/lib/services/chat.service.d.ts +0 -5
- package/esm2022/chat/acorex-components-chat.mjs +0 -5
- package/esm2022/chat/index.mjs +0 -14
- package/esm2022/chat/lib/chat-input/chat-input.component.mjs +0 -125
- package/esm2022/chat/lib/chat-input/chat-input.interface.mjs +0 -2
- package/esm2022/chat/lib/chat-message/chat-message.component.mjs +0 -54
- package/esm2022/chat/lib/chat-messages/chat-message-text.component.mjs +0 -23
- package/esm2022/chat/lib/chat-messages/chat-messages-voice/chat-message-voice.component.mjs +0 -97
- package/esm2022/chat/lib/chat-view/chat-view.component.mjs +0 -22
- package/esm2022/chat/lib/chat.module.mjs +0 -146
- package/esm2022/chat/lib/chat.types.mjs +0 -10
- package/esm2022/chat/lib/classes/events.interface.mjs +0 -2
- package/esm2022/chat/lib/services/chat-message-type-registry.service.mjs +0 -20
- package/esm2022/chat/lib/services/chat.service.mjs +0 -10
- package/esm2022/chat/lib/services/recording.service.mjs +0 -78
- package/fesm2022/acorex-components-chat.mjs +0 -552
- package/fesm2022/acorex-components-chat.mjs.map +0 -1
- /package/{chat → conversation}/README.md +0 -0
- /package/{chat → conversation}/lib/classes/events.interface.d.ts +0 -0
- /package/{chat/lib/chat-input/chat-input.interface.d.ts → conversation/lib/conversation-input/conversation-input.interface.d.ts} +0 -0
- /package/{chat → conversation}/lib/services/recording.service.d.ts +0 -0
@@ -1,552 +0,0 @@
|
|
1
|
-
import { MXInputBaseValueComponent, MXLookComponent, AXComponent, AXFocusableComponent, AXValuableComponent, MXBaseComponent, AXRippleDirective } from '@acorex/components/common';
|
2
|
-
import * as i0 from '@angular/core';
|
3
|
-
import { signal, Injectable, EventEmitter, inject, forwardRef, Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Output, input, HostBinding, afterNextRender, NgModule, Optional, Inject } from '@angular/core';
|
4
|
-
import * as i1 from '@angular/forms';
|
5
|
-
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
6
|
-
import { classes } from 'polytype';
|
7
|
-
import * as i2 from '@acorex/components/button';
|
8
|
-
import { AXButtonModule } from '@acorex/components/button';
|
9
|
-
import * as i3 from '@acorex/components/decorators';
|
10
|
-
import { AXDecoratorModule } from '@acorex/components/decorators';
|
11
|
-
import * as i4 from '@acorex/components/dropdown';
|
12
|
-
import { AXDropdownModule } from '@acorex/components/dropdown';
|
13
|
-
import * as i5 from '@angular/common';
|
14
|
-
import { CommonModule, AsyncPipe } from '@angular/common';
|
15
|
-
import * as i6 from '@acorex/core/translation';
|
16
|
-
import { AXTranslationModule } from '@acorex/core/translation';
|
17
|
-
import { isBrowser } from '@acorex/core/platform';
|
18
|
-
import * as i1$1 from '@angular/cdk/portal';
|
19
|
-
import { ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
20
|
-
import * as i3$1 from '@acorex/core/format';
|
21
|
-
import { AXFormatModule } from '@acorex/core/format';
|
22
|
-
import * as i2$1 from '@acorex/components/audio-wave';
|
23
|
-
import { AXAudioWaveModule } from '@acorex/components/audio-wave';
|
24
|
-
import { AXCircularProgressModule } from '@acorex/components/circular-progress';
|
25
|
-
import * as i3$2 from '@acorex/components/loading';
|
26
|
-
import { AXLoadingModule } from '@acorex/components/loading';
|
27
|
-
import { AXDateTimeModule } from '@acorex/core/date-time';
|
28
|
-
|
29
|
-
class AXRecordingService {
|
30
|
-
constructor() {
|
31
|
-
this.audioBlobs = [];
|
32
|
-
this.streamBeingCaptured = null;
|
33
|
-
this.timer = signal('00:0');
|
34
|
-
this.time = {
|
35
|
-
seconds: 0,
|
36
|
-
minutes: 0,
|
37
|
-
hours: 0,
|
38
|
-
};
|
39
|
-
}
|
40
|
-
startRecording() {
|
41
|
-
if (!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia)) {
|
42
|
-
return Promise.reject(new Error('mediaDevices API or getUserMedia method is not supported in this browser.'));
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
return navigator.mediaDevices
|
46
|
-
.getUserMedia({ audio: true })
|
47
|
-
.then((stream) => {
|
48
|
-
this.streamBeingCaptured = stream;
|
49
|
-
this.mediaRecorder = new MediaRecorder(stream);
|
50
|
-
this.audioBlobs = [];
|
51
|
-
this.mediaRecorder.addEventListener('dataavailable', (event) => {
|
52
|
-
this.audioBlobs.push(event.data);
|
53
|
-
});
|
54
|
-
this.mediaRecorder.start();
|
55
|
-
this.timerInterval = setInterval(() => {
|
56
|
-
this.calculateTime();
|
57
|
-
}, 1000);
|
58
|
-
});
|
59
|
-
}
|
60
|
-
}
|
61
|
-
stopRecording() {
|
62
|
-
return new Promise((resolve) => {
|
63
|
-
const mimeType = this.mediaRecorder?.mimeType;
|
64
|
-
this.mediaRecorder?.addEventListener('stop', () => {
|
65
|
-
const audioBlob = new Blob(this.audioBlobs, { type: mimeType });
|
66
|
-
resolve(audioBlob);
|
67
|
-
});
|
68
|
-
this.mediaRecorder?.stop();
|
69
|
-
this.streamBeingCaptured.getTracks().forEach((track) => track.stop());
|
70
|
-
this.mediaRecorder = null;
|
71
|
-
this.streamBeingCaptured = null;
|
72
|
-
this.resetTimer();
|
73
|
-
});
|
74
|
-
}
|
75
|
-
calculateTime() {
|
76
|
-
this.time.seconds++;
|
77
|
-
if (this.time.seconds >= 60) {
|
78
|
-
this.time.seconds = 0;
|
79
|
-
this.time.minutes++;
|
80
|
-
if (this.time.minutes >= 60) {
|
81
|
-
this.time.minutes = 0;
|
82
|
-
this.time.hours++;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
const formattedTime = (this.time.hours > 0 ? this.time.hours + ':' : '') +
|
86
|
-
(this.time.minutes < 10 ? '0' + this.time.minutes : this.time.minutes) +
|
87
|
-
':' +
|
88
|
-
(this.time.seconds < 10 ? '0' + this.time.seconds : this.time.seconds);
|
89
|
-
this.timer.set(formattedTime);
|
90
|
-
}
|
91
|
-
resetTimer() {
|
92
|
-
clearInterval(this.timerInterval);
|
93
|
-
this.time.seconds = 0;
|
94
|
-
this.time.minutes = 0;
|
95
|
-
this.time.hours = 0;
|
96
|
-
this.timer.set('00:0');
|
97
|
-
}
|
98
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRecordingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
99
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRecordingService }); }
|
100
|
-
}
|
101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXRecordingService, decorators: [{
|
102
|
-
type: Injectable
|
103
|
-
}] });
|
104
|
-
|
105
|
-
class AXChatInputComponent extends classes((MXInputBaseValueComponent), MXLookComponent) {
|
106
|
-
constructor() {
|
107
|
-
super(...arguments);
|
108
|
-
this.hasAttachment = true;
|
109
|
-
this.haVoice = true;
|
110
|
-
this.acceptFileType = '*';
|
111
|
-
this.onSendClick = new EventEmitter();
|
112
|
-
this.onStartRecording = new EventEmitter();
|
113
|
-
this.onStopRecording = new EventEmitter();
|
114
|
-
this.onFileChange = new EventEmitter();
|
115
|
-
this.recording = signal(false);
|
116
|
-
this.recordingService = inject(AXRecordingService);
|
117
|
-
this._updateOn = 'change';
|
118
|
-
this.recordedAudio = null;
|
119
|
-
}
|
120
|
-
_handleModelChange(value) {
|
121
|
-
this.commitValue(value, true);
|
122
|
-
}
|
123
|
-
handleRecordClick() {
|
124
|
-
this.recordedAudio = null;
|
125
|
-
this.recording.set(true);
|
126
|
-
this.recordingService
|
127
|
-
?.startRecording()
|
128
|
-
.then(() => {
|
129
|
-
this.onStartRecording.emit({
|
130
|
-
component: this,
|
131
|
-
data: { recording: true },
|
132
|
-
isUserInteraction: true,
|
133
|
-
});
|
134
|
-
})
|
135
|
-
.catch((e) => {
|
136
|
-
console.error(e);
|
137
|
-
});
|
138
|
-
}
|
139
|
-
handleStopClick() {
|
140
|
-
this.recordingService.stopRecording().then((c) => {
|
141
|
-
this.recording.set(false);
|
142
|
-
this.recordedAudio = c;
|
143
|
-
this.onStopRecording.emit({
|
144
|
-
component: this,
|
145
|
-
data: { value: this.recordedAudio },
|
146
|
-
});
|
147
|
-
});
|
148
|
-
}
|
149
|
-
handleAttachClick() {
|
150
|
-
this.inputFile.nativeElement.click();
|
151
|
-
}
|
152
|
-
handleChangeFile(event) {
|
153
|
-
this.onFileChange.emit({
|
154
|
-
component: this,
|
155
|
-
data: { value: event.target.files },
|
156
|
-
});
|
157
|
-
}
|
158
|
-
handleSendClick() {
|
159
|
-
this.onSendClick.emit({
|
160
|
-
component: this,
|
161
|
-
data: { value: this.value },
|
162
|
-
isUserInteraction: true,
|
163
|
-
});
|
164
|
-
}
|
165
|
-
handleSendVoiceClick() {
|
166
|
-
this.handleStopClick();
|
167
|
-
this.onSendClick.emit({
|
168
|
-
component: this,
|
169
|
-
data: { value: this.value },
|
170
|
-
isUserInteraction: true,
|
171
|
-
});
|
172
|
-
}
|
173
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
174
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXChatInputComponent, selector: "ax-chat-input", inputs: { maxLength: "maxLength", hasAttachment: "hasAttachment", haVoice: "haVoice", acceptFileType: "acceptFileType" }, outputs: { onSendClick: "onSendClick", onStartRecording: "onStartRecording", onStopRecording: "onStopRecording", onFileChange: "onFileChange" }, providers: [
|
175
|
-
{ provide: AXComponent, useExisting: AXChatInputComponent },
|
176
|
-
{ provide: AXFocusableComponent, useExisting: AXChatInputComponent },
|
177
|
-
{ provide: AXValuableComponent, useExisting: AXChatInputComponent },
|
178
|
-
{
|
179
|
-
provide: NG_VALUE_ACCESSOR,
|
180
|
-
useExisting: forwardRef(() => AXChatInputComponent),
|
181
|
-
multi: true,
|
182
|
-
},
|
183
|
-
], viewQueries: [{ propertyName: "inputFile", first: true, predicate: ["inputFile"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-chat-input\" [class.ax-state-recording]=\"recording()\">\n @if (recording()) {\n <div class=\"ax-chat-input-start-side\">\n <span class=\"ax-record-dot\"></span>\n <span>{{ recordingService.timer() }}</span>\n </div>\n <div class=\"ax-chat-input-main-side\">\n <ax-button class=\"ax-sm\" look=\"blank\" color=\"primary\" [text]=\"'cancel' | translate | async\"\n (onClick)=\"handleStopClick()\"></ax-button>\n </div>\n <div class=\"ax-chat-input-end-side\">\n <ax-button look=\"solid\" color=\"danger\" class=\"ax-blob ax-sm\" (onClick)=\"handleSendVoiceClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-send\"></i>\n </ax-icon>\n </ax-button>\n </div>\n } @else {\n <div class=\"ax-chat-input-start-side\">\n <ax-button look=\"blank\" class=\"ax-sm\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-emoji\"></i>\n </ax-icon>\n <ax-dropdown-panel>\n <ng-container>\n <div class=\"ax-emoji-container\">\n <div>\u26A0\uFE0F</div>\n <div>\u27A1\uFE0F</div>\n <div>\uD83D\uDD03</div>\n <div>\uD83D\uDD37</div>\n <div>\uD83E\uDD1A</div>\n <div>\uD83D\uDE02</div>\n <div>\uD83D\uDE0A</div>\n </div>\n </ng-container>\n </ax-dropdown-panel>\n </ax-button>\n </div>\n <textarea class=\"ax-chat-input-main-side\"\n oninput='this.style.height = \"\";this.style.height = this.scrollHeight + \"px\"' type=\"text\" rows=\"1\" [id]=\"id\"\n [name]=\"name\" [attr.placeholder]=\"placeholder\" [attr.maxlength]=\"maxLength\" [disabled]=\"disabled\"\n [readonly]=\"readonly\" [tabindex]=\"tabIndex\" [ngModel]=\"value\" (ngModelChange)=\"_handleModelChange($event)\"\n [ngModelOptions]=\"{ updateOn: _updateOn }\" (keydown)=\"emitOnKeydownEvent($event)\" (keyup)=\"emitOnKeyupEvent($event)\"\n (keypress)=\"emitOnKeypressEvent($event)\" (focus)=\"emitOnFocusEvent($event)\"\n (blur)=\"emitOnBlurEvent($event)\"></textarea>\n <div class=\"ax-chat-input-end-side\">\n @if (!value) {\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"handleAttachClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-attach\"></i>\n </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"handleRecordClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-mic\"></i>\n </ax-icon>\n </ax-button>\n <input #inputFile [accept]=\"acceptFileType\" type=\"file\" class=\"ax-attach-input\" (change)=\"handleChangeFile($event)\">\n }\n\n @if (value) {\n <ax-button look=\"solid\" color=\"primary\" class=\"ax-sm\" (onClick)=\"handleSendClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-send\"></i>\n </ax-icon>\n </ax-button>\n }\n </div>\n }\n</div>", styles: [".ax-dark .ax-chat-input:focus-within{box-shadow:0 0 0 1px rgba(var(--ax-color-primary-200));border-color:rgba(var(--ax-color-primary-200))}.ax-chat-input{border:1px solid;border-color:rgba(var(--ax-color-border-default));display:flex;align-items:flex-end;border-radius:var(--ax-rounded-border-default);position:relative;resize:vertical;height:auto;padding:.5rem;font-size:.875rem}.ax-chat-input.ax-state-recording{align-items:center;display:grid;grid-template-columns:repeat(3,1fr)}.ax-chat-input.ax-state-recording .ax-chat-input-start-side{justify-content:flex-start}.ax-chat-input.ax-state-recording .ax-chat-input-end-side{justify-content:flex-end}.ax-chat-input:focus-within{box-shadow:0 0 0 1px rgba(var(--ax-color-primary-500));border-color:rgba(var(--ax-color-primary-500))}.ax-chat-input>textarea{font-size:.875rem;background-color:transparent;max-height:10rem;min-height:1.5rem;line-height:2rem;flex:1 1 auto;height:auto;resize:none}.ax-chat-input>textarea:focus,.ax-chat-input>textarea:focus-visible{outline:unset}.ax-chat-input .ax-chat-input-start-side,.ax-chat-input .ax-chat-input-end-side{display:flex;align-items:center;justify-content:center}.ax-chat-input .ax-chat-input-start-side{padding-inline-end:.75rem}.ax-chat-input .ax-chat-input-main-side{flex:1 1 auto;display:flex;align-items:center;justify-content:center}.ax-chat-input .ax-chat-input-end-side{padding-inline-start:.75rem;gap:.5rem}.ax-chat-input .ax-record-dot{display:inline-flex;width:.5rem;height:.5rem;background-color:rgba(var(--ax-color-danger-500));border-radius:999rem;margin-inline-end:.5rem}.ax-chat-input .ax-blob{animation:pulse .75s infinite}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 rgba(var(--ax-color-danger-500),.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(var(--ax-color-danger-500),0)}to{transform:scale(1);box-shadow:0 0 rgba(var(--ax-color-danger-500),0)}}.ax-chat-input .ax-attach-input{opacity:0;width:0;height:0;position:absolute}.ax-emoji-container{padding:.75rem;gap:.5rem;display:grid;grid-template-columns:repeat(7,1fr)}.ax-emoji-container>div{padding:.25rem;cursor:pointer;border-radius:var(--ax-rounded-border-default)}.ax-emoji-container>div:hover{background-color:rgba(var(--ax-color-on-surface))}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i4.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "_target", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
184
|
-
}
|
185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatInputComponent, decorators: [{
|
186
|
-
type: Component,
|
187
|
-
args: [{ selector: 'ax-chat-input', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
188
|
-
{ provide: AXComponent, useExisting: AXChatInputComponent },
|
189
|
-
{ provide: AXFocusableComponent, useExisting: AXChatInputComponent },
|
190
|
-
{ provide: AXValuableComponent, useExisting: AXChatInputComponent },
|
191
|
-
{
|
192
|
-
provide: NG_VALUE_ACCESSOR,
|
193
|
-
useExisting: forwardRef(() => AXChatInputComponent),
|
194
|
-
multi: true,
|
195
|
-
},
|
196
|
-
], template: "<div class=\"ax-chat-input\" [class.ax-state-recording]=\"recording()\">\n @if (recording()) {\n <div class=\"ax-chat-input-start-side\">\n <span class=\"ax-record-dot\"></span>\n <span>{{ recordingService.timer() }}</span>\n </div>\n <div class=\"ax-chat-input-main-side\">\n <ax-button class=\"ax-sm\" look=\"blank\" color=\"primary\" [text]=\"'cancel' | translate | async\"\n (onClick)=\"handleStopClick()\"></ax-button>\n </div>\n <div class=\"ax-chat-input-end-side\">\n <ax-button look=\"solid\" color=\"danger\" class=\"ax-blob ax-sm\" (onClick)=\"handleSendVoiceClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-send\"></i>\n </ax-icon>\n </ax-button>\n </div>\n } @else {\n <div class=\"ax-chat-input-start-side\">\n <ax-button look=\"blank\" class=\"ax-sm\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-emoji\"></i>\n </ax-icon>\n <ax-dropdown-panel>\n <ng-container>\n <div class=\"ax-emoji-container\">\n <div>\u26A0\uFE0F</div>\n <div>\u27A1\uFE0F</div>\n <div>\uD83D\uDD03</div>\n <div>\uD83D\uDD37</div>\n <div>\uD83E\uDD1A</div>\n <div>\uD83D\uDE02</div>\n <div>\uD83D\uDE0A</div>\n </div>\n </ng-container>\n </ax-dropdown-panel>\n </ax-button>\n </div>\n <textarea class=\"ax-chat-input-main-side\"\n oninput='this.style.height = \"\";this.style.height = this.scrollHeight + \"px\"' type=\"text\" rows=\"1\" [id]=\"id\"\n [name]=\"name\" [attr.placeholder]=\"placeholder\" [attr.maxlength]=\"maxLength\" [disabled]=\"disabled\"\n [readonly]=\"readonly\" [tabindex]=\"tabIndex\" [ngModel]=\"value\" (ngModelChange)=\"_handleModelChange($event)\"\n [ngModelOptions]=\"{ updateOn: _updateOn }\" (keydown)=\"emitOnKeydownEvent($event)\" (keyup)=\"emitOnKeyupEvent($event)\"\n (keypress)=\"emitOnKeypressEvent($event)\" (focus)=\"emitOnFocusEvent($event)\"\n (blur)=\"emitOnBlurEvent($event)\"></textarea>\n <div class=\"ax-chat-input-end-side\">\n @if (!value) {\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"handleAttachClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-attach\"></i>\n </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"handleRecordClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-mic\"></i>\n </ax-icon>\n </ax-button>\n <input #inputFile [accept]=\"acceptFileType\" type=\"file\" class=\"ax-attach-input\" (change)=\"handleChangeFile($event)\">\n }\n\n @if (value) {\n <ax-button look=\"solid\" color=\"primary\" class=\"ax-sm\" (onClick)=\"handleSendClick()\">\n <ax-icon>\n <i class=\"ax-icon ax-icon-send\"></i>\n </ax-icon>\n </ax-button>\n }\n </div>\n }\n</div>", styles: [".ax-dark .ax-chat-input:focus-within{box-shadow:0 0 0 1px rgba(var(--ax-color-primary-200));border-color:rgba(var(--ax-color-primary-200))}.ax-chat-input{border:1px solid;border-color:rgba(var(--ax-color-border-default));display:flex;align-items:flex-end;border-radius:var(--ax-rounded-border-default);position:relative;resize:vertical;height:auto;padding:.5rem;font-size:.875rem}.ax-chat-input.ax-state-recording{align-items:center;display:grid;grid-template-columns:repeat(3,1fr)}.ax-chat-input.ax-state-recording .ax-chat-input-start-side{justify-content:flex-start}.ax-chat-input.ax-state-recording .ax-chat-input-end-side{justify-content:flex-end}.ax-chat-input:focus-within{box-shadow:0 0 0 1px rgba(var(--ax-color-primary-500));border-color:rgba(var(--ax-color-primary-500))}.ax-chat-input>textarea{font-size:.875rem;background-color:transparent;max-height:10rem;min-height:1.5rem;line-height:2rem;flex:1 1 auto;height:auto;resize:none}.ax-chat-input>textarea:focus,.ax-chat-input>textarea:focus-visible{outline:unset}.ax-chat-input .ax-chat-input-start-side,.ax-chat-input .ax-chat-input-end-side{display:flex;align-items:center;justify-content:center}.ax-chat-input .ax-chat-input-start-side{padding-inline-end:.75rem}.ax-chat-input .ax-chat-input-main-side{flex:1 1 auto;display:flex;align-items:center;justify-content:center}.ax-chat-input .ax-chat-input-end-side{padding-inline-start:.75rem;gap:.5rem}.ax-chat-input .ax-record-dot{display:inline-flex;width:.5rem;height:.5rem;background-color:rgba(var(--ax-color-danger-500));border-radius:999rem;margin-inline-end:.5rem}.ax-chat-input .ax-blob{animation:pulse .75s infinite}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 rgba(var(--ax-color-danger-500),.7)}70%{transform:scale(1);box-shadow:0 0 0 10px rgba(var(--ax-color-danger-500),0)}to{transform:scale(1);box-shadow:0 0 rgba(var(--ax-color-danger-500),0)}}.ax-chat-input .ax-attach-input{opacity:0;width:0;height:0;position:absolute}.ax-emoji-container{padding:.75rem;gap:.5rem;display:grid;grid-template-columns:repeat(7,1fr)}.ax-emoji-container>div{padding:.25rem;cursor:pointer;border-radius:var(--ax-rounded-border-default)}.ax-emoji-container>div:hover{background-color:rgba(var(--ax-color-on-surface))}\n"] }]
|
197
|
-
}], propDecorators: { inputFile: [{
|
198
|
-
type: ViewChild,
|
199
|
-
args: ['inputFile']
|
200
|
-
}], maxLength: [{
|
201
|
-
type: Input
|
202
|
-
}], hasAttachment: [{
|
203
|
-
type: Input
|
204
|
-
}], haVoice: [{
|
205
|
-
type: Input
|
206
|
-
}], acceptFileType: [{
|
207
|
-
type: Input
|
208
|
-
}], onSendClick: [{
|
209
|
-
type: Output
|
210
|
-
}], onStartRecording: [{
|
211
|
-
type: Output
|
212
|
-
}], onStopRecording: [{
|
213
|
-
type: Output
|
214
|
-
}], onFileChange: [{
|
215
|
-
type: Output
|
216
|
-
}] } });
|
217
|
-
|
218
|
-
class AXChatMessageTypeRegistryService {
|
219
|
-
constructor() {
|
220
|
-
this.plugins = new Map();
|
221
|
-
}
|
222
|
-
register(...plugins) {
|
223
|
-
plugins.forEach((p) => this.plugins.set(p.name, p));
|
224
|
-
}
|
225
|
-
resolve(name) {
|
226
|
-
return this.plugins.get(name);
|
227
|
-
}
|
228
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageTypeRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
229
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageTypeRegistryService, providedIn: 'root' }); }
|
230
|
-
}
|
231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageTypeRegistryService, decorators: [{
|
232
|
-
type: Injectable,
|
233
|
-
args: [{ providedIn: 'root' }]
|
234
|
-
}] });
|
235
|
-
|
236
|
-
class AXChatMessageComponent extends MXBaseComponent {
|
237
|
-
constructor() {
|
238
|
-
super(...arguments);
|
239
|
-
this.chatMessage = input();
|
240
|
-
this.registryService = inject(AXChatMessageTypeRegistryService);
|
241
|
-
}
|
242
|
-
get isOwn() {
|
243
|
-
return !this.chatMessage().fromId;
|
244
|
-
}
|
245
|
-
get __hostClass() {
|
246
|
-
return `${this.isOwn ? 'ax-state-own' : ''} ${!this.isOwn ? 'ax-state-other' : ''}`;
|
247
|
-
}
|
248
|
-
ngOnInit() {
|
249
|
-
this._portal = new ComponentPortal(this.registryService.resolve(this.chatMessage().type).component);
|
250
|
-
}
|
251
|
-
_handleAttched(ref) {
|
252
|
-
ref = ref;
|
253
|
-
if (ref.instance && isBrowser()) {
|
254
|
-
Object.assign(ref.instance, { message: this.chatMessage() });
|
255
|
-
this.cdr.markForCheck();
|
256
|
-
const prefix = this.getHostElement().querySelector('ax-prefix');
|
257
|
-
const suffix = this.getHostElement().querySelector('ax-suffix');
|
258
|
-
const prefixContainer = this.getHostElement().querySelector('.ax-message-prefix');
|
259
|
-
const suffixContainer = this.getHostElement().querySelector('.ax-message-suffix');
|
260
|
-
if (prefix && prefixContainer) {
|
261
|
-
prefix.style.display = 'flex';
|
262
|
-
prefixContainer.append(prefix);
|
263
|
-
}
|
264
|
-
if (suffix && suffixContainer) {
|
265
|
-
suffix.style.display = 'flex';
|
266
|
-
suffixContainer.append(suffix);
|
267
|
-
}
|
268
|
-
}
|
269
|
-
}
|
270
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
271
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXChatMessageComponent, selector: "ax-chat-message", inputs: { chatMessage: { classPropertyName: "chatMessage", publicName: "chatMessage", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.__hostClass" } }, usesInheritance: true, ngImport: i0, template: "<ng-template [cdkPortalOutlet]=\"_portal\" (attached)=\"_handleAttched($event)\"></ng-template>\n\n<div class=\"ax-chat-message-status\">\n <div class=\"ax-message-prefix\">\n </div>\n <div>\n <div class=\"ax-message-suffix\"></div>\n <span>{{ chatMessage().sendTime | format:'datetime':'HH:mm' | async }}</span>\n <span>\n @if(isOwn)\n {\n @if(chatMessage().deliverTime){\n <i class=\"ax-icon ax-icon-check ax-message-status\"></i>\n }\n @if(chatMessage().readTime){\n <i class=\"ax-icon ax-icon-dobble-check ax-message-status\"></i>\n }\n }\n </span>\n </div>\n</div>", styles: ["ax-chat-message{display:block;padding:.75rem;font-size:.875rem;line-height:1.25rem;border-radius:.75rem;border:1px solid;--ax-other-color: rgba(var(--ax-color-surface));--ax-other-color-fore: rgba(var(--ax-color-surface-fore));--ax-own-color: rgba(var(--ax-color-primary-100));--ax-own-color-fore: rgba(var(--ax-color-primary-fore-tint));--ax-message-status-color: rgba(var(--ax-color-primary-700))}ax-chat-message.ax-state-own{border-end-end-radius:0!important;background-color:var(--ax-own-color);border-color:var(--ax-own-color);color:var(--ax-own-color-fore)}ax-chat-message.ax-state-own .ax-chat-message-status{color:var(--ax-own-color-fore)}ax-chat-message.ax-state-other{border-end-start-radius:0!important;background-color:var(--ax-other-color);border-color:var(--ax-other-color);border-color:rgba(var(--ax-color-border-default))}ax-chat-message.ax-state-other .ax-chat-message-status{color:var(--ax-own-color-fore)}ax-chat-message .ax-chat-message-status{display:flex;justify-content:space-between;align-items:center;font-size:.75rem}ax-chat-message .ax-chat-message-status>div{display:flex;gap:.125rem;align-items:center}ax-chat-message .ax-chat-message-status .ax-message-status{color:var(--ax-message-status-color)}ax-chat-message ax-prefix,ax-chat-message ax-suffix{display:none}.ax-dark ax-chat-message{--ax-reply-bk: rgba(var(--ax-color-primary-800));--ax-reply-color: rgba(var(--ax-color-primary-fore));--ax-reply-border-color: rgba(var(--ax-color-primary-fore));--ax-own-color: rgba(var(--ax-color-primary-700));--ax-own-color-fore: rgba(var(--ax-color-primary-fore));--ax-message-status-color: rgba(var(--ax-color-primary-100))}\n"], dependencies: [{ kind: "directive", type: i1$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$1.AXFormatPipe, name: "format" }], encapsulation: i0.ViewEncapsulation.None }); }
|
272
|
-
}
|
273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageComponent, decorators: [{
|
274
|
-
type: Component,
|
275
|
-
args: [{ selector: 'ax-chat-message', encapsulation: ViewEncapsulation.None, template: "<ng-template [cdkPortalOutlet]=\"_portal\" (attached)=\"_handleAttched($event)\"></ng-template>\n\n<div class=\"ax-chat-message-status\">\n <div class=\"ax-message-prefix\">\n </div>\n <div>\n <div class=\"ax-message-suffix\"></div>\n <span>{{ chatMessage().sendTime | format:'datetime':'HH:mm' | async }}</span>\n <span>\n @if(isOwn)\n {\n @if(chatMessage().deliverTime){\n <i class=\"ax-icon ax-icon-check ax-message-status\"></i>\n }\n @if(chatMessage().readTime){\n <i class=\"ax-icon ax-icon-dobble-check ax-message-status\"></i>\n }\n }\n </span>\n </div>\n</div>", styles: ["ax-chat-message{display:block;padding:.75rem;font-size:.875rem;line-height:1.25rem;border-radius:.75rem;border:1px solid;--ax-other-color: rgba(var(--ax-color-surface));--ax-other-color-fore: rgba(var(--ax-color-surface-fore));--ax-own-color: rgba(var(--ax-color-primary-100));--ax-own-color-fore: rgba(var(--ax-color-primary-fore-tint));--ax-message-status-color: rgba(var(--ax-color-primary-700))}ax-chat-message.ax-state-own{border-end-end-radius:0!important;background-color:var(--ax-own-color);border-color:var(--ax-own-color);color:var(--ax-own-color-fore)}ax-chat-message.ax-state-own .ax-chat-message-status{color:var(--ax-own-color-fore)}ax-chat-message.ax-state-other{border-end-start-radius:0!important;background-color:var(--ax-other-color);border-color:var(--ax-other-color);border-color:rgba(var(--ax-color-border-default))}ax-chat-message.ax-state-other .ax-chat-message-status{color:var(--ax-own-color-fore)}ax-chat-message .ax-chat-message-status{display:flex;justify-content:space-between;align-items:center;font-size:.75rem}ax-chat-message .ax-chat-message-status>div{display:flex;gap:.125rem;align-items:center}ax-chat-message .ax-chat-message-status .ax-message-status{color:var(--ax-message-status-color)}ax-chat-message ax-prefix,ax-chat-message ax-suffix{display:none}.ax-dark ax-chat-message{--ax-reply-bk: rgba(var(--ax-color-primary-800));--ax-reply-color: rgba(var(--ax-color-primary-fore));--ax-reply-border-color: rgba(var(--ax-color-primary-fore));--ax-own-color: rgba(var(--ax-color-primary-700));--ax-own-color-fore: rgba(var(--ax-color-primary-fore));--ax-message-status-color: rgba(var(--ax-color-primary-100))}\n"] }]
|
276
|
-
}], propDecorators: { __hostClass: [{
|
277
|
-
type: HostBinding,
|
278
|
-
args: ['class']
|
279
|
-
}] } });
|
280
|
-
|
281
|
-
class AXChatViewComponent extends MXBaseComponent {
|
282
|
-
constructor() {
|
283
|
-
super(...arguments);
|
284
|
-
this._chats = signal([]);
|
285
|
-
}
|
286
|
-
set chats(items) {
|
287
|
-
this._chats.set(items);
|
288
|
-
}
|
289
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
290
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXChatViewComponent, selector: "ax-chat-view", inputs: { chats: "chats" }, usesInheritance: true, ngImport: i0, template: "@for (item of _chats(); track $index) {\n<ax-chat-message [chatMessage]=\"item\"></ax-chat-message>\n}", styles: ["ax-chat-view{display:flex;flex-direction:column;gap:1rem;height:100%;width:100%;overflow-y:auto;overflow-x:hidden}\n"], dependencies: [{ kind: "component", type: AXChatMessageComponent, selector: "ax-chat-message", inputs: ["chatMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
291
|
-
}
|
292
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatViewComponent, decorators: [{
|
293
|
-
type: Component,
|
294
|
-
args: [{ selector: 'ax-chat-view', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "@for (item of _chats(); track $index) {\n<ax-chat-message [chatMessage]=\"item\"></ax-chat-message>\n}", styles: ["ax-chat-view{display:flex;flex-direction:column;gap:1rem;height:100%;width:100%;overflow-y:auto;overflow-x:hidden}\n"] }]
|
295
|
-
}], propDecorators: { chats: [{
|
296
|
-
type: Input
|
297
|
-
}] } });
|
298
|
-
|
299
|
-
class AXChatMessageBaseComponent {
|
300
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
301
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageBaseComponent }); }
|
302
|
-
}
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatMessageBaseComponent, decorators: [{
|
304
|
-
type: Injectable
|
305
|
-
}] });
|
306
|
-
|
307
|
-
class AXChatTextMessageComponent extends AXChatMessageBaseComponent {
|
308
|
-
constructor() {
|
309
|
-
super(...arguments);
|
310
|
-
this._text = signal('');
|
311
|
-
}
|
312
|
-
ngOnInit() {
|
313
|
-
this._text.set(this.message?.content);
|
314
|
-
}
|
315
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatTextMessageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
316
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.2", type: AXChatTextMessageComponent, selector: "ng-component", inputs: { message: "message" }, usesInheritance: true, ngImport: i0, template: `<div [innerHtml]="_text()"></div>`, isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
|
317
|
-
}
|
318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatTextMessageComponent, decorators: [{
|
319
|
-
type: Component,
|
320
|
-
args: [{
|
321
|
-
template: `<div [innerHtml]="_text()"></div>`,
|
322
|
-
encapsulation: ViewEncapsulation.None,
|
323
|
-
inputs: ['message'],
|
324
|
-
}]
|
325
|
-
}] });
|
326
|
-
|
327
|
-
class AXChatAudioMessageComponent extends AXChatMessageBaseComponent {
|
328
|
-
constructor() {
|
329
|
-
super();
|
330
|
-
this.config = { url: '' };
|
331
|
-
this.audioState = signal('paused');
|
332
|
-
this.selectedRate = signal(1);
|
333
|
-
this.selectedRateIndex = signal(1);
|
334
|
-
this.audioProgress = signal(0);
|
335
|
-
this.timeLeft = signal(0);
|
336
|
-
this.currentTime = signal(0);
|
337
|
-
this.duration = signal(0);
|
338
|
-
afterNextRender(() => {
|
339
|
-
this.config.url = this.message?.content;
|
340
|
-
this.config.audioRate = 0.25;
|
341
|
-
if (this.message.fromId) {
|
342
|
-
const neutral300 = getComputedStyle(document.body).getPropertyValue('--ax-color-neutral-200');
|
343
|
-
const neutral500 = getComputedStyle(document.body).getPropertyValue('--ax-color-neutral-500');
|
344
|
-
this.config.waveColor = `rgba(${neutral300})`;
|
345
|
-
this.config.progressColor = `rgba(${neutral500})`;
|
346
|
-
}
|
347
|
-
this.handleLoadingProgress();
|
348
|
-
});
|
349
|
-
}
|
350
|
-
handlePauseClick() {
|
351
|
-
this.audio?.pause();
|
352
|
-
this.audioState.set('paused');
|
353
|
-
}
|
354
|
-
handlePlayClick() {
|
355
|
-
this.audio?.play()?.then(() => {
|
356
|
-
this.audioState.set('playing');
|
357
|
-
});
|
358
|
-
}
|
359
|
-
handleOnStatusChanged(e) {
|
360
|
-
if (e.status === 'load' || e.status === 'loading') {
|
361
|
-
this.audioState.set('loading');
|
362
|
-
}
|
363
|
-
if (e.status === 'loading') {
|
364
|
-
this.audioProgress.set(e.data.percent);
|
365
|
-
this.duration.set(Math.ceil(e.data.duration * 1000));
|
366
|
-
}
|
367
|
-
if (e.status === 'ready') {
|
368
|
-
this.audioState.set('ready');
|
369
|
-
this.duration.set(Math.ceil(e.data.duration * 1000));
|
370
|
-
}
|
371
|
-
if (e.status === 'finish') {
|
372
|
-
this.audioState.set('paused');
|
373
|
-
}
|
374
|
-
if (e.status === 'timeupdate') {
|
375
|
-
this.timeLeft.set(this.duration() - e.data.currentTime * 1000);
|
376
|
-
this.currentTime.set(e.data.currentTime * 1000);
|
377
|
-
}
|
378
|
-
if (e.status === 'error') {
|
379
|
-
this.audioState.set('error');
|
380
|
-
}
|
381
|
-
}
|
382
|
-
handleLoadingProgress() {
|
383
|
-
// this.audioLoaderProgress?.nativeElement.style.cssText = `--ax-audio-progress: ${this.audioProgress()}`;
|
384
|
-
}
|
385
|
-
handleCancelLoading() {
|
386
|
-
//
|
387
|
-
}
|
388
|
-
handleReloadClick() {
|
389
|
-
//
|
390
|
-
this.audioState.set('loading');
|
391
|
-
this.audio.load();
|
392
|
-
}
|
393
|
-
handleRateClick() {
|
394
|
-
const rates = [0.5, 1, 2, 4];
|
395
|
-
if (this.selectedRateIndex() == rates.length - 1) {
|
396
|
-
this.selectedRateIndex.set(0);
|
397
|
-
}
|
398
|
-
else {
|
399
|
-
this.selectedRateIndex.set(this.selectedRateIndex() + 1);
|
400
|
-
}
|
401
|
-
this.selectedRate.set(rates[this.selectedRateIndex()]);
|
402
|
-
this.audio.setRate(this.selectedRate());
|
403
|
-
}
|
404
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatAudioMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
405
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: AXChatAudioMessageComponent, selector: "ax-chat-message-audio", inputs: { message: "message" }, viewQueries: [{ propertyName: "audio", first: true, predicate: ["a"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ax-prefix>\n @switch (audioState()) {\n @case ('paused')\n {\n {{currentTime() | format:'time-duration' | async}}\n }\n @case ('playing')\n {\n {{currentTime() | format:'time-duration' | async}}\n }\n @default {\n {{duration() | format:'time-duration' | async}}\n }\n }\n <button class=\"ax-audio-speed\" (click)=\"handleRateClick()\"></button>\n\n</ax-prefix>\n<div class=\"ax-audio-controller\">\n\n @switch (audioState()) {\n @case ('playing') {\n <button (click)=\"handlePauseClick()\">\n <i class=\"ax-icon ax-icon-pause\"></i>\n </button>\n }\n\n @case ('ready') {\n <button (click)=\"handlePlayClick()\">\n <i class=\"ax-icon ax-icon-play\" style=\"margin-inline-start: 0.25rem;\"></i>\n </button>\n }\n\n @case ('paused')\n {\n <button (click)=\"handlePlayClick()\">\n <i class=\"ax-icon ax-icon-play\" style=\"margin-inline-start: 0.25rem;\"></i>\n </button>\n }\n\n @case ('error')\n {\n <button class=\"ax-state-error\" (click)=\"handleReloadClick()\">\n <i class=\"ax-icon ax-icon-reload\"></i>\n </button>\n }\n\n @default {\n <!-- <button (click)=\"handleCancelLoading()\" class=\"ax-audio-loader\" [style.--ax-audio-progress]=\"audioProgress()\"\n [style.--ax-animation-duration]=\"audioProgress()*10+'ms'\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <circle fill=\"none\" stroke-linecap=\"round\" cx=\"20\" cy=\"20\" r=\"15.915494309\" />\n </svg>\n </button> -->\n <button (click)=\"handleCancelLoading()\">\n <ax-loading-spinner [size]=\"24\" [stroke]=\"2\" color=\"white\"></ax-loading-spinner>\n </button>\n }\n }\n\n</div>\n<ax-audio-wave #a [config]=\"config\" (onStatusChanged)=\"handleOnStatusChanged($event)\"></ax-audio-wave>\n<ax-suffix>\n <div class=\"ax-audio-rate-button\" [class.ax-state-isOwn]=\"!message?.fromId\" (click)=\"handleRateClick()\">\n {{selectedRate()}}X</div>\n</ax-suffix>", styles: ["ax-chat-message-audio{display:flex;align-items:center;justify-content:space-between;gap:.25rem}ax-chat-message-audio .ax-audio-controller button{width:2.5rem;height:2.5rem;background-color:rgba(var(--ax-color-primary-500));color:rgba(var(--ax-color-primary-fore));border-radius:999rem;display:flex;align-items:center;justify-content:center}ax-chat-message-audio .ax-audio-controller button ax-loading-spinner{display:flex}ax-chat-message-audio .ax-audio-controller button.ax-state-error{background-color:rgba(var(--ax-color-danger-500));color:rgba(var(--ax-color-danger-fore))}ax-chat-message-audio .ax-audio-controller button>i{width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;font-size:1.25rem;font-weight:700}ax-chat-message-audio .ax-audio-controller button.ax-audio-loader{--ax-audio-progress: 100}ax-chat-message-audio .ax-audio-controller button.ax-audio-loader svg circle{stroke:#fff;stroke-width:.125rem;stroke-dasharray:var(--ax-audio-progress);stroke-dashoffset:0;animation:loader normal;animation-duration:var(--ax-animation-duration);transform-origin:center;transform:rotate(-90deg)}@keyframes loader{0%{stroke-dashoffset:var(--ax-audio-progress);transform:rotate(-90deg)}to{stroke-dashoffset:0;transform:rotate(450deg)}}ax-chat-message-audio .ax-audio-wave{flex:1}.ax-audio-rate-button{background-color:rgba(var(--ax-color-neutral-200));color:rgba(var(--ax-color-neutral-fore-tint));border-radius:.5rem;padding:0 .5rem;font-weight:700;margin-inline-end:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.ax-audio-rate-button.ax-state-isOwn{background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}\n"], dependencies: [{ kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title , ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "component", type: i2$1.AXAudioWaveComponent, selector: "ax-audio-wave", inputs: ["config"], outputs: ["onStatusChanged"] }, { kind: "component", type: i3$2.AXLoadingSpinnerComponent, selector: "ax-loading-spinner", inputs: ["color", "size", "stroke"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$1.AXFormatPipe, name: "format" }], encapsulation: i0.ViewEncapsulation.None }); }
|
406
|
-
}
|
407
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatAudioMessageComponent, decorators: [{
|
408
|
-
type: Component,
|
409
|
-
args: [{ selector: 'ax-chat-message-audio', encapsulation: ViewEncapsulation.None, inputs: ['message'], template: "<ax-prefix>\n @switch (audioState()) {\n @case ('paused')\n {\n {{currentTime() | format:'time-duration' | async}}\n }\n @case ('playing')\n {\n {{currentTime() | format:'time-duration' | async}}\n }\n @default {\n {{duration() | format:'time-duration' | async}}\n }\n }\n <button class=\"ax-audio-speed\" (click)=\"handleRateClick()\"></button>\n\n</ax-prefix>\n<div class=\"ax-audio-controller\">\n\n @switch (audioState()) {\n @case ('playing') {\n <button (click)=\"handlePauseClick()\">\n <i class=\"ax-icon ax-icon-pause\"></i>\n </button>\n }\n\n @case ('ready') {\n <button (click)=\"handlePlayClick()\">\n <i class=\"ax-icon ax-icon-play\" style=\"margin-inline-start: 0.25rem;\"></i>\n </button>\n }\n\n @case ('paused')\n {\n <button (click)=\"handlePlayClick()\">\n <i class=\"ax-icon ax-icon-play\" style=\"margin-inline-start: 0.25rem;\"></i>\n </button>\n }\n\n @case ('error')\n {\n <button class=\"ax-state-error\" (click)=\"handleReloadClick()\">\n <i class=\"ax-icon ax-icon-reload\"></i>\n </button>\n }\n\n @default {\n <!-- <button (click)=\"handleCancelLoading()\" class=\"ax-audio-loader\" [style.--ax-audio-progress]=\"audioProgress()\"\n [style.--ax-animation-duration]=\"audioProgress()*10+'ms'\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <circle fill=\"none\" stroke-linecap=\"round\" cx=\"20\" cy=\"20\" r=\"15.915494309\" />\n </svg>\n </button> -->\n <button (click)=\"handleCancelLoading()\">\n <ax-loading-spinner [size]=\"24\" [stroke]=\"2\" color=\"white\"></ax-loading-spinner>\n </button>\n }\n }\n\n</div>\n<ax-audio-wave #a [config]=\"config\" (onStatusChanged)=\"handleOnStatusChanged($event)\"></ax-audio-wave>\n<ax-suffix>\n <div class=\"ax-audio-rate-button\" [class.ax-state-isOwn]=\"!message?.fromId\" (click)=\"handleRateClick()\">\n {{selectedRate()}}X</div>\n</ax-suffix>", styles: ["ax-chat-message-audio{display:flex;align-items:center;justify-content:space-between;gap:.25rem}ax-chat-message-audio .ax-audio-controller button{width:2.5rem;height:2.5rem;background-color:rgba(var(--ax-color-primary-500));color:rgba(var(--ax-color-primary-fore));border-radius:999rem;display:flex;align-items:center;justify-content:center}ax-chat-message-audio .ax-audio-controller button ax-loading-spinner{display:flex}ax-chat-message-audio .ax-audio-controller button.ax-state-error{background-color:rgba(var(--ax-color-danger-500));color:rgba(var(--ax-color-danger-fore))}ax-chat-message-audio .ax-audio-controller button>i{width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;font-size:1.25rem;font-weight:700}ax-chat-message-audio .ax-audio-controller button.ax-audio-loader{--ax-audio-progress: 100}ax-chat-message-audio .ax-audio-controller button.ax-audio-loader svg circle{stroke:#fff;stroke-width:.125rem;stroke-dasharray:var(--ax-audio-progress);stroke-dashoffset:0;animation:loader normal;animation-duration:var(--ax-animation-duration);transform-origin:center;transform:rotate(-90deg)}@keyframes loader{0%{stroke-dashoffset:var(--ax-audio-progress);transform:rotate(-90deg)}to{stroke-dashoffset:0;transform:rotate(450deg)}}ax-chat-message-audio .ax-audio-wave{flex:1}.ax-audio-rate-button{background-color:rgba(var(--ax-color-neutral-200));color:rgba(var(--ax-color-neutral-fore-tint));border-radius:.5rem;padding:0 .5rem;font-weight:700;margin-inline-end:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.ax-audio-rate-button.ax-state-isOwn{background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}\n"] }]
|
410
|
-
}], ctorParameters: () => [], propDecorators: { audio: [{
|
411
|
-
type: ViewChild,
|
412
|
-
args: ['a']
|
413
|
-
}] } });
|
414
|
-
|
415
|
-
const COMPONENT = [
|
416
|
-
AXChatViewComponent,
|
417
|
-
AXChatInputComponent,
|
418
|
-
AXChatMessageComponent,
|
419
|
-
AXChatTextMessageComponent,
|
420
|
-
AXChatAudioMessageComponent,
|
421
|
-
];
|
422
|
-
const MODULES = [
|
423
|
-
CommonModule,
|
424
|
-
FormsModule,
|
425
|
-
AsyncPipe,
|
426
|
-
AXRippleDirective,
|
427
|
-
AXButtonModule,
|
428
|
-
AXDecoratorModule,
|
429
|
-
AXTranslationModule,
|
430
|
-
AXDropdownModule,
|
431
|
-
AXFormatModule,
|
432
|
-
AXAudioWaveModule,
|
433
|
-
AXCircularProgressModule,
|
434
|
-
AXDateTimeModule,
|
435
|
-
CdkPortalOutlet,
|
436
|
-
AXLoadingModule,
|
437
|
-
];
|
438
|
-
class AXChatModule {
|
439
|
-
static forRoot(config) {
|
440
|
-
return {
|
441
|
-
ngModule: AXChatModule,
|
442
|
-
providers: [
|
443
|
-
{
|
444
|
-
provide: 'AXChatModuleFactory',
|
445
|
-
useFactory: (registry) => () => {
|
446
|
-
if (config?.types?.length) {
|
447
|
-
registry.register(...config.types);
|
448
|
-
}
|
449
|
-
registry.register({
|
450
|
-
name: 'text',
|
451
|
-
component: AXChatTextMessageComponent,
|
452
|
-
});
|
453
|
-
registry.register({
|
454
|
-
name: 'audio',
|
455
|
-
component: AXChatAudioMessageComponent,
|
456
|
-
});
|
457
|
-
},
|
458
|
-
deps: [AXChatMessageTypeRegistryService],
|
459
|
-
multi: true,
|
460
|
-
},
|
461
|
-
],
|
462
|
-
};
|
463
|
-
}
|
464
|
-
static forChild(config) {
|
465
|
-
return {
|
466
|
-
ngModule: AXChatModule,
|
467
|
-
providers: [
|
468
|
-
{
|
469
|
-
provide: 'AXPWorkflowModuleFactory',
|
470
|
-
useFactory: (registry) => () => {
|
471
|
-
if (config?.types?.length) {
|
472
|
-
registry.register(...config.types);
|
473
|
-
}
|
474
|
-
},
|
475
|
-
deps: [AXChatMessageTypeRegistryService],
|
476
|
-
multi: true,
|
477
|
-
},
|
478
|
-
],
|
479
|
-
};
|
480
|
-
}
|
481
|
-
/**
|
482
|
-
* @ignore
|
483
|
-
*/
|
484
|
-
constructor(instances) {
|
485
|
-
instances?.forEach((f) => {
|
486
|
-
f();
|
487
|
-
});
|
488
|
-
}
|
489
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatModule, deps: [{ token: 'AXChatModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
490
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXChatModule, declarations: [AXChatViewComponent,
|
491
|
-
AXChatInputComponent,
|
492
|
-
AXChatMessageComponent,
|
493
|
-
AXChatTextMessageComponent,
|
494
|
-
AXChatAudioMessageComponent], imports: [CommonModule,
|
495
|
-
FormsModule,
|
496
|
-
AsyncPipe,
|
497
|
-
AXRippleDirective,
|
498
|
-
AXButtonModule,
|
499
|
-
AXDecoratorModule,
|
500
|
-
AXTranslationModule,
|
501
|
-
AXDropdownModule,
|
502
|
-
AXFormatModule,
|
503
|
-
AXAudioWaveModule,
|
504
|
-
AXCircularProgressModule,
|
505
|
-
AXDateTimeModule,
|
506
|
-
CdkPortalOutlet,
|
507
|
-
AXLoadingModule], exports: [AXChatViewComponent,
|
508
|
-
AXChatInputComponent,
|
509
|
-
AXChatMessageComponent,
|
510
|
-
AXChatTextMessageComponent,
|
511
|
-
AXChatAudioMessageComponent] }); }
|
512
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatModule, providers: [AXRecordingService], imports: [CommonModule,
|
513
|
-
FormsModule,
|
514
|
-
AXButtonModule,
|
515
|
-
AXDecoratorModule,
|
516
|
-
AXTranslationModule,
|
517
|
-
AXDropdownModule,
|
518
|
-
AXFormatModule,
|
519
|
-
AXAudioWaveModule,
|
520
|
-
AXCircularProgressModule,
|
521
|
-
AXDateTimeModule,
|
522
|
-
AXLoadingModule] }); }
|
523
|
-
}
|
524
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatModule, decorators: [{
|
525
|
-
type: NgModule,
|
526
|
-
args: [{
|
527
|
-
declarations: [...COMPONENT],
|
528
|
-
imports: [...MODULES],
|
529
|
-
exports: [...COMPONENT],
|
530
|
-
providers: [AXRecordingService],
|
531
|
-
}]
|
532
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
533
|
-
type: Optional
|
534
|
-
}, {
|
535
|
-
type: Inject,
|
536
|
-
args: ['AXChatModuleFactory']
|
537
|
-
}] }] });
|
538
|
-
|
539
|
-
class AXChatService {
|
540
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
541
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatService }); }
|
542
|
-
}
|
543
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXChatService, decorators: [{
|
544
|
-
type: Injectable
|
545
|
-
}] });
|
546
|
-
|
547
|
-
/**
|
548
|
-
* Generated bundle index. Do not edit.
|
549
|
-
*/
|
550
|
-
|
551
|
-
export { AXChatAudioMessageComponent, AXChatInputComponent, AXChatMessageBaseComponent, AXChatMessageComponent, AXChatMessageTypeRegistryService, AXChatModule, AXChatService, AXChatTextMessageComponent, AXChatViewComponent, AXRecordingService };
|
552
|
-
//# sourceMappingURL=acorex-components-chat.mjs.map
|