@ruc-lib/metaform 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +36 -0
- package/dist/README.md +135 -0
- package/dist/package.json +38 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +6 -0
- package/package.json +20 -38
- package/project.json +50 -0
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.css +10 -0
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.html +11 -0
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.spec.ts +103 -0
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.ts +33 -0
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.css +16 -0
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.html +18 -0
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.spec.ts +85 -0
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.ts +44 -0
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.css +13 -0
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.html +12 -0
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.spec.ts +98 -0
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.ts +28 -0
- package/src/components/ruc-meta-select/ruc-meta-select.component.css +9 -0
- package/src/components/ruc-meta-select/ruc-meta-select.component.html +12 -0
- package/src/components/ruc-meta-select/ruc-meta-select.component.spec.ts +1165 -0
- package/src/components/ruc-meta-select/ruc-meta-select.component.ts +45 -0
- package/src/components/ruc-text-area/ruc-text-area.component.css +0 -0
- package/src/components/ruc-text-area/ruc-text-area.component.html +16 -0
- package/src/components/ruc-text-area/ruc-text-area.component.spec.ts +100 -0
- package/src/components/ruc-text-area/ruc-text-area.component.ts +30 -0
- package/src/index.ts +2 -0
- package/src/interfaces/metaFormsDefault.ts +71 -0
- package/src/lib/ruclib-metaform/ruclib-metaform.component.html +99 -0
- package/src/lib/ruclib-metaform/ruclib-metaform.component.scss +15 -0
- package/src/lib/ruclib-metaform/ruclib-metaform.component.spec.ts +1253 -0
- package/src/lib/ruclib-metaform/ruclib-metaform.component.stories.ts +676 -0
- package/src/lib/ruclib-metaform/ruclib-metaform.component.ts +91 -0
- package/src/lib/ruclib-metaform.module.ts +59 -0
- package/src/services/ruc-meta-form-validation.service.spec.ts +75 -0
- package/src/services/ruc-meta-form-validation.service.ts +30 -0
- package/src/services/ruc-meta-form.service.spec.ts +63 -0
- package/src/services/ruc-meta-form.service.ts +20 -0
- package/src/test-setup.ts +1 -0
- package/tsconfig.json +30 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
- /package/{components → dist/components}/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.d.ts +0 -0
- /package/{components → dist/components}/ruc-meta-inputs/ruc-meta-inputs.component.d.ts +0 -0
- /package/{components → dist/components}/ruc-meta-radio-group/ruc-meta-radio-group.component.d.ts +0 -0
- /package/{components → dist/components}/ruc-meta-select/ruc-meta-select.component.d.ts +0 -0
- /package/{components → dist/components}/ruc-text-area/ruc-text-area.component.d.ts +0 -0
- /package/{esm2020 → dist/esm2020}/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/components/ruc-meta-inputs/ruc-meta-inputs.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/components/ruc-meta-radio-group/ruc-meta-radio-group.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/components/ruc-meta-select/ruc-meta-select.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/components/ruc-text-area/ruc-text-area.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/index.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/interfaces/metaFormsDefault.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/lib/ruclib-metaform/ruclib-metaform.component.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/lib/ruclib-metaform.module.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/ruc-lib-metaform.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/services/ruc-meta-form-validation.service.mjs +0 -0
- /package/{esm2020 → dist/esm2020}/services/ruc-meta-form.service.mjs +0 -0
- /package/{fesm2015 → dist/fesm2015}/ruc-lib-metaform.mjs +0 -0
- /package/{fesm2015 → dist/fesm2015}/ruc-lib-metaform.mjs.map +0 -0
- /package/{fesm2020 → dist/fesm2020}/ruc-lib-metaform.mjs +0 -0
- /package/{fesm2020 → dist/fesm2020}/ruc-lib-metaform.mjs.map +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{interfaces → dist/interfaces}/metaFormsDefault.d.ts +0 -0
- /package/{lib → dist/lib}/ruclib-metaform/ruclib-metaform.component.d.ts +0 -0
- /package/{lib → dist/lib}/ruclib-metaform.module.d.ts +0 -0
- /package/{services → dist/services}/ruc-meta-form-validation.service.d.ts +0 -0
- /package/{services → dist/services}/ruc-meta-form.service.d.ts +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core';
|
|
2
|
+
import { RucMetaFormService } from "../../services/ruc-meta-form.service"
|
|
3
|
+
import {RucMetaFormValidationService} from '../../services/ruc-meta-form-validation.service';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'ruc-meta-select',
|
|
7
|
+
templateUrl: './ruc-meta-select.component.html',
|
|
8
|
+
styleUrls: ['./ruc-meta-select.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class RucMetaSelectComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
@Input() rucInputData : any;
|
|
13
|
+
errorMessage: string | undefined
|
|
14
|
+
@Output() transferUserInput = new EventEmitter<any>();
|
|
15
|
+
constructor(public service: RucMetaFormService,public validationService:RucMetaFormValidationService) { }
|
|
16
|
+
|
|
17
|
+
ngOnInit(): void {
|
|
18
|
+
this.errorMessage = this.validationService.defaultErrorMessage;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
modelChangeFn(e:any) {
|
|
22
|
+
this.rucInputData.groupOptions.forEach((x: any)=>{
|
|
23
|
+
if(x.value == e.value){
|
|
24
|
+
this.rucInputData.selectedParentId = x.id;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if(this.rucInputData.dependentFields){
|
|
28
|
+
this.removDependentFieldParentIdFromOther(this.rucInputData.dependentFields);
|
|
29
|
+
}
|
|
30
|
+
this.service.currentFormElement = this.rucInputData;
|
|
31
|
+
this.transferUserInput.emit(this.rucInputData);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
removDependentFieldParentIdFromOther(child: any){
|
|
35
|
+
child.forEach((x:any)=>{
|
|
36
|
+
if(x.selectedParentId){
|
|
37
|
+
delete(x.selectedParentId);
|
|
38
|
+
x.value = "";
|
|
39
|
+
if(x.dependentFields){
|
|
40
|
+
this.removDependentFieldParentIdFromOther(x.dependentFields);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<mat-form-field [ngStyle]="{ 'width.%': rucInputData?.width }" [appearance]="rucInputData?.appearance || 'fill'" class="{{customTheme}}">
|
|
2
|
+
<mat-label>{{rucInputData?.label}}</mat-label>
|
|
3
|
+
<textarea matInput
|
|
4
|
+
placeholder="{{rucInputData?.placeholder}}"
|
|
5
|
+
cdkTextareaAutosize
|
|
6
|
+
#autosize="cdkTextareaAutosize"
|
|
7
|
+
cdkAutosizeMinRows="{{rucInputData.min}}"
|
|
8
|
+
cdkAutosizeMaxRows="{{rucInputData.max}}"
|
|
9
|
+
[readonly]="rucInputData?.readonly"
|
|
10
|
+
[(ngModel)]="rucInputData.value"
|
|
11
|
+
matTooltip="{{rucInputData?.tooltip}}"
|
|
12
|
+
(ngModelChange)="modelChangeFn($event.target)"></textarea>
|
|
13
|
+
</mat-form-field>
|
|
14
|
+
<div *ngIf="rucInputData?.errorMsg" class="form-error">
|
|
15
|
+
{{rucInputData?.customErrorMessage ? rucInputData?.customErrorMessage : errorMessage}}
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { RucTextAreaComponent } from './ruc-text-area.component';
|
|
4
|
+
import {TextFieldModule} from '@angular/cdk/text-field';
|
|
5
|
+
import { MetaFormConfig } from '../../interfaces/metaFormsDefault';
|
|
6
|
+
describe('RucTextAreaComponent', () => {
|
|
7
|
+
let component: RucTextAreaComponent;
|
|
8
|
+
let fixture: ComponentFixture<RucTextAreaComponent>;
|
|
9
|
+
const mockFormData: MetaFormConfig = {
|
|
10
|
+
"formType": "simple",
|
|
11
|
+
"fieldType": "textarea",
|
|
12
|
+
"inputType": "text",
|
|
13
|
+
"id": "firstName",
|
|
14
|
+
"name": "firstName",
|
|
15
|
+
"errorMsg": false,
|
|
16
|
+
"label": "First Name",
|
|
17
|
+
"className": "firstName",
|
|
18
|
+
"value": "",
|
|
19
|
+
"alt": "na",
|
|
20
|
+
"appearance": "outline",
|
|
21
|
+
"min": "4",
|
|
22
|
+
"max": "20",
|
|
23
|
+
"width": "100",
|
|
24
|
+
"height": "20",
|
|
25
|
+
"checked": false,
|
|
26
|
+
"disabled": false,
|
|
27
|
+
"maxlength": "100",
|
|
28
|
+
"readonly": false,
|
|
29
|
+
"required": false,
|
|
30
|
+
"size": "100",
|
|
31
|
+
"step": "100",
|
|
32
|
+
"sameRow": true,
|
|
33
|
+
"sameRowColumnWidth": "25",
|
|
34
|
+
"tooltip": "First Name",
|
|
35
|
+
"tooltipPosition": "right",
|
|
36
|
+
"pattern": "any",
|
|
37
|
+
"placeholder": "First Name",
|
|
38
|
+
"autofocus": true,
|
|
39
|
+
"autocomplete": ["amar", "bharat", "charan"],
|
|
40
|
+
"customComponentName": "none",
|
|
41
|
+
"rucDialogInput": {},
|
|
42
|
+
"hasDependentFields": false,
|
|
43
|
+
"dependentFieldParentId": "any",
|
|
44
|
+
"toolTipDescription": "none",
|
|
45
|
+
"showErrorOnPopUp": true,
|
|
46
|
+
"groupOptions": [
|
|
47
|
+
{
|
|
48
|
+
"id": "Winter",
|
|
49
|
+
"name": "Winter",
|
|
50
|
+
"value": ""
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "Spring",
|
|
54
|
+
"name": "Spring",
|
|
55
|
+
"value": ""
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "Summer",
|
|
59
|
+
"name": "Summer",
|
|
60
|
+
"value": ""
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "Autumn",
|
|
64
|
+
"name": "Autumn",
|
|
65
|
+
"value": ""
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"dependentFields": []
|
|
69
|
+
}
|
|
70
|
+
beforeEach(async () => {
|
|
71
|
+
await TestBed.configureTestingModule({
|
|
72
|
+
imports: [TextFieldModule],
|
|
73
|
+
declarations: [ RucTextAreaComponent ]
|
|
74
|
+
})
|
|
75
|
+
.compileComponents();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
fixture = TestBed.createComponent(RucTextAreaComponent);
|
|
80
|
+
component = fixture.componentInstance;
|
|
81
|
+
component.rucInputData = mockFormData;
|
|
82
|
+
fixture.detectChanges();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should create', () => {
|
|
86
|
+
component.rucInputData = mockFormData;
|
|
87
|
+
expect(component).toBeTruthy();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should called modelChangeFn ', () => {
|
|
91
|
+
component.rucInputData = mockFormData;
|
|
92
|
+
const event = {
|
|
93
|
+
value: "Winter"
|
|
94
|
+
}
|
|
95
|
+
const spy = spyOn(component.transferUserInput, 'emit');
|
|
96
|
+
component.modelChangeFn(event);
|
|
97
|
+
|
|
98
|
+
expect(spy).toHaveBeenCalled();
|
|
99
|
+
})
|
|
100
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core';
|
|
2
|
+
import {RucMetaFormValidationService} from '../../services/ruc-meta-form-validation.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ruc-text-area',
|
|
6
|
+
templateUrl: './ruc-text-area.component.html',
|
|
7
|
+
styleUrls: ['./ruc-text-area.component.css']
|
|
8
|
+
})
|
|
9
|
+
export class RucTextAreaComponent implements OnInit {
|
|
10
|
+
@Input() rucInputData : any;
|
|
11
|
+
@Output() transferUserInput = new EventEmitter<any>();
|
|
12
|
+
@Input() customTheme: string | undefined;
|
|
13
|
+
errorMessage: string | undefined
|
|
14
|
+
|
|
15
|
+
constructor(public validationService:RucMetaFormValidationService) {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ngOnInit(): void {
|
|
20
|
+
this.errorMessage = this.validationService.defaultErrorMessage;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param e
|
|
25
|
+
*/
|
|
26
|
+
modelChangeFn(e:any) {
|
|
27
|
+
this.transferUserInput.emit(this.rucInputData);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
export interface MetaFormConfig {
|
|
3
|
+
formType?: 'simple' | 'stepper' // less priority
|
|
4
|
+
inputType: 'text' | 'password' | 'button' | 'checkbox' | 'email' | 'color' | 'date' | 'file' | 'hidden' | 'image' | 'radio' | 'number' | 'range' | 'reset' | 'search' | 'submit' | 'time' | 'tel' | 'url' | 'week' | 'month' | 'number' | 'custom' | 'select' | 'rucMultiFileUpload' | 'rucMultiSelect',
|
|
5
|
+
fieldType: string,
|
|
6
|
+
id?: string,
|
|
7
|
+
errorMsg? : boolean,
|
|
8
|
+
name?: string,
|
|
9
|
+
label?: string,
|
|
10
|
+
value?: any,
|
|
11
|
+
className?: string, // to be check value?: string, //Specifies the default value for an input field src?: string,
|
|
12
|
+
alt?: string,
|
|
13
|
+
appearance?: string,
|
|
14
|
+
min?: string, //Specifies the minimum value for an input field
|
|
15
|
+
max?: string, //Specifies the maximum value for an input field
|
|
16
|
+
width?: string, // like for image
|
|
17
|
+
height?: string, // like for image
|
|
18
|
+
checked?: boolean, //Specifies that an input field should be pre-selected when the page loads (for type="checkbox" or type="radio")
|
|
19
|
+
disabled?: boolean, //Specifies that an input field should be disabled
|
|
20
|
+
maxlength?: string, //Specifies the maximum number of character for an input field
|
|
21
|
+
readonly?: boolean, //Specifies that an input field is read only (cannot be changed)
|
|
22
|
+
required?: boolean, //Specifies that an input field is required (must be filled out)
|
|
23
|
+
size?: string, //Specifies the width (in characters) of an input field
|
|
24
|
+
step?: string, //Specifies the legal number intervals for an input field
|
|
25
|
+
sameRow? : boolean,
|
|
26
|
+
sameRowColumnWidth? : string,
|
|
27
|
+
tooltip? : string,
|
|
28
|
+
tooltipPosition? : string, //'after', 'before', 'above', 'below', 'left', 'right'
|
|
29
|
+
pattern? : any, // The input pattern attribute specifies a regular expression that the input field's value is checked against, when the form is submitted. The pattern attribute works with the following input types: text, date, search, url, tel, email, and password.
|
|
30
|
+
placeholder?: any,
|
|
31
|
+
autofocus?: any, //The input autofocus attribute specifies that an input field should automatically get focus when the page loads.
|
|
32
|
+
autocomplete?: any,
|
|
33
|
+
customComponentName?: 'dialog' | 'multiselect' | 'none',
|
|
34
|
+
rucDialogInput? : any,
|
|
35
|
+
rucMultiselectInput? : {
|
|
36
|
+
rucInputData? : any,
|
|
37
|
+
dataSource? : any
|
|
38
|
+
}, // multiselect interface
|
|
39
|
+
rucMultiFileUpload? : {rucInputData? : any}
|
|
40
|
+
hasDependentFields?: boolean,
|
|
41
|
+
dependentFieldParentId?: any,
|
|
42
|
+
dependentFields?: MetaFormConfig[];
|
|
43
|
+
selectedParentId?: any;
|
|
44
|
+
toolTipDescription?: string,
|
|
45
|
+
customErrorMessage?: string,
|
|
46
|
+
showErrorOnPopUp?: boolean, //need to be discuss more. as a enhancement
|
|
47
|
+
groupOptions?: groupOptions[] // Or like [''],
|
|
48
|
+
stepperForm?: boolean;
|
|
49
|
+
stepper?: Stepper[],
|
|
50
|
+
rucMultiFileUploadInput?:{
|
|
51
|
+
rucInputData? : any,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export interface FormAttributes {
|
|
55
|
+
action: any,
|
|
56
|
+
target?: any,
|
|
57
|
+
method?:any,
|
|
58
|
+
novalidate?: boolean,
|
|
59
|
+
showFormProgress?: boolean // need to spend time on it
|
|
60
|
+
}
|
|
61
|
+
export interface groupOptions{
|
|
62
|
+
id: string,
|
|
63
|
+
name: string,
|
|
64
|
+
value?: string, // compulsary if its select option part selected?: boolean
|
|
65
|
+
disable? : boolean
|
|
66
|
+
}
|
|
67
|
+
export interface Stepper{
|
|
68
|
+
stepControl?: string;
|
|
69
|
+
stepperlabel?: string;
|
|
70
|
+
stepperFormData?: MetaFormConfig[];
|
|
71
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<form novalidate>
|
|
2
|
+
<ng-container *ngFor="let dynamicField of formData; let j = index;" [ngSwitch]="dynamicField?.fieldType">
|
|
3
|
+
<div [ngStyle] = "{ 'width.%': dynamicField.sameRowColumnWidth - 2 }" [ngClass]="dynamicField.sameRow === true ? 'margin-5 column-in-same-row' : 'margin-5 column-in-new-row'"
|
|
4
|
+
*ngIf="dynamicField.formType != 'stepper'">
|
|
5
|
+
|
|
6
|
+
<ng-template [ngSwitchCase]="'input'">
|
|
7
|
+
<div *ngIf="(!selectedParentId && !dynamicField.hasDependentFields) || (selectedParentId && selectedParentId == dynamicField.dependentFieldParentId)">
|
|
8
|
+
<ruc-meta-inputs [customTheme] = "customTheme" [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-meta-inputs>
|
|
9
|
+
</div>
|
|
10
|
+
</ng-template>
|
|
11
|
+
<ng-template [ngSwitchCase]="'radio'">
|
|
12
|
+
<div *ngIf="(!selectedParentId && !dynamicField.dependentFields) || (selectedParentId && selectedParentId == dynamicField.dependentFieldParentId) || (!selectedParentId && dynamicField.dependentFields && !isChild)">
|
|
13
|
+
<ruc-meta-radio-group [customTheme] = "customTheme" [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-meta-radio-group>
|
|
14
|
+
</div>
|
|
15
|
+
</ng-template>
|
|
16
|
+
<ng-template [ngSwitchCase]="'checkbox'">
|
|
17
|
+
<div *ngIf="(!selectedParentId && !dynamicField.dependentFields) || (selectedParentId && selectedParentId == dynamicField.dependentFieldParentId) || (!selectedParentId && dynamicField.dependentFields && !isChild)">
|
|
18
|
+
<ruc-meta-checkbox-group [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-meta-checkbox-group>
|
|
19
|
+
</div>
|
|
20
|
+
</ng-template>
|
|
21
|
+
<ng-template class="" [ngSwitchCase]="'select'">
|
|
22
|
+
<div *ngIf="(!selectedParentId && !dynamicField.dependentFields) || (selectedParentId && selectedParentId == dynamicField.dependentFieldParentId) || (!selectedParentId && dynamicField.dependentFields && !isChild)">
|
|
23
|
+
<ruc-meta-select [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-meta-select>
|
|
24
|
+
</div>
|
|
25
|
+
</ng-template>
|
|
26
|
+
<ng-template class="" [ngSwitchCase]="'textarea'">
|
|
27
|
+
<ruc-text-area [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-text-area>
|
|
28
|
+
</ng-template>
|
|
29
|
+
<ng-template [ngSwitchCase]="'rucMultiSelect'">
|
|
30
|
+
<uxp-ruclib-multi-select [rucInputData]="dynamicField?.rucMultiselectInput?.rucInputData"
|
|
31
|
+
[dataSource]="dynamicField?.rucMultiselectInput?.dataSource" [customTheme]="customTheme"
|
|
32
|
+
(rucEvent)="passEvent($event)"></uxp-ruclib-multi-select>
|
|
33
|
+
</ng-template>
|
|
34
|
+
<ng-template [ngSwitchCase]="'rucMultiFileUpload'">
|
|
35
|
+
<uxp-ruclib-multi-file-upload
|
|
36
|
+
[rucInputData]="dynamicField?.rucMultiFileUploadInput?.rucInputData" [customTheme]="customTheme"
|
|
37
|
+
(rucEvent)="passEvent($event,dynamicField)"></uxp-ruclib-multi-file-upload>
|
|
38
|
+
</ng-template>
|
|
39
|
+
<div *ngIf="dynamicField.hasDependentFields && dynamicField.value">
|
|
40
|
+
<uxp-ruclib-metaform #dynamicField.id [rucInputData]="formData" [childForm] ="dynamicField.dependentFields"
|
|
41
|
+
[isChild]="true" [selectedParentId] = "dynamicField.selectedParentId" (rucEvent)="passEvent($event,dynamicField.id)"></uxp-ruclib-metaform>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
<div *ngIf="dynamicField.formType == 'stepper'">
|
|
46
|
+
<mat-stepper linear #stepper>
|
|
47
|
+
<div *ngFor="let stapperField of dynamicField.stepper; let s = index;" [ngSwitch]="stapperField?.fieldType">
|
|
48
|
+
<mat-step [stepControl]="stapperField.stepControl" *ngIf="stapperField.stepControl != 'done'">
|
|
49
|
+
<ng-template matStepLabel>{{stapperField.stepperlabel}}</ng-template>
|
|
50
|
+
<ng-container *ngFor="let stepperFormData of stapperField.stepperFormData; let j = index;" [ngSwitch]="stepperFormData?.fieldType">
|
|
51
|
+
<div [ngStyle] = "{ 'width.%': dynamicField.sameRowColumnWidth - 2 }" [ngClass]="dynamicField.sameRow === true ? 'margin-5 column-in-same-row' : 'margin-5 column-in-new-row'"
|
|
52
|
+
>
|
|
53
|
+
<ng-template [ngSwitchCase]="'input'">
|
|
54
|
+
<div>
|
|
55
|
+
<ruc-meta-inputs [customTheme] = "customTheme" [rucInputData]="stepperFormData" (transferUserInput)="getMetaFormData($event)"></ruc-meta-inputs>
|
|
56
|
+
</div>
|
|
57
|
+
</ng-template>
|
|
58
|
+
<ng-template class="" [ngSwitchCase]="'textarea'">
|
|
59
|
+
<ruc-text-area [rucInputData]="stepperFormData" (transferUserInput)="getMetaFormData($event)"></ruc-text-area>
|
|
60
|
+
</ng-template>
|
|
61
|
+
<ng-template [ngSwitchCase]="'radio'">
|
|
62
|
+
<div>
|
|
63
|
+
<ruc-meta-radio-group [customTheme] = "customTheme" [rucInputData]="stepperFormData" (transferUserInput)="getMetaFormData($event)"></ruc-meta-radio-group>
|
|
64
|
+
</div>
|
|
65
|
+
</ng-template>
|
|
66
|
+
<ng-template [ngSwitchCase]="'checkbox'">
|
|
67
|
+
<div >
|
|
68
|
+
<ruc-meta-checkbox-group [rucInputData]="stepperFormData" (transferUserInput)="getMetaFormData($event)"></ruc-meta-checkbox-group>
|
|
69
|
+
</div>
|
|
70
|
+
</ng-template>
|
|
71
|
+
<ng-template class="" [ngSwitchCase]="'select'">
|
|
72
|
+
<div *ngIf="(!selectedParentId && !dynamicField.dependentFields) || (selectedParentId && selectedParentId == dynamicField.dependentFieldParentId) || (!selectedParentId && dynamicField.dependentFields && !isChild)">
|
|
73
|
+
<ruc-meta-select [rucInputData]="dynamicField" (transferUserInput)="getMetaFormData($event)"></ruc-meta-select>
|
|
74
|
+
</div>
|
|
75
|
+
</ng-template>
|
|
76
|
+
</div>
|
|
77
|
+
</ng-container>
|
|
78
|
+
<div>
|
|
79
|
+
<button mat-button matStepperPrevious *ngIf="s > 0">Back</button>
|
|
80
|
+
<button mat-button matStepperNext *ngIf="s< dynamicField.stepper.length">Next</button>
|
|
81
|
+
</div>
|
|
82
|
+
</mat-step>
|
|
83
|
+
<mat-step *ngIf="stapperField.stepControl == 'done'">
|
|
84
|
+
<ng-template matStepLabel>{{stapperField.stepControl}}</ng-template>
|
|
85
|
+
<p>{{stapperField.stepperlabel}}</p>
|
|
86
|
+
<div>
|
|
87
|
+
<button mat-button matStepperPrevious>Back</button>
|
|
88
|
+
<button mat-button (click)="stepper.reset()">Reset</button>
|
|
89
|
+
</div>
|
|
90
|
+
</mat-step>
|
|
91
|
+
</div>
|
|
92
|
+
</mat-stepper>
|
|
93
|
+
</div>
|
|
94
|
+
</ng-container>
|
|
95
|
+
<ng-container>
|
|
96
|
+
<button mat-raised-button color="primary" (click)="clearForm()" *ngIf="!isChild">Clear Form</button>
|
|
97
|
+
</ng-container>
|
|
98
|
+
|
|
99
|
+
</form>
|