mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
95
lib/core/form/models/form-definition.model.ts
Normal file
95
lib/core/form/models/form-definition.model.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export class FormDefinitionModel {
|
||||
reusable: boolean = false;
|
||||
newVersion: boolean = false;
|
||||
formRepresentation: any;
|
||||
formImageBase64: string = '';
|
||||
|
||||
constructor(id: string, name: any, lastUpdatedByFullName: string, lastUpdated: string, metadata: any) {
|
||||
|
||||
this.formRepresentation = {
|
||||
id: id,
|
||||
name: name,
|
||||
description: '',
|
||||
version: 1,
|
||||
lastUpdatedBy: 1,
|
||||
lastUpdatedByFullName: lastUpdatedByFullName,
|
||||
lastUpdated: lastUpdated,
|
||||
stencilSetId: 0,
|
||||
referenceId: null,
|
||||
formDefinition: {
|
||||
fields: [{
|
||||
name: 'Label',
|
||||
type: 'container',
|
||||
fieldType: 'ContainerRepresentation',
|
||||
numberOfColumns: 2,
|
||||
required: false,
|
||||
readOnly: false,
|
||||
sizeX: 2,
|
||||
sizeY: 1,
|
||||
row: -1,
|
||||
col: -1,
|
||||
fields: {'1': this.metadataToFields(metadata)}
|
||||
}],
|
||||
gridsterForm: false,
|
||||
javascriptEvents: [],
|
||||
metadata: {},
|
||||
outcomes: [],
|
||||
className: '',
|
||||
style: '',
|
||||
tabs: [],
|
||||
variables: []
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private metadataToFields(metadata: any): any[] {
|
||||
let fields = [];
|
||||
if (metadata) {
|
||||
metadata.forEach(function(property) {
|
||||
if (property) {
|
||||
let field = {
|
||||
type: 'text',
|
||||
id: property.name,
|
||||
name: property.name,
|
||||
required: false,
|
||||
readOnly: false,
|
||||
sizeX: 1,
|
||||
sizeY: 1,
|
||||
row: -1,
|
||||
col: -1,
|
||||
colspan: 1,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 2
|
||||
},
|
||||
layout: {
|
||||
colspan: 1,
|
||||
row: -1,
|
||||
column: -1
|
||||
}
|
||||
};
|
||||
fields.push(field);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
}
|
26
lib/core/form/models/node-metadata.model.ts
Normal file
26
lib/core/form/models/node-metadata.model.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export class NodeMetadata {
|
||||
metadata: any;
|
||||
nodeType: string;
|
||||
|
||||
constructor(metadata: any, nodeType: string) {
|
||||
this.metadata = metadata;
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
}
|
22
lib/core/form/models/task-process-variable.model.ts
Normal file
22
lib/core/form/models/task-process-variable.model.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export class TaskProcessVariableModel {
|
||||
id: string;
|
||||
type: string;
|
||||
value: string;
|
||||
}
|
28
lib/core/form/models/widget-visibility.model.ts
Normal file
28
lib/core/form/models/widget-visibility.model.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
export class WidgetVisibilityModel {
|
||||
leftFormFieldId: string;
|
||||
leftRestResponseId: string;
|
||||
nextCondition: WidgetVisibilityModel;
|
||||
nextConditionOperator: string;
|
||||
operator: string;
|
||||
rightFormFieldId: string;
|
||||
rightRestResponseId: string;
|
||||
rightType: string;
|
||||
rightValue: string;
|
||||
}
|
Reference in New Issue
Block a user