@datarailsshared/datarailsshared 1.4.95 → 1.4.98
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/bundles/datarailsshared-datarailsshared.umd.js +541 -19
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.98.tgz +0 -0
- package/datarailsshared-datarailsshared.d.ts +8 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/datarailsshared-datarailsshared.js +9 -1
- package/esm2015/lib/dr-chat/chat.component.js +58 -0
- package/esm2015/lib/dr-chat/chat.module.js +37 -0
- package/esm2015/lib/dr-chat/dr-chat-form/chat-form.component.js +127 -0
- package/esm2015/lib/dr-chat/dr-chat-message/chat-message.component.js +70 -0
- package/esm2015/lib/dr-chat/dr-chat-message/dr-chat-message-custom/chat-custom-message.directive.js +49 -0
- package/esm2015/lib/dr-chat/dr-chat-message/dr-chat-message-custom/chat-custom-message.service.js +23 -0
- package/esm2015/lib/dr-chat/dr-chat-message/dr-chat-message-file/chat-message-file.component.js +47 -0
- package/esm2015/lib/dr-chat/dr-chat-message/dr-chat-message-rich-text/chat-message-rich-text.component.js +18 -0
- package/esm2015/lib/dr-chat/dr-chat-message/dr-chat-message-text/chat-message-text.component.js +18 -0
- package/esm2015/lib/dr-dialog/components/dialog-modal-wrapper/dialog-modal-wrapper.component.js +2 -2
- package/esm2015/lib/dr-inputs/dr-select/dr-select.component.js +2 -2
- package/esm2015/lib/models/chat.js +33 -0
- package/esm2015/public-api.js +3 -1
- package/fesm2015/datarailsshared-datarailsshared.js +465 -16
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-chat/chat.component.d.ts +21 -0
- package/lib/dr-chat/chat.module.d.ts +2 -0
- package/lib/dr-chat/dr-chat-form/chat-form.component.d.ts +55 -0
- package/lib/dr-chat/dr-chat-message/chat-message.component.d.ts +38 -0
- package/lib/dr-chat/dr-chat-message/dr-chat-message-custom/chat-custom-message.directive.d.ts +18 -0
- package/lib/dr-chat/dr-chat-message/dr-chat-message-custom/chat-custom-message.service.d.ts +11 -0
- package/lib/dr-chat/dr-chat-message/dr-chat-message-file/chat-message-file.component.d.ts +25 -0
- package/lib/dr-chat/dr-chat-message/dr-chat-message-rich-text/chat-message-rich-text.component.d.ts +12 -0
- package/lib/dr-chat/dr-chat-message/dr-chat-message-text/chat-message-text.component.d.ts +12 -0
- package/lib/models/chat.d.ts +106 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/datarailsshared-datarailsshared-1.4.95.tgz +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementRef, QueryList, AfterViewInit, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { DrChatFormComponent } from './dr-chat-form/chat-form.component';
|
|
3
|
+
import { DrChatMessageComponent } from './dr-chat-message/chat-message.component';
|
|
4
|
+
export declare class DrChatComponent implements AfterViewInit {
|
|
5
|
+
private cdr;
|
|
6
|
+
title: string;
|
|
7
|
+
noMessagesPlaceholder: string;
|
|
8
|
+
/**
|
|
9
|
+
* Scroll chat to the bottom of the list when a new message arrives
|
|
10
|
+
*/
|
|
11
|
+
get scrollBottom(): boolean;
|
|
12
|
+
set scrollBottom(value: boolean);
|
|
13
|
+
protected _scrollBottom: boolean;
|
|
14
|
+
messagesContainer: ElementRef;
|
|
15
|
+
messages: QueryList<DrChatMessageComponent>;
|
|
16
|
+
chatForm: DrChatFormComponent;
|
|
17
|
+
constructor(cdr: ChangeDetectorRef);
|
|
18
|
+
ngAfterViewInit(): void;
|
|
19
|
+
updateView(): void;
|
|
20
|
+
scrollListBottom(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
|
2
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
export declare class DrChatFormComponent {
|
|
4
|
+
protected cdr: ChangeDetectorRef;
|
|
5
|
+
protected domSanitizer: DomSanitizer;
|
|
6
|
+
inputFocus: boolean;
|
|
7
|
+
inputHover: boolean;
|
|
8
|
+
droppedFiles: any[];
|
|
9
|
+
/**
|
|
10
|
+
* Predefined message text
|
|
11
|
+
*
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
message: string;
|
|
15
|
+
/**
|
|
16
|
+
* Message placeholder text
|
|
17
|
+
*
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
messagePlaceholder: string;
|
|
21
|
+
/**
|
|
22
|
+
* Show send button
|
|
23
|
+
*
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
dropFiles: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* File drop placeholder text
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
dropFilePlaceholder: string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {EventEmitter<{ message: string, files: File[] }>}
|
|
36
|
+
*/
|
|
37
|
+
send: EventEmitter<{
|
|
38
|
+
message: string;
|
|
39
|
+
files: File[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Emits when message input value has been changed
|
|
43
|
+
*
|
|
44
|
+
* @type {EventEmitter<string>}
|
|
45
|
+
*/
|
|
46
|
+
inputChange: EventEmitter<string>;
|
|
47
|
+
fileOver: boolean;
|
|
48
|
+
constructor(cdr: ChangeDetectorRef, domSanitizer: DomSanitizer);
|
|
49
|
+
onDrop(event: any): void;
|
|
50
|
+
removeFile(file: any): void;
|
|
51
|
+
onDragOver(event: DragEvent): void;
|
|
52
|
+
onDragLeave(event: DragEvent): void;
|
|
53
|
+
sendMessage(): void;
|
|
54
|
+
onModelChange(value: string): void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { CHAT_MESSAGE_TYPE, IChatMessage } from '../../models/chat';
|
|
3
|
+
import { DrChatCustomMessageDirective } from './dr-chat-message-custom/chat-custom-message.directive';
|
|
4
|
+
import { DrChatCustomMessageService } from './dr-chat-message-custom/chat-custom-message.service';
|
|
5
|
+
export declare class DrChatMessageComponent {
|
|
6
|
+
private customMessageService;
|
|
7
|
+
MESSAGE_TYPE: typeof CHAT_MESSAGE_TYPE;
|
|
8
|
+
MESSAGE_TYPE_CUSTOM: CHAT_MESSAGE_TYPE;
|
|
9
|
+
get flyInOut(): boolean;
|
|
10
|
+
get notReply(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines if a message is a reply
|
|
13
|
+
*/
|
|
14
|
+
get reply(): boolean;
|
|
15
|
+
set reply(value: boolean);
|
|
16
|
+
protected _reply: boolean;
|
|
17
|
+
type: string;
|
|
18
|
+
/**
|
|
19
|
+
* Message
|
|
20
|
+
*
|
|
21
|
+
* @type {IChatMessage}
|
|
22
|
+
*/
|
|
23
|
+
message: IChatMessage;
|
|
24
|
+
/**
|
|
25
|
+
* Data which will be set as custom message template context
|
|
26
|
+
*
|
|
27
|
+
* @type {any}
|
|
28
|
+
*/
|
|
29
|
+
customMessageData: any;
|
|
30
|
+
customMessage: boolean;
|
|
31
|
+
constructor(customMessageService: DrChatCustomMessageService);
|
|
32
|
+
getTemplate(): TemplateRef<any>;
|
|
33
|
+
getTemplateContext(): {
|
|
34
|
+
$implicit: any;
|
|
35
|
+
isReply: boolean;
|
|
36
|
+
};
|
|
37
|
+
protected getCustomMessage(type: string): DrChatCustomMessageDirective;
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
|
+
import { DrChatCustomMessageService } from './chat-custom-message.service';
|
|
3
|
+
export declare class DrChatCustomMessageDirective implements OnInit, OnDestroy {
|
|
4
|
+
templateRef: TemplateRef<any>;
|
|
5
|
+
protected customMessageService: DrChatCustomMessageService;
|
|
6
|
+
/**
|
|
7
|
+
* Defines a message type which should rendered with the custom message template.
|
|
8
|
+
*
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
get drCustomMessage(): string;
|
|
12
|
+
set drCustomMessage(value: string);
|
|
13
|
+
protected _type: string;
|
|
14
|
+
get type(): string;
|
|
15
|
+
constructor(templateRef: TemplateRef<any>, customMessageService: DrChatCustomMessageService);
|
|
16
|
+
ngOnInit(): void;
|
|
17
|
+
ngOnDestroy(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DrChatCustomMessageDirective } from './chat-custom-message.directive';
|
|
2
|
+
/**
|
|
3
|
+
* `DrCustomMessageService` is used to store instances of `DrChatCustomMessageDirective`s which
|
|
4
|
+
* were provided in the chat component.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DrChatCustomMessageService {
|
|
7
|
+
protected readonly customMessages: Map<string, DrChatCustomMessageDirective>;
|
|
8
|
+
register(type: string, instance: DrChatCustomMessageDirective): void;
|
|
9
|
+
unregister(type: string): boolean;
|
|
10
|
+
getInstance(type: string): DrChatCustomMessageDirective | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
import { IChatDownloadFileMessage, IChatImageMessage, IChatMessageFile } from '../../../models/chat';
|
|
4
|
+
/**
|
|
5
|
+
* Chat message component.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DrChatMessageFileComponent {
|
|
8
|
+
protected cd: ChangeDetectorRef;
|
|
9
|
+
protected domSanitizer: DomSanitizer;
|
|
10
|
+
readyFiles: any[];
|
|
11
|
+
/**
|
|
12
|
+
* Message with file
|
|
13
|
+
*
|
|
14
|
+
* @type {IChatDownloadFileMessage | IChatImageMessage}
|
|
15
|
+
*/
|
|
16
|
+
message: IChatDownloadFileMessage | IChatImageMessage;
|
|
17
|
+
/**
|
|
18
|
+
* Message file path
|
|
19
|
+
*
|
|
20
|
+
* @type {Date}
|
|
21
|
+
*/
|
|
22
|
+
set files(files: IChatMessageFile[]);
|
|
23
|
+
constructor(cd: ChangeDetectorRef, domSanitizer: DomSanitizer);
|
|
24
|
+
isImage(file: IChatMessageFile): boolean;
|
|
25
|
+
}
|
package/lib/dr-chat/dr-chat-message/dr-chat-message-rich-text/chat-message-rich-text.component.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IChatRichTextMessage } from '../../../models/chat';
|
|
2
|
+
/**
|
|
3
|
+
* Chat rich-text message component.
|
|
4
|
+
*/
|
|
5
|
+
export declare class DrChatMessageRichTextComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Message sender
|
|
8
|
+
*
|
|
9
|
+
* @type {IChatRichTextMessage}
|
|
10
|
+
*/
|
|
11
|
+
message: IChatRichTextMessage;
|
|
12
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export declare const IMAGE_TYPES: string[];
|
|
2
|
+
export interface IChatSignUpRequest {
|
|
3
|
+
userName: string;
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IChatSignInRequest {
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IChatCreateConversationRequest {
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IChatConversation {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IChatAccount {
|
|
19
|
+
kind: 'user' | 'bot';
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
email?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare enum CHAT_MESSAGE_TYPE {
|
|
25
|
+
TEXT = "text",
|
|
26
|
+
RICH_TEXT = "rich-text",
|
|
27
|
+
IMAGE = "image",
|
|
28
|
+
DOWNLOAD_FILE = "download-file",
|
|
29
|
+
MAILTO = "mailto",
|
|
30
|
+
EMBED = "embed",
|
|
31
|
+
WIDGET = "widget",
|
|
32
|
+
INPUT = "input",
|
|
33
|
+
CODE = "code"
|
|
34
|
+
}
|
|
35
|
+
export interface IChatMessageBase {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: string | CHAT_MESSAGE_TYPE;
|
|
38
|
+
seq: number;
|
|
39
|
+
conversationId: string;
|
|
40
|
+
reply: boolean;
|
|
41
|
+
senderId: string;
|
|
42
|
+
parentId?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface IChatTextMessage extends IChatMessageBase {
|
|
45
|
+
kind: string | CHAT_MESSAGE_TYPE.TEXT;
|
|
46
|
+
text?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface IChatRichTextMessage extends IChatMessageBase {
|
|
49
|
+
kind: string | CHAT_MESSAGE_TYPE.RICH_TEXT;
|
|
50
|
+
paragraphs?: IChatRichTextParagraph[];
|
|
51
|
+
}
|
|
52
|
+
export interface IChatRichTextParagraph {
|
|
53
|
+
kind: string | CHAT_MESSAGE_TYPE;
|
|
54
|
+
value: string;
|
|
55
|
+
}
|
|
56
|
+
export interface IChatImageMessage extends IChatMessageBase {
|
|
57
|
+
kind: string | CHAT_MESSAGE_TYPE.IMAGE;
|
|
58
|
+
url?: string;
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface IChatDownloadFileMessage extends IChatMessageBase {
|
|
62
|
+
kind: string | CHAT_MESSAGE_TYPE.DOWNLOAD_FILE;
|
|
63
|
+
url?: string;
|
|
64
|
+
label?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface IChatMailtoMessage extends IChatMessageBase {
|
|
67
|
+
kind: string | CHAT_MESSAGE_TYPE.MAILTO;
|
|
68
|
+
subject?: string;
|
|
69
|
+
body?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface IChatEmbedMessage extends IChatMessageBase {
|
|
72
|
+
kind: string | CHAT_MESSAGE_TYPE.EMBED;
|
|
73
|
+
url?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface IChatInputMessage extends IChatMessageBase {
|
|
76
|
+
kind: string | CHAT_MESSAGE_TYPE.INPUT;
|
|
77
|
+
form?: any;
|
|
78
|
+
}
|
|
79
|
+
export declare type IChatMessage = IChatMessageBase & IChatTextMessage & IChatRichTextMessage & IChatImageMessage & IChatDownloadFileMessage & IChatMailtoMessage & IChatEmbedMessage & IChatInputMessage;
|
|
80
|
+
export interface IChatMessageFileIconPreview {
|
|
81
|
+
url: string;
|
|
82
|
+
icon: string;
|
|
83
|
+
}
|
|
84
|
+
export interface IChatMessageFileImagePreview {
|
|
85
|
+
url: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}
|
|
88
|
+
export declare type IChatMessageFile = IChatMessageFileIconPreview | IChatMessageFileImagePreview;
|
|
89
|
+
export declare class ChatMessage implements IChatMessageBase, IChatTextMessage, IChatRichTextMessage, IChatImageMessage, IChatDownloadFileMessage, IChatMailtoMessage, IChatEmbedMessage, IChatInputMessage {
|
|
90
|
+
id: string;
|
|
91
|
+
kind: string | CHAT_MESSAGE_TYPE;
|
|
92
|
+
seq: number;
|
|
93
|
+
conversationId: string;
|
|
94
|
+
reply: boolean;
|
|
95
|
+
senderId: string;
|
|
96
|
+
parentId?: string;
|
|
97
|
+
text?: string;
|
|
98
|
+
paragraphs?: IChatRichTextParagraph[];
|
|
99
|
+
url?: string;
|
|
100
|
+
label?: string;
|
|
101
|
+
subject?: string;
|
|
102
|
+
body?: any;
|
|
103
|
+
form?: any;
|
|
104
|
+
parameters?: any;
|
|
105
|
+
constructor(obj: any, user: IChatAccount);
|
|
106
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export { ISpinnerOptions, SpinnerType, SpinnerSize } from './lib/models/spinnerO
|
|
|
52
52
|
export { ElPosition, IDropdown, IDropdownItem, IDropdownActionIcon, IDropdownCoordinate, IDropdownCallEvent, IDropdownAction } from './lib/models/dropdown';
|
|
53
53
|
export { DrPopoverRef, IDrPopoverComponentModel, Point, DrPopoverConfig, IPopoverManualClosing, DrPopoverAlignment, DrPopoverAlignmentDimension, } from './lib/models/popover';
|
|
54
54
|
export { IValidationError } from './lib/models/validationError';
|
|
55
|
+
export * from './lib/models/chat';
|
|
55
56
|
export { DateTagModule } from './lib/date-tags/date-tag.module';
|
|
56
57
|
export { ListTagModule } from './lib/list-tags/list-tag.module';
|
|
57
58
|
export { DrTagModule } from './lib/dr-tags/dr-tag.module';
|
|
@@ -68,3 +69,4 @@ export { DrLayoutModule } from './lib/dr-layout/dr-layout.module';
|
|
|
68
69
|
export { DrErrorModule } from './lib/dr-error/dr-error.module';
|
|
69
70
|
export { DrStepperModule } from './lib/stepper/stepper.module';
|
|
70
71
|
export { DrDialogModule } from './lib/dr-dialog/dialog.module';
|
|
72
|
+
export { DrChatModule } from './lib/dr-chat/chat.module';
|
|
Binary file
|