import { ChangeDetectorRef, EventEmitter, NgZone, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { ModalController } from '@ionic/angular'; import { UofxToastController } from '@uofx/app-components'; import { UofxFileDownloadHelper, UofxFileModel } from '@uofx/app-components/file-helper'; import { UofxFileOpenerPlugin, UofxFilePickerPlugin, UofxFilePlugin, UofxFileTransferPlugin } from '@uofx/app-native'; import { UofxI18NService } from '@uofx/core'; import { UofxFileService } from './api/service/file.service'; import { UofxFileUploadController } from './controller/file-upload.controller'; import { UofxFileActionType, UofxFileButton, UofxFileButtons, UofxFileButtonType, UofxFileClickAction, UofxFileGroupModel, UofxFileUploadFileItem, UofxFileUploadModuleType } from './file.interface'; import * as i0 from "@angular/core"; export declare class UofxFileUploadComponent implements OnInit, OnChanges, ControlValueAccessor { private _uofFile; private _ft; private _fileOpener; private _filePicker; private _i18n; private _zone; private _fileUploadCtrl; private cdr; private fileService; private downloadHelper; private modalCtrl; private toastCtrl; /** 模組名稱,例: Bpm,會影響檔案上傳實際存放的位置 */ module: UofxFileUploadModuleType; /** 上傳檔案的子分類 */ subModule: string; /** [外掛模組] Plugin 代號 */ pluginCode: string; /** 允許上傳的檔案類型,範例:'.doc,.xlsx' */ allowExtensions: string; /** 觀看模式,不會顯示上傳鈕也不能編輯 */ readonly: boolean; /** Disable狀態,會顯示按鈕跟檔案列表但不能選擇新檔案 */ disabled: boolean; /** 允許選擇多筆檔案 */ allowMultiple: boolean; /** 檔案列表簡要模式,只會顯示二個檔案,超過的會用數量顯示 */ shortMode: boolean; /** 是否用於pdf viewer (用於文件檢視器) */ pdfViewerUsed: boolean; /** 是否啟用浮水印 (用於文件檢視器) */ enableWatermark: boolean; /** 是否允許viewer內點擊下載pdf檔案(預設為true) */ enabledDownloadPdf: boolean; /** 是否允許下載原始檔(預設為true) */ allowDownloadFile: boolean; /** 是否紀錄檔案動作 */ recordFileAction: boolean; /** * 上傳按鈕 * - * 系統提供三種按鈕類型: * - `default`: 預設按鈕 "選擇檔案" * - `attachment`: 附件按鈕 "附件" * - 自訂按鈕: 需提供 `UofxFileButton` 類型並指定 `style`, `text`, `icon` */ set headerButton(value: InputHeaderButtonsType); /** * 元件不顯示樣式 (用於各頁面/元件自己實作檔案樣式) * - * 實作時,需透過fileList傳單一檔案進來,再自己viewChild拿轉好的資訊 (resultFileList[0]) */ liteMode: boolean; /** * 從檔案元件開的pdfViewer,也套用浮水印設定 * - * 檔案元件開pdf會走simpleOpen(不加密),原先這條路也不會設定浮水印,但因應dms檔案,需另開一條路讓simpleOpen也吃浮水印 * * 現況開pdf的三條路: * 1. 文件檢視器 (加密、吃浮水印) * 2. 檔案元件 (不加密、不吃浮水印) * 3. simpleOpenWithWatermark (不加密、吃浮水印) */ simpleOpenWithWatermark: boolean; /** 已上傳檔案清單 */ set existList(value: Array); /** 本次已上傳的檔案 */ fileChanged: EventEmitter; /** 新增的檔案 */ newFile: EventEmitter; headerTemplate: TemplateRef | undefined; /** 系統提供的按鈕 */ readonly SYS_BUTTONS: UofxFileButtons; /** File Group Id */ fileGroupId: string; /** 單一檔案上傳限制 (bytes) */ uploadSize: number; /** 剩餘容量 (bytes),-1表示不限制 */ remainingSize: number; /** 檔案切割大小(預設 1MB) */ uofChunkSize: number; /** 所有檔案 (signal) */ resultFileList: import("@angular/core").WritableSignal; /** 錯誤提示 */ errorTip: string; /** 字詞-更多資訊 */ moreInfoText: string; /** 字詞-較少資訊 */ reduceInfoText: string; /** 是否為顯示"較少資訊"的狀態 */ isReduceInfo: boolean; /** 是否為網頁模式 */ isWebMode: boolean; /** 停止上傳檔案 */ stopUpload: boolean; /** 按鈕名稱 */ btnName: string; /** 支援格式顯示,範例: .doc .docx .xls .xlsx */ get supportTypes(): string; /** 實際上要顯示於 UI 的按鈕 */ displayHeaderButton: import("@angular/core").WritableSignal; /** 是否為外掛模組上傳 */ isPluginUpload: import("@angular/core").Signal; /** 是否允許上傳 */ isValidUpload: import("@angular/core").WritableSignal; private mcoreConfig; constructor(_uofFile: UofxFilePlugin, _ft: UofxFileTransferPlugin, _fileOpener: UofxFileOpenerPlugin, _filePicker: UofxFilePickerPlugin, _i18n: UofxI18NService, _zone: NgZone, _fileUploadCtrl: UofxFileUploadController, cdr: ChangeDetectorRef, fileService: UofxFileService, downloadHelper: UofxFileDownloadHelper, modalCtrl: ModalController, toastCtrl: UofxToastController); ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; /** @internal 檢查 Module 是否設定正確 */ _checkModuleSetting(): boolean; /** * 重製上傳元件 * * @param {boolean} [emitChange=true] - 是否發出變更事件 * @memberof UofxFileUploadComponent */ reset(emitChange?: boolean): void; /** @public 載入檔案清單(請先傳入fileGroupId) */ loadFileList(fileGroupId: string): void; /** @public 建立 file item,為初始準備上傳狀態 */ createFileItem(fileName: string, fileSize: number): UofxFileUploadFileItem; onChooseFileClick(fileInput: HTMLInputElement): void; /** 新增檔案(網頁版) */ onFileChanged(filesElement: HTMLInputElement): void; /** 開啟檔案選取頁面(透過 ionic plugin) */ appAddFile(): void; /** @internal 取得檔案上傳大小限制 */ getFileUploadLimit(callback?: () => void): void; /** 檔案每個項目上的點擊事件邏輯 */ onFileItemClick(action: UofxFileClickAction, item: UofxFileUploadFileItem, title?: string): void; /** 移除檔案 */ removeFile(item: UofxFileUploadFileItem): void; /** 點擊檔案要執行的邏輯 (刪除以外) */ fileClickLogic(item: UofxFileUploadFileItem, title?: string): void; /** 紀錄檔案動作 */ recordAction(fileId: string, action: UofxFileActionType): void; /** 處理下載檔案相關 */ executeDownloadFile(item: UofxFileUploadFileItem): void; /** 點擊檔案無法下載,根據轉檔狀態跳不同提示 */ fileClickToast(item: UofxFileUploadFileItem): void; /** 顯示提示Toast */ showToast(statusKey: string, id?: string): void; /** 開啟滿版pdf viewer */ openFullscreenViewer(item: UofxFileUploadFileItem, title?: string): Promise; /** 開啟滿版cad viewer */ openFullscreenCadViewer(item: UofxFileUploadFileItem, title?: string): Promise; /** [App mode]下載檔案 */ downloadFile(item: UofxFileUploadFileItem): Promise; /** [App mode]開啟外部瀏覽器下載 */ downloadByBrowser(item: UofxFileUploadFileItem): void; /** 在 app 中進行下載 */ downloadByApp(item: UofxFileUploadFileItem): Promise; /** 用系統預設的 app 開啟檔案 */ openFile(item: UofxFileUploadFileItem): Promise; /** @public 取得要上傳的FileGroup */ _getFileSaveModel(): UofxFileGroupModel; /** * @public 是否有檔案正在上傳 * * @param {boolean} [showMsg=true] 是否顯示上傳中訊息,預設為 true * @memberof UofxFileUploadComponent */ hasFileUploading(showMsg?: boolean): boolean; /** @public 是否有檔案有錯誤 */ hasFileError(): boolean; /** @public 是否有檔案正在上傳中或有錯誤 */ hasFileUploadingOrError(): boolean; /** @public 是否有檔案還在轉檔中 */ hasFileConverting(): boolean; /** 驗證上傳檔案的正確性 */ validUploadFile(fileSize: number, fileName: string): boolean; /** 檢查檔案類別是否正確 */ checkExtensions(fileName: string): boolean; /** 檢查檔案上傳大小限制 */ checkUploadedSize(fileSize: number, fileName: string): boolean; /** 新增上傳檔案 item */ addFileItem(fileItem: UofxFileUploadFileItem): void; /** 新增檔案後,若限制只能上傳一份檔案,將上傳按鈕disabled */ stopUploadIfSingleFileAllowed(): void; /** 已上傳的檔案大小 */ getUploadedTotalSize(): number; /** 轉成上傳元件的檔案model */ mapToUofxFileModel(fileList: Array): UofxFileUploadFileItem[]; /** * 更新從後端取得的最新轉檔相關資訊到檔案物件上 * @param {Array} resultFiles 從後端檢查取得的最新結果 */ updateConvertInfo(resultFiles: Array): void; /** 檔案顯示更多資訊按鈕 */ onMoreInfoClick(): void; _emitFileChanged(): void; _onChange: (value: UofxFileGroupModel) => void; _onTouched: () => void; /** @public 寫入值 */ writeValue(value: UofxFileGroupModel): void; /** 檢查是否有暫存區的 url */ _checkTempUrl(): void; /** @public 註冊變更事件 */ registerOnChange(fn: (value: UofxFileGroupModel) => void): void; /** @public 註冊觸碰事件 */ registerOnTouched(fn: () => void): void; /** @public 設定 disabled 狀態 */ setDisabledState(isDisabled: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** 可設定的 Header Button 類型 */ type InputHeaderButtonsType = UofxFileButtonType | UofxFileButton; export {};