mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1139] People search - Provide an API to reset the search (#2196)
* People search provide a way to reset the search * Fix readme rules
This commit is contained in:
committed by
Eugenio Romano
parent
c6f00345d0
commit
925cd0f7f1
@@ -39,6 +39,11 @@
|
|||||||
- [Task People Component](#task-people-component)
|
- [Task People Component](#task-people-component)
|
||||||
* [Properties](#properties-8)
|
* [Properties](#properties-8)
|
||||||
+ [Events](#events-7)
|
+ [Events](#events-7)
|
||||||
|
+ [How to customize the people component behavior](#how-to-customize-the-people-component-behavior)
|
||||||
|
+ [Involve People single click and close search](#involve-people-single-click-and-close-search)
|
||||||
|
+ [Involve People single click without close search](#involve-people-single-click-without-close-search)
|
||||||
|
+ [Involve People double click and close search](#involve-people-double-click-and-close-search)
|
||||||
|
+ [Involve People double double without close search](#involve-people-double-double-without-close-search)
|
||||||
- [ADF Comments Component](#adf-comments-component)
|
- [ADF Comments Component](#adf-comments-component)
|
||||||
* [Properties](#properties-9)
|
* [Properties](#properties-9)
|
||||||
+ [Events](#events-8)
|
+ [Events](#events-8)
|
||||||
@@ -50,7 +55,7 @@
|
|||||||
+ [Events](#events-10)
|
+ [Events](#events-10)
|
||||||
- [People Search Component](#people-search-component)
|
- [People Search Component](#people-search-component)
|
||||||
* [Properties](#properties-12)
|
* [Properties](#properties-12)
|
||||||
* [Events](#events-12)
|
* [Events](#events-11)
|
||||||
- [Build from sources](#build-from-sources)
|
- [Build from sources](#build-from-sources)
|
||||||
- [NPM scripts](#npm-scripts)
|
- [NPM scripts](#npm-scripts)
|
||||||
- [Demo](#demo)
|
- [Demo](#demo)
|
||||||
@@ -474,6 +479,66 @@ This component displays involved users to a specified task
|
|||||||
|
|
||||||
No Events
|
No Events
|
||||||
|
|
||||||
|
#### How to customize the people component behavior
|
||||||
|
|
||||||
|
The people component provide two methods to customize the behavior:
|
||||||
|
- involveUserAndCloseSearch: The selected user is going to be added and the search section closed
|
||||||
|
- involveUserWithoutCloseSearch: The selected user is going to be added without close the search section
|
||||||
|
|
||||||
|
In this way will be easy customize the people component to involve the user with the single or double click event:
|
||||||
|
|
||||||
|
#### Involve People single click and close search
|
||||||
|
|
||||||
|
```html
|
||||||
|
<adf-people #people
|
||||||
|
(row-click)="people.involveUserAndCloseSearch()"
|
||||||
|
[people]="YOUR_INVOLVED_PEOPLE_LIST"
|
||||||
|
[taskId]="YOUR_TASK_ID"
|
||||||
|
[readOnly]="YOUR_READ_ONLY_FLAG">
|
||||||
|
</adf-people>
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Involve People single click without close search
|
||||||
|
|
||||||
|
```html
|
||||||
|
<adf-people #people
|
||||||
|
(row-click)="people.involveUserWithoutCloseSearch()"
|
||||||
|
[people]="YOUR_INVOLVED_PEOPLE_LIST"
|
||||||
|
[taskId]="YOUR_TASK_ID"
|
||||||
|
[readOnly]="YOUR_READ_ONLY_FLAG">
|
||||||
|
</adf-people>
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Involve People double click and close search
|
||||||
|
|
||||||
|
```html
|
||||||
|
<adf-people #people
|
||||||
|
(row-dblclick)="people.involveUserAndCloseSearch()"
|
||||||
|
[people]="YOUR_INVOLVED_PEOPLE_LIST"
|
||||||
|
[taskId]="YOUR_TASK_ID"
|
||||||
|
[readOnly]="YOUR_READ_ONLY_FLAG">
|
||||||
|
</adf-people>
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Involve People double double without close search
|
||||||
|
|
||||||
|
```html
|
||||||
|
<adf-people #people
|
||||||
|
(row-dblclick)="people.involveUserWithoutCloseSearch()"
|
||||||
|
[people]="YOUR_INVOLVED_PEOPLE_LIST"
|
||||||
|
[taskId]="YOUR_TASK_ID"
|
||||||
|
[readOnly]="YOUR_READ_ONLY_FLAG">
|
||||||
|
</adf-people>
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## ADF Comments Component
|
## ADF Comments Component
|
||||||
|
|
||||||
This component displays comments entered by involved users to a specified task. It also allows an involved user to add his/her comment to the task.
|
This component displays comments entered by involved users to a specified task. It also allows an involved user to add his/her comment to the task.
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
Binary file not shown.
After Width: | Height: | Size: 4.8 MiB |
@@ -2,6 +2,7 @@
|
|||||||
[rows]="users"
|
[rows]="users"
|
||||||
[actions]="hasActions()"
|
[actions]="hasActions()"
|
||||||
(rowClick)="selectUser($event)"
|
(rowClick)="selectUser($event)"
|
||||||
|
(rowDblClick)="selectUser($event)"
|
||||||
(showRowActionsMenu)="onShowRowActionsMenu($event)"
|
(showRowActionsMenu)="onShowRowActionsMenu($event)"
|
||||||
(executeRowAction)="onExecuteRowAction($event)">
|
(executeRowAction)="onExecuteRowAction($event)">
|
||||||
</adf-datatable>
|
</adf-datatable>
|
@@ -26,7 +26,7 @@
|
|||||||
<button md-button type="button" id="close-people-search" (click)="closeSearchList()">
|
<button md-button type="button" id="close-people-search" (click)="closeSearchList()">
|
||||||
{{'PEOPLE.DIALOG_CLOSE' | translate }}
|
{{'PEOPLE.DIALOG_CLOSE' | translate }}
|
||||||
</button>
|
</button>
|
||||||
<button md-button type="button" id="add-people" (click)="addInvolvedUser()">
|
<button md-button type="button" id="add-people" (click)="involveUserAndClose()">
|
||||||
<ng-content select="action-button-label"></ng-content>
|
<ng-content select="action-button-label"></ng-content>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -73,7 +73,12 @@ export class PeopleSearchComponent implements OnInit {
|
|||||||
this.closeSearch.emit();
|
this.closeSearch.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
addInvolvedUser() {
|
involveUserAndClose() {
|
||||||
|
this.involveUser();
|
||||||
|
this.closeSearchList();
|
||||||
|
}
|
||||||
|
|
||||||
|
involveUser() {
|
||||||
if (this.selectedUser === undefined) {
|
if (this.selectedUser === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -15,11 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AfterViewInit, Component, Input } from '@angular/core';
|
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
|
||||||
import { LogService } from 'ng2-alfresco-core';
|
import { LogService } from 'ng2-alfresco-core';
|
||||||
import { Observable, Observer } from 'rxjs/Rx';
|
import { Observable, Observer } from 'rxjs/Rx';
|
||||||
import { UserEventModel } from '../models/user-event.model';
|
import { UserEventModel } from '../models/user-event.model';
|
||||||
import { User } from '../models/user.model';
|
import { User } from '../models/user.model';
|
||||||
|
import { PeopleSearchComponent } from './people-search.component';
|
||||||
|
|
||||||
import { PeopleService } from '../services/people.service';
|
import { PeopleService } from '../services/people.service';
|
||||||
|
|
||||||
@@ -45,6 +46,9 @@ export class PeopleComponent implements AfterViewInit {
|
|||||||
@Input()
|
@Input()
|
||||||
readOnly: boolean = false;
|
readOnly: boolean = false;
|
||||||
|
|
||||||
|
@ViewChild(PeopleSearchComponent)
|
||||||
|
peopleSearch: PeopleSearchComponent;
|
||||||
|
|
||||||
showAssignment: boolean = false;
|
showAssignment: boolean = false;
|
||||||
|
|
||||||
private peopleSearchObserver: Observer<User[]>;
|
private peopleSearchObserver: Observer<User[]>;
|
||||||
@@ -74,6 +78,18 @@ export class PeopleComponent implements AfterViewInit {
|
|||||||
return isUpgraded;
|
return isUpgraded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
involveUserAndCloseSearch() {
|
||||||
|
if (this.peopleSearch) {
|
||||||
|
this.peopleSearch.involveUserAndClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
involveUserWithoutCloseSearch() {
|
||||||
|
if (this.peopleSearch) {
|
||||||
|
this.peopleSearch.involveUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
searchUser(searchedWord: string) {
|
searchUser(searchedWord: string) {
|
||||||
this.peopleService.getWorkflowUsers(this.taskId, searchedWord)
|
this.peopleService.getWorkflowUsers(this.taskId, searchedWord)
|
||||||
.subscribe((users) => {
|
.subscribe((users) => {
|
||||||
@@ -82,7 +98,6 @@ export class PeopleComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
involveUser(user: User) {
|
involveUser(user: User) {
|
||||||
this.showAssignment = false;
|
|
||||||
this.peopleService.involveUserWithTask(this.taskId, user.id.toString())
|
this.peopleService.involveUserWithTask(this.taskId, user.id.toString())
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.people = [...this.people, user];
|
this.people = [...this.people, user];
|
||||||
|
@@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<adf-people *ngIf="showInvolvePeople"
|
<adf-people *ngIf="showInvolvePeople" #people
|
||||||
[iconImageUrl]="peopleIconImageUrl"
|
[iconImageUrl]="peopleIconImageUrl"
|
||||||
[people]="taskPeople"
|
[people]="taskPeople"
|
||||||
[readOnly]="readOnlyForm"
|
[readOnly]="readOnlyForm"
|
||||||
|
4505
ng2-components/package-lock.json
generated
4505
ng2-components/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user