diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 9cc184f586..a881122c5e 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -81,6 +81,8 @@ import { DemoErrorComponent } from './components/error/demo-error.component'; import { ProcessServicesCloudModule } from '@alfresco/adf-process-services-cloud'; import { FilteredSearchComponent } from './components/files/filtered-search.component'; import { RouterModule } from '@angular/router'; +import { ProcessCloudLayoutComponent } from './components/cloud/process-cloud-layout.component'; +import { SampleWidgetComponent } from './components/cloud/custom-form-components/sample-widget.component'; import { registerLocaleData } from '@angular/common'; import localeFr from '@angular/common/locales/fr'; @@ -185,7 +187,9 @@ registerLocaleData(localeSv); PeopleGroupCloudDemoComponent, ConfirmDialogExampleComponent, FormCloudDemoComponent, - ConfirmDialogExampleComponent + ConfirmDialogExampleComponent, + SampleWidgetComponent, + ProcessCloudLayoutComponent ], providers: [ { diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index 640ef0bbb2..c98c513e92 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -53,6 +53,7 @@ import { ConfirmDialogExampleComponent } from './components/confirm-dialog/confi import { DemoErrorComponent } from './components/error/demo-error.component'; import { TaskHeaderCloudDemoComponent } from './components/cloud/task-header-cloud-demo.component'; import { FilteredSearchComponent } from './components/files/filtered-search.component'; +import { ProcessCloudLayoutComponent } from './components/cloud/process-cloud-layout.component'; export const appRoutes: Routes = [ { path: 'login', loadChildren: () => import('./components/login/login.module').then(m => m.AppLoginModule) }, @@ -197,6 +198,7 @@ export const appRoutes: Routes = [ path: ':appName', canActivate: [AuthGuardSsoRoleService], data: { clientRoles: ['appName'], roles: ['ACTIVITI_USER'], redirectUrl: '/error/403' }, + component: ProcessCloudLayoutComponent, children: [ { path: '', diff --git a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts index 481e1aa42c..c4966f25ba 100644 --- a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts +++ b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.ts @@ -16,9 +16,19 @@ */ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { FormFieldModel, NotificationService, CoreAutomationService, FormModel, FormRenderingService } from '@alfresco/adf-core'; -import { FormCloudService, CloudFormRenderingService } from '@alfresco/adf-process-services-cloud'; +import { + CoreAutomationService, + FormFieldModel, + FormModel, + FormRenderingService, + NotificationService +} from '@alfresco/adf-core'; +import { + CloudFormRenderingService, + FormCloudService +} from '@alfresco/adf-process-services-cloud'; import { Subscription } from 'rxjs'; +import { SampleWidgetComponent } from '../../../cloud/custom-form-components/sample-widget.component'; @Component({ templateUrl: 'cloud-form-demo.component.html', @@ -47,7 +57,11 @@ export class FormCloudDemoComponent implements OnInit, OnDestroy { constructor( private notificationService: NotificationService, private formService: FormCloudService, - private automationService: CoreAutomationService) { + private automationService: CoreAutomationService, + private formRenderingService: FormRenderingService) { + this.formRenderingService.register({ + 'custom': () => SampleWidgetComponent + }); } logErrors(errorFields: FormFieldModel[]) { diff --git a/demo-shell/src/app/components/cloud/custom-form-components/sample-widget.component.ts b/demo-shell/src/app/components/cloud/custom-form-components/sample-widget.component.ts new file mode 100644 index 0000000000..c730460bf3 --- /dev/null +++ b/demo-shell/src/app/components/cloud/custom-form-components/sample-widget.component.ts @@ -0,0 +1,57 @@ +/*! + * @license + * Copyright 2019 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, OnInit } from '@angular/core'; +import { FormService, WidgetComponent } from '@alfresco/adf-core'; + +@Component({ + selector: 'app-sample-widget', + template: ` +
+ Look, I'm custom cloud form widget! +

+ Value :: {{displayValue}} +

+ + + + + + + +
+ ` +}) +export class SampleWidgetComponent extends WidgetComponent implements OnInit { + + displayValue: string; + + constructor(public formService: FormService) { + super(formService); + } + + ngOnInit() { + this.displayValue = this.field.value; + } +} diff --git a/demo-shell/src/app/components/cloud/process-cloud-layout.component.ts b/demo-shell/src/app/components/cloud/process-cloud-layout.component.ts new file mode 100644 index 0000000000..c7478f7a5c --- /dev/null +++ b/demo-shell/src/app/components/cloud/process-cloud-layout.component.ts @@ -0,0 +1,36 @@ +/*! + * @license + * Copyright 2019 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 } from '@angular/core'; +import { FormRenderingService } from '@alfresco/adf-core'; +import { CloudFormRenderingService } from '@alfresco/adf-process-services-cloud'; +import { SampleWidgetComponent } from './custom-form-components/sample-widget.component'; + +@Component({ + template: ``, + providers: [ + { provide: FormRenderingService, useClass: CloudFormRenderingService } + ] +}) +export class ProcessCloudLayoutComponent { + + constructor(private formRenderingService: FormRenderingService) { + this.formRenderingService.register({ + 'custom': () => SampleWidgetComponent + }); + } +}