## class: `WyFileTable`, `wy-file-table`

Table view for file lists.

**Used sub components:**

*   [`<wy-file-menu>`](./wy-file-menu)
*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-button>`](./ui/wy-button)

### Fields

| Name    | Type                      | Default                             | Description                       | Inherited From |
| ------- | ------------------------- | ----------------------------------- | --------------------------------- | -------------- |
| `files` | `FileType[] \| undefined` |                                     | Files rendered in the table view. |                |
| `order` | `FileOrderType`           | `{ by: "name", descending: false }` | Active sort order for the table.  |                |

### Methods

| Name                     | Description                                                              | Parameters                                                                                                                       | Return                       | Inherited From    |
| ------------------------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----------------- |
| `dispatchFileOpen`       | Emit a \`file-open\` event requesting preview for the supplied file.     | `fileId: number, tab: "comments" \| "versions"`                                                                                  |                              |                   |
| `dispatchOrder`          | Emit an \`order\` event with the provided sort order.                    | `order: FileOrderType`                                                                                                           |                              |                   |
| `dispatchEditName`       | Emit an \`edit-name\` event to enter rename mode for the specified file. | `file: FileType`                                                                                                                 |                              |                   |
| `dispatchRename`         | Emit a \`rename\` event carrying the updated filename.                   | `file: FileType, name: string`                                                                                                   |                              |                   |
| `dispatchTrash`          | Emit a \`trash\` event to move the file to the recycle bin.              | `file: FileType`                                                                                                                 |                              |                   |
| `dispatchRestore`        | Emit a \`restore\` event to recover a trashed file.                      | `file: FileType`                                                                                                                 |                              |                   |
| `dispatchDeleteForever`  | Emit a \`delete-forever\` event to permanently remove the file.          | `file: FileType`                                                                                                                 |                              |                   |
| `dispatchSubscribe`      | Emit a \`subscribe\` event toggling subscription state for the file.     | `file: FileType, subscribe: boolean`                                                                                             |                              |                   |
| `renderFileTable`        | Render the complete file table layout.                                   | `files: FileType[], order: FileOrderType, isRenamingId: number, highlightId: number, highlightRef: Ref`                          |                              |                   |
| `renderFileTableHeaders` | Render table header cells with sorting affordances.                      | `order: FileOrderType`                                                                                                           |                              |                   |
| `renderFileTableRow`     | Render a single file table row.                                          | `weavy: WeavyType \| undefined, { file }: { file: FileType }, isRenamingId: number, highlightId: number, highlightRef: Ref, row` |                              |                   |
| `whenReady`              | Resolves when the component has rendered first time.                     |                                                                                                                                  | `Promise<WeavySubComponent>` | WeavySubComponent |

### Events

| Name             | Type                            | Description                                      | Inherited From    |
| ---------------- | ------------------------------- | ------------------------------------------------ | ----------------- |
| `file-open`      | `FileOpenEventType`             | Emitted when a file should be opened in preview. |                   |
| `order`          | `OrderEventType<FileOrderType>` | Emitted when the user changes sort order.        |                   |
| `edit-name`      | `FileEditNameEventType`         | Emitted when rename mode is activated.           |                   |
| `rename`         | `FileRenameEventType`           | Emitted when a file is renamed.                  |                   |
| `trash`          | `FileTrashEventType`            | Emitted when a file is trashed.                  |                   |
| `restore`        | `FileRestoreEventType`          | Emitted when a file is restored.                 |                   |
| `delete-forever` | `FileDeleteForeverEventType`    | Emitted when a file is permanently deleted.      |                   |
| `subscribe`      | `FileSubscribeEventType`        | Emitted when subscribe state is toggled.         |                   |
| `ready`          | `CustomEvent`                   | When the component has rendered.                 | WeavySubComponent |

### CSS Parts

| Name                   | Description                      |
| ---------------------- | -------------------------------- |
| `wy-table`             | Table root element               |
| `wy-table-interactive` | Modifier for hoverable rows      |
| `wy-tr`                | Table rows                       |
| `wy-th`                | Table header cells               |
| `wy-col-icon`          | Cells that contain icons/actions |
| `wy-col-icon-content`  | Content in icon/action cells     |
| `wy-col-name`          | Cells that contain name          |
| `wy-col-time`          | Cells that contain time          |
| `wy-col-kind`          | Cells that contain kind          |
| `wy-col-size`          | Cells that contain size          |
| `wy-sort-link`         | Sortable table header cell       |
| `wy-input`             | Input field for file rename.     |
| `wy-highlight`         | Modifier for highlighted row     |
| `wy-trashed`           | Modifier for trashed row.        |
| `wy-badge`             | Badge used for comment counts    |

<details><summary>Private API</summary>

### Fields

| Name                | Privacy | Type                                                  | Default                                                              | Description | Inherited From    |
| ------------------- | ------- | ----------------------------------------------------- | -------------------------------------------------------------------- | ----------- | ----------------- |
| `#resolveContextId` | private | `(contextId: ContextIdType) => void \| undefined`     |                                                                      |             | WeavySubComponent |
| `#whenContextId`    | private |                                                       | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })` |             | WeavySubComponent |
| `#resolveUser`      | private | `(user: UserType) => void \| undefined`               |                                                                      |             | WeavySubComponent |
| `#whenUser`         | private |                                                       | `new Promise<UserType>((r) => { this.#resolveUser = r; })`           |             | WeavySubComponent |
| `#resolveWeavy`     | private | `(weavy: WeavyType) => void \| undefined`             |                                                                      |             | WeavySubComponent |
| `#whenWeavy`        | private |                                                       | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`         |             | WeavySubComponent |
| `#resolveReady`     | private | `(component: WeavySubComponent) => void \| undefined` |                                                                      |             | WeavySubComponent |
| `#whenReady`        | private |                                                       | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })` |             | WeavySubComponent |

</details>

<hr/>

## Exports

| Kind                        | Name            | Declaration | Module                          | Package |
| --------------------------- | --------------- | ----------- | ------------------------------- | ------- |
| `js`                        | `WyFileTable`   | WyFileTable | lib/components/wy-file-table.ts |         |
| `custom-element-definition` | `wy-file-table` | WyFileTable | lib/components/wy-file-table.ts |         |
