@ruc-lib/metaform 2.0.1 → 2.0.3
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/package.json +39 -20
- package/.eslintrc.json +0 -36
- package/dist/README.md +0 -135
- package/dist/package.json +0 -38
- package/jest.config.ts +0 -22
- package/ng-package.json +0 -6
- package/project.json +0 -50
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.css +0 -10
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.html +0 -11
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.spec.ts +0 -103
- package/src/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.ts +0 -33
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.css +0 -16
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.html +0 -18
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.spec.ts +0 -85
- package/src/components/ruc-meta-inputs/ruc-meta-inputs.component.ts +0 -44
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.css +0 -13
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.html +0 -12
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.spec.ts +0 -98
- package/src/components/ruc-meta-radio-group/ruc-meta-radio-group.component.ts +0 -28
- package/src/components/ruc-meta-select/ruc-meta-select.component.css +0 -9
- package/src/components/ruc-meta-select/ruc-meta-select.component.html +0 -12
- package/src/components/ruc-meta-select/ruc-meta-select.component.spec.ts +0 -1165
- package/src/components/ruc-meta-select/ruc-meta-select.component.ts +0 -45
- package/src/components/ruc-text-area/ruc-text-area.component.css +0 -0
- package/src/components/ruc-text-area/ruc-text-area.component.html +0 -16
- package/src/components/ruc-text-area/ruc-text-area.component.spec.ts +0 -100
- package/src/components/ruc-text-area/ruc-text-area.component.ts +0 -30
- package/src/index.ts +0 -2
- package/src/interfaces/metaFormsDefault.ts +0 -71
- package/src/lib/ruclib-metaform/ruclib-metaform.component.html +0 -99
- package/src/lib/ruclib-metaform/ruclib-metaform.component.scss +0 -15
- package/src/lib/ruclib-metaform/ruclib-metaform.component.spec.ts +0 -1253
- package/src/lib/ruclib-metaform/ruclib-metaform.component.stories.ts +0 -676
- package/src/lib/ruclib-metaform/ruclib-metaform.component.ts +0 -91
- package/src/lib/ruclib-metaform.module.ts +0 -59
- package/src/services/ruc-meta-form-validation.service.spec.ts +0 -75
- package/src/services/ruc-meta-form-validation.service.ts +0 -30
- package/src/services/ruc-meta-form.service.spec.ts +0 -63
- package/src/services/ruc-meta-form.service.ts +0 -20
- package/src/test-setup.ts +0 -1
- package/tsconfig.json +0 -30
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -16
- /package/{dist/components → components}/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.d.ts +0 -0
- /package/{dist/components → components}/ruc-meta-inputs/ruc-meta-inputs.component.d.ts +0 -0
- /package/{dist/components → components}/ruc-meta-radio-group/ruc-meta-radio-group.component.d.ts +0 -0
- /package/{dist/components → components}/ruc-meta-select/ruc-meta-select.component.d.ts +0 -0
- /package/{dist/components → components}/ruc-text-area/ruc-text-area.component.d.ts +0 -0
- /package/{dist/esm2020 → esm2020}/components/ruc-meta-checkbox-group/ruc-meta-checkbox-group.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/components/ruc-meta-inputs/ruc-meta-inputs.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/components/ruc-meta-radio-group/ruc-meta-radio-group.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/components/ruc-meta-select/ruc-meta-select.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/components/ruc-text-area/ruc-text-area.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/index.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/interfaces/metaFormsDefault.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/ruclib-metaform/ruclib-metaform.component.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/lib/ruclib-metaform.module.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/ruc-lib-metaform.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/services/ruc-meta-form-validation.service.mjs +0 -0
- /package/{dist/esm2020 → esm2020}/services/ruc-meta-form.service.mjs +0 -0
- /package/{dist/fesm2015 → fesm2015}/ruc-lib-metaform.mjs +0 -0
- /package/{dist/fesm2015 → fesm2015}/ruc-lib-metaform.mjs.map +0 -0
- /package/{dist/fesm2020 → fesm2020}/ruc-lib-metaform.mjs +0 -0
- /package/{dist/fesm2020 → fesm2020}/ruc-lib-metaform.mjs.map +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/interfaces → interfaces}/metaFormsDefault.d.ts +0 -0
- /package/{dist/lib → lib}/ruclib-metaform/ruclib-metaform.component.d.ts +0 -0
- /package/{dist/lib → lib}/ruclib-metaform.module.d.ts +0 -0
- /package/{dist/services → services}/ruc-meta-form-validation.service.d.ts +0 -0
- /package/{dist/services → services}/ruc-meta-form.service.d.ts +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
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-meta-inputs',
|
|
6
|
-
templateUrl: './ruc-meta-inputs.component.html',
|
|
7
|
-
styleUrls: ['./ruc-meta-inputs.component.css']
|
|
8
|
-
})
|
|
9
|
-
export class RucMetaInputsComponent implements OnInit {
|
|
10
|
-
@Input() rucInputData : any;
|
|
11
|
-
@Input() selectedParentId?:any;
|
|
12
|
-
@Output() transferUserInput = new EventEmitter<any>();
|
|
13
|
-
@Input() customTheme: string | undefined;
|
|
14
|
-
errorMessage: string | undefined
|
|
15
|
-
options: string[] = [];
|
|
16
|
-
filteredOptions: any;
|
|
17
|
-
constructor(public validationService:RucMetaFormValidationService) {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
ngOnInit(): void {
|
|
22
|
-
this.errorMessage = this.validationService.defaultErrorMessage;
|
|
23
|
-
this.rucInputData.value === undefined ? "" : this.rucInputData.value;
|
|
24
|
-
this.options = this.rucInputData.autocomplete;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param e
|
|
29
|
-
*/
|
|
30
|
-
modelChangeFn(e:any) {
|
|
31
|
-
const validate = this.validationService.alphaNumericValidator(this.rucInputData);
|
|
32
|
-
this.rucInputData.errorMsg = validate;
|
|
33
|
-
if(this.rucInputData.autocomplete){
|
|
34
|
-
this.filteredOptions = this._filter(this.rucInputData.value);
|
|
35
|
-
}
|
|
36
|
-
this.transferUserInput.emit(this.rucInputData);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private _filter(value: string): string[] {
|
|
40
|
-
const filterValue = value.toLowerCase();
|
|
41
|
-
return this.options.filter(option => option.toLowerCase().includes(filterValue));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<mat-label>{{rucInputData?.label}}</mat-label>
|
|
2
|
-
<mat-radio-group
|
|
3
|
-
aria-labelledby="radio-group-label"
|
|
4
|
-
class="{{customTheme}} radio-group" [(ngModel)]="radioValue">
|
|
5
|
-
<mat-radio-button class="radio-button" *ngFor="let item of rucInputData?.groupOptions" [value]="item.value"
|
|
6
|
-
(change)="modelChangeFn($event)">
|
|
7
|
-
{{item?.name}}
|
|
8
|
-
</mat-radio-button>
|
|
9
|
-
</mat-radio-group>
|
|
10
|
-
<div *ngIf="rucInputData?.errorMsg" class="form-error">
|
|
11
|
-
{{rucInputData?.customErrorMessage ? rucInputData?.customErrorMessage : errorMessage}}
|
|
12
|
-
</div>
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { RucMetaRadioGroupComponent } from './ruc-meta-radio-group.component';
|
|
4
|
-
import { MetaFormConfig } from '../../interfaces/metaFormsDefault';
|
|
5
|
-
|
|
6
|
-
describe('RucMetaRadioGroupComponent', () => {
|
|
7
|
-
let component: RucMetaRadioGroupComponent;
|
|
8
|
-
let fixture: ComponentFixture<RucMetaRadioGroupComponent>;
|
|
9
|
-
const mockFormData: MetaFormConfig = {
|
|
10
|
-
"formType": "simple",
|
|
11
|
-
"fieldType": "radio",
|
|
12
|
-
"inputType": "radio",
|
|
13
|
-
"id": "radio",
|
|
14
|
-
"name": "radio",
|
|
15
|
-
"label": "radio configuration",
|
|
16
|
-
"className": "radio",
|
|
17
|
-
"value": "",
|
|
18
|
-
"alt": "na",
|
|
19
|
-
"appearance": "outline",
|
|
20
|
-
"min": "4",
|
|
21
|
-
"max": "20",
|
|
22
|
-
"width": "100",
|
|
23
|
-
"height": "20",
|
|
24
|
-
"checked": false,
|
|
25
|
-
"disabled": false,
|
|
26
|
-
"maxlength": "100",
|
|
27
|
-
"readonly": false,
|
|
28
|
-
"required": true,
|
|
29
|
-
"size": "100",
|
|
30
|
-
"step": "100",
|
|
31
|
-
"sameRow":false,
|
|
32
|
-
"sameRowColumnWidth": "100",
|
|
33
|
-
"tooltip": "Checkpoint",
|
|
34
|
-
"tooltipPosition": "above",
|
|
35
|
-
"pattern": "any",
|
|
36
|
-
"placeholder": "",
|
|
37
|
-
"autofocus": true,
|
|
38
|
-
"autocomplete": false,
|
|
39
|
-
"customComponentName": "none",
|
|
40
|
-
"rucDialogInput": {},
|
|
41
|
-
"hasDependentFields": false,
|
|
42
|
-
"dependentFieldParentId": "any",
|
|
43
|
-
"dependentFields": [],
|
|
44
|
-
"toolTipDescription": "none",
|
|
45
|
-
"errorMsg": false,
|
|
46
|
-
"customErrorMessage": "invalid selection",
|
|
47
|
-
"showErrorOnPopUp": true,
|
|
48
|
-
"groupOptions": [
|
|
49
|
-
{
|
|
50
|
-
"id": "Winter",
|
|
51
|
-
"name": "Winter",
|
|
52
|
-
"value": ""
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "Spring",
|
|
56
|
-
"name": "Spring",
|
|
57
|
-
"value": ""
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"id": "Summer",
|
|
61
|
-
"name": "Summer",
|
|
62
|
-
"value": ""
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"id": "Autumn",
|
|
66
|
-
"name": "Autumn",
|
|
67
|
-
"value": ""
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
beforeEach(async () => {
|
|
72
|
-
await TestBed.configureTestingModule({
|
|
73
|
-
declarations: [ RucMetaRadioGroupComponent ]
|
|
74
|
-
})
|
|
75
|
-
.compileComponents();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
beforeEach(() => {
|
|
79
|
-
fixture = TestBed.createComponent(RucMetaRadioGroupComponent);
|
|
80
|
-
component = fixture.componentInstance;
|
|
81
|
-
fixture.detectChanges();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should create', () => {
|
|
85
|
-
expect(component).toBeTruthy();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should called modelChangeFn ', () => {
|
|
89
|
-
component.dataSource = mockFormData;
|
|
90
|
-
const event = {
|
|
91
|
-
value: "Winter"
|
|
92
|
-
}
|
|
93
|
-
const spy = spyOn(component.transferUserInput, 'emit');
|
|
94
|
-
component.modelChangeFn(event);
|
|
95
|
-
|
|
96
|
-
expect(spy).toHaveBeenCalled();
|
|
97
|
-
})
|
|
98
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit,EventEmitter, Output } from '@angular/core';
|
|
2
|
-
import {RucMetaFormValidationService} from '../../services/ruc-meta-form-validation.service';
|
|
3
|
-
import { MatRadioChange } from '@angular/material/radio';
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'ruc-meta-radio-group',
|
|
6
|
-
templateUrl: './ruc-meta-radio-group.component.html',
|
|
7
|
-
styleUrls: ['./ruc-meta-radio-group.component.css'],
|
|
8
|
-
})
|
|
9
|
-
export class RucMetaRadioGroupComponent implements OnInit {
|
|
10
|
-
@Input() rucInputData : any;
|
|
11
|
-
@Input() customTheme: string | undefined;
|
|
12
|
-
@Output() transferUserInput = new EventEmitter<any>();
|
|
13
|
-
errorMessage: string | undefined
|
|
14
|
-
radioValue: string | undefined;
|
|
15
|
-
constructor(public validationService:RucMetaFormValidationService) { }
|
|
16
|
-
|
|
17
|
-
ngOnInit(): void {
|
|
18
|
-
this.errorMessage = this.validationService.defaultErrorMessage;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @param e
|
|
23
|
-
*/
|
|
24
|
-
modelChangeFn(e:any) {
|
|
25
|
-
this.rucInputData.value = e.value;
|
|
26
|
-
this.transferUserInput.emit(this.rucInputData);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<div class="select-label">
|
|
2
|
-
<mat-label>{{rucInputData?.label}}</mat-label>
|
|
3
|
-
</div>
|
|
4
|
-
<mat-form-field [ngStyle]="{ 'width.%': rucInputData?.width }" matTooltip="{{rucInputData?.tooltip}}" [appearance]="rucInputData?.appearance || 'fill'">
|
|
5
|
-
<mat-label>Choose an option</mat-label>
|
|
6
|
-
<mat-select (selectionChange)="modelChangeFn($event)" [(ngModel)]="rucInputData.value">
|
|
7
|
-
<mat-option *ngFor="let item of rucInputData?.groupOptions" [value]="item.value" [disabled]="item?.disable"> {{item.name}}</mat-option>
|
|
8
|
-
</mat-select>
|
|
9
|
-
</mat-form-field>
|
|
10
|
-
<div *ngIf="rucInputData?.errorMsg" class="form-error">
|
|
11
|
-
{{rucInputData?.customErrorMessage ? rucInputData?.customErrorMessage : errorMessage}}
|
|
12
|
-
</div>
|