import { EventEmitter, OnInit, OnChanges, SimpleChanges, ElementRef } from '@angular/core'; import { SafeResourceUrl } from '@angular/platform-browser'; import { BaseAngularComponent } from '@memberjunction/ng-base-types'; import { BaseEntity } from '@memberjunction/core'; import { MJFileStorageProviderEntity, StorageAccountWithProvider } from '@memberjunction/core-entities'; import { RecordAttachmentItem, RecordAttachmentsConfig, AttachmentViewMode, AttachmentMediaType } from './record-attachments.types'; import { BeforeUploadAttachmentEventArgs, AfterUploadAttachmentEventArgs, BeforeDeleteAttachmentEventArgs, AfterDeleteAttachmentEventArgs, BeforeUnlinkAttachmentEventArgs, AfterUnlinkAttachmentEventArgs, BeforeDownloadAttachmentEventArgs, AfterDownloadAttachmentEventArgs, BeforePreviewAttachmentEventArgs, AfterPreviewAttachmentEventArgs, BeforeReplaceAttachmentEventArgs, AfterReplaceAttachmentEventArgs } from './record-attachments.events'; import * as i0 from "@angular/core"; /** * World-class Angular component for displaying, previewing, uploading, * and managing file attachments linked to an entity record. * * Selector: `mj-record-attachments` */ export declare class RecordAttachmentsComponent extends BaseAngularComponent implements OnInit, OnChanges { private cdr; private notifications; private sanitizer; private static readonly PREF_WIDTH_KEY; private static readonly PREF_VIEW_MODE_KEY; /** Entity record to load attachments for */ Record?: BaseEntity; /** Explicit EntityID (alternative to passing Record) */ EntityID?: string; /** Explicit RecordID (alternative to passing Record) */ RecordID?: string; /** Bound attachment items (supports direct data-binding / manipulation) */ Attachments: RecordAttachmentItem[]; /** Attachment configuration bag */ Config?: RecordAttachmentsConfig; /** Whether the slide panel is visible */ Visible: boolean; /** Whether the slide panel is resizable */ Resizable: boolean; /** Initial width in px. 0 = auto/persisted setting */ WidthPx: number; /** Minimum panel width in px */ MinWidthPx: number; /** Maximum panel width ratio of viewport */ MaxWidthRatio: number; /** Panel title */ Title: string; /** Permissions / Feature flags */ AllowUpload: boolean; AllowDelete: boolean; AllowUnlink: boolean; AllowDownload: boolean; AllowPreview: boolean; AllowReplace: boolean; AllowEditMetadata: boolean; /** UI Controls */ ShowProviderFilter: boolean; ShowSearch: boolean; ViewMode: AttachmentViewMode; PanelClosed: EventEmitter; WidthChanged: EventEmitter; AttachmentCountChanged: EventEmitter; ViewModeChanged: EventEmitter; BeforeUpload: EventEmitter; AfterUpload: EventEmitter; BeforeDelete: EventEmitter; AfterDelete: EventEmitter; BeforeUnlink: EventEmitter; AfterUnlink: EventEmitter; BeforeDownload: EventEmitter; AfterDownload: EventEmitter; BeforePreview: EventEmitter; AfterPreview: EventEmitter; BeforeReplace: EventEmitter; AfterReplace: EventEmitter; fileInputRef?: ElementRef; replaceInputRef?: ElementRef; IsLoading: boolean; IsUploading: boolean; UploadProgressPercent: number; UploadStatusText: string; UploadingFileName: string; SearchTerm: string; SelectedProviderFilter: string; StorageAccounts: StorageAccountWithProvider[]; ActiveProviders: MJFileStorageProviderEntity[]; SelectedStorageAccountID: string; /** User Permissions */ UserCanCreateFile: boolean; UserCanDeleteFile: boolean; UserCanUpdateFile: boolean; UserCanCreateLink: boolean; UserCanDeleteLink: boolean; /** Active Preview State */ PreviewModalOpen: boolean; IsLoadingPreview: boolean; IsMediaLoaded: boolean; ActivePreviewItem: RecordAttachmentItem | null; ActivePreviewUrl: string | null; ActivePreviewSafeUrl: SafeResourceUrl | null; ActivePreviewTextContent: string | null; /** Replace Target */ private pendingReplaceItem; private navigationService; private mediaLoadedTimer?; /** Edit Metadata Dialog */ EditMetadataModalOpen: boolean; EditMetadataItem: RecordAttachmentItem | null; EditMetadataName: string; EditMetadataDescription: string; /** Active Overflow Menu */ ActiveMenuLinkID: string | null; ngOnInit(): Promise; ngOnChanges(changes: SimpleChanges): Promise; private RestoreUserPreferences; OnWidthChanged(width: number): void; SetViewMode(mode: AttachmentViewMode): void; private CheckStorageAndPermissions; get EffectiveEntityID(): string | null; get EffectiveRecordID(): string | null; get EffectiveAllowUpload(): boolean; get EffectiveAllowDelete(): boolean; get EffectiveAllowUnlink(): boolean; get FilteredAttachments(): RecordAttachmentItem[]; get ProviderCounts(): Map; GetProviderItemCount(providerId: string): number; get TotalSizeFormatted(): string; /** * Refreshes the linked attachments list by querying `MJ: File Entity Record Links` and `MJ: Files`. */ Refresh(): Promise; /** * Uploads one or more files and links them to the active record. */ UploadFiles(files: File[], storageAccountId?: string, categoryId?: string): Promise; /** * Unlinks an attachment from the record (keeps file in storage). */ UnlinkAttachment(attachment: RecordAttachmentItem): Promise; /** * Deletes an attachment completely (unlinks and deletes from storage provider). */ DeleteAttachment(attachment: RecordAttachmentItem, hardDelete?: boolean): Promise; /** * Resolves an authenticated inline URL for streaming, previewing, and opening in a new tab. * Prefers the inline streaming endpoint (/media/:fileId?token=...) so the browser renders * the document/media natively without triggering forced attachment downloads or Save As dialogs. */ private GetInlineFileUrl; /** * Opens the attachment in a new browser tab for direct viewing. */ DownloadAttachment(attachment: RecordAttachmentItem): Promise; /** * Opens the in-app rich media preview modal for an attachment. */ PreviewAttachment(attachment: RecordAttachmentItem): Promise; OnPreviewMediaLoaded(): void; /** * Opens the file record in a dedicated MJ Explorer workspace tab and closes the attachments slide-in panel. * If running standalone/outside Explorer, falls back to opening the in-app media preview modal. */ OpenAttachmentRecord(attachment: RecordAttachmentItem): void; /** * Initiates replace workflow for an existing attachment. */ RequestReplace(attachment: RecordAttachmentItem): void; /** * Replaces an existing attachment with a newly uploaded file. */ ReplaceAttachment(attachment: RecordAttachmentItem, newFile: File): Promise; ClosePanel(): void; ClosePreviewModal(): void; OpenEditMetadata(attachment: RecordAttachmentItem): void; CloseEditMetadataModal(): void; SaveEditMetadata(): Promise; OnFilesSelected(event: Event): void; OnReplaceFileSelected(event: Event): void; OnDragOver(event: DragEvent): void; OnDrop(event: DragEvent): void; GetMediaType(attachment: RecordAttachmentItem): AttachmentMediaType; FormatSize(bytes?: number | null): string; GetFileIcon(attachment: RecordAttachmentItem): string; GetFileColorClass(attachment: RecordAttachmentItem): string; OnDocumentClick(): void; OnEscapePress(): void; ToggleItemMenu(event: MouseEvent, item: RecordAttachmentItem): void; CloseItemMenu(): void; GetProviderIcon(item: RecordAttachmentItem): string; GetProviderBrandColor(item: RecordAttachmentItem): string | undefined; GetFallbackProviderIcon(providerName?: string | null): string; private ProviderSupportsDirectUpload; private TriggerBrowserDownload; /** * Performs an authenticated direct binary upload of a raw File/Blob to a pre-authenticated cloud storage URL. */ private uploadBinaryDirect; /** * Performs an authenticated raw binary streaming upload to the /media/upload-stage REST endpoint. * Uses the cryptographically signed media-upload token minted by CreateUploadStageToken. * Returns an ephemeral single-use upload token to pass to the GraphQL UploadStorageFile mutation. */ private uploadBinaryStage; private fileToBase64; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } //# sourceMappingURL=record-attachments.component.d.ts.map