Merge branch 'develop' into feature/AAE-36582-forms-misalignment

This commit is contained in:
Tomasz Nastaly
2025-07-29 14:06:11 +02:00
committed by GitHub
6 changed files with 172 additions and 47 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript
@@ -39,7 +39,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -53,4 +53,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
@@ -21,6 +21,10 @@
<ng-template #render let-fieldToRender="fieldToRender">
<div *ngFor="let currentRootElement of fieldToRender">
<div *ngIf="currentRootElement.type === 'section'" [id]="'field-' + currentRootElement?.id + '-container'" class="adf-container-widget">
<adf-form-section [field]="currentRootElement" />
</div>
<div *ngIf="currentRootElement.type === 'container' || currentRootElement.type === 'group'"
[id]="'field-' + currentRootElement?.id + '-container'"
class="adf-container-widget"
@@ -708,5 +708,103 @@ describe('FormModel', () => {
expect(fields[1].type).toBe(FormFieldTypes.DATE);
expect(fields[2].type).toBe(FormFieldTypes.NUMBER);
});
it('should handle sections at root level correctly', () => {
const mockFormWithRootSection = {
id: 'test-form',
name: 'Test Form',
fields: [
{
id: 'root-section',
name: 'Root Section',
type: 'section',
numberOfColumns: 2,
fields: {
1: [
{
id: 'text-in-root-section',
name: 'Text in Root Section',
type: 'text',
required: false,
readOnly: false
}
]
}
}
]
};
const formWithRootSection = new FormModel(mockFormWithRootSection);
// Check that the root section is parsed correctly - wrapped in ContainerModel as expected
expect(formWithRootSection.fields.length).toBe(1);
expect(formWithRootSection.fields[0]).toBeInstanceOf(ContainerModel);
expect(formWithRootSection.fields[0].field.type).toBe('section');
expect(formWithRootSection.fields[0].field.id).toBe('root-section');
// Check that getFormFields returns all fields including the section and its children
const allFields = formWithRootSection.getFormFields();
expect(allFields.length).toBe(2); // section + text field inside
expect(allFields[0].type).toBe('section');
expect(allFields[1].type).toBe('text');
expect(allFields[1].id).toBe('text-in-root-section');
});
it('should process container fields before section fields in getFormFields', () => {
const mockFormWithContainerAndSection = {
id: 'test-form',
name: 'Test Form',
fields: [
{
id: 'container-field',
name: 'Container Field',
type: 'container',
numberOfColumns: 2,
fields: {
1: [
{
id: 'text-in-container',
name: 'Text in Container',
type: 'text',
required: false,
readOnly: false
}
]
}
},
{
id: 'section-field',
name: 'Section Field',
type: 'section',
numberOfColumns: 1,
fields: {
1: [
{
id: 'text-in-section',
name: 'Text in Section',
type: 'text',
required: false,
readOnly: false
}
]
}
}
]
};
const formWithMixed = new FormModel(mockFormWithContainerAndSection);
const allFields = formWithMixed.getFormFields();
// Check that the following order is correct: container, text-in-container, section, text-in-section
expect(allFields.length).toBe(4);
expect(allFields[0].type).toBe('container');
expect(allFields[0].id).toBe('container-field');
expect(allFields[1].type).toBe('text');
expect(allFields[1].id).toBe('text-in-container');
expect(allFields[2].type).toBe('section');
expect(allFields[2].id).toBe('section-field');
expect(allFields[3].type).toBe('text');
expect(allFields[3].id).toBe('text-in-section');
});
});
});
@@ -201,7 +201,7 @@ export class FormModel implements ProcessFormModel {
this.validateForm();
}
// Activiti supports 3 types of root fields: container|group|dynamic-table
// Activiti supports 4 types of root fields: container|group|dynamic-table|section
private parseRootFields(json: any): (ContainerModel | FormFieldModel)[] {
let fields = [];
@@ -354,10 +354,10 @@ export class FormModel implements ProcessFormModel {
private processFields(fields: (ContainerModel | FormFieldModel)[], formFieldModel: FormFieldModel[]): void {
fields.forEach((field) => {
if (this.isSectionField(field)) {
this.handleSectionField(field, formFieldModel);
} else if (this.isContainerField(field)) {
if (this.isContainerField(field)) {
this.handleContainerField(field, formFieldModel);
} else if (this.isSectionField(field)) {
this.handleSectionField(field, formFieldModel);
} else if (this.isFormField(field)) {
this.handleSingleField(field, formFieldModel);
}
+61 -38
View File
@@ -86,7 +86,7 @@
"@types/superagent": "^4.1.22",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/typescript-estree": "8.35.1",
"@typescript-eslint/typescript-estree": "8.38.0",
"@typescript-eslint/utils": "^8.8.1",
"ajv": "^8.12.0",
"commander": "12.0.0",
@@ -96,7 +96,7 @@
"eslint": "^8.47.0",
"eslint-config-prettier": "10.1.2",
"eslint-plugin-ban": "^1.6.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jsdoc": "50.3.1",
"eslint-plugin-license-header": "0.8.0",
"eslint-plugin-prefer-arrow": "1.2.3",
@@ -14456,6 +14456,13 @@
}
}
},
"node_modules/@rtsao/scc": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
"integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
"dev": true,
"license": "MIT"
},
"node_modules/@schematics/angular": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-19.2.7.tgz",
@@ -16810,14 +16817,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.35.1.tgz",
"integrity": "sha512-VYxn/5LOpVxADAuP3NrnxxHYfzVtQzLKeldIhDhzC8UHaiQvYlXvKuVho1qLduFbJjjy5U5bkGwa3rUGUb1Q6Q==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.38.0.tgz",
"integrity": "sha512-dbK7Jvqcb8c9QfH01YB6pORpqX1mn5gDZc9n63Ak/+jD67oWXn3Gs0M6vddAN+eDXBCS5EmNWzbSxsn9SzFWWg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.35.1",
"@typescript-eslint/types": "^8.35.1",
"@typescript-eslint/tsconfig-utils": "^8.38.0",
"@typescript-eslint/types": "^8.38.0",
"debug": "^4.3.4"
},
"engines": {
@@ -16831,6 +16838,20 @@
"typescript": ">=4.8.4 <5.9.0"
}
},
"node_modules/@typescript-eslint/project-service/node_modules/@typescript-eslint/types": {
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.38.0.tgz",
"integrity": "sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz",
@@ -16864,9 +16885,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.35.1.tgz",
"integrity": "sha512-K5/U9VmT9dTHoNowWZpz+/TObS3xqC5h0xAIjXPw+MNcKV9qg6eSatEnmeAwkjHijhACH0/N7bkhKvbt1+DXWQ==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.38.0.tgz",
"integrity": "sha512-Lum9RtSE3EroKk/bYns+sPOodqb2Fv50XOl/gMviMKNvanETUuUcC9ObRbzrJ4VSd2JalPqgSAavwrPiPvnAiQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -17048,16 +17069,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.35.1.tgz",
"integrity": "sha512-Vvpuvj4tBxIka7cPs6Y1uvM7gJgdF5Uu9F+mBJBPY4MhvjrjWGK4H0lVgLJd/8PWZ23FTqsaJaLEkBCFUk8Y9g==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.38.0.tgz",
"integrity": "sha512-fooELKcAKzxux6fA6pxOflpNS0jc+nOQEEOipXFNjSlBS6fqrJOVY/whSn70SScHrcJ2LDsxWrneFoWYSVfqhQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.35.1",
"@typescript-eslint/tsconfig-utils": "8.35.1",
"@typescript-eslint/types": "8.35.1",
"@typescript-eslint/visitor-keys": "8.35.1",
"@typescript-eslint/project-service": "8.38.0",
"@typescript-eslint/tsconfig-utils": "8.38.0",
"@typescript-eslint/types": "8.38.0",
"@typescript-eslint/visitor-keys": "8.38.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@@ -17077,9 +17098,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/types": {
"version": "8.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.35.1.tgz",
"integrity": "sha512-q/O04vVnKHfrrhNAscndAn1tuQhIkwqnaW+eu5waD5IPts2eX1dgJxgqcPx5BX109/qAz7IG6VrEPTOYKCNfRQ==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.38.0.tgz",
"integrity": "sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -17091,13 +17112,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.35.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.35.1.tgz",
"integrity": "sha512-VRwixir4zBWCSTP/ljEo091lbpypz57PoeAQ9imjG+vbeof9LplljsL1mos4ccG6H9IjfrVGM359RozUnuFhpw==",
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.38.0.tgz",
"integrity": "sha512-pWrTcoFNWuwHlA9CvlfSsGWs14JxfN1TH25zM5L7o0pRLhsoZkDnTsXfQRJBEWJoV5DL0jf+Z+sxiud+K0mq1g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.35.1",
"@typescript-eslint/types": "8.38.0",
"eslint-visitor-keys": "^4.2.1"
},
"engines": {
@@ -22511,35 +22532,37 @@
}
},
"node_modules/eslint-plugin-import": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"version": "2.32.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz",
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
"dev": true,
"license": "MIT",
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
"array.prototype.flat": "^1.3.2",
"array.prototype.flatmap": "^1.3.2",
"@rtsao/scc": "^1.1.0",
"array-includes": "^3.1.9",
"array.prototype.findlastindex": "^1.2.6",
"array.prototype.flat": "^1.3.3",
"array.prototype.flatmap": "^1.3.3",
"debug": "^3.2.7",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.0",
"hasown": "^2.0.0",
"is-core-module": "^2.13.1",
"eslint-module-utils": "^2.12.1",
"hasown": "^2.0.2",
"is-core-module": "^2.16.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.fromentries": "^2.0.7",
"object.groupby": "^1.0.1",
"object.values": "^1.1.7",
"object.fromentries": "^2.0.8",
"object.groupby": "^1.0.3",
"object.values": "^1.2.1",
"semver": "^6.3.1",
"string.prototype.trimend": "^1.0.9",
"tsconfig-paths": "^3.15.0"
},
"engines": {
"node": ">=4"
},
"peerDependencies": {
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9"
}
},
"node_modules/eslint-plugin-import/node_modules/brace-expansion": {
+2 -2
View File
@@ -106,7 +106,7 @@
"@types/superagent": "^4.1.22",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/typescript-estree": "8.35.1",
"@typescript-eslint/typescript-estree": "8.38.0",
"@typescript-eslint/utils": "^8.8.1",
"ajv": "^8.12.0",
"commander": "12.0.0",
@@ -116,7 +116,7 @@
"eslint": "^8.47.0",
"eslint-config-prettier": "10.1.2",
"eslint-plugin-ban": "^1.6.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jsdoc": "50.3.1",
"eslint-plugin-license-header": "0.8.0",
"eslint-plugin-prefer-arrow": "1.2.3",