UNPKG

devextreme-angular

Version:

Angular UI and visualization components based on DevExtreme widgets

683 lines (650 loc) 26.5 kB
import * as i2 from '@angular/platform-browser'; import { BrowserTransferStateModule } from '@angular/platform-browser'; import * as i0 from '@angular/core'; import { PLATFORM_ID, Component, Inject, Input, Output, NgModule } from '@angular/core'; import DxFileManager from 'devextreme/ui/file_manager'; import * as i1 from 'devextreme-angular/core'; import { DxComponent, DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper, DxIntegrationModule, DxTemplateModule } from 'devextreme-angular/core'; import { DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule } from 'devextreme-angular/ui/nested'; /*! * devextreme-angular * Version: 22.1.14 * Build date: Mon Apr 29 2024 * * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ /** * The FileManager is a UI component that allows users to upload, select, and manage files and directories in different file storages. */ class DxFileManagerComponent extends DxComponent { constructor(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) { super(elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId); this._watcherHelper = _watcherHelper; this._idh = _idh; this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'contextMenuItemClick', emit: 'onContextMenuItemClick' }, { subscribe: 'contextMenuShowing', emit: 'onContextMenuShowing' }, { subscribe: 'currentDirectoryChanged', emit: 'onCurrentDirectoryChanged' }, { subscribe: 'directoryCreated', emit: 'onDirectoryCreated' }, { subscribe: 'directoryCreating', emit: 'onDirectoryCreating' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'errorOccurred', emit: 'onErrorOccurred' }, { subscribe: 'fileUploaded', emit: 'onFileUploaded' }, { subscribe: 'fileUploading', emit: 'onFileUploading' }, { subscribe: 'focusedItemChanged', emit: 'onFocusedItemChanged' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemCopied', emit: 'onItemCopied' }, { subscribe: 'itemCopying', emit: 'onItemCopying' }, { subscribe: 'itemDeleted', emit: 'onItemDeleted' }, { subscribe: 'itemDeleting', emit: 'onItemDeleting' }, { subscribe: 'itemDownloading', emit: 'onItemDownloading' }, { subscribe: 'itemMoved', emit: 'onItemMoved' }, { subscribe: 'itemMoving', emit: 'onItemMoving' }, { subscribe: 'itemRenamed', emit: 'onItemRenamed' }, { subscribe: 'itemRenaming', emit: 'onItemRenaming' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'selectedFileOpened', emit: 'onSelectedFileOpened' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { subscribe: 'toolbarItemClick', emit: 'onToolbarItemClick' }, { emit: 'accessKeyChange' }, { emit: 'activeStateEnabledChange' }, { emit: 'allowedFileExtensionsChange' }, { emit: 'contextMenuChange' }, { emit: 'currentPathChange' }, { emit: 'currentPathKeysChange' }, { emit: 'customizeDetailColumnsChange' }, { emit: 'customizeThumbnailChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'fileSystemProviderChange' }, { emit: 'focusedItemKeyChange' }, { emit: 'focusStateEnabledChange' }, { emit: 'heightChange' }, { emit: 'hintChange' }, { emit: 'hoverStateEnabledChange' }, { emit: 'itemViewChange' }, { emit: 'notificationsChange' }, { emit: 'permissionsChange' }, { emit: 'rootFolderNameChange' }, { emit: 'rtlEnabledChange' }, { emit: 'selectedItemKeysChange' }, { emit: 'selectionModeChange' }, { emit: 'tabIndexChange' }, { emit: 'toolbarChange' }, { emit: 'uploadChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' } ]); this._idh.setHost(this); optionHost.setHost(this); } /** * Specifies the shortcut key that sets focus on the UI component. */ get accessKey() { return this._getOption('accessKey'); } set accessKey(value) { this._setOption('accessKey', value); } /** * Specifies whether the UI component changes its visual state as a result of user interaction. */ get activeStateEnabled() { return this._getOption('activeStateEnabled'); } set activeStateEnabled(value) { this._setOption('activeStateEnabled', value); } /** * Specifies the allowed upload file extensions. */ get allowedFileExtensions() { return this._getOption('allowedFileExtensions'); } set allowedFileExtensions(value) { this._setOption('allowedFileExtensions', value); } /** * Configures the context menu settings. */ get contextMenu() { return this._getOption('contextMenu'); } set contextMenu(value) { this._setOption('contextMenu', value); } /** * Specifies the path that is used when the FileManager is initialized. */ get currentPath() { return this._getOption('currentPath'); } set currentPath(value) { this._setOption('currentPath', value); } /** * Specifies an array of path keys to the current location. */ get currentPathKeys() { return this._getOption('currentPathKeys'); } set currentPathKeys(value) { this._setOption('currentPathKeys', value); } /** * Customizes columns in details view. Applies only if itemView.mode is 'details'. */ get customizeDetailColumns() { return this._getOption('customizeDetailColumns'); } set customizeDetailColumns(value) { this._setOption('customizeDetailColumns', value); } /** * Allows you to provide custom icons to be used as thumbnails. */ get customizeThumbnail() { return this._getOption('customizeThumbnail'); } set customizeThumbnail(value) { this._setOption('customizeThumbnail', value); } /** * Specifies whether the UI component responds to user interaction. */ get disabled() { return this._getOption('disabled'); } set disabled(value) { this._setOption('disabled', value); } /** * Specifies the global attributes to be attached to the UI component's container element. */ get elementAttr() { return this._getOption('elementAttr'); } set elementAttr(value) { this._setOption('elementAttr', value); } /** * Specifies the file system provider. */ get fileSystemProvider() { return this._getOption('fileSystemProvider'); } set fileSystemProvider(value) { this._setOption('fileSystemProvider', value); } /** * Specifies a key of the initially or currently focused item. */ get focusedItemKey() { return this._getOption('focusedItemKey'); } set focusedItemKey(value) { this._setOption('focusedItemKey', value); } /** * Specifies whether the UI component can be focused using keyboard navigation. */ get focusStateEnabled() { return this._getOption('focusStateEnabled'); } set focusStateEnabled(value) { this._setOption('focusStateEnabled', value); } /** * Specifies the UI component's height. */ get height() { return this._getOption('height'); } set height(value) { this._setOption('height', value); } /** * Specifies text for a hint that appears when a user pauses on the UI component. */ get hint() { return this._getOption('hint'); } set hint(value) { this._setOption('hint', value); } /** * Specifies whether the UI component changes its state when a user pauses on it. */ get hoverStateEnabled() { return this._getOption('hoverStateEnabled'); } set hoverStateEnabled(value) { this._setOption('hoverStateEnabled', value); } /** * Configures the file and directory view. */ get itemView() { return this._getOption('itemView'); } set itemView(value) { this._setOption('itemView', value); } /** * Configures notification settings. */ get notifications() { return this._getOption('notifications'); } set notifications(value) { this._setOption('notifications', value); } /** * Specifies actions that a user is allowed to perform on files and directories. */ get permissions() { return this._getOption('permissions'); } set permissions(value) { this._setOption('permissions', value); } /** * Specifies the root directory display name. */ get rootFolderName() { return this._getOption('rootFolderName'); } set rootFolderName(value) { this._setOption('rootFolderName', value); } /** * Switches the UI component to a right-to-left representation. */ get rtlEnabled() { return this._getOption('rtlEnabled'); } set rtlEnabled(value) { this._setOption('rtlEnabled', value); } /** * Contains an array of initially or currently selected files and directories' keys. */ get selectedItemKeys() { return this._getOption('selectedItemKeys'); } set selectedItemKeys(value) { this._setOption('selectedItemKeys', value); } /** * Specifies whether a user can select a single or multiple files and directories in the item view simultaneously. */ get selectionMode() { return this._getOption('selectionMode'); } set selectionMode(value) { this._setOption('selectionMode', value); } /** * Specifies the number of the element when the Tab key is used for navigating. */ get tabIndex() { return this._getOption('tabIndex'); } set tabIndex(value) { this._setOption('tabIndex', value); } /** * Configures toolbar settings. */ get toolbar() { return this._getOption('toolbar'); } set toolbar(value) { this._setOption('toolbar', value); } /** * Configures upload settings. */ get upload() { return this._getOption('upload'); } set upload(value) { this._setOption('upload', value); } /** * Specifies whether the UI component is visible. */ get visible() { return this._getOption('visible'); } set visible(value) { this._setOption('visible', value); } /** * Specifies the UI component's width. */ get width() { return this._getOption('width'); } set width(value) { this._setOption('width', value); } _createInstance(element, options) { return new DxFileManager(element, options); } ngOnDestroy() { this._destroyWidget(); } ngOnChanges(changes) { super.ngOnChanges(changes); this.setupChanges('allowedFileExtensions', changes); this.setupChanges('currentPathKeys', changes); this.setupChanges('selectedItemKeys', changes); } setupChanges(prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } } ngDoCheck() { this._idh.doCheck('allowedFileExtensions'); this._idh.doCheck('currentPathKeys'); this._idh.doCheck('selectedItemKeys'); this._watcherHelper.checkWatchers(); super.ngDoCheck(); super.clearChangedOptions(); } _setOption(name, value) { let isSetup = this._idh.setupSingle(name, value); let isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { super._setOption(name, value); } } } /** @nocollapse */ DxFileManagerComponent.ɵfac = function DxFileManagerComponent_Factory(t) { return new (t || DxFileManagerComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i1.DxTemplateHost), i0.ɵɵdirectiveInject(i1.WatcherHelper), i0.ɵɵdirectiveInject(i1.IterableDifferHelper), i0.ɵɵdirectiveInject(i1.NestedOptionHost), i0.ɵɵdirectiveInject(i2.TransferState), i0.ɵɵdirectiveInject(PLATFORM_ID)); }; /** @nocollapse */ DxFileManagerComponent.ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: DxFileManagerComponent, selectors: [["dx-file-manager"]], inputs: { accessKey: "accessKey", activeStateEnabled: "activeStateEnabled", allowedFileExtensions: "allowedFileExtensions", contextMenu: "contextMenu", currentPath: "currentPath", currentPathKeys: "currentPathKeys", customizeDetailColumns: "customizeDetailColumns", customizeThumbnail: "customizeThumbnail", disabled: "disabled", elementAttr: "elementAttr", fileSystemProvider: "fileSystemProvider", focusedItemKey: "focusedItemKey", focusStateEnabled: "focusStateEnabled", height: "height", hint: "hint", hoverStateEnabled: "hoverStateEnabled", itemView: "itemView", notifications: "notifications", permissions: "permissions", rootFolderName: "rootFolderName", rtlEnabled: "rtlEnabled", selectedItemKeys: "selectedItemKeys", selectionMode: "selectionMode", tabIndex: "tabIndex", toolbar: "toolbar", upload: "upload", visible: "visible", width: "width" }, outputs: { onContentReady: "onContentReady", onContextMenuItemClick: "onContextMenuItemClick", onContextMenuShowing: "onContextMenuShowing", onCurrentDirectoryChanged: "onCurrentDirectoryChanged", onDirectoryCreated: "onDirectoryCreated", onDirectoryCreating: "onDirectoryCreating", onDisposing: "onDisposing", onErrorOccurred: "onErrorOccurred", onFileUploaded: "onFileUploaded", onFileUploading: "onFileUploading", onFocusedItemChanged: "onFocusedItemChanged", onInitialized: "onInitialized", onItemCopied: "onItemCopied", onItemCopying: "onItemCopying", onItemDeleted: "onItemDeleted", onItemDeleting: "onItemDeleting", onItemDownloading: "onItemDownloading", onItemMoved: "onItemMoved", onItemMoving: "onItemMoving", onItemRenamed: "onItemRenamed", onItemRenaming: "onItemRenaming", onOptionChanged: "onOptionChanged", onSelectedFileOpened: "onSelectedFileOpened", onSelectionChanged: "onSelectionChanged", onToolbarItemClick: "onToolbarItemClick", accessKeyChange: "accessKeyChange", activeStateEnabledChange: "activeStateEnabledChange", allowedFileExtensionsChange: "allowedFileExtensionsChange", contextMenuChange: "contextMenuChange", currentPathChange: "currentPathChange", currentPathKeysChange: "currentPathKeysChange", customizeDetailColumnsChange: "customizeDetailColumnsChange", customizeThumbnailChange: "customizeThumbnailChange", disabledChange: "disabledChange", elementAttrChange: "elementAttrChange", fileSystemProviderChange: "fileSystemProviderChange", focusedItemKeyChange: "focusedItemKeyChange", focusStateEnabledChange: "focusStateEnabledChange", heightChange: "heightChange", hintChange: "hintChange", hoverStateEnabledChange: "hoverStateEnabledChange", itemViewChange: "itemViewChange", notificationsChange: "notificationsChange", permissionsChange: "permissionsChange", rootFolderNameChange: "rootFolderNameChange", rtlEnabledChange: "rtlEnabledChange", selectedItemKeysChange: "selectedItemKeysChange", selectionModeChange: "selectionModeChange", tabIndexChange: "tabIndexChange", toolbarChange: "toolbarChange", uploadChange: "uploadChange", visibleChange: "visibleChange", widthChange: "widthChange" }, features: [i0.ɵɵProvidersFeature([ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ]), i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function DxFileManagerComponent_Template(rf, ctx) { }, encapsulation: 2 }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DxFileManagerComponent, [{ type: Component, args: [{ selector: 'dx-file-manager', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }] }], function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.DxTemplateHost }, { type: i1.WatcherHelper }, { type: i1.IterableDifferHelper }, { type: i1.NestedOptionHost }, { type: i2.TransferState }, { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID] }] }]; }, { accessKey: [{ type: Input }], activeStateEnabled: [{ type: Input }], allowedFileExtensions: [{ type: Input }], contextMenu: [{ type: Input }], currentPath: [{ type: Input }], currentPathKeys: [{ type: Input }], customizeDetailColumns: [{ type: Input }], customizeThumbnail: [{ type: Input }], disabled: [{ type: Input }], elementAttr: [{ type: Input }], fileSystemProvider: [{ type: Input }], focusedItemKey: [{ type: Input }], focusStateEnabled: [{ type: Input }], height: [{ type: Input }], hint: [{ type: Input }], hoverStateEnabled: [{ type: Input }], itemView: [{ type: Input }], notifications: [{ type: Input }], permissions: [{ type: Input }], rootFolderName: [{ type: Input }], rtlEnabled: [{ type: Input }], selectedItemKeys: [{ type: Input }], selectionMode: [{ type: Input }], tabIndex: [{ type: Input }], toolbar: [{ type: Input }], upload: [{ type: Input }], visible: [{ type: Input }], width: [{ type: Input }], onContentReady: [{ type: Output }], onContextMenuItemClick: [{ type: Output }], onContextMenuShowing: [{ type: Output }], onCurrentDirectoryChanged: [{ type: Output }], onDirectoryCreated: [{ type: Output }], onDirectoryCreating: [{ type: Output }], onDisposing: [{ type: Output }], onErrorOccurred: [{ type: Output }], onFileUploaded: [{ type: Output }], onFileUploading: [{ type: Output }], onFocusedItemChanged: [{ type: Output }], onInitialized: [{ type: Output }], onItemCopied: [{ type: Output }], onItemCopying: [{ type: Output }], onItemDeleted: [{ type: Output }], onItemDeleting: [{ type: Output }], onItemDownloading: [{ type: Output }], onItemMoved: [{ type: Output }], onItemMoving: [{ type: Output }], onItemRenamed: [{ type: Output }], onItemRenaming: [{ type: Output }], onOptionChanged: [{ type: Output }], onSelectedFileOpened: [{ type: Output }], onSelectionChanged: [{ type: Output }], onToolbarItemClick: [{ type: Output }], accessKeyChange: [{ type: Output }], activeStateEnabledChange: [{ type: Output }], allowedFileExtensionsChange: [{ type: Output }], contextMenuChange: [{ type: Output }], currentPathChange: [{ type: Output }], currentPathKeysChange: [{ type: Output }], customizeDetailColumnsChange: [{ type: Output }], customizeThumbnailChange: [{ type: Output }], disabledChange: [{ type: Output }], elementAttrChange: [{ type: Output }], fileSystemProviderChange: [{ type: Output }], focusedItemKeyChange: [{ type: Output }], focusStateEnabledChange: [{ type: Output }], heightChange: [{ type: Output }], hintChange: [{ type: Output }], hoverStateEnabledChange: [{ type: Output }], itemViewChange: [{ type: Output }], notificationsChange: [{ type: Output }], permissionsChange: [{ type: Output }], rootFolderNameChange: [{ type: Output }], rtlEnabledChange: [{ type: Output }], selectedItemKeysChange: [{ type: Output }], selectionModeChange: [{ type: Output }], tabIndexChange: [{ type: Output }], toolbarChange: [{ type: Output }], uploadChange: [{ type: Output }], visibleChange: [{ type: Output }], widthChange: [{ type: Output }] }); })(); class DxFileManagerModule { } /** @nocollapse */ DxFileManagerModule.ɵfac = function DxFileManagerModule_Factory(t) { return new (t || DxFileManagerModule)(); }; /** @nocollapse */ DxFileManagerModule.ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: DxFileManagerModule }); /** @nocollapse */ DxFileManagerModule.ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ imports: [[ DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule ], DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxTemplateModule] }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DxFileManagerModule, [{ type: NgModule, args: [{ imports: [ DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule ], declarations: [ DxFileManagerComponent ], exports: [ DxFileManagerComponent, DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxTemplateModule ] }] }], null, null); })(); (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(DxFileManagerModule, { declarations: [DxFileManagerComponent], imports: [DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule], exports: [DxFileManagerComponent, DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoNotificationsModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxTemplateModule] }); })(); /** * Generated bundle index. Do not edit. */ export { DxFileManagerComponent, DxFileManagerModule }; //# sourceMappingURL=devextreme-angular-ui-file-manager.js.map