mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4009] - People/GroupComponentDemoPage - add role input filter (#4260)
* [ADF-4009] - add roles input for GroupCloudComponent * [ADF-4009] - fix lint * [ADF-4009] - change role variable name * [ADF-4009] - fix PR changes and add people input filter * [ADF-4009] - fix lint
This commit is contained in:
committed by
Maurizio Vitale
parent
2badd81634
commit
fc642bcb6a
@@ -292,7 +292,8 @@
|
||||
"PEOPLE_GROUPS_CLOUD": {
|
||||
"SINGLE": "Single",
|
||||
"MULTI": "Multi",
|
||||
"PRESELECTED_VALUE": "Preselected value"
|
||||
"PRESELECTED_VALUE": "Preselect value",
|
||||
"ROLE": "Preselect roles"
|
||||
},
|
||||
"ABOUT": {
|
||||
"TITLE": "Plugins",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<mat-card class="adf-people-groups-section">
|
||||
<mat-card class="adf-section">
|
||||
<mat-card-title>
|
||||
{{ 'APP_LAYOUT.PEOPLE_CLOUD' | translate}}
|
||||
</mat-card-title>
|
||||
@@ -6,16 +6,22 @@
|
||||
<mat-card-content>
|
||||
<div class="people-control-options">
|
||||
<mat-radio-group (change)="onChangePeopleMode($event)">
|
||||
<mat-radio-button class="adf-people-single-mode" value="{{ peopleSingleMode }}">{{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-multiple-mode" value="{{ peopleMultipleMode }}">{{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-single-mode" value="{{ peopleSingleMode }}">{{
|
||||
'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-multiple-mode" value="{{ peopleMultipleMode }}">{{
|
||||
'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<mat-form-field class="adf-preselect-value">
|
||||
<mat-label>{{ 'PEOPLE_GROUPS_CLOUD.ROLE' | translate }}</mat-label>
|
||||
<input matInput (input)="setPeopleRoles($event)" placeholder="['ACTIVITI_ADMIN']" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="adf-preselect-value">
|
||||
<mat-label>{{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }}</mat-label>
|
||||
<input matInput (input)="setPeoplePreselectValue($event.target.value)" />
|
||||
<input matInput (input)="setPeoplePreselectValue($event)" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<adf-cloud-people [preSelectUsers]="preSelectUsers" [mode]="peopleMode"></adf-cloud-people>
|
||||
<adf-cloud-people [preSelectUsers]="preSelectUsers" [roles]="peopleRoles" [mode]="peopleMode"></adf-cloud-people>
|
||||
</div>
|
||||
|
||||
<div class="adf-people-list" *ngIf="canShowPeopleList()">
|
||||
@@ -29,7 +35,7 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="adf-people-groups-section">
|
||||
<mat-card class="adf-section">
|
||||
<mat-card-title>
|
||||
{{ 'APP_LAYOUT.GROUPS_CLOUD' | translate}}
|
||||
</mat-card-title>
|
||||
@@ -37,12 +43,18 @@
|
||||
<mat-card-content>
|
||||
<div class="groups-control-options">
|
||||
<mat-radio-group (change)="onChangeGroupsMode($event)">
|
||||
<mat-radio-button class="adf-people-single-mode" value="{{ groupSingleMode }}">{{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-multiple-mode" value="{{ groupMultipleMode }}">{{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-single-mode" value="{{ groupSingleMode }}">{{
|
||||
'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="adf-people-multiple-mode" value="{{ groupMultipleMode }}">{{
|
||||
'PEOPLE_GROUPS_CLOUD.MULTI' | translate }}</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<mat-form-field class="adf-preselect-value">
|
||||
<mat-label>{{ 'PEOPLE_GROUPS_CLOUD.ROLE' | translate }}</mat-label>
|
||||
<input matInput (input)="setGroupRoles($event)" placeholder="['ACTIVITI_ADMIN']" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<adf-cloud-group [mode]="groupMode" [preSelectGroups]="preSelectGroup" (selectGroup)="onSelectGroup($event)"
|
||||
<adf-cloud-group [mode]="groupMode" [roles]="groupRoles" [preSelectGroups]="preSelectGroup" (selectGroup)="onSelectGroup($event)"
|
||||
(removeGroup)="onRemoveGroup($event)"></adf-cloud-group>
|
||||
</div>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
.adf {
|
||||
&-people-groups-section {
|
||||
&-section {
|
||||
mat-card-title {
|
||||
font-size:18px;
|
||||
font-weight: bold;
|
||||
@@ -12,8 +12,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
mat-card-content .adf-preselect-value {
|
||||
width: calc(100% - 160px);
|
||||
mat-card-content {
|
||||
|
||||
.adf-preselect-value {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,26 +28,28 @@ import { MatRadioChange } from '@angular/material';
|
||||
export class PeopleGroupCloudDemoComponent {
|
||||
|
||||
peopleMode: string = PeopleCloudComponent.MODE_SINGLE;
|
||||
preSelectUsers: any = [];
|
||||
preSelectUsers: string[] = [];
|
||||
peopleRoles: string[] = [];
|
||||
|
||||
groupMode: string = GroupCloudComponent.MODE_SINGLE;
|
||||
preSelectGroup: any = [];
|
||||
selectedGroupList: any = [];
|
||||
preSelectGroup: string[] = [];
|
||||
selectedGroupList: GroupModel[] = [];
|
||||
groupRoles: string[];
|
||||
|
||||
setPeoplePreselectValue(value: string) {
|
||||
if (this.isStringArray(value)) {
|
||||
this.preSelectUsers = JSON.parse(value);
|
||||
} else if (value.length === 0) {
|
||||
this.preSelectUsers = [];
|
||||
}
|
||||
setPeoplePreselectValue(event: any) {
|
||||
this.preSelectUsers = this.getArrayFromString(event.target.value);
|
||||
}
|
||||
|
||||
setGroupsPreselectValue(value: string) {
|
||||
if (this.isStringArray(value)) {
|
||||
this.preSelectGroup = JSON.parse(value);
|
||||
} else if (value.length === 0) {
|
||||
this.preSelectGroup = [];
|
||||
setGroupsPreselectValue(event: any) {
|
||||
this.preSelectGroup = this.getArrayFromString(event.target.value);
|
||||
}
|
||||
|
||||
setPeopleRoles(event: any) {
|
||||
this.peopleRoles = this.getArrayFromString(event.target.value);
|
||||
}
|
||||
|
||||
setGroupRoles(event: any) {
|
||||
this.groupRoles = this.getArrayFromString(event.target.value);
|
||||
}
|
||||
|
||||
onChangePeopleMode(event: MatRadioChange) {
|
||||
@@ -67,6 +69,15 @@ export class PeopleGroupCloudDemoComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private getArrayFromString(value: string) {
|
||||
|
||||
if (this.isStringArray(value)) {
|
||||
return JSON.parse(value);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
canShowPeopleList() {
|
||||
return this.peopleMode === GroupCloudComponent.MODE_MULTIPLE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user