@propbinder/mobile-design 0.2.35 → 0.2.36

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.
@@ -15144,8 +15144,10 @@ class DsMobileChatModalComponent {
15144
15144
  }, 150);
15145
15145
  });
15146
15146
  });
15147
- // In a real app, you would send this to your backend
15148
- // this.chatService.sendMessage(this.chatData.participant.id, event.content, event.attachments);
15147
+ // Executing the onSend callback if provided
15148
+ if (this.chatData.onSend) {
15149
+ this.chatData.onSend(event.content, event.attachments || []);
15150
+ }
15149
15151
  }
15150
15152
  /**
15151
15153
  * Handle attachment click
@@ -15251,8 +15253,28 @@ class DsMobileChatModalComponent {
15251
15253
  * Handle file attachment click
15252
15254
  */
15253
15255
  handleFileAttachmentClick(fileAttachment) {
15254
- console.log('[ChatModal] File attachment clicked:', fileAttachment);
15255
- // In a real app, you would open the file viewer
15256
+ // If a custom handler is provided, use it
15257
+ if (this.chatData.onFileClick) {
15258
+ this.chatData.onFileClick(fileAttachment);
15259
+ return;
15260
+ }
15261
+ // Default behavior: Try to open/download the file
15262
+ const url = fileAttachment.src || fileAttachment.url;
15263
+ if (url) {
15264
+ const link = document.createElement('a');
15265
+ link.href = url;
15266
+ link.target = '_blank';
15267
+ // If it has a name, setting download attribute suggests downloading
15268
+ if (fileAttachment.name) {
15269
+ link.download = fileAttachment.name;
15270
+ }
15271
+ document.body.appendChild(link);
15272
+ link.click();
15273
+ document.body.removeChild(link);
15274
+ }
15275
+ else {
15276
+ console.warn('[ChatModal] No URL or source for file attachment:', fileAttachment);
15277
+ }
15256
15278
  }
15257
15279
  /**
15258
15280
  * Handle image attachment click - opens lightbox
@@ -15809,7 +15831,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
15809
15831
  * ],
15810
15832
  * currentUserId: '456',
15811
15833
  * currentUserInitials: 'JD',
15812
- * autoFocus: true
15834
+ * currentUserInitials: 'JD',
15835
+ * autoFocus: true,
15836
+ * onSend: async (message, attachments) => {
15837
+ * console.log('Sending message:', message);
15838
+ * // await this.chatService.sendMessage(participant.id, message, attachments);
15839
+ * },
15840
+ * onFileClick: (file) => {
15841
+ * console.log('File clicked:', file);
15842
+ * // window.open(file.url, '_blank');
15843
+ * }
15813
15844
  * });
15814
15845
  * }
15815
15846
  * ```