UNPKG

devextreme-angular

Version:

Angular UI and visualization components based on DevExtreme widgets

847 lines (815 loc) • 31.1 kB
import { __extends, __decorate, __metadata, __param } from 'tslib'; import { TransferState, BrowserTransferStateModule } from '@angular/platform-browser'; import { ElementRef, NgZone, Inject, PLATFORM_ID, Input, Output, EventEmitter, Component, NgModule } from '@angular/core'; import DxFileManager from 'devextreme/ui/file_manager'; import { DxTemplateHost, WatcherHelper, IterableDifferHelper, NestedOptionHost, DxComponent, DxIntegrationModule, DxTemplateModule } from 'devextreme-angular/core'; import { DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule } from 'devextreme-angular/ui/nested'; /*! * devextreme-angular * Version: 20.2.5 * Build date: Fri Jan 15 2021 * * Copyright (c) 2012 - 2021 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. */ var DxFileManagerComponent = /** @class */ (function (_super) { __extends(DxFileManagerComponent, _super); function DxFileManagerComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) { var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this; _this._watcherHelper = _watcherHelper; _this._idh = _idh; _this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'contextMenuItemClick', emit: 'onContextMenuItemClick' }, { subscribe: 'currentDirectoryChanged', emit: 'onCurrentDirectoryChanged' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'errorOccurred', emit: 'onErrorOccurred' }, { subscribe: 'focusedItemChanged', emit: 'onFocusedItemChanged' }, { subscribe: 'initialized', emit: 'onInitialized' }, { 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: '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); return _this; } Object.defineProperty(DxFileManagerComponent.prototype, "accessKey", { /** * Specifies the shortcut key that sets focus on the UI component. */ get: function () { return this._getOption('accessKey'); }, set: function (value) { this._setOption('accessKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "activeStateEnabled", { /** * Specifies whether or not the UI component changes its state when interacting with a user. */ get: function () { return this._getOption('activeStateEnabled'); }, set: function (value) { this._setOption('activeStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "allowedFileExtensions", { /** * Specifies the allowed upload file extensions. */ get: function () { return this._getOption('allowedFileExtensions'); }, set: function (value) { this._setOption('allowedFileExtensions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "contextMenu", { /** * Configures the context menu settings. */ get: function () { return this._getOption('contextMenu'); }, set: function (value) { this._setOption('contextMenu', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "currentPath", { /** * Specifies the path that is used when the FileManager is initialized. */ get: function () { return this._getOption('currentPath'); }, set: function (value) { this._setOption('currentPath', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "currentPathKeys", { /** * Specifies an array of path keys to the current location. */ get: function () { return this._getOption('currentPathKeys'); }, set: function (value) { this._setOption('currentPathKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "customizeDetailColumns", { /** * Customizes columns in details view. Applies only if itemView.mode is 'details'. */ get: function () { return this._getOption('customizeDetailColumns'); }, set: function (value) { this._setOption('customizeDetailColumns', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "customizeThumbnail", { /** * Allows you to provide custom icons to be used as thumbnails. */ get: function () { return this._getOption('customizeThumbnail'); }, set: function (value) { this._setOption('customizeThumbnail', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "disabled", { /** * Specifies whether the UI component responds to user interaction. */ get: function () { return this._getOption('disabled'); }, set: function (value) { this._setOption('disabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "elementAttr", { /** * Specifies the global attributes to be attached to the UI component's container element. */ get: function () { return this._getOption('elementAttr'); }, set: function (value) { this._setOption('elementAttr', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "fileSystemProvider", { /** * Specifies the file system provider. */ get: function () { return this._getOption('fileSystemProvider'); }, set: function (value) { this._setOption('fileSystemProvider', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "focusedItemKey", { /** * Specifies a key of the initially or currently focused item. */ get: function () { return this._getOption('focusedItemKey'); }, set: function (value) { this._setOption('focusedItemKey', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "focusStateEnabled", { /** * Specifies whether the UI component can be focused using keyboard navigation. */ get: function () { return this._getOption('focusStateEnabled'); }, set: function (value) { this._setOption('focusStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "height", { /** * Specifies the UI component's height. */ get: function () { return this._getOption('height'); }, set: function (value) { this._setOption('height', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "hint", { /** * Specifies text for a hint that appears when a user pauses on the UI component. */ get: function () { return this._getOption('hint'); }, set: function (value) { this._setOption('hint', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "hoverStateEnabled", { /** * Specifies whether the UI component changes its state when a user pauses on it. */ get: function () { return this._getOption('hoverStateEnabled'); }, set: function (value) { this._setOption('hoverStateEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "itemView", { /** * Configures the file and folder view. */ get: function () { return this._getOption('itemView'); }, set: function (value) { this._setOption('itemView', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "permissions", { /** * Specifies actions that a user is allowed to perform on files and folders. */ get: function () { return this._getOption('permissions'); }, set: function (value) { this._setOption('permissions', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "rootFolderName", { /** * Specifies the root folder name. */ get: function () { return this._getOption('rootFolderName'); }, set: function (value) { this._setOption('rootFolderName', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "rtlEnabled", { /** * Switches the UI component to a right-to-left representation. */ get: function () { return this._getOption('rtlEnabled'); }, set: function (value) { this._setOption('rtlEnabled', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "selectedItemKeys", { /** * Contains an array of initially or currently selected files and directories' keys. */ get: function () { return this._getOption('selectedItemKeys'); }, set: function (value) { this._setOption('selectedItemKeys', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "selectionMode", { /** * Specifies whether a user can select a single or multiple files and folders in the item view simultaneously. */ get: function () { return this._getOption('selectionMode'); }, set: function (value) { this._setOption('selectionMode', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "tabIndex", { /** * Specifies the number of the element when the Tab key is used for navigating. */ get: function () { return this._getOption('tabIndex'); }, set: function (value) { this._setOption('tabIndex', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "toolbar", { /** * Configures toolbar settings. */ get: function () { return this._getOption('toolbar'); }, set: function (value) { this._setOption('toolbar', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "upload", { /** * Configures upload settings. */ get: function () { return this._getOption('upload'); }, set: function (value) { this._setOption('upload', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "visible", { /** * Specifies whether the UI component is visible. */ get: function () { return this._getOption('visible'); }, set: function (value) { this._setOption('visible', value); }, enumerable: true, configurable: true }); Object.defineProperty(DxFileManagerComponent.prototype, "width", { /** * Specifies the UI component's width. */ get: function () { return this._getOption('width'); }, set: function (value) { this._setOption('width', value); }, enumerable: true, configurable: true }); DxFileManagerComponent.prototype._createInstance = function (element, options) { return new DxFileManager(element, options); }; DxFileManagerComponent.prototype.ngOnDestroy = function () { this._destroyWidget(); }; DxFileManagerComponent.prototype.ngOnChanges = function (changes) { _super.prototype.ngOnChanges.call(this, changes); this.setupChanges('allowedFileExtensions', changes); this.setupChanges('currentPathKeys', changes); this.setupChanges('selectedItemKeys', changes); }; DxFileManagerComponent.prototype.setupChanges = function (prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } }; DxFileManagerComponent.prototype.ngDoCheck = function () { this._idh.doCheck('allowedFileExtensions'); this._idh.doCheck('currentPathKeys'); this._idh.doCheck('selectedItemKeys'); this._watcherHelper.checkWatchers(); _super.prototype.ngDoCheck.call(this); _super.prototype.clearChangedOptions.call(this); }; DxFileManagerComponent.prototype._setOption = function (name, value) { var isSetup = this._idh.setupSingle(name, value); var isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { _super.prototype._setOption.call(this, name, value); } }; DxFileManagerComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: NgZone }, { type: DxTemplateHost }, { type: WatcherHelper }, { type: IterableDifferHelper }, { type: NestedOptionHost }, { type: TransferState }, { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] } ]; }; __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "accessKey", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "activeStateEnabled", null); __decorate([ Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DxFileManagerComponent.prototype, "allowedFileExtensions", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "contextMenu", null); __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "currentPath", null); __decorate([ Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DxFileManagerComponent.prototype, "currentPathKeys", null); __decorate([ Input(), __metadata("design:type", Function), __metadata("design:paramtypes", [Function]) ], DxFileManagerComponent.prototype, "customizeDetailColumns", null); __decorate([ Input(), __metadata("design:type", Function), __metadata("design:paramtypes", [Function]) ], DxFileManagerComponent.prototype, "customizeThumbnail", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "disabled", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "elementAttr", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "fileSystemProvider", null); __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "focusedItemKey", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "focusStateEnabled", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "height", null); __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "hint", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "hoverStateEnabled", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "itemView", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "permissions", null); __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "rootFolderName", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "rtlEnabled", null); __decorate([ Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], DxFileManagerComponent.prototype, "selectedItemKeys", null); __decorate([ Input(), __metadata("design:type", String), __metadata("design:paramtypes", [String]) ], DxFileManagerComponent.prototype, "selectionMode", null); __decorate([ Input(), __metadata("design:type", Number), __metadata("design:paramtypes", [Number]) ], DxFileManagerComponent.prototype, "tabIndex", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "toolbar", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "upload", null); __decorate([ Input(), __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], DxFileManagerComponent.prototype, "visible", null); __decorate([ Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], DxFileManagerComponent.prototype, "width", null); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onContentReady", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onContextMenuItemClick", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onCurrentDirectoryChanged", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onDisposing", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onErrorOccurred", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onFocusedItemChanged", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onInitialized", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onOptionChanged", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onSelectedFileOpened", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onSelectionChanged", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "onToolbarItemClick", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "accessKeyChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "activeStateEnabledChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "allowedFileExtensionsChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "contextMenuChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "currentPathChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "currentPathKeysChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "customizeDetailColumnsChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "customizeThumbnailChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "disabledChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "elementAttrChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "fileSystemProviderChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "focusedItemKeyChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "focusStateEnabledChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "heightChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "hintChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "hoverStateEnabledChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "itemViewChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "permissionsChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "rootFolderNameChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "rtlEnabledChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "selectedItemKeysChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "selectionModeChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "tabIndexChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "toolbarChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "uploadChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "visibleChange", void 0); __decorate([ Output(), __metadata("design:type", EventEmitter) ], DxFileManagerComponent.prototype, "widthChange", void 0); DxFileManagerComponent = __decorate([ Component({ selector: 'dx-file-manager', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }), __param(7, Inject(PLATFORM_ID)), __metadata("design:paramtypes", [ElementRef, NgZone, DxTemplateHost, WatcherHelper, IterableDifferHelper, NestedOptionHost, TransferState, Object]) ], DxFileManagerComponent); return DxFileManagerComponent; }(DxComponent)); var DxFileManagerModule = /** @class */ (function () { function DxFileManagerModule() { } DxFileManagerModule = __decorate([ NgModule({ imports: [ DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule ], declarations: [ DxFileManagerComponent ], exports: [ DxFileManagerComponent, DxoContextMenuModule, DxiItemModule, DxoItemViewModule, DxoDetailsModule, DxiColumnModule, DxoPermissionsModule, DxoToolbarModule, DxiFileSelectionItemModule, DxoUploadModule, DxTemplateModule ] }) ], DxFileManagerModule); return DxFileManagerModule; }()); /** * Generated bundle index. Do not edit. */ export { DxFileManagerComponent, DxFileManagerModule }; //# sourceMappingURL=devextreme-angular-ui-file-manager.js.map