Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
f7092b5
release-2.0.0 code refactoring
Jun 13, 2024
bb158e8
issue #fix validations for number and link
GSuma21 Jun 13, 2024
222a6a9
issue #fix add resource component
GSuma21 Jun 14, 2024
d82a160
Merge pull request #1 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jun 14, 2024
5fdab5c
issue #fix adding name
GSuma21 Jun 14, 2024
76d9955
Merge pull request #2 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jun 16, 2024
4f33d02
issue #fix chnage trigger issue
GSuma21 Jun 21, 2024
f169585
Merge pull request #3 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jun 21, 2024
96316b3
value attribute added
Jun 22, 2024
47719e0
for focusout issue fix
Jun 25, 2024
b88da90
issue #fix ui for all fields and mat error
GSuma21 Jun 25, 2024
9f4b39c
Merge pull request #4 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jun 26, 2024
70a2f8c
select multiple dropdonw added
Jun 26, 2024
bd23f72
issue #fix ui for learning resources error messages
GSuma21 Jun 27, 2024
1ad595b
Merge pull request #5 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jun 28, 2024
3867482
issue #fix learning resources prefill
GSuma21 Jul 2, 2024
0e36f4f
issue fix
GSuma21 Jul 2, 2024
54426d5
issue #fix
GSuma21 Jul 2, 2024
40fcc20
Merge pull request #6 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 2, 2024
8e4a125
issue #fix bug-1398
GSuma21 Jul 16, 2024
cb74099
Merge pull request #7 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 16, 2024
c36b0bb
handle focus added
Jul 17, 2024
0916d66
issue #fix
GSuma21 Jul 17, 2024
ed5ab81
Merge pull request #8 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 17, 2024
6993436
added focus after deleting resources
GSuma21 Jul 17, 2024
9edb31c
Merge pull request #9 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 17, 2024
610dff9
issue #fix 1515
GSuma21 Jul 18, 2024
8a7e89a
Merge pull request #10 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 18, 2024
2d4261e
issue #fix 1512
GSuma21 Jul 18, 2024
bc4bb36
Merge pull request #11 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 18, 2024
47561dd
issue #fix 1512
GSuma21 Jul 22, 2024
fa8671f
Merge pull request #12 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 22, 2024
5a6f715
drop down fixes
Jul 23, 2024
39fbc95
pull changes
Jul 23, 2024
796b2ad
issue #fix save button change to primary color
GSuma21 Jul 23, 2024
652071b
Merge pull request #13 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 23, 2024
1b6e3a9
max validatiion fix
Jul 23, 2024
defb83e
issue #fix 1565
GSuma21 Jul 25, 2024
6508cf3
Merge pull request #14 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 25, 2024
541cafd
issue #feat added viewOnly for dynamic form
GSuma21 Jul 29, 2024
031c327
issue #fix
GSuma21 Jul 29, 2024
512d6bf
Merge pull request #15 from GSuma21/form-ui-changes
ramkumar-pacewisdom Jul 29, 2024
27840bb
issue #fix viewOnly
GSuma21 Aug 14, 2024
90e20ae
issue #fix
GSuma21 Aug 14, 2024
3a8fc68
removed unwanted code
GSuma21 Aug 14, 2024
8787950
Merge pull request #16 from GSuma21/form-ui-changes
ramkumar-pacewisdom Aug 14, 2024
8512e10
issue #fix 1665
GSuma21 Aug 21, 2024
6d7882d
Merge pull request #17 from GSuma21/form-ui-changes
ramkumar-pacewisdom Aug 22, 2024
a885f8a
adding css changes for dialogpopup
Arti-Khillare1 Sep 5, 2024
fa2b7ab
adding css changes for errormessages
Arti-Khillare1 Sep 5, 2024
207fa51
resolve comments
Arti-Khillare1 Sep 5, 2024
1995260
Merge pull request #18 from Arti-Khillare1/add-learning
ramkumar-pacewisdom Sep 5, 2024
25637ff
adding info icon flow to dynamic form
Arti-Khillare1 Oct 1, 2024
cfc0f00
resolve comments
Arti-Khillare1 Oct 1, 2024
0e268e3
Merge pull request #19 from Arti-Khillare1/add-learning
ramkumar-pacewisdom Oct 1, 2024
0430a03
adding padding for info icons for infoicon projectflow story 1329
Arti-Khillare1 Oct 8, 2024
cbc0b0e
Merge pull request #20 from Arti-Khillare1/add-learning
ramkumar-pacewisdom Oct 8, 2024
db039e6
added date input - that can take any date as value
GSuma21 Oct 21, 2024
d82a93f
fixed comments
GSuma21 Oct 22, 2024
e132ce6
Merge pull request #21 from GSuma21/scp-dynamic-form
ramkumar-pacewisdom Oct 22, 2024
7602d52
resolve bug - 2019
GSuma21 Nov 4, 2024
9db2799
Merge pull request #22 from GSuma21/scp-dynamic-form
ramkumar-pacewisdom Nov 5, 2024
17d33c8
added name
GSuma21 Nov 5, 2024
0f115e3
0.0.1
GSuma21 Nov 5, 2024
7c69437
0.0.2
GSuma21 Nov 5, 2024
b320269
form control change detection added
Nov 19, 2024
e10b3ff
added name
GSuma21 Nov 5, 2024
62fd466
0.0.1
GSuma21 Nov 5, 2024
13316e4
0.0.2
GSuma21 Nov 5, 2024
95b9b20
ui fixes
Nov 19, 2024
25a2e4d
Merge pull request #1 from ramkumar-pacewisdom/release-2.0.0-refactor
GSuma21 Nov 19, 2024
123d8e4
added version
GSuma21 Nov 19, 2024
c543078
handle focus out fix
Nov 19, 2024
0ec56bd
Merge pull request #2 from ramkumar-pacewisdom/release-2.0.0-refactor
GSuma21 Nov 19, 2024
27f32c5
Merge branch 'scp-dynamic-form-suma' of https://github.com/GSuma21/fr…
GSuma21 Nov 19, 2024
0e42877
resource line break fix
Nov 21, 2024
2841f52
Merge pull request #3 from ramkumar-pacewisdom/release-2.0.0-refactor
GSuma21 Nov 21, 2024
a1f0374
rollout changes
GSuma21 Nov 21, 2024
350c17f
Merge branch 'scp-dynamic-form-suma' of https://github.com/GSuma21/fr…
GSuma21 Nov 21, 2024
0b80215
roll out changes
GSuma21 Dec 2, 2024
2a597b9
roll out feature
GSuma21 Dec 3, 2024
4919de2
Merge remote-tracking branch 'origin/scp-test-rollout' into scp-dynam…
GSuma21 Dec 3, 2024
111ec8d
rollout feature
GSuma21 Dec 3, 2024
15d49e3
changes for add fields
GSuma21 Dec 3, 2024
b1c6f36
added html file
GSuma21 Dec 3, 2024
57425c3
added new version
GSuma21 Dec 3, 2024
5ea6d45
changes for showing target criteria
GSuma21 Dec 16, 2024
fb7d29f
targetting criteria changes
GSuma21 Dec 16, 2024
ef1d12d
min and max validation for start and end date
GSuma21 Dec 19, 2024
cc56ba2
changes for roll out view only
GSuma21 Dec 27, 2024
908950d
changes for roll out view only date
GSuma21 Dec 27, 2024
7d78c5d
adding end date with time 11:59
GSuma21 Dec 31, 2024
10f49f7
bug: 2234
GSuma21 Jan 7, 2025
9db1fdd
date utc issue of date picker fixed
GSuma21 Jan 16, 2025
8275345
bug: 2344
GSuma21 Feb 5, 2025
385c360
bug resolve
GSuma21 Feb 5, 2025
87381e9
changes to get a date control
GSuma21 Mar 13, 2025
13356c7
Merge remote-tracking branch 'shikshalokam/release-2.0.0' into scp-dy…
GSuma21 Mar 18, 2025
cb519dc
app module
GSuma21 Mar 18, 2025
c6c09f1
info icon text to hindi
GSuma21 Mar 18, 2025
2e0ce60
translation related changes for scp
GSuma21 Mar 21, 2025
6a15de1
package update
GSuma21 Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@
}
},
"cli": {
"analytics": false
"analytics": "93200aa4-1367-4de5-9e11-8ceb1188617f"
}
}
6,588 changes: 3,668 additions & 2,920 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-library",
"version": "0.0.0",
"version": "0.0.2",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
4 changes: 2 additions & 2 deletions projects/dynamic-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elevate/dynamic-form",
"version": "0.0.1",
"name": "dynamic-form-suma",
"version": "0.0.24",
"peerDependencies": {
"@angular/common": "^17.3.4",
"@angular/core": "^17.3.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
.container{
width: 50%;
height: 50%;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: .5rem 1rem;
background-color: #0a4f9d;
color: white;
}
.dialog-container {
width: 500px;
height: auto;
}
.footer {
display: flex;
justify-content: end;
padding: 1rem;
}
.cancel-btn {
margin-right: 1rem;
}
.form-container {
display: flex;
justify-content: space-between;
padding: 1rem 2rem;
}
.button-container {
margin-top: 1rem;
margin-left: 2rem;
margin-bottom: 2rem;
}

.error-message{
display: flex;
flex-direction: row;
align-items: start;
font-size: 0.75rem;
padding: 0.125rem 0;
}

.error-icon{
padding-right: 1.125rem;
font-size: 1rem;
width: 1.25rem;
height: auto;
}

.error-container {
display: flex;
height: 2.000rem;
}

.main-container{
max-height: 18.75rem;
overflow-y: auto;
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
<div [formGroup]="myGroup" class="flex flex-col w-[500px] h-[500px] border border-gray-300 rounded-lg">
<header class="h-12">
<div class="flex items-center justify-between px-4 h-full">
<h3 class="text-white">{{dialogData.control.header}}</h3>
<mat-icon class="cursor-pointer text-white" [mat-dialog-close]="false">close</mat-icon>
<form [formGroup]="myGroup" class="dialog-container">
<header>
<div class="header">
<h3 class="text-white">{{dialogData.control.header | languageTranslate: language}}</h3>
<mat-icon class="cursor-pointer text-white" [mat-dialog-close]="false">close</mat-icon>
</div>
</header>
<main formArrayName="resources" class="flex-grow p-4 main-container">
<div *ngFor="let resourceGroup of resources.controls; let i = index" [formGroupName]="i" class="form-container">
<div *ngFor="let control of dialogData.control.resource[i]" class="w-[45%]">
<mat-form-field floatLabel="always" class="w-full" appearance="outline">
<mat-label *ngIf="control.label">{{ control?.label | languageTranslate: language }}</mat-label>
<input
matInput
[placeholder]="control?.placeHolder | languageTranslate: language"
[type]="control?.type"
[formControlName]="control?.name"
[maxlength]="control?.validators.maxLength"
[required]="control?.validators?.required"
[pattern]="control?.validators?.pattern"
[value]="control?.value"
/>
</mat-form-field>
<mat-error class="error-container" *ngIf="control?.errorMessage" >
<div *ngIf="resourceGroup.get(control.name)?.touched && resourceGroup.get(control.name)?.invalid">
<div class="error-message" *ngIf="control?.errorMessage[((resourceGroup.get(control.name)?.errors | keyvalue) || [])[0].key ]; else genericErrorMessage ">
<mat-icon class="error-icon" matPrefix>error_outline</mat-icon>
{{ control?.errorMessage[ ((resourceGroup.get(control.name)?.errors | keyvalue) || [])[0].key ] | languageTranslate: language}}
</div>
<ng-template #genericErrorMessage>
<div class="error-message">
<mat-icon class="error-icon" matPrefix>error_outline</mat-icon>
Enter {{ control?.label}}
</div>
</ng-template>
</div>
</mat-error>
</div>
</header>
<main formArrayName="resources" class="flex-grow overflow-auto p-4">
<div *ngFor="let resourceGroup of resources.controls; let i = index" [formGroupName]="i" class="flex flex-wrap gap-4 justify-center">
<div *ngFor="let control of dialogData.control.resource[i]" class="w-[45%]">
<mat-form-field floatLabel="always" class="w-full">
<mat-label *ngIf="control.label">{{ control?.label }}</mat-label>
<input
matInput
[placeholder]="control?.placeHolder"
[type]="control?.type"
[formControlName]="control?.name"
[required]="control?.validators?.required"
/>
</mat-form-field>
</div>
</div>
<div (click)="onClickAddResource()">
<button [disabled]="myGroup.invalid" mat-raised-button>
<mat-icon class="cursor-pointer">add_circle</mat-icon>
<p> {{dialogData.control?.addButton}}</p>
</button>
</div>
</main>
<footer class="h-12 border-t flex items-center justify-between px-4">
<button mat-raised-button [mat-dialog-close]="false">{{dialogData.control.cancelButton}}</button>
<button [disabled]="myGroup.invalid" mat-raised-button [mat-dialog-close]="true" cdkFocusInitial (click)="confirmButton()">{{dialogData.control.confirmButton}}</button>
</footer>
</div>
</div>
<div class="button-container">
<button (click)="onClickAddResource()" [disabled]="myGroup.invalid" mat-raised-button>
<mat-icon class="cursor-pointer">add_circle</mat-icon>
<p> {{dialogData.control?.addButton | languageTranslate: language}}</p>
</button>
</div>
</main>
<hr>
<section class="footer">
<button mat-raised-button [mat-dialog-close]="false" class="cancel-btn">{{dialogData.control.cancelButton | languageTranslate: language}}</button>
<button [disabled]="myGroup.invalid" color="primary" mat-raised-button [mat-dialog-close]="true" cdkFocusInitial (click)="confirmButton()">{{dialogData.control.confirmButton | languageTranslate: language}}</button>
</section>
</form>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Inject, Input, Output } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FormGroup, FormControl, FormArray } from '@angular/forms';
import { FormGroup, FormControl, FormArray, Validators } from '@angular/forms';

