From f5d2269c2e44e995ebbfb4798d1c9fe1a2551bde Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Mon, 16 Jan 2017 11:50:14 +0000 Subject: [PATCH] #1112 Use the mdl-chip (#1466) * #1112 Use the mdl-chip * fix unit test --- .../ng2-activiti-tasklist/README.md | 1 + .../src/assets/images/user.jpg | Bin 0 -> 6961 bytes .../activiti-people-search.component.css | 18 ++++++++++++++++++ .../activiti-people-search.component.html | 9 ++++----- .../activiti-people-search.component.spec.ts | 10 ++++++---- .../activiti-people-search.component.ts | 6 ++++++ .../components/activiti-people.component.html | 14 ++++++-------- .../components/activiti-people.component.ts | 5 +++++ .../activiti-task-details.component.html | 2 +- .../activiti-task-details.component.ts | 3 +++ 10 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 ng2-components/ng2-activiti-tasklist/src/assets/images/user.jpg diff --git a/ng2-components/ng2-activiti-tasklist/README.md b/ng2-components/ng2-activiti-tasklist/README.md index 11aacfe5cf..a972fff803 100644 --- a/ng2-components/ng2-activiti-tasklist/README.md +++ b/ng2-components/ng2-activiti-tasklist/README.md @@ -267,6 +267,7 @@ The component shows the details of the task id passed in input | `showFormRefreshButton` | {boolean} | optional | Toggle rendering of the `Refresh` button. | | `showFormSaveButton` | {boolean} | optional | Toggle rendering of the `Save` outcome button. | | `showFormCompleteButton` | {boolean} | optional | Toggle rendering of the Form `Complete` outcome button | +| `peopleIconImageUrl` | {string} | optional | Define a custom people icon image | ### Custom 'empty Activiti Task Details' template diff --git a/ng2-components/ng2-activiti-tasklist/src/assets/images/user.jpg b/ng2-components/ng2-activiti-tasklist/src/assets/images/user.jpg new file mode 100644 index 0000000000000000000000000000000000000000..930ab14f0b20c224bad94fee8df1f9839854c8e9 GIT binary patch literal 6961 zcmZ8l1y~f{*B)59mk!AVq!Cscq`PBD0qO2eMG&N=q)WPGfdxTSkPhiaI+v0X3FX^g z{QuAQeeZpqxpQak#5?DmbM86!^Y?22iJFqC5`cyV0BEQN+%Ez00Q!Fc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AOjyJO8rD5q8^#O z<+-bdhbiUfFRe}WKVF2imeGBR<#!B8Sj^{8UMZ%nBveZ-Gf&!=jy@|?-gfGH3cfM* vN+y4TxTtCE=HHMkp1fY%Pb+PBBrO}i3wc$)NtDx|P|j^(mXMIFf4}fQiA~1H literal 0 HcmV?d00001 diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.css b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.css index 11c70fd077..2bbb854137 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.css +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.css @@ -16,3 +16,21 @@ padding-bottom: 0px; padding-left: 0px; } + +.mdl-chip-search-people{ + margin: auto; + min-width: 60%; +} + +.mdl-chip-search-people:hover{ + background-color: #c1c1c1; + cursor: pointer; +} + +.mdl-chip-search-people img{ + margin-left: -30px; +} + +.mdl-chip-search-people__text{ + padding-left: 10px; +} \ No newline at end of file diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.html index b6e13ddeb3..94a6dc7075 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.html @@ -5,11 +5,10 @@
  • - - face - {{getDisplayUser(user)}} - +
  • No user found to involve diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.spec.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.spec.ts index 144604d799..ab0e57f66e 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.spec.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.spec.ts @@ -109,10 +109,11 @@ describe('ActivitiPeopleSearch', () => { searchInput.dispatchEvent(new Event('input')); }); - it('should send an event when an user is clicked', async(() => { + it('should send an event when an user is clicked', (done) => { activitiPeopleSearchComponent.onRowClicked.subscribe((user) => { expect(user).toBeDefined(); expect(user.firstName).toBe('fake-name'); + done(); }); activitiPeopleSearchComponent.results = Observable.of(userArray); activitiPeopleSearchComponent.ngOnInit(); @@ -122,9 +123,9 @@ describe('ActivitiPeopleSearch', () => { let userToSelect = element.querySelector('#user-1'); userToSelect.click(); }); - })); + }); - it('should remove clicked user', async(() => { + it('should remove clicked user', (done) => { activitiPeopleSearchComponent.results = Observable.of(userArray); activitiPeopleSearchComponent.ngOnInit(); fixture.detectChanges(); @@ -135,6 +136,7 @@ describe('ActivitiPeopleSearch', () => { fixture.whenStable() .then(() => { expect(element.querySelector('#user-1')).toBeNull(); + done(); }); - })); + }); }); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.ts index 687a74c1f8..a06b06cb55 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-search.component.ts @@ -32,6 +32,11 @@ declare let componentHandler: any; export class ActivitiPeopleSearch implements OnInit, AfterViewInit { + baseComponentPath = module.id.replace('/activiti-people-search.component.js', ''); + + @Input() + iconImageUrl: string; + @Input() results: Observable; @@ -81,6 +86,7 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit { onRowClick(userClicked: User) { this.onRowClicked.emit(userClicked); this.userList = this.userList.filter((user) => { + this.searchUser.reset(); return user.id !== userClicked.id; }); } diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.html index 7e5cdbf1a1..e11aa7d557 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.html @@ -7,14 +7,11 @@ @@ -27,7 +24,8 @@
    + [results]="peopleSearch$" + [iconImageUrl]="iconImageUrl">
    diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.ts index e4213f2d24..cc4733429e 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people.component.ts @@ -31,6 +31,11 @@ declare let dialogPolyfill: any; }) export class ActivitiPeople { + baseComponentPath = module.id.replace('/activiti-people.component.js', ''); + + @Input() + iconImageUrl: string; + @Input() people: User [] = []; diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html index 7d1d86a2b3..46be6220d5 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html @@ -15,7 +15,7 @@ (claim)="onClaimTask($event)">
    -
    diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts index ee5574ce03..1abb7e4ab8 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.ts @@ -61,6 +61,9 @@ export class ActivitiTaskDetails implements OnInit, OnChanges { @Input() showFormRefreshButton: boolean = true; + @Input() + peopleIconImageUrl: string; + @Output() formSaved: EventEmitter = new EventEmitter();