import { LitElement, PropertyValueMap, nothing } from 'lit'; import { FileType } from '../types/files.types'; import { ComponentFeaturePolicy } from '../contexts/features-context'; import { ShadowPartsController } from '../controllers/shadow-parts-controller'; import { AppType } from '../types/app.types'; import { WeavyType } from '../contexts/weavy-context'; import { UserType } from '../contexts'; declare global { interface HTMLElementTagNameMap { "wy-file-menu": WyFileMenu; } } /** * File actions, with Publish and Discard while editing. Publish is disabled until the editor has produced a draft, * and Discard both drops the draft and leaves edit mode, so it doubles as the way to close an unchanged edit. * * In preview mode with an unsaved draft, the dropdown starts with Publish and Discard, which act on the draft * without opening the editor, and the toolbar has a single "Continue editing" button while the draft itself is the * viewed entry (`draftActive`); a stored version viewed alongside the draft gets no toolbar button. Without a draft, * editing starts from * the Edit item first in the dropdown instead, which is hidden while an older version (`oldVersionActive`) is viewed * since editing always starts from the current version. Comments are a toolbar button without a draft and move * into the dropdown while a draft exists, so the toolbar holds only "Continue editing" then. * * **Used sub components:** * * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-dropdown.ts) * - [``](./ui/wy-icon.ts) * * @slot - Additional file menu items * * @fires {FileSaveEventType} save - Emitted when file save is requested. * @fires {FileEditEventType} edit - Emitted when file edit mode change is requested. * @fires {FileEditNameEventType} edit-name - Emitted when rename mode should be activated. * @fires {FileSubscribeEventType} subscribe - Emitted when subscribe/unsubscribe is requested. * @fires {FileTrashEventType} trash - Emitted when a file should be moved to trash. * @fires {FileRestoreEventType} restore - Emitted when a trashed file should be restored. * @fires {FileDeleteForeverEventType} delete-forever - Emitted when a file should be permanently deleted. * @fires {FileCommentsEventType} comments - Emitted when file comments should be opened. * @fires {FileVersionsEventType} versions - Emitted when file versions should be opened. */ export declare class WyFileMenu extends LitElement { /** @internal */ protected exportParts: ShadowPartsController; /** * @internal */ weavy: WeavyType | undefined; /** * @internal * Consumed feature policy controlling which actions are available. */ protected componentFeatures?: ComponentFeaturePolicy | undefined; /** * The app data. * @internal */ app: AppType | undefined; /** * Current user data. * @internal */ user: UserType | undefined; /** * File to operate on when rendering menu actions. */ file?: FileType; /** * Render the dropdown using compact button styling. */ small: boolean; hasEdit: boolean; hasComments: boolean; hasVersions: boolean; /** * Whether the subscribe/unsubscribe item may be shown. Defaults to true since the item is otherwise gated by * a `subscribe` listener; set to false for attachments, which cannot be subscribed to on their own. */ hasSubscribe: boolean; /** * Whether the rename item may be shown. Defaults to true since the item is otherwise gated by an `edit-name` * listener and the file rename feature; set to false for attachments, which inherit the features of the block * that opened them (e.g. file rename from the Files block) but are not renamable. */ hasRename: boolean; /** * Indicates edit mode if available. */ editActive: boolean; /** * Indicates edit mode if available. */ editNameActive: boolean; /** * Whether the unsaved draft is the viewed entry in preview mode. "Continue editing" is only offered while the * draft itself is on screen, not while a stored version is viewed alongside it. */ draftActive: boolean; /** * Whether an older stored version is shown instead of the current one. Editing always starts from the current * version, so the Edit item is hidden to avoid suggesting that the shown version would be edited. */ oldVersionActive: boolean; commentsActive: boolean; versionsActive: boolean; /** * Id used for handling drafts. * @internal */ draftKey?: string; /** * Query controller for getting file draft. * @internal */ private draftQuery; /** * Tracks which action events have listeners attached. */ hasEventListener: { [key: string]: boolean; }; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; /** * Open download URL for the current file. * @internal */ protected triggerDownload(): void; /** * Open external provider URL for the current file. * @internal */ protected triggerExternal(): void; /** * Open application-specific URL for the current file. * @internal */ protected triggerApplication(): void; /** * Emit an `save` event for requesting the current file to be saved. * * @internal * @returns Whether the event was not canceled. */ protected dispatchSave(): boolean; /** * Emit an `edit` event for requesting the current file to be edited. * * @internal * @param edit - Whether the file should be in edit mode. * @returns Whether the event was not canceled. */ protected dispatchEdit(edit: boolean): boolean; /** * Emit an `edit-name` event to enter rename mode for the current file. * * @internal * @returns Whether the event was not canceled. */ protected dispatchEditName(editName: boolean): boolean; /** * Emit a `subscribe` event toggling subscription state. * * @internal * @param subscribe - Desired subscription setting. */ protected dispatchSubscribe(subscribe: boolean): boolean; /** * Emit a `trash` event for the current file. * @internal */ protected dispatchTrash(): boolean; /** * Emit a `restore` event for the current file. * @internal */ protected dispatchRestore(): boolean; /** * Emit a `delete-forever` event for the current file. * @internal */ protected dispatchDeleteForever(): boolean; /** * Emit a `comments` event containing for showing or hiding file comments. * * @param show - Whether comments should be shown. * @returns Whether the event was not canceled. */ protected dispatchComments(show: boolean): boolean; /** * Emit a `versions` event for showing or hiding file versions. * * @param show - Whether versions should be shown. * @returns Whether the event was not canceled. */ protected dispatchVersions(show: boolean): boolean; protected toggleEdit(): void; protected toggleEditName(): void; protected toggleComments(): void; protected toggleVersions(): void; /** * Removes any draft for the current file. */ removeDraft(): void; isNotTemp(): boolean | undefined; willUpdate(changedProperties: PropertyValueMap): Promise; render(): import('../../node_modules/lit-html/node/lit-html.js').TemplateResult<1> | typeof nothing; } //# sourceMappingURL=wy-file-menu.d.ts.map