diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index c9800fce56..e5a9ceece7 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -88,7 +88,10 @@ "SEARCH_SERVICE_APPROACH": "Check this to disable the input property and configure using the service", "HEADER_DATA": "Header Data", "TREE_VIEW": "Tree View", - "ICONS": "Icons" + "ICONS": "Icons", + "PEOPLE_GROUPS_CLOUD": "People/Group Cloud", + "PEOPLE_CLOUD": "People Cloud Component", + "GROUPS_CLOUD": "Groups Cloud Component" }, "TRASHCAN": { "ACTIONS": { @@ -281,6 +284,11 @@ "TASK_LIST_CLOUD_DEMO": { "CUSTOMIZE_FILTERS": "Customise your filter" }, + "PEOPLE_GROUPS_CLOUD": { + "SINGLE": "Single", + "MULTI": "Multi", + "PRESELECTED_VALUE": "Preselected value" + }, "ABOUT": { "TITLE": "Plugins", "TABLE_HEADERS": { diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 98fa5c0466..975f3e22a5 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -63,7 +63,7 @@ import { ContentModule } from '@alfresco/adf-content-services'; import { InsightsModule } from '@alfresco/adf-insights'; import { ProcessModule } from '@alfresco/adf-process-services'; import { AuthBearerInterceptor } from './services'; -import { ProcessServicesCloudModule } from '@alfresco/adf-process-services-cloud'; +import { ProcessServicesCloudModule, GroupCloudModule } from '@alfresco/adf-process-services-cloud'; import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component'; import { AppExtensionsModule } from './extensions/extensions.module'; import { CloudLayoutComponent } from './components/app-layout/cloud/cloud-layout.component'; @@ -76,6 +76,7 @@ import { TasksCloudDemoComponent } from './components/app-layout/cloud/tasks-clo import { CloudFiltersDemoComponent } from './components/app-layout/cloud/cloud-filters-demo.component'; import { StartProcessCloudDemoComponent } from './components/app-layout/cloud/start-process-cloud-demo.component'; import { DocumentListDemoComponent } from './components/document-list/document-list-demo.component'; +import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/people-groups-cloud-demo.component'; @NgModule({ imports: [ @@ -95,7 +96,8 @@ import { DocumentListDemoComponent } from './components/document-list/document-l ChartsModule, MonacoEditorModule.forRoot(), ProcessServicesCloudModule, - AppExtensionsModule.forRoot() + AppExtensionsModule.forRoot(), + GroupCloudModule ], declarations: [ AppComponent, @@ -135,7 +137,8 @@ import { DocumentListDemoComponent } from './components/document-list/document-l StartProcessCloudDemoComponent, CloudBreadcrumbsComponent, CloudFiltersDemoComponent, - DocumentListDemoComponent + DocumentListDemoComponent, + PeopleGroupCloudDemoComponent ], providers: [ { diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index 2c99649157..513f1944f3 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -47,6 +47,7 @@ import { TasksCloudDemoComponent } from './components/app-layout/cloud/tasks-clo import { StartTaskCloudDemoComponent } from './components/app-layout/cloud/start-task-cloud-demo.component'; import { StartProcessCloudDemoComponent } from './components/app-layout/cloud/start-process-cloud-demo.component'; import { DocumentListDemoComponent } from './components/document-list/document-list-demo.component'; +import { PeopleGroupCloudDemoComponent } from './components/app-layout/cloud/people-groups-cloud-demo.component'; export const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, @@ -146,6 +147,10 @@ export const appRoutes: Routes = [ path: '', component: AppsCloudDemoComponent }, + { + path: 'people-group-cloud', + component: PeopleGroupCloudDemoComponent + }, { path: ':applicationName', children: [ diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.ts b/demo-shell/src/app/components/app-layout/app-layout.component.ts index 0cab4dd49b..648399e8df 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.ts +++ b/demo-shell/src/app/components/app-layout/app-layout.component.ts @@ -41,6 +41,7 @@ export class AppLayoutComponent implements OnInit { { href: '/task-list', icon: 'assignment', title: 'APP_LAYOUT.TASK_LIST' }, { href: '/process-list', icon: 'assignment', title: 'APP_LAYOUT.PROCESS_LIST' }, { href: '/cloud', icon: 'cloud', title: 'APP_LAYOUT.PROCESS_CLOUD' }, + { href: '/cloud/people-group-cloud', icon: 'group', title: 'APP_LAYOUT.PEOPLE_GROUPS_CLOUD' }, { href: '/activiti', icon: 'device_hub', title: 'APP_LAYOUT.PROCESS_SERVICES' }, { href: '/login', icon: 'vpn_key', title: 'APP_LAYOUT.LOGIN' }, { href: '/trashcan', icon: 'delete', title: 'APP_LAYOUT.TRASHCAN' }, diff --git a/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html new file mode 100644 index 0000000000..66f2f4deb0 --- /dev/null +++ b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.html @@ -0,0 +1,58 @@ + + + {{ 'APP_LAYOUT.PEOPLE_CLOUD' | translate}} + + + + + + {{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }} + {{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }} + + + {{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }} + + + + + + + + + + + person + {{ item?.firstName }} {{ item?.lastName }} + + + + + + + + + {{ 'APP_LAYOUT.GROUPS_CLOUD' | translate}} + + + + + + {{ 'PEOPLE_GROUPS_CLOUD.SINGLE' | translate }} + {{ 'PEOPLE_GROUPS_CLOUD.MULTI' | translate }} + + + + + + + + + + group + {{ item.name }} + + + + + \ No newline at end of file diff --git a/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.scss b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.scss new file mode 100644 index 0000000000..d47134a4a0 --- /dev/null +++ b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.scss @@ -0,0 +1,19 @@ +.adf { + &-people-groups-section { + mat-card-title { + font-size:18px; + font-weight: bold; + } + mat-radio-group { + margin:7px 10px; + + mat-radio-button { + margin: 0 3px; + } + } + + mat-card-content .adf-preselect-value { + width: calc(100% - 160px); + } + } +} diff --git a/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.ts b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.ts new file mode 100644 index 0000000000..c96643d99c --- /dev/null +++ b/demo-shell/src/app/components/app-layout/cloud/people-groups-cloud-demo.component.ts @@ -0,0 +1,99 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, ViewEncapsulation } from '@angular/core'; +import { PeopleCloudComponent, GroupCloudComponent, GroupModel } from '@alfresco/adf-process-services-cloud'; +import { MatRadioChange } from '@angular/material'; + +@Component({ + selector: 'app-people-groups-cloud', + templateUrl: './people-groups-cloud-demo.component.html', + styleUrls: ['./people-groups-cloud-demo.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class PeopleGroupCloudDemoComponent { + + peopleMode: string = PeopleCloudComponent.MODE_SINGLE; + preSelectUsers: any = []; + + groupMode: string = GroupCloudComponent.MODE_SINGLE; + preSelectGroup: any = []; + selectedGroupList: any = []; + + setPeoplePreselectValue(value: string) { + if (this.isStringArray(value)) { + this.preSelectUsers = JSON.parse(value); + } else if (value.length === 0) { + this.preSelectUsers = []; + } + } + + setGroupsPreselectValue(value: string) { + if (this.isStringArray(value)) { + this.preSelectGroup = JSON.parse(value); + } else if (value.length === 0) { + this.preSelectGroup = []; + } + } + + onChangePeopleMode(event: MatRadioChange) { + this.peopleMode = event.value; + } + + onChangeGroupsMode(event: MatRadioChange) { + this.groupMode = event.value; + } + + isStringArray(str: string) { + try { + const result = JSON.parse(str); + return Array.isArray(result); + } catch (e) { + return false; + } + } + + canShowPeopleList() { + return this.peopleMode === GroupCloudComponent.MODE_MULTIPLE; + } + + onRemoveGroup(group: GroupModel) { + this.selectedGroupList = this.selectedGroupList.filter((value: any) => value.id !== group.id); + } + + onSelectGroup(group: GroupModel) { + if (this.groupMode === GroupCloudComponent.MODE_MULTIPLE) { + this.selectedGroupList.push(group); + } + } + + get peopleSingleMode() { + return PeopleCloudComponent.MODE_SINGLE; + } + + get peopleMultipleMode() { + return PeopleCloudComponent.MODE_MULTIPLE; + } + + get groupSingleMode() { + return GroupCloudComponent.MODE_SINGLE; + } + + get groupMultipleMode() { + return GroupCloudComponent.MODE_MULTIPLE; + } +}