@Component({
selector: 'lib-add-resource',
Expand All @@ -12,42 +12,78 @@ export class AddResourceComponent {
myGroup: FormGroup;
@Output() saveLearningResource = new EventEmitter<any>();
values:any = []

constructor(public dialogRef: MatDialogRef<AddResourceComponent>, @Inject(MAT_DIALOG_DATA) public dialogData: any) {
language:any

constructor(public dialogRef: MatDialogRef<AddResourceComponent>, @Inject(MAT_DIALOG_DATA) public dialogData: any) {
this.myGroup = new FormGroup({
resources: new FormArray([])
});
// Optionally, initialize with one resource
this.addResource();
this.language = this.dialogData.language
}

get resources() {
return this.myGroup.get('resources') as FormArray;
}

addResource() {
let formControls: { [key: string]: any } = {};
for(let control of this.dialogData.control.resource[0]){
formControls[control.name] = new FormControl('');
for (let control of this.dialogData.control.resource[0]) {
let validators = [];
for (const [key, value] of Object.entries(control.validators)) {
switch (key) {
case 'min':
validators.push(Validators.min(value as number));
break;
case 'max':
validators.push(Validators.max(value as number));
break;
case 'required':
if (value) {
validators.push(Validators.required);
}
break;
case 'requiredTrue':
if (value) {
validators.push(Validators.requiredTrue);
}
break;
case 'maxLength':
validators.push(Validators.maxLength(value as number));
break;
case 'pattern':
validators.push(Validators.pattern(value as string));
break;
case 'nullValidator':
if (value) {
validators.push(Validators.nullValidator);
}
break;
default:
break;
}
}
// Add more validators here if needed
formControls[control.name] = new FormControl('', validators);
}
const resourceGroup = new FormGroup(formControls);
this.resources.push(resourceGroup);
}

onClickAddResource(){
this.addResource()
let data = this.dialogData.control.resource[0]
this.dialogData.control.resource.push(data)

}

confirmButton(){
this.saveLearningResource.emit(this. getValues())
}

getValues() {
if(this.myGroup.valid){
return this.myGroup?.value?.resources
return this.myGroup?.value?.resources
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
flex-direction: row;
flex: 1;
flex-wrap: wrap;
}

.add-chips{
display: flex;
flex-direction: row;
align-items: center;
gap: 0.3125rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
(click)="addOption()"
style="cursor: pointer"
>
<mat-icon>add_circle</mat-icon> Add
<span class="add-chips"><mat-icon>add_circle</mat-icon> Add</span>
</mat-chip>
</div>
<mat-slide-toggle
*ngIf="chipControl?.meta?.showSelectAll"
[(ngModel)]="enableSelectAll"
(change)="toggleSelectAll()"
(change)="toggleSelectAll($event)"
color="primary"
></mat-slide-toggle>
</mat-chip-listbox>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DialogInputComponent } from '../dialog-input/dialog-input.component';
],
})
export class ChipInputComponent implements OnInit, ControlValueAccessor {
@Input() viewOnly = false;
@Input() chipControl: any;
selectedChips: any;
enableSelectAll: boolean = false;
Expand Down Expand Up @@ -83,6 +84,7 @@ export class ChipInputComponent implements OnInit, ControlValueAccessor {
data: {
header: this.chipControl.meta.addNewPopupHeader,
label: this.chipControl.meta.addNewPopupSubHeader,
placeHolder:this.chipControl.meta.placeHolder,
required: true,
maxLength: 20,
buttonText: {
Expand All @@ -105,20 +107,25 @@ export class ChipInputComponent implements OnInit, ControlValueAccessor {
});
}

toggleSelectAll() {
this.markAsTouched();
if (this.enableSelectAll) {
this.chipControl.options.map((chipItem: any) => {
this.selectedChips.add(chipItem);
});
} else {
this.selectedChips.clear();
}

if (this.selectedChips.size) {
this.onChange([...this.selectedChips]);
} else {
this.onChange([]);
toggleSelectAll(event:any) {
if(this.viewOnly){
event.source.checked = !event.checked;
}else{
this.markAsTouched();
if (this.enableSelectAll) {
this.chipControl.options.map((chipItem: any) => {
this.selectedChips.add(chipItem);
});
} else {
this.selectedChips.clear();
}

if (this.selectedChips.size) {
this.onChange([...this.selectedChips]);
} else {
this.onChange([]);
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0 0.625rem;
}

.buttons-section{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<div class="dialog-header">
<mat-label mat-dialog-title>{{ dialogData?.header }}</mat-label>
<mat-icon class="mat-cancel-icon" [mat-dialog-close]="false"
>cancel_circle_outline</mat-icon
>
<h2>{{ dialogData?.header }}</h2>
<mat-icon class="mat-cancel-icon" [mat-dialog-close]="false" style="cursor: pointer"
>cancel_circle_outline</mat-icon>
</div>
<hr>
<div mat-dialog-content>
<mat-form-field style="width: 100%" floatLabel="always">
<mat-form-field style="width: 100%" floatLabel="always" appearance="outline">
<mat-label>{{ dialogData?.label }}</mat-label>
<input
matInput
[(ngModel)]="data"
[required]="dialogData?.required"
[maxlength]="dialogData?.maxLength"
[placeholder]="dialogData?.placeHolder"
/>
</mat-form-field>
</div>
Expand Down
Loading