New packages org (#2639)

New packages org
This commit is contained in:
Eugenio Romano
2017-11-16 14:12:52 +00:00
committed by GitHub
parent 6a24c6ef75
commit a52bb5600a
1984 changed files with 17179 additions and 40423 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
<adf-form-list [forms]="formList" (row-dblclick)="onRowDblClick($event)">
</adf-form-list>
<div class="form-container" *ngIf="!isEmptyForm()">
<adf-form [form]="form" [data]="restoredData">
</adf-form>
</div>
<button mat-button (click)="store()" color="primary">{{'FORM-LIST.STORE' | translate }}</button>
<button mat-button (click)="restore()" color="primary">{{'FORM-LIST.RESTORE' | translate }}</button>

View File

@@ -0,0 +1,8 @@
.form-container {
padding: 10px;
}
.store-form-container{
width: 80%;
height: 80%;
}

View File

@@ -0,0 +1,84 @@
/*!
* @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, ViewChild } from '@angular/core';
import { FormComponent, FormModel, FormService, LogService } from '@alfresco/core';
@Component({
selector: 'form-list',
templateUrl: 'form-list.component.html',
styleUrls: ['form-list.component.scss']
})
export class FormListComponent {
@ViewChild(FormComponent)
activitiForm: FormComponent;
formList: any [] = [];
form: FormModel;
formId: string;
storedData: any = {};
restoredData: any = {};
constructor(private formService: FormService, private logService: LogService) {
// Prevent default outcome actions
formService.executeOutcome.subscribe(e => {
e.preventDefault();
this.logService.log(e.outcome);
});
}
onRowDblClick(event: CustomEvent) {
let rowForm = event.detail.value.obj;
this.formService.getFormDefinitionById(rowForm.id).subscribe((formModel) => {
let form = this.formService.parseForm(formModel.formDefinition);
this.form = form;
});
this.logService.log(rowForm);
}
isEmptyForm() {
return this.form === null || this.form === undefined;
}
store() {
this.clone(this.activitiForm.form.values, this.storedData);
this.logService.log('DATA SAVED');
this.logService.log(this.storedData);
this.logService.log('DATA SAVED');
this.restoredData = null;
}
clone(objToCopyFrom, objToCopyTo) {
for (let attribute in objToCopyFrom) {
if (objToCopyFrom.hasOwnProperty(attribute)) {
objToCopyTo[attribute] = objToCopyFrom[attribute];
}
}
return objToCopyTo;
}
restore() {
this.restoredData = this.storedData;
this.storedData = {};
}
}

View File

@@ -0,0 +1,3 @@
.form-container {
padding: 10px;
}

View File

@@ -0,0 +1,4 @@
<div class="form-container">
<adf-form [form]="form">
</adf-form>
</div>

View File

@@ -0,0 +1,48 @@
/*!
* @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, Inject, OnInit } from '@angular/core';
import { FormModel, FormService, LogService } from '@alfresco/core';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { DemoForm } from './demo-form';
@Component({
selector: 'form',
templateUrl: 'form.component.html',
styleUrls: [ 'form.component.css' ],
providers: [
{ provide: FormService, useClass: InMemoryFormService }
]
})
export class FormComponent implements OnInit {
form: FormModel;
constructor(@Inject(FormService) private formService: InMemoryFormService, private logSevice: LogService) {
// Prevent default outcome actions
formService.executeOutcome.subscribe(e => {
e.preventDefault();
this.logSevice.log(e.outcome);
});
}
ngOnInit() {
let formDefinitionJSON: any = DemoForm.getDefinition();
this.form = this.formService.parseForm(formDefinitionJSON);
}
}