[ADF-4152] Restructured Content Services docs (#4429)

* [ADF-4152] Moved content services docs to subfolders

* [ADF-4152] Manual URL fixes for cont services docs

* [ADF-4152] Moved content services docs to subfolders

* [ADF-4152] Manual URL fixes for cont services docs

* [ADF-4152] Updated doc index pages for content services
This commit is contained in:
Andy Stark
2019-03-13 18:44:37 +00:00
committed by Eugenio Romano
parent bc5208b767
commit dfea5c2f04
72 changed files with 958 additions and 1055 deletions

View File

@@ -0,0 +1,92 @@
---
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")
Defines the Image Resolver function used by the [Document List Component](../components/document-list.component.md).
## Definitions
- `type` **ImageResolver** = (row: [`DataRow`](../../../lib/core/datatable/data/data-row.model.ts), column: [`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts)) => `string`
- _row:_ [`DataRow`](../../../lib/core/datatable/data/data-row.model.ts) - Data that defines the row
- _column:_ [`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts) - 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).
**Note:** Image resolvers are executed only for columns of the `image` type.
A typical image resolver implementation receives [`DataRow`](../../../lib/core/datatable/data/data-row.model.ts) and [`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts) objects as parameters:
```ts
myImageResolver(row: DataRow, col: DataColumn): string {
return '/path/to/image';
}
```
Your function can return `null` or `false` values to fall back to the default image
resolving behavior.
_Note that for the sake of simplicity the example code below was reduced to the main points of interest only._
**View1.component.html**
```html
<adf-document-list
[imageResolver]="folderImageResolver">
<data-columns>
<data-column key="name" type="image"></data-column>
</data-columns>
</adf-document-list>
```
**View1.component.ts**
```ts
import { DataColumn, DataRow } from '@alfresco/adf-core';
import { ImageResolver } from '@alfresco/adf-content-services';
export class View1 {
folderImageResolver: ImageResolver;
constructor() {
// Customize folder icons, leave file icons untouched
this.folderImageResolver = (row: DataRow, col: DataColumn) => {
let isFolder = <boolean> row.getValue('isFolder');
if (isFolder) {
// (optional) You may want dynamically getting the column value
let name = row.getValue(col.key);
// Format image url
return `http://<my custom path to folder icon>/${name}`;
}
// For the rest of the cases just fallback to default behaviour.
return null;
};
}
}
```
## See also
- [Document List Component](../components/document-list.component.md)
- [Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)

View File

@@ -0,0 +1,78 @@
---
Title: Permission Style model
Added: v2.0.0
Status: Active
Last reviewed: 2019-02-13
---
# [Permission Style model](../../../lib/content-services/document-list/models/permissions-style.model.ts "Defined in permissions-style.model.ts")
Sets custom CSS styles for rows of a Document List according to the item's permissions.
## Class members
### Properties
| [`Property`](../../../lib/content-services/content-metadata/interfaces/property.interface.ts) | Type | Description |
| --------------------------------------------------------------------------------------------- | ---- | ----------- |
| isFile | boolean | Does this style apply to files? |
| isFolder | boolean | Does this style apply to folders? |
| permission | Permissions | An enum value defining the permissions that this style applies to (see below) |
| css | string | The name of the CSS class to add |
## Details
You can customize the style of a [Document List](../components/document-list.component.md) row based on the user's
permissions for that item. The list has a `permissionsStyle` property containing an array of
[Permission Style model](permissions-style.model.md) objects. These objects associate a particular CSS style with a permission level
and can be applied separately to files and folders by setting `isFile` and `isFolder` appropriately.
### Permissions enum
The [Allowable Operations](https://github.com/Alfresco/alfresco-ng2-components/blob/development/lib/core/models/allowable-operations.enum.ts)
enum contains all the valid permissions for which you can apply custom styles: **DELETE**, **UPDATE**,
**CREATE**, **UPDATEPERMISSIONS**, **NOT_DELETE**, **NOT_UPDATE**, **NOT_CREATE**, **NOT_UPDATEPERMISSIONS**.
### Examples
If you want to change the style on rows where the user can create content:
```ts
let permissionsStyle: PermissionStyleModel[] = [];
this.permissionsStyle.push(new PermissionStyleModel('document-list__create', AllowableOperationsEnum.CREATE));
```
```html
<adf-document-list [permissionsStyle]="permissionsStyle">
</adf-document-list>
```
```css
adf-document-list ::ng-deep adf-datatable tr.document-list__create {
background: green !important;
}
```
If you want to change the style on the folders where the user doesn't have the permission to update:
```ts
let permissionsStyle: PermissionStyleModel[] = [];
this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', AllowableOperationsEnum.NOT_UPDATE, false, true));
```
```html
<adf-document-list [permissionsStyle]="permissionsStyle">
</adf-document-list>
```
```css
adf-document-list ::ng-deep adf-datatable tr.document-list__disable {
background: red !important;
}
```
## See also
- [Document list component](../components/document-list.component.md)

View File

@@ -0,0 +1,76 @@
---
Title: Row Filter Model
Added: v2.0.0
Status: Active
Last reviewed: 2019-02-08
---
# [Row Filter Model](../../../lib/content-services/document-list/data/row-filter.model.ts "Defined in row-filter.model.ts")
Defines the Row Filter function used by the [Document List Component](../components/document-list.component.md).
## Definitions
- `type` **RowFilter** = (value: [`ShareDataRow`](../../../lib/content-services/document-list/data/share-data-row.model.ts), index: `number`, array: [`ShareDataRow`](../../../lib/content-services/document-list/data/share-data-row.model.ts)`[]`) => any
- _value:_ [`ShareDataRow`](../../../lib/content-services/document-list/data/share-data-row.model.ts) - Data that defines the row
- _index:_ `number` - Index of the row within the list
- _array:_ [`ShareDataRow`](../../../lib/content-services/document-list/data/share-data-row.model.ts)`[]` - The full set of rows for the list
- **Returns** True if the row should be shown, false otherwise
## Details
A row filter function selectively hides or shows rows from 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 row filter to customize the behavior of the list.
The function returns `true` if the row should be
displayed or `false` if it should be hidden.
A typical row filter implementation receives at least a [`ShareDataRow`](../../../lib/content-services/document-list/data/share-data-row.model.ts) object as a parameter:
```ts
myFilter(row: ShareDataRow): boolean {
return true;
}
```
_Note that for the sake of simplicity the example code below was reduced to the main points of interest only._
**View1.component.html**
```html
<adf-document-list
[rowFilter]="folderFilter">
</adf-document-list>
```
**View1.component.ts**
```ts
import { RowFilter, ShareDataRow } from '@alfresco/adf-content-services';
export class View1 {
folderFilter: RowFilter;
constructor() {
// This filter will make the document list show only folders
this.folderFilter = (row: ShareDataRow) => {
let node = row.node.entry;
if (node && node.isFolder) {
return true;
}
return false;
};
}
}
```
## See also
- [Document List Component](../components/document-list.component.md)
- [Content Node Selector Panel Component](../components/content-node-selector-panel.component.md)