## class: `WyFilesGrid`, `wy-files-grid`

Grid view renderer for files (card view).

**Used sub components:**

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

### Fields

| Name               | Type                     | Default | Description                                                     | Inherited From        |
| ------------------ | ------------------------ | ------- | --------------------------------------------------------------- | --------------------- |
| `selectedId`       | `number \| undefined`    | `NaN`   | File id that is selected.                                       |                       |
| `previousPagerRef` | `RefOrCallback<Element>` |         | Reference to the pager element for loading previous items.      |                       |
| `nextPagerRef`     | `RefOrCallback<Element>` |         | Reference to the pager element for loading next items.          |                       |
| `link`             | `LinkType \| undefined`  |         | Any provided link that should be loaded, shown and highlighted. | WeavySubTypeComponent |

### Methods

| Name             | Description                                           | Parameters                        | Return                       | Inherited From        |
| ---------------- | ----------------------------------------------------- | --------------------------------- | ---------------------------- | --------------------- |
| `dispatchOrder`  | Emit an \`order\` event with the selected sort order. | `order: FileOrderType`            |                              |                       |
| `whenLink`       | Resolves when a provided link is available.           |                                   | `Promise<LinkType>`          | WeavySubTypeComponent |
| `whenReady`      | Resolves when the component has rendered first time.  |                                   | `Promise<WeavySubComponent>` | WeavySubComponent     |
| `dispatchAction` | Dispatch a \`wy-action\` event on the component.      | `detail: WyActionEventDetailType` | `boolean`                    | WeavySubComponent     |

### Events

| Name        | Type                            | Description                                       | Inherited From    |
| ----------- | ------------------------------- | ------------------------------------------------- | ----------------- |
| `wy-action` | `WyActionEventType`             | Emitted when an action is performed on an entity. |                   |
| `order`     | `OrderEventType<FileOrderType>` | Emitted when the user changes sort order.         |                   |
| `ready`     | `CustomEvent`                   | When the component has rendered.                  | WeavySubComponent |

### Attributes

| Name         | Field      | Inherited From |
| ------------ | ---------- | -------------- |
| `selectedId` | selectedId |                |

### CSS Parts

| Name                  | Description                                    |
| --------------------- | ---------------------------------------------- |
| `wy-grid`             | Card grid layout                               |
| `wy-card`             | Card root container                            |
| `wy-trashed`          | Modifier for trashed cards                     |
| `wy-card-interactive` | Hoverable card modifier                        |
| `wy-highlight`        | Highlighted card modifier                      |
| `wy-card-actions`     | Container for per-card actions                 |
| `wy-card-image`       | Thumbnail image area                           |
| `wy-card-image-top`   | Modifier for image top area                    |
| `wy-card-icon`        | Icon area for non-image files                  |
| `wy-card-title`       | Card title area                                |
| `wy-card-text`        | Text in the card                               |
| `wy-card-button-icon` | Title action / badge                           |
| `wy-badge`            | Badge used for comment counts                  |
| `wy-pager`            | Pager anchor for infinite scrolling detection. |
| `wy-pager-overlay`    | Modifier for overlaying pager.                 |
| `wy-pager-top`        | Modifier for pager placed in the top.          |
| `wy-pager-bottom`     | Modifier for pager placed in the bottom.       |

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

### Fields

| Name                        | Privacy | Type                                                               | Default                                                                               | Description | Inherited From        |
| --------------------------- | ------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | ----------- | --------------------- |
| `#resolveContextDataBlobs`  | private | `(blobs: ContextDataBlobsType) => void \| undefined`               |                                                                                       |             | WeavySubTypeComponent |
| `#whenContextDataBlobs`     | private |                                                                    | `new Promise<ContextDataBlobsType>((r) => { this.#resolveContextDataBlobs = r; })`    |             | WeavySubTypeComponent |
| `#resolveComponentFeatures` | private | `(componentFeatures: ComponentFeaturePolicy) => void \| undefined` |                                                                                       |             | WeavySubTypeComponent |
| `#whenComponentFeatures`    | private |                                                                    | `new Promise<ComponentFeaturePolicy>((r) => { this.#resolveComponentFeatures = r; })` |             | WeavySubTypeComponent |
| `#resolveLink`              | private | `(link: LinkType) => void \| undefined`                            |                                                                                       |             | WeavySubTypeComponent |
| `#whenLink`                 | private |                                                                    | `new Promise<LinkType>((r) => { this.#resolveLink = r; })`                            |             | WeavySubTypeComponent |
| `#resolveSettings`          | private | `(settings: WeavyComponentSettingsType) => void \| undefined`      |                                                                                       |             | WeavySubTypeComponent |
| `#whenSettings`             | private |                                                                    | `new Promise<WeavyComponentSettingsType>((r) => { this.#resolveSettings = r; })`      |             | WeavySubTypeComponent |
| `#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`                        | `WyFilesGrid`   | WyFilesGrid | lib/components/wy-files-grid.ts |         |
| `custom-element-definition` | `wy-files-grid` | WyFilesGrid | lib/components/wy-files-grid.ts |         |
