mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-10767] Separate core card view logic from content-services and add documentation to reflect the changes (#7952)
This commit is contained in:
53
docs/core/interfaces/base-card-view-update.interface.md
Normal file
53
docs/core/interfaces/base-card-view-update.interface.md
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
Title: Base Card View Update Interface
|
||||
Added: v6.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2022-11-25
|
||||
---
|
||||
|
||||
# [Base Card View Update interface](../../../lib/core/src/lib/card-view/interfaces/base-card-view-update.interface.ts "Defined in base-card-view-update.interface.ts")
|
||||
|
||||
Specifies required properties and methods for [Card View Update service](../../../lib/core/src/lib/card-view/services/card-view-update.service.ts).
|
||||
|
||||
## Basic usage
|
||||
|
||||
```ts
|
||||
export interface BaseCardViewUpdate {
|
||||
itemUpdated$: Subject<UpdateNotification>;
|
||||
itemClicked$: Subject<ClickNotification>;
|
||||
updateItem$: Subject<CardViewBaseItemModel>;
|
||||
|
||||
update(property: CardViewBaseItemModel, newValue: any);
|
||||
clicked(property: CardViewBaseItemModel);
|
||||
updateElement(notification: CardViewBaseItemModel);
|
||||
}
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| itemUpdated$ | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`UpdateNotification`](../../../lib/core/src/lib/card-view/interfaces/update-notification.interface.ts)`>` | The current updated item. |
|
||||
| itemClicked$ | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`ClickNotification`](../../../lib/core/src/lib/card-view/interfaces/click-notification.interface.ts)`>` | The current clicked item. |
|
||||
| updateItem$ | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts)`>` | The current model for the update item. |
|
||||
|
||||
### Methods
|
||||
|
||||
- **update**(property: [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts), newValue: `any`)<br/>
|
||||
Update itemUpdated$ property.
|
||||
|
||||
- property:\_ [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) - The property.
|
||||
- newValue:\_ `any` - new value.
|
||||
|
||||
- **clicked**(property: [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts))<br/>
|
||||
Update itemClicked$ property.
|
||||
|
||||
- property:\_ [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) - The property.
|
||||
|
||||
- **updateElement**(notification: [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts))<br/>
|
||||
Update updateItem$ observable.
|
||||
- notification:\_ [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) - The notification.
|
||||
|
||||
## See also
|
||||
|
||||
- [CardViewUpdate service](../services/card-view-update.service.md)
|
26
docs/core/interfaces/click-notification.interface.md
Normal file
26
docs/core/interfaces/click-notification.interface.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
Title: Click Notification Interface
|
||||
Added: v6.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2022-11-25
|
||||
---
|
||||
|
||||
# [Click Notification Interface](../../../lib/core/src/lib/card-view/interfaces/click-notification.interface.ts "Defined in click-notification.interface.ts")
|
||||
|
||||
## Basic usage
|
||||
|
||||
```ts
|
||||
export interface ClickNotification {
|
||||
target: any;
|
||||
}
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| target | `any` | The target for the click notification. |
|
||||
|
||||
## See also
|
||||
|
||||
- [BaseCardViewUpdate interface](../interfaces/base-card-view-update.interface.md)
|
28
docs/core/interfaces/update-notification.interface.md
Normal file
28
docs/core/interfaces/update-notification.interface.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
Title: Update Notification Interface
|
||||
Added: v6.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2022-11-25
|
||||
---
|
||||
|
||||
# [Update Notification Interface](../../../lib/core/src/lib/card-view/interfaces/update-notification.interface.ts "Defined in update-notification.interface.ts")
|
||||
|
||||
## Basic usage
|
||||
|
||||
```ts
|
||||
export interface UpdateNotification {
|
||||
target: CardViewBaseItemModel;
|
||||
changed: any;
|
||||
}
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| target | [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) | The target for the update notification. |
|
||||
| changed | `any` | The changed value on the update notification. |
|
||||
|
||||
## See also
|
||||
|
||||
- [BaseCardViewUpdate interface](../interfaces/base-card-view-update.interface.md)
|
@@ -2,12 +2,13 @@
|
||||
Title: Card View Update service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-14
|
||||
Last reviewed: 2022-11-25
|
||||
---
|
||||
|
||||
# [Card View Update service](lib/core/src/lib/card-view/services/card-view-update.service.ts "Defined in card-view-update.service.ts")
|
||||
# [Card View Update service](../../../lib/core/src/lib/card-view/services/card-view-update.service.ts "Defined in card-view-update.service.ts")
|
||||
|
||||
Reports edits and clicks within fields of a [Card View component](../components/card-view.component.md).
|
||||
Implements [`BaseCardViewUpdate`](../../../lib/core/src/lib/card-view/interfaces/base-card-view-update.interface.ts).
|
||||
|
||||
## Details
|
||||
|
||||
@@ -55,7 +56,7 @@ constructor(private cardViewUpdateService: CardViewUpdateService) {
|
||||
}
|
||||
```
|
||||
|
||||
The constructor here also sets the [`CardViewTextItemModel`](lib/core/src/lib/card-view/models/card-view-textitem.model.ts) instances that define the layout of the
|
||||
The constructor here also sets the [`CardViewTextItemModel`](../../../lib/core/src/lib/card-view/models/card-view-textitem.model.ts) instances that define the layout of the
|
||||
card view (see the [Card View component](../components/card-view.component.md) for further information
|
||||
about this). The model objects and the `key` property are used to identify which item has been clicked
|
||||
or updated when an event occurs.
|
||||
@@ -77,7 +78,7 @@ called after updates and clicks, respectively.
|
||||
|
||||
### Responding to updates
|
||||
|
||||
The update function is passed a parameter of type [`UpdateNotification`](lib/core/src/lib/card-view/services/card-view-update.service.ts):
|
||||
The update function is passed a parameter of type [`UpdateNotification`](../../../lib/core/src/lib/card-view/interfaces/update-notification.interface.ts):
|
||||
|
||||
```ts
|
||||
export interface UpdateNotification {
|
||||
@@ -86,8 +87,8 @@ export interface UpdateNotification {
|
||||
}
|
||||
```
|
||||
|
||||
Here, `target` contains the [`CardViewTextItemModel`](lib/core/src/lib/card-view/models/card-view-textitem.model.ts) that was used to initialize
|
||||
the field in question (in practice, this might be a [`CardViewDateItemModel`](lib/core/src/lib/card-view/models/card-view-dateitem.model.ts) or [`CardViewMapItemModel`](lib/core/src/lib/card-view/models/card-view-mapitem.model.ts) if
|
||||
Here, `target` contains the [`CardViewTextItemModel`](../../../lib/core/src/lib/card-view/models/card-view-textitem.model.ts) that was used to initialize
|
||||
the field in question (in practice, this might be a [`CardViewDateItemModel`](../../../lib/core/src/lib/card-view/models/card-view-dateitem.model.ts) or [`CardViewMapItemModel`](../../../lib/core/src/lib/card-view/models/card-view-mapitem.model.ts) if
|
||||
the card layout includes these objects). The `changed` property contains an object with a single property:
|
||||
|
||||
```ts
|
||||
@@ -115,7 +116,7 @@ on the [Card View component](../components/card-view.component.md) itself.
|
||||
|
||||
### Responding to clicks
|
||||
|
||||
The click function is passed a [`ClickNotification`](lib/core/src/lib/card-view/services/card-view-update.service.ts) object, which is similar to [`UpdateNotification`](lib/core/src/lib/card-view/services/card-view-update.service.ts) described above,
|
||||
The click function is passed a [`ClickNotification`](../../../lib/core/src/lib/card-view/interfaces/click-notification.interface.ts) object, which is similar to [`UpdateNotification`](../../../lib/core/src/lib/card-view/interfaces/update-notification.interface.ts) described above,
|
||||
but without the `changed` property. Use the `target` property to identify the item that was clicked:
|
||||
|
||||
```ts
|
||||
@@ -128,7 +129,7 @@ Note that this function will only be called if the `clickable` property of the m
|
||||
|
||||
## Update cardview update item
|
||||
|
||||
[`updateElement`](lib/core/src/lib/card-view/services/card-view-update.service.ts) function helps to update the card view item. It takes the [`CardViewBaseItemModel`](lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) type object as parameter.
|
||||
[`updateElement`](../../../lib/core/src/lib/card-view/services/card-view-update.service.ts) function helps to update the card view item. It takes the [`CardViewBaseItemModel`](../../../lib/core/src/lib/card-view/models/card-view-baseitem.model.ts) type object as parameter.
|
||||
|
||||
Example
|
||||
|
||||
@@ -139,3 +140,5 @@ Example
|
||||
## See also
|
||||
|
||||
- [Card view component](../components/card-view.component.md)
|
||||
- [UpdateNotification interface](../interfaces/update-notification.interface.md)
|
||||
- [ClickNotification interface](../interfaces/click-notification.interface.md)
|
||||
|
Reference in New Issue
Block a user