@volo/abp.ng.chat 8.2.1 → 8.2.3
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/config/public-api.d.ts +1 -0
- package/config/validators/index.d.ts +1 -0
- package/config/validators/message-deletion.validator.d.ts +2 -0
- package/esm2022/config/components/chat-tab.component.mjs +19 -9
- package/esm2022/config/public-api.mjs +2 -1
- package/esm2022/config/services/chat-config.service.mjs +2 -2
- package/esm2022/config/validators/index.mjs +2 -0
- package/esm2022/config/validators/message-deletion.validator.mjs +16 -0
- package/esm2022/lib/components/chat-contacts.component.mjs +56 -34
- package/esm2022/lib/components/chat.component.mjs +75 -71
- package/esm2022/lib/components/conversation-avatar.component.mjs +19 -15
- package/fesm2022/volo-abp.ng.chat-config.mjs +35 -10
- package/fesm2022/volo-abp.ng.chat-config.mjs.map +1 -1
- package/fesm2022/volo-abp.ng.chat.mjs +148 -118
- package/fesm2022/volo-abp.ng.chat.mjs.map +1 -1
- package/lib/components/chat-contacts.component.d.ts +9 -7
- package/lib/components/chat.component.d.ts +15 -17
- package/package.json +1 -1
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SubscriptionService,
|
|
3
|
-
import
|
|
4
|
-
import { ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
1
|
+
import * as i1 from '@abp/ng.core';
|
|
2
|
+
import { SubscriptionService, PagedResultRequestDto, ConfigStateService, HttpWaitService, RouterOutletComponent, authGuard, permissionGuard, ReplaceableRouteContainerComponent, LazyModuleFactory, CoreModule } from '@abp/ng.core';
|
|
3
|
+
import { ConfirmationService, ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
5
4
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable, Component, Input, inject, EventEmitter, Output, ViewChild, NgModule } from '@angular/core';
|
|
7
|
-
import * as i1$
|
|
5
|
+
import { Injectable, Component, Input, inject, model, EventEmitter, output, effect, Output, DestroyRef, ViewChild, NgModule } from '@angular/core';
|
|
6
|
+
import * as i1$3 from '@angular/router';
|
|
8
7
|
import { RouterModule } from '@angular/router';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { finalize, debounceTime, takeUntil, take as take$1 } from 'rxjs/operators';
|
|
13
|
-
import * as i1$1 from '@volo/abp.ng.chat/proxy';
|
|
8
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
9
|
+
import { take, fromEvent } from 'rxjs';
|
|
10
|
+
import { debounceTime, finalize, take as take$1 } from 'rxjs/operators';
|
|
14
11
|
import { ConversationService as ConversationService$1, ChatMessageSide as ChatMessageSide$1, chatDeletingMessagesOptions, chatDeletingConversationsOptions, ChatDeletingMessages, ChatDeletingConversations } from '@volo/abp.ng.chat/proxy';
|
|
15
|
-
import
|
|
16
|
-
import * as
|
|
12
|
+
import { ChatConfigService } from '@volo/abp.ng.chat/config';
|
|
13
|
+
import * as i1$1 from '@angular/common';
|
|
14
|
+
import * as i1$2 from '@angular/forms';
|
|
17
15
|
import * as i4 from '@ng-bootstrap/ng-bootstrap';
|
|
18
16
|
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
|
19
17
|
|
|
@@ -31,13 +29,13 @@ class ContactService {
|
|
|
31
29
|
getContactsByInput(params = {}) {
|
|
32
30
|
return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
|
|
33
31
|
}
|
|
34
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContactService, deps: [{ token:
|
|
32
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
35
33
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContactService, providedIn: 'root' }); }
|
|
36
34
|
}
|
|
37
35
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContactService, decorators: [{
|
|
38
36
|
type: Injectable,
|
|
39
37
|
args: [{ providedIn: 'root' }]
|
|
40
|
-
}], ctorParameters: () => [{ type:
|
|
38
|
+
}], ctorParameters: () => [{ type: i1.RestService }] });
|
|
41
39
|
|
|
42
40
|
class ChatContactDto {
|
|
43
41
|
constructor(initialValues = {}) {
|
|
@@ -86,23 +84,27 @@ class ConversationAvatarComponent {
|
|
|
86
84
|
return typeof this.small === 'string' || this.small;
|
|
87
85
|
}
|
|
88
86
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
89
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `
|
|
88
|
+
<div
|
|
89
|
+
class="avatar me-2 float-start rounded-circle"
|
|
90
|
+
[class.small]="isSmall"
|
|
91
|
+
[ngStyle]="avatarBgStyle"
|
|
92
|
+
>
|
|
93
|
+
{{ avatarText }}
|
|
94
|
+
</div>
|
|
95
|
+
`, isInline: true, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
|
96
96
|
}
|
|
97
97
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
|
|
98
98
|
type: Component,
|
|
99
|
-
args: [{ selector: 'abp-conversation-avatar', template:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
args: [{ selector: 'abp-conversation-avatar', template: `
|
|
100
|
+
<div
|
|
101
|
+
class="avatar me-2 float-start rounded-circle"
|
|
102
|
+
[class.small]="isSmall"
|
|
103
|
+
[ngStyle]="avatarBgStyle"
|
|
104
|
+
>
|
|
105
|
+
{{ avatarText }}
|
|
106
|
+
</div>
|
|
107
|
+
`, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"] }]
|
|
106
108
|
}], propDecorators: { contact: [{
|
|
107
109
|
type: Input
|
|
108
110
|
}], small: [{
|
|
@@ -110,18 +112,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
110
112
|
}] } });
|
|
111
113
|
|
|
112
114
|
class ChatContactsComponent {
|
|
113
|
-
|
|
114
|
-
this.contactService = inject(ContactService);
|
|
115
|
-
this.chatConfigService = inject(ChatConfigService);
|
|
116
|
-
this.subscription = inject(SubscriptionService);
|
|
117
|
-
this.chatConversationService = inject(ConversationService$1);
|
|
118
|
-
this.selected = new EventEmitter();
|
|
119
|
-
this.allContacts = [];
|
|
120
|
-
this.selectedContact = {};
|
|
121
|
-
this.filter = '';
|
|
122
|
-
this.getContactName = getContactName;
|
|
123
|
-
this.trackByUserId = trackBy('userId');
|
|
124
|
-
}
|
|
115
|
+
#startConversation;
|
|
125
116
|
get contacts() {
|
|
126
117
|
return this.allContacts
|
|
127
118
|
.filter(contact => contact.lastMessage)
|
|
@@ -156,26 +147,56 @@ class ChatContactsComponent {
|
|
|
156
147
|
}
|
|
157
148
|
});
|
|
158
149
|
}
|
|
159
|
-
|
|
160
|
-
this.
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
constructor() {
|
|
151
|
+
this.contactService = inject(ContactService);
|
|
152
|
+
this.chatConfigService = inject(ChatConfigService);
|
|
153
|
+
this.subscription = inject(SubscriptionService);
|
|
154
|
+
this.chatConversationService = inject(ConversationService$1);
|
|
155
|
+
this.startConversation = model();
|
|
156
|
+
this.selected = new EventEmitter();
|
|
157
|
+
this.conversationDeleted = output();
|
|
158
|
+
this.allContacts = [];
|
|
159
|
+
this.selectedContact = {};
|
|
160
|
+
this.filter = '';
|
|
161
|
+
this.getContactName = getContactName;
|
|
162
|
+
effect(() => {
|
|
163
|
+
if (this.startConversation()) {
|
|
164
|
+
this.#startConversation = this.startConversation();
|
|
165
|
+
this.filter = undefined;
|
|
166
|
+
this.get(null, true);
|
|
167
|
+
}
|
|
163
168
|
});
|
|
164
169
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
ngOnInit() {
|
|
171
|
+
this.selectContact(this.allContacts.length ? this.allContacts[0] : {});
|
|
172
|
+
this.listenToNewMessages();
|
|
173
|
+
}
|
|
174
|
+
typing() {
|
|
175
|
+
if (!this.filter && this.#startConversation) {
|
|
176
|
+
this.get(null, true);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (this.filter) {
|
|
180
|
+
this.get(() => {
|
|
181
|
+
this.startConversation.set(false);
|
|
182
|
+
}, true);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!this.filter && !this.#startConversation) {
|
|
186
|
+
this.allContacts = [];
|
|
168
187
|
}
|
|
169
188
|
}
|
|
170
189
|
get(onSuccess, includeOtherContacts) {
|
|
171
|
-
const
|
|
172
|
-
|
|
190
|
+
const isBoolean = typeof includeOtherContacts === 'boolean';
|
|
191
|
+
const includeOtherContactsParam = isBoolean ? includeOtherContacts : !!this.filter;
|
|
192
|
+
this.filter = this.filter?.trim();
|
|
173
193
|
this.contactService
|
|
174
194
|
.getContactsByInput({ includeOtherContacts: includeOtherContactsParam, filter: this.filter })
|
|
175
195
|
.subscribe(res => {
|
|
176
196
|
this.allContacts = res;
|
|
177
|
-
if (onSuccess)
|
|
197
|
+
if (onSuccess) {
|
|
178
198
|
onSuccess();
|
|
199
|
+
}
|
|
179
200
|
});
|
|
180
201
|
}
|
|
181
202
|
selectContact(contact) {
|
|
@@ -192,19 +213,22 @@ class ChatContactsComponent {
|
|
|
192
213
|
this.selectedContact.unreadMessageCount = 0;
|
|
193
214
|
}
|
|
194
215
|
deleteConversation(contact) {
|
|
195
|
-
this.chatConversationService
|
|
196
|
-
|
|
216
|
+
this.chatConversationService
|
|
217
|
+
.deleteConversation({ targetUserId: contact.userId })
|
|
218
|
+
.pipe(take(1))
|
|
219
|
+
.subscribe(() => {
|
|
220
|
+
this.conversationDeleted.emit(contact);
|
|
221
|
+
this.selectedContact = null;
|
|
222
|
+
this.get(null, true);
|
|
197
223
|
});
|
|
198
224
|
}
|
|
199
225
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatContactsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
200
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: { startConversation: "startConversation",
|
|
226
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: { conversationDeletable: { classPropertyName: "conversationDeletable", publicName: "conversationDeletable", isSignal: false, isRequired: false, transformFunction: null }, startConversation: { classPropertyName: "startConversation", publicName: "startConversation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startConversation: "startConversationChange", selected: "selected", conversationDeleted: "conversationDeleted" }, providers: [SubscriptionService], ngImport: i0, template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n *abpPermission=\"'Chat.Searching'\"\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"typing()\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"messages-box m-0 p-0\">\r\n <div\r\n class=\"list-group rounded-3\"\r\n [ngStyle]=\"{ 'min-height': allContacts.length && 'calc(100vh - 254.34px)' }\"\r\n id=\"contact-list\"\r\n >\r\n @for (contact of contacts; track contact.userId; let i = $index) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n }\r\n @if (otherContacts.length) {\r\n <div\r\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-start-0 border-end-0\"\r\n >\r\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\r\n </div>\r\n }\r\n @for (contact of otherContacts; track contact.userId; let i = $index) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #contactTemplate let-contact let-i=\"index\">\r\n <a\r\n (click)=\"selectContact(contact)\"\r\n class=\"chat-contact list-group-item list-group-item-action cursor-pointer position-relative px-2 border-2 rounded-2 mb-1 mt-0\"\r\n [class.active]=\"selectedContact?.userId === contact.userId\"\r\n >\r\n <div class=\"media\">\r\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\r\n <div class=\"media-body ms-2\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-0\">\r\n <h5 class=\"mb-0 mt-1\">\r\n @if (contact.unreadMessageCount) {\r\n <small class=\"badge badge-success me-1\">{{ contact.unreadMessageCount }}</small>\r\n }\r\n {{ getContactName(contact) }}\r\n </h5>\r\n <small class=\"last-message-date\">{{ contact.lastMessageDate | date: 'HH:mm' }}</small>\r\n </div>\r\n <p class=\"mb-0 small last-message\">\r\n {{\r\n contact.lastMessage?.length > 24\r\n ? (contact.lastMessage | slice: 0 : 23) + '...'\r\n : contact.lastMessage\r\n }}\r\n </p>\r\n @if (conversationDeletable) {\r\n <div ngbDropdown class=\"dropdown position-absolute bottom-0 end-0\">\r\n <button class=\"btn p-1 down-arrow\" id=\"dropdownBasic1\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteConversation(contact)\">Delete</button>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </a>\r\n</ng-template>\r\n", styles: [".messages-box{overflow-y:scroll;max-height:calc(100vh - 254.34px)}.dropdown-toggle:after{display:none}.dropdown{border-color:transparent}.down-arrow{border:none;opacity:0}.media:hover .down-arrow{opacity:100%}.list-group{padding-right:7px}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--lpx-border-color)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1$2.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$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.InputEventDebounceDirective, selector: "[input.debounce]", inputs: ["debounce"], outputs: ["input.debounce"] }, { kind: "directive", type: i1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "directive", type: i4.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i4.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i4.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i4.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i4.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }, { kind: "pipe", type: i1$1.SlicePipe, name: "slice" }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
201
227
|
}
|
|
202
228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatContactsComponent, decorators: [{
|
|
203
229
|
type: Component,
|
|
204
|
-
args: [{ selector: 'abp-chat-contacts', providers: [SubscriptionService], template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"
|
|
205
|
-
}], propDecorators: {
|
|
206
|
-
type: Input
|
|
207
|
-
}], conversationDeletable: [{
|
|
230
|
+
args: [{ selector: 'abp-chat-contacts', providers: [SubscriptionService], template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n *abpPermission=\"'Chat.Searching'\"\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"typing()\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"messages-box m-0 p-0\">\r\n <div\r\n class=\"list-group rounded-3\"\r\n [ngStyle]=\"{ 'min-height': allContacts.length && 'calc(100vh - 254.34px)' }\"\r\n id=\"contact-list\"\r\n >\r\n @for (contact of contacts; track contact.userId; let i = $index) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n }\r\n @if (otherContacts.length) {\r\n <div\r\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-start-0 border-end-0\"\r\n >\r\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\r\n </div>\r\n }\r\n @for (contact of otherContacts; track contact.userId; let i = $index) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #contactTemplate let-contact let-i=\"index\">\r\n <a\r\n (click)=\"selectContact(contact)\"\r\n class=\"chat-contact list-group-item list-group-item-action cursor-pointer position-relative px-2 border-2 rounded-2 mb-1 mt-0\"\r\n [class.active]=\"selectedContact?.userId === contact.userId\"\r\n >\r\n <div class=\"media\">\r\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\r\n <div class=\"media-body ms-2\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-0\">\r\n <h5 class=\"mb-0 mt-1\">\r\n @if (contact.unreadMessageCount) {\r\n <small class=\"badge badge-success me-1\">{{ contact.unreadMessageCount }}</small>\r\n }\r\n {{ getContactName(contact) }}\r\n </h5>\r\n <small class=\"last-message-date\">{{ contact.lastMessageDate | date: 'HH:mm' }}</small>\r\n </div>\r\n <p class=\"mb-0 small last-message\">\r\n {{\r\n contact.lastMessage?.length > 24\r\n ? (contact.lastMessage | slice: 0 : 23) + '...'\r\n : contact.lastMessage\r\n }}\r\n </p>\r\n @if (conversationDeletable) {\r\n <div ngbDropdown class=\"dropdown position-absolute bottom-0 end-0\">\r\n <button class=\"btn p-1 down-arrow\" id=\"dropdownBasic1\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteConversation(contact)\">Delete</button>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </a>\r\n</ng-template>\r\n", styles: [".messages-box{overflow-y:scroll;max-height:calc(100vh - 254.34px)}.dropdown-toggle:after{display:none}.dropdown{border-color:transparent}.down-arrow{border:none;opacity:0}.media:hover .down-arrow{opacity:100%}.list-group{padding-right:7px}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--lpx-border-color)}\n"] }]
|
|
231
|
+
}], ctorParameters: () => [], propDecorators: { conversationDeletable: [{
|
|
208
232
|
type: Input
|
|
209
233
|
}], selected: [{
|
|
210
234
|
type: Output
|
|
@@ -334,15 +358,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
334
358
|
const now = new Date();
|
|
335
359
|
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf();
|
|
336
360
|
class ChatComponent {
|
|
361
|
+
#destroyRef;
|
|
337
362
|
get selectedContactMessages() {
|
|
338
363
|
return this.userMessages.get(this.selectedContact.userId) || [];
|
|
339
364
|
}
|
|
340
|
-
|
|
341
|
-
this.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
365
|
+
addFilterToHttpWaitService() {
|
|
366
|
+
this.httpWaitService.addFilter([
|
|
367
|
+
{
|
|
368
|
+
method: 'POST',
|
|
369
|
+
endpoint: '/api/chat/conversation/send-message',
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
method: 'GET',
|
|
373
|
+
endpoint: '/api/chat/contact/contacts',
|
|
374
|
+
},
|
|
375
|
+
]);
|
|
376
|
+
}
|
|
377
|
+
listenToChatBoxScroll() {
|
|
378
|
+
if (this.chatBoxRef) {
|
|
379
|
+
fromEvent(this.chatBoxRef.nativeElement, 'scroll')
|
|
380
|
+
.pipe(debounceTime(150), takeUntilDestroyed(this.#destroyRef))
|
|
381
|
+
.subscribe(this.onScroll);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
listenToNewMessages() {
|
|
385
|
+
this.chatConfigService.message$
|
|
386
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
387
|
+
.subscribe(({ senderUserId, text } = {}) => {
|
|
388
|
+
if (!this.userMessages.has(senderUserId)) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const isSelected = this.selectedContact.userId === senderUserId;
|
|
392
|
+
this.userMessages.get(senderUserId).push({
|
|
393
|
+
message: text,
|
|
394
|
+
messageDate: Date(),
|
|
395
|
+
side: ChatMessageSide$1.Receiver,
|
|
396
|
+
isRead: isSelected,
|
|
397
|
+
readDate: isSelected ? Date() : null,
|
|
398
|
+
});
|
|
399
|
+
this.scrollToEnd();
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
constructor() {
|
|
403
|
+
this.#destroyRef = inject(DestroyRef);
|
|
404
|
+
this.conversationService = inject(ConversationService$1);
|
|
405
|
+
this.chatConfigService = inject(ChatConfigService);
|
|
406
|
+
this.configState = inject(ConfigStateService);
|
|
407
|
+
this.httpWaitService = inject(HttpWaitService);
|
|
408
|
+
this.confirmation = inject(ConfirmationService);
|
|
346
409
|
this.selectedContact = {};
|
|
347
410
|
this.unreadMessageCount = 0;
|
|
348
411
|
this.userMessages = new Map();
|
|
@@ -351,9 +414,6 @@ class ChatComponent {
|
|
|
351
414
|
this.conversationDeletable = false;
|
|
352
415
|
this.messageDeletable = false;
|
|
353
416
|
this.messageDeletableWithPeriod = false;
|
|
354
|
-
this.trackByMessageDate = trackBy('messageDate');
|
|
355
|
-
this.destroy$ = new Subject();
|
|
356
|
-
this.options = ['AbpIdentity::ExternalUser'];
|
|
357
417
|
this.onScroll = (event) => {
|
|
358
418
|
if (this.allMessagesLoaded ||
|
|
359
419
|
this.pagingLoading ||
|
|
@@ -379,52 +439,18 @@ class ChatComponent {
|
|
|
379
439
|
this.userMessages.get(this.selectedContact.userId).unshift(...res.messages.reverse());
|
|
380
440
|
});
|
|
381
441
|
};
|
|
382
|
-
this.
|
|
383
|
-
{
|
|
384
|
-
method: 'POST',
|
|
385
|
-
endpoint: '/api/chat/conversation/send-message',
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
method: 'GET',
|
|
389
|
-
endpoint: '/api/chat/contact/contacts',
|
|
390
|
-
},
|
|
391
|
-
]);
|
|
442
|
+
this.addFilterToHttpWaitService();
|
|
392
443
|
}
|
|
393
444
|
ngOnInit() {
|
|
394
445
|
const deletingMessages = chatDeletingMessagesOptions.find(opt => opt.key === this.configState.getSetting('Volo.Chat.Messaging.DeletingMessages')).value;
|
|
395
446
|
const deletingConversations = chatDeletingConversationsOptions.find(opt => opt.key === this.configState.getSetting('Volo.Chat.Messaging.DeletingConversations')).value;
|
|
396
|
-
const messageDeletionPeriod = Number(this.configState.getSetting('Volo.Chat.Messaging.MessageDeletionPeriod'));
|
|
397
447
|
this.conversationDeletable =
|
|
398
448
|
deletingMessages === ChatDeletingMessages.Enabled &&
|
|
399
449
|
deletingConversations === ChatDeletingConversations.Enabled;
|
|
400
450
|
this.messageDeletable = deletingMessages === ChatDeletingMessages.Enabled;
|
|
401
451
|
this.messageDeletableWithPeriod =
|
|
402
452
|
deletingMessages === ChatDeletingMessages.EnabledWithDeletionPeriod;
|
|
403
|
-
this.messageDeletePeriod =
|
|
404
|
-
}
|
|
405
|
-
listenToChatBoxScroll() {
|
|
406
|
-
if (this.chatBoxRef) {
|
|
407
|
-
fromEvent(this.chatBoxRef.nativeElement, 'scroll')
|
|
408
|
-
.pipe(debounceTime(150), takeUntil(this.destroy$))
|
|
409
|
-
.subscribe(this.onScroll);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
listenToNewMessages() {
|
|
413
|
-
this.chatConfigService.message$
|
|
414
|
-
.pipe(takeUntil(this.destroy$))
|
|
415
|
-
.subscribe(({ senderUserId, text } = {}) => {
|
|
416
|
-
if (!this.userMessages.has(senderUserId))
|
|
417
|
-
return;
|
|
418
|
-
const isSelected = this.selectedContact.userId === senderUserId;
|
|
419
|
-
this.userMessages.get(senderUserId).push({
|
|
420
|
-
message: text,
|
|
421
|
-
messageDate: Date(),
|
|
422
|
-
side: ChatMessageSide$1.Receiver,
|
|
423
|
-
isRead: isSelected,
|
|
424
|
-
readDate: isSelected ? Date() : null,
|
|
425
|
-
});
|
|
426
|
-
this.scrollToEnd();
|
|
427
|
-
});
|
|
453
|
+
this.messageDeletePeriod = Number(this.configState.getSetting('Volo.Chat.Messaging.MessageDeletionPeriod'));
|
|
428
454
|
}
|
|
429
455
|
ngAfterViewInit() {
|
|
430
456
|
this.sendOnEnter =
|
|
@@ -432,10 +458,6 @@ class ChatComponent {
|
|
|
432
458
|
this.listenToChatBoxScroll();
|
|
433
459
|
this.listenToNewMessages();
|
|
434
460
|
}
|
|
435
|
-
ngOnDestroy() {
|
|
436
|
-
this.destroy$.next(null);
|
|
437
|
-
this.destroy$.complete();
|
|
438
|
-
}
|
|
439
461
|
getConversation(scrollToEnd) {
|
|
440
462
|
this.allMessagesLoaded = false;
|
|
441
463
|
this.conversationService
|
|
@@ -446,10 +468,12 @@ class ChatComponent {
|
|
|
446
468
|
})
|
|
447
469
|
.subscribe(res => {
|
|
448
470
|
this.userMessages.set(this.selectedContact.userId, res.messages.reverse());
|
|
449
|
-
if (scrollToEnd)
|
|
471
|
+
if (scrollToEnd) {
|
|
450
472
|
this.scrollToEnd();
|
|
451
|
-
|
|
473
|
+
}
|
|
474
|
+
if (this.selectedContact.unreadMessageCount) {
|
|
452
475
|
this.markConversationAsRead();
|
|
476
|
+
}
|
|
453
477
|
});
|
|
454
478
|
}
|
|
455
479
|
send() {
|
|
@@ -542,13 +566,19 @@ class ChatComponent {
|
|
|
542
566
|
const now = new Date().getTime();
|
|
543
567
|
return now - readDate > this.messageDeletePeriod ? false : true;
|
|
544
568
|
}
|
|
545
|
-
|
|
546
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ChatComponent, selector: "abp-chat", viewQueries: [{ propertyName: "chatBoxRef", first: true, predicate: ["chatBox"], descendants: true }, { propertyName: "chatContactsComponent", first: true, predicate: ChatContactsComponent, descendants: true }], ngImport: i0, template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [startConversation]=\"clickedStartMessage\"\r\n [conversationDeletable]=\"conversationDeletable\"\r\n ></abp-chat-contacts>\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n @if (selectedContact.userId) {\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\"></abp-chat-message-title>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n @for (\r\n message of selectedContactMessages;\r\n track message.messageDate;\r\n let i = $index\r\n ) {\r\n @if (selectedContactMessages.length - unreadMessageCount === i) {\r\n <div class=\"row justify-content-center unread-message-count-badge-wrapper\">\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n @if (unreadMessageCount === 1) {\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n } @else {\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n }\r\n </span>\r\n </h3>\r\n </div>\r\n }\r\n @if ({ isSender: message.side === chatMessageSide.Sender }; as data) {\r\n <div class=\"media w-75 mw-65 w-lp-auto mb-2\" [class.ms-auto]=\"data.isSender\">\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{\r\n data.isSender ? 'text-white' : 'text-muted'\r\n }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n\r\n @if (messageDeletable) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-light down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (messageDeletableWithPeriod && showDeleteDropdown(message)) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-light down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n <!-- Typing area -->\r\n @if (selectedContact?.userId) {\r\n <div id=\"send-message-form\" class=\"bg-light rounded-3 m-0\">\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n @if (!loading) {\r\n <i class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n } @else {\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n }\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n @if (!selectedContact.userId) {\r\n <div class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}.dropdown-toggle:after{display:none}.dropdown{border-color:transparent}.down-arrow{border:none;opacity:0}.media-body:hover .down-arrow{opacity:100%}.chat-box-container{padding-right:7px}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--lpx-border-color)}\n"], dependencies: [{ kind: "directive", type: i5.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: i5.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i4.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i4.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i4.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i4.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "component", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: ["startConversation", "conversationDeletable"], outputs: ["selected"] }, { kind: "component", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: ["selectedContact"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
569
|
+
conversationDeleted(contact) {
|
|
570
|
+
if (this.selectedContact.userId === contact.userId) {
|
|
571
|
+
this.selectedContact = {};
|
|
572
|
+
this.userMessages.delete(contact.userId);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
576
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ChatComponent, selector: "abp-chat", viewQueries: [{ propertyName: "chatBoxRef", first: true, predicate: ["chatBox"], descendants: true }, { propertyName: "chatContactsComponent", first: true, predicate: ChatContactsComponent, descendants: true }], ngImport: i0, template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [(startConversation)]=\"clickedStartMessage\"\r\n [conversationDeletable]=\"conversationDeletable\"\r\n (conversationDeleted)=\"conversationDeleted($event)\"\r\n />\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n @if (selectedContact.userId) {\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\" />\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n @for (\r\n message of selectedContactMessages;\r\n track message.messageDate;\r\n let i = $index\r\n ) {\r\n @if (selectedContactMessages.length - unreadMessageCount === i) {\r\n <div class=\"row justify-content-center unread-message-count-badge-wrapper\">\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n @if (unreadMessageCount === 1) {\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n } @else {\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n }\r\n </span>\r\n </h3>\r\n </div>\r\n }\r\n\r\n @if ({ isSender: message.side === chatMessageSide.Sender }; as data) {\r\n <div class=\"media w-75 mw-65 w-lp-auto mb-2\" [class.ms-auto]=\"data.isSender\">\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1\"\r\n [class.bg-primary]=\"data.isSender\"\r\n [class.bg-light]=\"!data.isSender\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{\r\n data.isSender ? 'text-white' : 'text-muted'\r\n }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n\r\n @if (messageDeletable && message.side === chatMessageSide.Sender) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-white down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (\r\n messageDeletableWithPeriod &&\r\n showDeleteDropdown(message) &&\r\n message.side === chatMessageSide.Sender\r\n ) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-light down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (selectedContact?.userId) {\r\n <div id=\"send-message-form\" class=\"bg-light rounded-3 m-0\">\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n @if (!loading) {\r\n <i class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n } @else {\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n }\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!selectedContact.userId) {\r\n <div class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}.dropdown-toggle:after{display:none}.dropdown{border-color:transparent}.down-arrow{border:none;opacity:0}.media-body:hover .down-arrow{opacity:100%}.chat-box-container{padding-right:7px}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--lpx-border-color)}\n"], dependencies: [{ kind: "directive", type: i1$2.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$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i4.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i4.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i4.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i4.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "component", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: ["conversationDeletable", "startConversation"], outputs: ["startConversationChange", "selected", "conversationDeleted"] }, { kind: "component", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: ["selectedContact"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
547
577
|
}
|
|
548
578
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatComponent, decorators: [{
|
|
549
579
|
type: Component,
|
|
550
|
-
args: [{ selector: 'abp-chat', template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [startConversation]=\"clickedStartMessage\"\r\n [conversationDeletable]=\"conversationDeletable\"\r\n
|
|
551
|
-
}], ctorParameters: () => [
|
|
580
|
+
args: [{ selector: 'abp-chat', template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [(startConversation)]=\"clickedStartMessage\"\r\n [conversationDeletable]=\"conversationDeletable\"\r\n (conversationDeleted)=\"conversationDeleted($event)\"\r\n />\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n @if (selectedContact.userId) {\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\" />\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n @for (\r\n message of selectedContactMessages;\r\n track message.messageDate;\r\n let i = $index\r\n ) {\r\n @if (selectedContactMessages.length - unreadMessageCount === i) {\r\n <div class=\"row justify-content-center unread-message-count-badge-wrapper\">\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n @if (unreadMessageCount === 1) {\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n } @else {\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n }\r\n </span>\r\n </h3>\r\n </div>\r\n }\r\n\r\n @if ({ isSender: message.side === chatMessageSide.Sender }; as data) {\r\n <div class=\"media w-75 mw-65 w-lp-auto mb-2\" [class.ms-auto]=\"data.isSender\">\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1\"\r\n [class.bg-primary]=\"data.isSender\"\r\n [class.bg-light]=\"!data.isSender\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{\r\n data.isSender ? 'text-white' : 'text-muted'\r\n }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n\r\n @if (messageDeletable && message.side === chatMessageSide.Sender) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-white down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (\r\n messageDeletableWithPeriod &&\r\n showDeleteDropdown(message) &&\r\n message.side === chatMessageSide.Sender\r\n ) {\r\n <div ngbDropdown class=\"dropdown position-absolute top-0 end-0\">\r\n <button class=\"btn p-1 text-light down-arrow\" ngbDropdownToggle>\r\n <i class=\"bi bi-chevron-down\"></i>\r\n </button>\r\n <div ngbDropdownMenu>\r\n <button ngbDropdownItem (click)=\"deleteMessage(message)\">\r\n Delete\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (selectedContact?.userId) {\r\n <div id=\"send-message-form\" class=\"bg-light rounded-3 m-0\">\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n @if (!loading) {\r\n <i class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n } @else {\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n }\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!selectedContact.userId) {\r\n <div class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}.dropdown-toggle:after{display:none}.dropdown{border-color:transparent}.down-arrow{border:none;opacity:0}.media-body:hover .down-arrow{opacity:100%}.chat-box-container{padding-right:7px}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-thumb{background:var(--lpx-border-color)}\n"] }]
|
|
581
|
+
}], ctorParameters: () => [], propDecorators: { chatBoxRef: [{
|
|
552
582
|
type: ViewChild,
|
|
553
583
|
args: ['chatBox', { static: false }]
|
|
554
584
|
}], chatContactsComponent: [{
|
|
@@ -579,7 +609,7 @@ const routes = [
|
|
|
579
609
|
];
|
|
580
610
|
class ChatRoutingModule {
|
|
581
611
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
582
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: ChatRoutingModule, imports: [i1$
|
|
612
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: ChatRoutingModule, imports: [i1$3.RouterModule], exports: [RouterModule] }); }
|
|
583
613
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
|
|
584
614
|
}
|
|
585
615
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ChatRoutingModule, decorators: [{
|
|
@@ -639,13 +669,13 @@ class ConversationService {
|
|
|
639
669
|
markConversationAsReadByInput(body) {
|
|
640
670
|
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
641
671
|
}
|
|
642
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationService, deps: [{ token:
|
|
672
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
643
673
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationService, providedIn: 'root' }); }
|
|
644
674
|
}
|
|
645
675
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConversationService, decorators: [{
|
|
646
676
|
type: Injectable,
|
|
647
677
|
args: [{ providedIn: 'root' }]
|
|
648
|
-
}], ctorParameters: () => [{ type:
|
|
678
|
+
}], ctorParameters: () => [{ type: i1.RestService }] });
|
|
649
679
|
|
|
650
680
|
class SettingsService {
|
|
651
681
|
constructor(restService) {
|
|
@@ -655,13 +685,13 @@ class SettingsService {
|
|
|
655
685
|
setSendOnEnterSettingByInput(body) {
|
|
656
686
|
return this.restService.request({ url: '/api/chat/settings/send-on-enter', method: 'POST', body }, { apiName: this.apiName });
|
|
657
687
|
}
|
|
658
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettingsService, deps: [{ token:
|
|
688
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettingsService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
659
689
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettingsService, providedIn: 'root' }); }
|
|
660
690
|
}
|
|
661
691
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SettingsService, decorators: [{
|
|
662
692
|
type: Injectable,
|
|
663
693
|
args: [{ providedIn: 'root' }]
|
|
664
|
-
}], ctorParameters: () => [{ type:
|
|
694
|
+
}], ctorParameters: () => [{ type: i1.RestService }] });
|
|
665
695
|
|
|
666
696
|
/**
|
|
667
697
|
* Generated bundle index. Do not edit.
|