mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-7403: migrate site dropdown to standalone (#9847)
This commit is contained in:
@@ -1,36 +1,30 @@
|
||||
---
|
||||
Title: Image Resolver Model
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-02-08
|
||||
---
|
||||
|
||||
# [Image Resolver Model](../../../lib/content-services/document-list/data/image-resolver.model.ts "Defined in image-resolver.model.ts")
|
||||
# Image Resolver Model
|
||||
|
||||
Defines the Image Resolver function used by the [Document List Component](../components/document-list.component.md).
|
||||
|
||||
## Definitions
|
||||
|
||||
- `type` **[`ImageResolver`](../../../lib/content-services/src/lib/document-list/data/image-resolver.model.ts)** = (row: [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts), column: [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts)) => `string`
|
||||
- _row:_ [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts) - Data that defines the row
|
||||
- _column:_ [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts) - Data that defines the column
|
||||
- `type` **ImageResolver** = (row: `DataRow`, column: `DataColumn`) => `string`
|
||||
- _row:_ `DataRow` - Data that defines the row
|
||||
- _column:_ `DataColumn` - Data that defines the column
|
||||
- **Returns** File path for the image
|
||||
|
||||
## Details
|
||||
|
||||
An image resolver function selects an image file path for an item in
|
||||
a [Document List Component](../components/document-list.component.md)
|
||||
or another component that uses the Document List (such as the
|
||||
[Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)). You can supply your own image resolver
|
||||
to manage the way folder/file icons and thumbnails are resolved (ie, which image is shown for which item).
|
||||
An image resolver function selects an image file path for an item in a [Document List Component](../components/document-list.component.md)
|
||||
or another component that uses the Document List (such as the [Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)).
|
||||
|
||||
You can supply your own image resolver to manage the way folder/file icons and thumbnails are resolved (ie, which image is shown for which item).
|
||||
|
||||
**Note:** Image resolvers are executed only for columns of the `image` type.
|
||||
|
||||
A typical image resolver implementation receives [`DataRow`](../../../lib/core/src/lib/datatable/data/data-row.model.ts) and [`DataColumn`](../../../lib/core/src/lib/datatable/data/data-column.model.ts) objects as parameters:
|
||||
A typical image resolver implementation receives `DataRow` and `DataColumn` objects as parameters:
|
||||
|
||||
```ts
|
||||
myImageResolver(row: DataRow, col: DataColumn): string {
|
||||
return '/path/to/image';
|
||||
export class MyComponent {
|
||||
myImageResolver(row: DataRow, col: DataColumn): string {
|
||||
return '/path/to/image';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -74,15 +68,13 @@ export class View1 {
|
||||
let name = row.getValue(col.key);
|
||||
|
||||
// Format image url
|
||||
return `http://<my custom path to folder icon>/${name}`;
|
||||
return `https://<my custom path to folder icon>/${name}`;
|
||||
}
|
||||
|
||||
// For the rest of the cases just fallback to default behaviour.
|
||||
return null;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user