@volo/abp.ng.chat 10.5.0 → 10.6.0-rc.2
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/fesm2022/volo-abp.ng.chat-config.mjs +15 -15
- package/fesm2022/volo-abp.ng.chat-config.mjs.map +1 -1
- package/fesm2022/volo-abp.ng.chat-proxy.mjs +9 -9
- package/fesm2022/volo-abp.ng.chat-proxy.mjs.map +1 -1
- package/fesm2022/volo-abp.ng.chat.mjs +154 -94
- package/fesm2022/volo-abp.ng.chat.mjs.map +1 -1
- package/package.json +1 -1
- package/types/volo-abp.ng.chat.d.ts +7 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PermissionDirective, LocalizationPipe, ConfigStateService, HttpWaitService, ReplaceableRouteContainerComponent, authGuard, permissionGuard, RouterOutletComponent, LazyModuleFactory, CoreModule, RestService, PagedResultRequestDto } from '@abp/ng.core';
|
|
2
2
|
import { ConfirmationService, ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, Component, inject, model, output, signal, effect, DestroyRef, DOCUMENT, viewChild, NgModule, Injectable } from '@angular/core';
|
|
4
|
+
import { input, Component, inject, model, output, signal, computed, effect, DestroyRef, DOCUMENT, viewChild, NgModule, Injectable } from '@angular/core';
|
|
5
5
|
import * as i1$1 from '@angular/router';
|
|
6
6
|
import { RouterModule } from '@angular/router';
|
|
7
7
|
import { NgTemplateOutlet, SlicePipe, DatePipe } from '@angular/common';
|
|
@@ -35,8 +35,10 @@ const avatarStyles = [
|
|
|
35
35
|
];
|
|
36
36
|
class ConversationAvatarComponent {
|
|
37
37
|
constructor() {
|
|
38
|
-
this.contact = input(undefined,
|
|
39
|
-
|
|
38
|
+
this.contact = input(undefined, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "contact" }] : /* istanbul ignore next */ []));
|
|
40
|
+
this.small = input(undefined, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "small" }] : /* istanbul ignore next */ []));
|
|
40
42
|
}
|
|
41
43
|
get avatarText() {
|
|
42
44
|
const contact = this.contact();
|
|
@@ -62,8 +64,8 @@ class ConversationAvatarComponent {
|
|
|
62
64
|
const small = this.small();
|
|
63
65
|
return typeof small === 'string' || small;
|
|
64
66
|
}
|
|
65
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
66
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
68
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.7", type: ConversationAvatarComponent, isStandalone: true, selector: "abp-conversation-avatar", inputs: { contact: { classPropertyName: "contact", publicName: "contact", isSignal: true, isRequired: false, transformFunction: null }, small: { classPropertyName: "small", publicName: "small", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
67
69
|
<div
|
|
68
70
|
class="avatar me-2 float-start rounded-circle"
|
|
69
71
|
[class.small]="isSmall"
|
|
@@ -73,7 +75,7 @@ class ConversationAvatarComponent {
|
|
|
73
75
|
</div>
|
|
74
76
|
`, 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"] }); }
|
|
75
77
|
}
|
|
76
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
|
|
77
79
|
type: Component,
|
|
78
80
|
args: [{ selector: 'abp-conversation-avatar', template: `
|
|
79
81
|
<div
|
|
@@ -88,19 +90,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
88
90
|
|
|
89
91
|
class ChatContactsComponent {
|
|
90
92
|
#startConversation;
|
|
91
|
-
|
|
92
|
-
return this.allContacts
|
|
93
|
-
.filter(contact => contact.lastMessage)
|
|
94
|
-
.sort((a, b) => new Date(a.lastMessageDate).valueOf() > new Date(b.lastMessageDate).valueOf() ? -1 : 1);
|
|
95
|
-
}
|
|
96
|
-
get otherContacts() {
|
|
97
|
-
return this.allContacts.filter(contact => !contact.lastMessage);
|
|
98
|
-
}
|
|
93
|
+
#hadFilter;
|
|
99
94
|
listenToNewMessages() {
|
|
100
95
|
this.chatConfigService.message$
|
|
101
96
|
.pipe(takeUntilDestroyed())
|
|
102
97
|
.subscribe((message = {}) => {
|
|
103
|
-
const
|
|
98
|
+
const allContacts = this.allContacts();
|
|
99
|
+
const index = allContacts.findIndex(cont => cont.userId === message.senderUserId);
|
|
104
100
|
const contact = {
|
|
105
101
|
userId: message.senderUserId,
|
|
106
102
|
username: message.senderUsername,
|
|
@@ -112,15 +108,15 @@ class ChatContactsComponent {
|
|
|
112
108
|
lastMessageSide: ChatMessageSide.Receiver,
|
|
113
109
|
};
|
|
114
110
|
if (index > -1) {
|
|
115
|
-
let unreadMessageCount =
|
|
116
|
-
if (this.selectedContact.userId ===
|
|
111
|
+
let unreadMessageCount = allContacts[index].unreadMessageCount + 1;
|
|
112
|
+
if (this.selectedContact.userId === allContacts[index].userId) {
|
|
117
113
|
unreadMessageCount = 0;
|
|
118
114
|
}
|
|
119
|
-
this.allContacts
|
|
115
|
+
this.allContacts.update(contacts => contacts.map((item, currentIndex) => currentIndex === index ? { ...contact, unreadMessageCount } : item));
|
|
120
116
|
return;
|
|
121
117
|
}
|
|
122
118
|
if (!this.filter()) {
|
|
123
|
-
this.allContacts.
|
|
119
|
+
this.allContacts.update(contacts => [...contacts, contact]);
|
|
124
120
|
}
|
|
125
121
|
});
|
|
126
122
|
}
|
|
@@ -128,15 +124,26 @@ class ChatContactsComponent {
|
|
|
128
124
|
this.contactService = inject(ContactService);
|
|
129
125
|
this.chatConfigService = inject(ChatConfigService);
|
|
130
126
|
this.chatConversationService = inject(ConversationService$1);
|
|
131
|
-
this.conversationDeletable = input(undefined,
|
|
132
|
-
|
|
127
|
+
this.conversationDeletable = input(undefined, /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "conversationDeletable" }] : /* istanbul ignore next */ []));
|
|
129
|
+
this.startConversation = model(/* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [undefined, { debugName: "startConversation" }] : /* istanbul ignore next */ []));
|
|
131
|
+
this.#hadFilter = false;
|
|
133
132
|
this.selected = output();
|
|
134
133
|
this.conversationDeleted = output();
|
|
135
|
-
this.allContacts = []
|
|
134
|
+
this.allContacts = signal([], /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "allContacts" }] : /* istanbul ignore next */ []));
|
|
136
136
|
this.selectedContact = {};
|
|
137
|
-
this.filter = signal('',
|
|
137
|
+
this.filter = signal('', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
138
139
|
this.debouncedFilter = toSignal(toObservable(this.filter).pipe(map(value => (value ?? '').trim()), debounceTime(300), distinctUntilChanged()), { initialValue: '' });
|
|
139
140
|
this.getContactName = getContactName;
|
|
141
|
+
this.contacts = computed(() => this.allContacts()
|
|
142
|
+
.filter(contact => contact.lastMessage)
|
|
143
|
+
.sort((a, b) => new Date(a.lastMessageDate).valueOf() > new Date(b.lastMessageDate).valueOf() ? -1 : 1), /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "contacts" }] : /* istanbul ignore next */ []));
|
|
145
|
+
this.otherContacts = computed(() => this.allContacts().filter(contact => !contact.lastMessage), /* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [{ debugName: "otherContacts" }] : /* istanbul ignore next */ []));
|
|
140
147
|
this.listenToNewMessages();
|
|
141
148
|
this.contactService
|
|
142
149
|
.getTotalUnreadMessageCount()
|
|
@@ -160,20 +167,24 @@ class ChatContactsComponent {
|
|
|
160
167
|
return;
|
|
161
168
|
}
|
|
162
169
|
if (currentFilter) {
|
|
170
|
+
this.#hadFilter = true;
|
|
163
171
|
this.get(() => {
|
|
164
172
|
this.startConversation.set(false);
|
|
165
173
|
}, true);
|
|
166
174
|
return;
|
|
167
175
|
}
|
|
168
|
-
if (
|
|
169
|
-
this
|
|
176
|
+
if (this.#hadFilter) {
|
|
177
|
+
this.#hadFilter = false;
|
|
178
|
+
this.get(null, false);
|
|
170
179
|
}
|
|
171
180
|
});
|
|
172
181
|
}
|
|
173
182
|
ngOnInit() {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
this.get(contacts => {
|
|
184
|
+
if (contacts.length) {
|
|
185
|
+
this.selectContact(contacts[0]);
|
|
186
|
+
}
|
|
187
|
+
}, false);
|
|
177
188
|
}
|
|
178
189
|
// Search behavior is handled via the debounced signal effect above.
|
|
179
190
|
get(onSuccess, includeOtherContacts) {
|
|
@@ -185,9 +196,9 @@ class ChatContactsComponent {
|
|
|
185
196
|
filter: this.debouncedFilter(),
|
|
186
197
|
})
|
|
187
198
|
.subscribe(res => {
|
|
188
|
-
this.allContacts
|
|
199
|
+
this.allContacts.set(res);
|
|
189
200
|
if (onSuccess) {
|
|
190
|
-
onSuccess();
|
|
201
|
+
onSuccess(res);
|
|
191
202
|
}
|
|
192
203
|
});
|
|
193
204
|
}
|
|
@@ -198,11 +209,17 @@ class ChatContactsComponent {
|
|
|
198
209
|
changeLastMessageOfSelectedContact(message) {
|
|
199
210
|
this.selectedContact.lastMessage = message;
|
|
200
211
|
this.selectedContact.lastMessageDate = new Date().toString();
|
|
201
|
-
const index = this.allContacts.findIndex(contact => contact.userId === this.selectedContact.userId);
|
|
202
|
-
this.allContacts
|
|
212
|
+
const index = this.allContacts().findIndex(contact => contact.userId === this.selectedContact.userId);
|
|
213
|
+
this.allContacts.update(contacts => {
|
|
214
|
+
if (index === -1) {
|
|
215
|
+
return [...contacts, { ...this.selectedContact }];
|
|
216
|
+
}
|
|
217
|
+
return contacts.map((contact, currentIndex) => currentIndex === index ? { ...this.selectedContact } : contact);
|
|
218
|
+
});
|
|
203
219
|
}
|
|
204
220
|
markSelectedContactAsRead() {
|
|
205
221
|
this.selectedContact.unreadMessageCount = 0;
|
|
222
|
+
this.allContacts.update(contacts => contacts.map(contact => contact.userId === this.selectedContact.userId ? { ...contact, unreadMessageCount: 0 } : contact));
|
|
206
223
|
}
|
|
207
224
|
deleteConversation(contact) {
|
|
208
225
|
this.chatConversationService
|
|
@@ -214,10 +231,10 @@ class ChatContactsComponent {
|
|
|
214
231
|
this.get(null, true);
|
|
215
232
|
});
|
|
216
233
|
}
|
|
217
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
218
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
234
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatContactsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
235
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: ChatContactsComponent, isStandalone: true, selector: "abp-chat-contacts", inputs: { conversationDeletable: { classPropertyName: "conversationDeletable", publicName: "conversationDeletable", isSignal: true, isRequired: false, transformFunction: null }, startConversation: { classPropertyName: "startConversation", publicName: "startConversation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startConversation: "startConversationChange", selected: "selected", conversationDeleted: "conversationDeleted" }, 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 (ngModelChange)=\"filter.set($event)\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\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 id=\"contact-list\"\r\n class=\"list-group rounded-3\"\r\n [style.min-height]=\"allContacts().length ? 'calc(100vh - 254.34px)' : null\"\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 }\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\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 }\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\" />\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 cursor-pointer\">\r\n {{ getContactName(contact) }}\r\n @if (contact.unreadMessageCount) {\r\n <span class=\"badge bg-secondary text-white ms-1\">{{\r\n contact.unreadMessageCount\r\n }}</span>\r\n }\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\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: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i2.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i2.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i2.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i2.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i2.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "directive", type: PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: SlicePipe, name: "slice" }, { kind: "pipe", type: DatePipe, name: "date" }] }); }
|
|
219
236
|
}
|
|
220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatContactsComponent, decorators: [{
|
|
221
238
|
type: Component,
|
|
222
239
|
args: [{ selector: 'abp-chat-contacts', imports: [
|
|
223
240
|
FormsModule,
|
|
@@ -228,7 +245,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
228
245
|
DatePipe,
|
|
229
246
|
ConversationAvatarComponent,
|
|
230
247
|
NgTemplateOutlet,
|
|
231
|
-
], 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 (ngModelChange)=\"filter.set($event)\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\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 id=\"contact-list\"\r\n class=\"list-group rounded-3\"\r\n [style.min-height]=\"allContacts.length ? 'calc(100vh - 254.34px)' : null\"\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 }\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\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 }\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\" />\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 cursor-pointer\">\r\n {{ getContactName(contact) }}\r\n @if (contact.unreadMessageCount) {\r\n <span class=\"badge bg-secondary text-white ms-1\">{{\r\n contact.unreadMessageCount\r\n }}</span>\r\n }\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\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"] }]
|
|
248
|
+
], 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 (ngModelChange)=\"filter.set($event)\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\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 id=\"contact-list\"\r\n class=\"list-group rounded-3\"\r\n [style.min-height]=\"allContacts().length ? 'calc(100vh - 254.34px)' : null\"\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 }\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\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 }\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\" />\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 cursor-pointer\">\r\n {{ getContactName(contact) }}\r\n @if (contact.unreadMessageCount) {\r\n <span class=\"badge bg-secondary text-white ms-1\">{{\r\n contact.unreadMessageCount\r\n }}</span>\r\n }\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\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"] }]
|
|
232
249
|
}], ctorParameters: () => [], propDecorators: { conversationDeletable: [{ type: i0.Input, args: [{ isSignal: true, alias: "conversationDeletable", required: false }] }], startConversation: [{ type: i0.Input, args: [{ isSignal: true, alias: "startConversation", required: false }] }, { type: i0.Output, args: ["startConversationChange"] }], selected: [{ type: i0.Output, args: ["selected"] }], conversationDeleted: [{ type: i0.Output, args: ["conversationDeleted"] }] } });
|
|
233
250
|
function getContactName({ name, surname, username }) {
|
|
234
251
|
if (!name && !surname)
|
|
@@ -238,13 +255,14 @@ function getContactName({ name, surname, username }) {
|
|
|
238
255
|
|
|
239
256
|
class ChatMessageTitleComponent {
|
|
240
257
|
constructor() {
|
|
241
|
-
this.selectedContact = input(undefined,
|
|
258
|
+
this.selectedContact = input(undefined, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "selectedContact" }] : /* istanbul ignore next */ []));
|
|
242
260
|
}
|
|
243
261
|
get contactName() {
|
|
244
262
|
return getContactName(this.selectedContact() || {});
|
|
245
263
|
}
|
|
246
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
247
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
264
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatMessageTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
265
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.7", type: ChatMessageTitleComponent, isStandalone: true, selector: "abp-chat-message-title", inputs: { selectedContact: { classPropertyName: "selectedContact", publicName: "selectedContact", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
248
266
|
<div class="px-2 py-1 border mb-2 rounded-2">
|
|
249
267
|
<div class="row">
|
|
250
268
|
<div class="col-auto py-1 pe-0">
|
|
@@ -258,7 +276,7 @@ class ChatMessageTitleComponent {
|
|
|
258
276
|
</div>
|
|
259
277
|
`, isInline: true, dependencies: [{ kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }] }); }
|
|
260
278
|
}
|
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatMessageTitleComponent, decorators: [{
|
|
262
280
|
type: Component,
|
|
263
281
|
args: [{
|
|
264
282
|
selector: 'abp-chat-message-title',
|
|
@@ -284,7 +302,14 @@ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf
|
|
|
284
302
|
class ChatComponent {
|
|
285
303
|
#destroyRef;
|
|
286
304
|
get selectedContactMessages() {
|
|
287
|
-
return this.userMessages.get(this.selectedContact.userId) || [];
|
|
305
|
+
return this.userMessages().get(this.selectedContact.userId) || [];
|
|
306
|
+
}
|
|
307
|
+
updateUserMessages(userId, update) {
|
|
308
|
+
this.userMessages.update(curr => {
|
|
309
|
+
const clone = new Map(curr);
|
|
310
|
+
clone.set(userId, update([...(clone.get(userId) || [])]));
|
|
311
|
+
return clone;
|
|
312
|
+
});
|
|
288
313
|
}
|
|
289
314
|
addFilterToHttpWaitService() {
|
|
290
315
|
this.httpWaitService.addFilter([
|
|
@@ -310,17 +335,20 @@ class ChatComponent {
|
|
|
310
335
|
this.chatConfigService.message$
|
|
311
336
|
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
312
337
|
.subscribe(({ senderUserId, text } = {}) => {
|
|
313
|
-
if (!this.userMessages.has(senderUserId)) {
|
|
338
|
+
if (!this.userMessages().has(senderUserId)) {
|
|
314
339
|
return;
|
|
315
340
|
}
|
|
316
341
|
const isSelected = this.selectedContact.userId === senderUserId;
|
|
317
|
-
this.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
342
|
+
this.updateUserMessages(senderUserId, messages => [
|
|
343
|
+
...messages,
|
|
344
|
+
{
|
|
345
|
+
message: text,
|
|
346
|
+
messageDate: Date(),
|
|
347
|
+
side: ChatMessageSide$1.Receiver,
|
|
348
|
+
isRead: isSelected,
|
|
349
|
+
readDate: isSelected ? Date() : null,
|
|
350
|
+
},
|
|
351
|
+
]);
|
|
324
352
|
this.scrollToEnd();
|
|
325
353
|
});
|
|
326
354
|
}
|
|
@@ -348,16 +376,20 @@ class ChatComponent {
|
|
|
348
376
|
this.document = inject(DOCUMENT);
|
|
349
377
|
this.selectedContact = {};
|
|
350
378
|
this.unreadMessageCount = 0;
|
|
351
|
-
this.userMessages = new Map()
|
|
379
|
+
this.userMessages = signal(new Map(), /* @ts-ignore */
|
|
380
|
+
...(ngDevMode ? [{ debugName: "userMessages" }] : /* istanbul ignore next */ []));
|
|
352
381
|
this.chatMessageSide = ChatMessageSide$1;
|
|
353
|
-
this.draftMessages = signal(new Map(),
|
|
382
|
+
this.draftMessages = signal(new Map(), /* @ts-ignore */
|
|
383
|
+
...(ngDevMode ? [{ debugName: "draftMessages" }] : /* istanbul ignore next */ []));
|
|
354
384
|
this.clickedStartMessage = false;
|
|
355
385
|
this.conversationDeletable = false;
|
|
356
386
|
this.messageDeletable = false;
|
|
357
387
|
this.messageDeletableWithPeriod = false;
|
|
358
388
|
this.hasContacts = toSignal(this.contactService.getContacts({ includeOtherContacts: true }).pipe(map$1(contacts => contacts && contacts.length > 0), startWith(false)), { initialValue: false });
|
|
359
|
-
this.chatBoxRef = viewChild('chatBox',
|
|
360
|
-
|
|
389
|
+
this.chatBoxRef = viewChild('chatBox', /* @ts-ignore */
|
|
390
|
+
...(ngDevMode ? [{ debugName: "chatBoxRef" }] : /* istanbul ignore next */ []));
|
|
391
|
+
this.chatContactsComponent = viewChild(ChatContactsComponent, /* @ts-ignore */
|
|
392
|
+
...(ngDevMode ? [{ debugName: "chatContactsComponent" }] : /* istanbul ignore next */ []));
|
|
361
393
|
this.onScroll = (event) => {
|
|
362
394
|
if (this.allMessagesLoaded ||
|
|
363
395
|
this.pagingLoading ||
|
|
@@ -380,7 +412,10 @@ class ChatComponent {
|
|
|
380
412
|
this.allMessagesLoaded = true;
|
|
381
413
|
return;
|
|
382
414
|
}
|
|
383
|
-
this.
|
|
415
|
+
this.updateUserMessages(this.selectedContact.userId, messages => [
|
|
416
|
+
...res.messages.reverse(),
|
|
417
|
+
...messages,
|
|
418
|
+
]);
|
|
384
419
|
});
|
|
385
420
|
};
|
|
386
421
|
this.init();
|
|
@@ -401,7 +436,11 @@ class ChatComponent {
|
|
|
401
436
|
targetUserId: this.selectedContact.userId,
|
|
402
437
|
})
|
|
403
438
|
.subscribe(res => {
|
|
404
|
-
this.userMessages.
|
|
439
|
+
this.userMessages.update(curr => {
|
|
440
|
+
const clone = new Map(curr);
|
|
441
|
+
clone.set(this.selectedContact.userId, res.messages.reverse());
|
|
442
|
+
return clone;
|
|
443
|
+
});
|
|
405
444
|
if (scrollToEnd) {
|
|
406
445
|
this.scrollToEnd();
|
|
407
446
|
}
|
|
@@ -413,28 +452,41 @@ class ChatComponent {
|
|
|
413
452
|
send() {
|
|
414
453
|
if (!this.message || this.loading)
|
|
415
454
|
return;
|
|
455
|
+
const targetUserId = this.selectedContact.userId;
|
|
456
|
+
const messageText = this.message;
|
|
457
|
+
const optimisticMessage = {
|
|
458
|
+
message: messageText,
|
|
459
|
+
messageDate: new Date().toString(),
|
|
460
|
+
side: ChatMessageSide$1.Sender,
|
|
461
|
+
isRead: true,
|
|
462
|
+
readDate: new Date().toString(),
|
|
463
|
+
};
|
|
416
464
|
this.unreadMessageCount = 0;
|
|
417
465
|
this.loading = true;
|
|
466
|
+
this.chatContactsComponent().changeLastMessageOfSelectedContact(messageText);
|
|
467
|
+
this.updateUserMessages(targetUserId, messages => [...messages, optimisticMessage]);
|
|
468
|
+
this.draftMessages.update(curr => {
|
|
469
|
+
if (!curr.has(targetUserId))
|
|
470
|
+
return curr;
|
|
471
|
+
const clone = new Map(curr);
|
|
472
|
+
clone.delete(targetUserId);
|
|
473
|
+
return clone;
|
|
474
|
+
});
|
|
475
|
+
this.message = '';
|
|
476
|
+
this.scrollToEnd();
|
|
418
477
|
this.conversationService
|
|
419
|
-
.sendMessage({ message:
|
|
478
|
+
.sendMessage({ message: messageText, targetUserId })
|
|
420
479
|
.pipe(finalize(() => (this.loading = false)))
|
|
421
|
-
.subscribe(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return curr;
|
|
432
|
-
const clone = new Map(curr);
|
|
433
|
-
clone.delete(this.selectedContact.userId);
|
|
434
|
-
return clone;
|
|
435
|
-
});
|
|
436
|
-
this.message = '';
|
|
437
|
-
this.scrollToEnd();
|
|
480
|
+
.subscribe({
|
|
481
|
+
next: message => {
|
|
482
|
+
this.updateUserMessages(targetUserId, messages => messages.map(item => (item === optimisticMessage ? message : item)));
|
|
483
|
+
},
|
|
484
|
+
error: () => {
|
|
485
|
+
this.updateUserMessages(targetUserId, messages => messages.filter(item => item !== optimisticMessage));
|
|
486
|
+
if (this.selectedContact.userId === targetUserId) {
|
|
487
|
+
this.message = messageText;
|
|
488
|
+
}
|
|
489
|
+
},
|
|
438
490
|
});
|
|
439
491
|
}
|
|
440
492
|
markConversationAsRead() {
|
|
@@ -475,7 +527,7 @@ class ChatComponent {
|
|
|
475
527
|
this.message = this.draftMessages().get(contact.userId) || '';
|
|
476
528
|
this.unreadMessageCount = contact.unreadMessageCount;
|
|
477
529
|
this.scrollToEnd();
|
|
478
|
-
if (this.userMessages.has(contact.userId) || !contact.lastMessage) {
|
|
530
|
+
if (this.userMessages().has(contact.userId) || !contact.lastMessage) {
|
|
479
531
|
if (contact.unreadMessageCount)
|
|
480
532
|
this.markConversationAsRead();
|
|
481
533
|
return;
|
|
@@ -521,10 +573,14 @@ class ChatComponent {
|
|
|
521
573
|
}))
|
|
522
574
|
.subscribe({
|
|
523
575
|
next: () => {
|
|
524
|
-
const newArray = this.userMessages.get(this.selectedContact.userId).filter(val => {
|
|
576
|
+
const newArray = this.userMessages().get(this.selectedContact.userId).filter(val => {
|
|
525
577
|
return val.id !== message.id;
|
|
526
578
|
});
|
|
527
|
-
this.userMessages.
|
|
579
|
+
this.userMessages.update(curr => {
|
|
580
|
+
const clone = new Map(curr);
|
|
581
|
+
clone.set(this.selectedContact.userId, newArray);
|
|
582
|
+
return clone;
|
|
583
|
+
});
|
|
528
584
|
},
|
|
529
585
|
error: err => {
|
|
530
586
|
const error = err.error?.error?.message;
|
|
@@ -543,7 +599,11 @@ class ChatComponent {
|
|
|
543
599
|
conversationDeleted(contact) {
|
|
544
600
|
if (this.selectedContact.userId === contact.userId) {
|
|
545
601
|
this.selectedContact = {};
|
|
546
|
-
this.userMessages.
|
|
602
|
+
this.userMessages.update(curr => {
|
|
603
|
+
const clone = new Map(curr);
|
|
604
|
+
clone.delete(contact.userId);
|
|
605
|
+
return clone;
|
|
606
|
+
});
|
|
547
607
|
this.draftMessages.update(curr => {
|
|
548
608
|
if (!curr.has(contact.userId))
|
|
549
609
|
return curr;
|
|
@@ -553,10 +613,10 @@ class ChatComponent {
|
|
|
553
613
|
});
|
|
554
614
|
}
|
|
555
615
|
}
|
|
556
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
557
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ChatComponent, isStandalone: true, selector: "abp-chat", viewQueries: [{ propertyName: "chatBoxRef", first: true, predicate: ["chatBox"], descendants: true, isSignal: true }, { propertyName: "chatContactsComponent", first: true, predicate: ChatContactsComponent, descendants: true, isSignal: 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 {{ 'AbpUi::Delete' | abpLocalization }}\r\n </button>\r\n </div>\r\n </div>\r\n }\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 {{ 'AbpUi::Delete' | abpLocalization }}\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\r\n [disabled]=\"!hasContacts()\"\r\n (click)=\"startConversation()\"\r\n type=\"button\"\r\n class=\"btn btn-primary\"\r\n >\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: "ngmodule", type: FormsModule }, { 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.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { 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: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i2.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i2.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i2.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i2.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i2.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "component", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: ["selectedContact"] }, { kind: "component", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: ["conversationDeletable", "startConversation"], outputs: ["startConversationChange", "selected", "conversationDeleted"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: DatePipe, name: "date" }] }); }
|
|
616
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
617
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: ChatComponent, isStandalone: true, selector: "abp-chat", viewQueries: [{ propertyName: "chatBoxRef", first: true, predicate: ["chatBox"], descendants: true, isSignal: true }, { propertyName: "chatContactsComponent", first: true, predicate: ChatContactsComponent, descendants: true, isSignal: 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 {{ 'AbpUi::Delete' | abpLocalization }}\r\n </button>\r\n </div>\r\n </div>\r\n }\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 {{ 'AbpUi::Delete' | abpLocalization }}\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\r\n [disabled]=\"!hasContacts()\"\r\n (click)=\"startConversation()\"\r\n type=\"button\"\r\n class=\"btn btn-primary\"\r\n >\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: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]" }, { 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: "ngmodule", type: NgbDropdownModule }, { kind: "directive", type: i2.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i2.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i2.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i2.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["tabindex", "disabled"] }, { kind: "directive", type: i2.NgbDropdownButtonItem, selector: "button[ngbDropdownItem]" }, { kind: "component", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: ["selectedContact"] }, { kind: "component", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: ["conversationDeletable", "startConversation"], outputs: ["startConversationChange", "selected", "conversationDeleted"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: DatePipe, name: "date" }] }); }
|
|
558
618
|
}
|
|
559
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatComponent, decorators: [{
|
|
560
620
|
type: Component,
|
|
561
621
|
args: [{ selector: 'abp-chat', imports: [
|
|
562
622
|
FormsModule,
|
|
@@ -590,11 +650,11 @@ const routes = [
|
|
|
590
650
|
},
|
|
591
651
|
];
|
|
592
652
|
class ChatRoutingModule {
|
|
593
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
594
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
595
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
653
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
654
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.7", ngImport: i0, type: ChatRoutingModule, imports: [i1$1.RouterModule], exports: [RouterModule] }); }
|
|
655
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
|
|
596
656
|
}
|
|
597
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
657
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatRoutingModule, decorators: [{
|
|
598
658
|
type: NgModule,
|
|
599
659
|
args: [{
|
|
600
660
|
imports: [RouterModule.forChild(routes)],
|
|
@@ -621,18 +681,18 @@ class ChatModule {
|
|
|
621
681
|
static forLazy() {
|
|
622
682
|
return new LazyModuleFactory(ChatModule.forChild());
|
|
623
683
|
}
|
|
624
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
625
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
684
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
685
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.7", ngImport: i0, type: ChatModule, imports: [CoreModule, ThemeSharedModule, ChatRoutingModule, NgbDropdownModule, ChatComponent,
|
|
626
686
|
ChatContactsComponent,
|
|
627
687
|
ConversationAvatarComponent,
|
|
628
688
|
ChatMessageTitleComponent], exports: [ChatComponent,
|
|
629
689
|
ChatContactsComponent,
|
|
630
690
|
ConversationAvatarComponent,
|
|
631
691
|
ChatMessageTitleComponent] }); }
|
|
632
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
692
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatModule, imports: [CoreModule, ThemeSharedModule, ChatRoutingModule, NgbDropdownModule, ChatComponent,
|
|
633
693
|
ChatContactsComponent] }); }
|
|
634
694
|
}
|
|
635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ChatModule, decorators: [{
|
|
636
696
|
type: NgModule,
|
|
637
697
|
args: [{
|
|
638
698
|
imports: [CoreModule, ThemeSharedModule, ChatRoutingModule, NgbDropdownModule, ...declarations],
|
|
@@ -678,10 +738,10 @@ class ConversationService {
|
|
|
678
738
|
markConversationAsReadByInput(body) {
|
|
679
739
|
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
680
740
|
}
|
|
681
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
682
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ConversationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
742
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ConversationService, providedIn: 'root' }); }
|
|
683
743
|
}
|
|
684
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ConversationService, decorators: [{
|
|
685
745
|
type: Injectable,
|
|
686
746
|
args: [{ providedIn: 'root' }]
|
|
687
747
|
}] });
|
|
@@ -694,10 +754,10 @@ class SettingsService {
|
|
|
694
754
|
setSendOnEnterSettingByInput(body) {
|
|
695
755
|
return this.restService.request({ url: '/api/chat/settings/send-on-enter', method: 'POST', body }, { apiName: this.apiName });
|
|
696
756
|
}
|
|
697
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
698
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
757
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
758
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SettingsService, providedIn: 'root' }); }
|
|
699
759
|
}
|
|
700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
760
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SettingsService, decorators: [{
|
|
701
761
|
type: Injectable,
|
|
702
762
|
args: [{ providedIn: 'root' }]
|
|
703
763
|
}] });
|