@ng-formworks/material 17.2.7 → 17.3.0
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/LICENSE +21 -0
- package/esm2022/lib/material-design-cssframework.mjs +19 -0
- package/esm2022/lib/material-design-framework.component.mjs +119 -0
- package/esm2022/lib/material-design-framework.module.mjs +117 -0
- package/esm2022/lib/material-design.framework.mjs +61 -0
- package/esm2022/lib/widgets/flex-layout-root.component.mjs +75 -0
- package/esm2022/lib/widgets/flex-layout-section.component.mjs +347 -0
- package/esm2022/lib/widgets/material-add-reference.component.mjs +66 -0
- package/esm2022/lib/widgets/material-button-group.component.mjs +90 -0
- package/esm2022/lib/widgets/material-button.component.mjs +80 -0
- package/esm2022/lib/widgets/material-checkbox.component.mjs +166 -0
- package/esm2022/lib/widgets/material-checkboxes.component.mjs +129 -0
- package/esm2022/lib/widgets/material-chip-list.component.mjs +35 -0
- package/esm2022/lib/widgets/material-datepicker.component.mjs +141 -0
- package/esm2022/lib/widgets/material-file.component.mjs +35 -0
- package/esm2022/lib/widgets/material-input.component.mjs +149 -0
- package/esm2022/lib/widgets/material-number.component.mjs +145 -0
- package/esm2022/lib/widgets/material-one-of.component.mjs +35 -0
- package/esm2022/lib/widgets/material-radios.component.mjs +122 -0
- package/esm2022/lib/widgets/material-select.component.mjs +186 -0
- package/esm2022/lib/widgets/material-slider.component.mjs +91 -0
- package/esm2022/lib/widgets/material-stepper.component.mjs +35 -0
- package/esm2022/lib/widgets/material-tabs.component.mjs +92 -0
- package/esm2022/lib/widgets/material-textarea.component.mjs +134 -0
- package/esm2022/lib/widgets/public_api.mjs +52 -0
- package/esm2022/ng-formworks-material.mjs +5 -0
- package/esm2022/public_api.mjs +8 -0
- package/fesm2022/ng-formworks-material.mjs +2353 -0
- package/fesm2022/ng-formworks-material.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/material-design-cssframework.d.ts +1 -0
- package/lib/material-design-framework.component.d.ts +35 -0
- package/lib/material-design-framework.module.d.ts +61 -0
- package/lib/material-design.framework.d.ts +46 -0
- package/lib/widgets/flex-layout-root.component.d.ts +15 -0
- package/lib/widgets/flex-layout-section.component.d.ts +25 -0
- package/lib/widgets/material-add-reference.component.d.ts +20 -0
- package/lib/widgets/material-button-group.component.d.ts +23 -0
- package/lib/widgets/material-button.component.d.ts +24 -0
- package/lib/widgets/material-checkbox.component.d.ts +25 -0
- package/lib/widgets/material-checkboxes.component.d.ts +27 -0
- package/lib/widgets/material-chip-list.component.d.ts +21 -0
- package/lib/widgets/material-datepicker.component.d.ts +22 -0
- package/lib/widgets/material-file.component.d.ts +21 -0
- package/lib/widgets/material-input.component.d.ts +23 -0
- package/lib/widgets/material-number.component.d.ts +26 -0
- package/lib/widgets/material-one-of.component.d.ts +21 -0
- package/lib/widgets/material-radios.component.d.ts +23 -0
- package/lib/widgets/material-select.component.d.ts +24 -0
- package/lib/widgets/material-slider.component.d.ts +25 -0
- package/lib/widgets/material-stepper.component.d.ts +21 -0
- package/lib/widgets/material-tabs.component.d.ts +20 -0
- package/lib/widgets/material-textarea.component.d.ts +22 -0
- package/{src/lib/widgets/public_api.ts → lib/widgets/public_api.d.ts} +41 -54
- package/package.json +62 -48
- package/{src/public_api.ts → public_api.d.ts} +4 -9
- package/karma.conf.js +0 -46
- package/ng-package.json +0 -13
- package/src/lib/flexlayout-replacement-styles.scss +0 -95
- package/src/lib/material-design-cssframework.ts +0 -20
- package/src/lib/material-design-framework.component.html +0 -13
- package/src/lib/material-design-framework.component.scss +0 -58
- package/src/lib/material-design-framework.component.spec.ts +0 -39
- package/src/lib/material-design-framework.component.ts +0 -143
- package/src/lib/material-design-framework.module.ts +0 -81
- package/src/lib/material-design-themes.scss +0 -71
- package/src/lib/material-design.framework.ts +0 -83
- package/src/lib/tailwind-output.scss +0 -622
- package/src/lib/widgets/flex-layout-root.component.html +0 -4
- package/src/lib/widgets/flex-layout-root.component.ts +0 -52
- package/src/lib/widgets/flex-layout-section.component.ts +0 -216
- package/src/lib/widgets/material-add-reference.component.ts +0 -56
- package/src/lib/widgets/material-button-group.component.ts +0 -68
- package/src/lib/widgets/material-button.component.ts +0 -66
- package/src/lib/widgets/material-checkbox.component.ts +0 -112
- package/src/lib/widgets/material-checkboxes.component.ts +0 -108
- package/src/lib/widgets/material-chip-list.component.ts +0 -35
- package/src/lib/widgets/material-datepicker.component.ts +0 -89
- package/src/lib/widgets/material-file.component.ts +0 -35
- package/src/lib/widgets/material-input.component.ts +0 -97
- package/src/lib/widgets/material-number.component.ts +0 -95
- package/src/lib/widgets/material-one-of.component.ts +0 -35
- package/src/lib/widgets/material-radios.component.ts +0 -91
- package/src/lib/widgets/material-select.component.ts +0 -118
- package/src/lib/widgets/material-slider.component.ts +0 -65
- package/src/lib/widgets/material-stepper.component.ts +0 -35
- package/src/lib/widgets/material-tabs.component.ts +0 -72
- package/src/lib/widgets/material-textarea.component.ts +0 -88
- package/src/test.ts +0 -17
- package/tailwind-input.css +0 -3
- package/tailwind.config.js +0 -12
- package/tsconfig.lib.json +0 -25
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -11
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
4
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'material-datepicker-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'fill'"
|
|
11
|
-
[class]="options?.htmlClass || ''"
|
|
12
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
13
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
14
|
-
[style.width]="'100%'">
|
|
15
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
16
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
17
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
18
|
-
<input matInput *ngIf="boundControl"
|
|
19
|
-
[formControl]="formControl"
|
|
20
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
21
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
22
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
23
|
-
[id]="'control' + layoutNode?._id"
|
|
24
|
-
[max]="options?.maximum"
|
|
25
|
-
[matDatepicker]="picker"
|
|
26
|
-
[min]="options?.minimum"
|
|
27
|
-
[name]="controlName"
|
|
28
|
-
[placeholder]="options?.title"
|
|
29
|
-
[readonly]="options?.readonly"
|
|
30
|
-
[required]="options?.required"
|
|
31
|
-
[style.width]="'100%'"
|
|
32
|
-
(blur)="options.showErrors = true"
|
|
33
|
-
>
|
|
34
|
-
<input matInput *ngIf="!boundControl"
|
|
35
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
36
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
37
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
38
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
39
|
-
[id]="'control' + layoutNode?._id"
|
|
40
|
-
[max]="options?.maximum"
|
|
41
|
-
[matDatepicker]="picker"
|
|
42
|
-
[min]="options?.minimum"
|
|
43
|
-
[name]="controlName"
|
|
44
|
-
[placeholder]="options?.title"
|
|
45
|
-
[required]="options?.required"
|
|
46
|
-
[style.width]="'100%'"
|
|
47
|
-
[readonly]="options?.readonly"
|
|
48
|
-
(blur)="options.showErrors = true"
|
|
49
|
-
>
|
|
50
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
51
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
52
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
53
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
54
|
-
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
|
55
|
-
</mat-form-field>
|
|
56
|
-
<mat-datepicker #picker ></mat-datepicker>
|
|
57
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
58
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
59
|
-
styles: [`
|
|
60
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
61
|
-
::ng-deep json-schema-form mat-form-field .mat-mdc-form-field-wrapper .mat-form-field-flex
|
|
62
|
-
.mat-form-field-infix { width: initial; }
|
|
63
|
-
`],
|
|
64
|
-
})
|
|
65
|
-
export class MaterialDatepickerComponent implements OnInit {
|
|
66
|
-
formControl: AbstractControl;
|
|
67
|
-
controlName: string;
|
|
68
|
-
dateValue: any;
|
|
69
|
-
controlDisabled = false;
|
|
70
|
-
boundControl = false;
|
|
71
|
-
options: any;
|
|
72
|
-
autoCompleteList: string[] = [];
|
|
73
|
-
@Input() layoutNode: any;
|
|
74
|
-
@Input() layoutIndex: number[];
|
|
75
|
-
@Input() dataIndex: number[];
|
|
76
|
-
|
|
77
|
-
constructor(
|
|
78
|
-
@Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) @Optional() public matFormFieldDefaultOptions,
|
|
79
|
-
private jsf: JsonSchemaFormService
|
|
80
|
-
) { }
|
|
81
|
-
|
|
82
|
-
ngOnInit() {
|
|
83
|
-
this.options = this.layoutNode.options || {};
|
|
84
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
85
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
86
|
-
this.options.description = this.options.placeholder;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
4
|
-
|
|
5
|
-
// TODO: Add this control
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
// tslint:disable-next-line:component-selector
|
|
9
|
-
selector: 'material-file-widget',
|
|
10
|
-
template: ``,
|
|
11
|
-
})
|
|
12
|
-
export class MaterialFileComponent implements OnInit {
|
|
13
|
-
formControl: AbstractControl;
|
|
14
|
-
controlName: string;
|
|
15
|
-
controlValue: any;
|
|
16
|
-
controlDisabled = false;
|
|
17
|
-
boundControl = false;
|
|
18
|
-
options: any;
|
|
19
|
-
@Input() layoutNode: any;
|
|
20
|
-
@Input() layoutIndex: number[];
|
|
21
|
-
@Input() dataIndex: number[];
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
private jsf: JsonSchemaFormService
|
|
25
|
-
) { }
|
|
26
|
-
|
|
27
|
-
ngOnInit() {
|
|
28
|
-
this.options = this.layoutNode.options || {};
|
|
29
|
-
this.jsf.initializeControl(this);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
updateValue(event) {
|
|
33
|
-
this.jsf.updateValue(this, event.target.value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
4
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'material-input-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'fill'"
|
|
11
|
-
[class]="options?.htmlClass || ''"
|
|
12
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
13
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
14
|
-
[style.width]="'100%'">
|
|
15
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
16
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
17
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
18
|
-
<input matInput *ngIf="boundControl"
|
|
19
|
-
[formControl]="formControl"
|
|
20
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
21
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
22
|
-
[attr.maxlength]="options?.maxLength"
|
|
23
|
-
[attr.minlength]="options?.minLength"
|
|
24
|
-
[attr.pattern]="options?.pattern"
|
|
25
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
26
|
-
[id]="'control' + layoutNode?._id"
|
|
27
|
-
[name]="controlName"
|
|
28
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
29
|
-
[required]="options?.required"
|
|
30
|
-
[style.width]="'100%'"
|
|
31
|
-
[type]="layoutNode?.type"
|
|
32
|
-
(blur)="options.showErrors = true">
|
|
33
|
-
<input matInput *ngIf="!boundControl"
|
|
34
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
35
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
36
|
-
[attr.maxlength]="options?.maxLength"
|
|
37
|
-
[attr.minlength]="options?.minLength"
|
|
38
|
-
[attr.pattern]="options?.pattern"
|
|
39
|
-
[disabled]="controlDisabled"
|
|
40
|
-
[id]="'control' + layoutNode?._id"
|
|
41
|
-
[name]="controlName"
|
|
42
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
43
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
44
|
-
[required]="options?.required"
|
|
45
|
-
[style.width]="'100%'"
|
|
46
|
-
[type]="layoutNode?.type"
|
|
47
|
-
[value]="controlValue"
|
|
48
|
-
(input)="updateValue($event)"
|
|
49
|
-
(blur)="options.showErrors = true">
|
|
50
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
51
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
52
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
53
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
54
|
-
<mat-autocomplete *ngIf="options?.typeahead?.source">
|
|
55
|
-
<mat-option *ngFor="let word of options?.typeahead?.source"
|
|
56
|
-
[value]="word">{{word}}</mat-option>
|
|
57
|
-
</mat-autocomplete>
|
|
58
|
-
</mat-form-field>
|
|
59
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
60
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
61
|
-
styles: [`
|
|
62
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
63
|
-
::ng-deep json-schema-form mat-form-field .mat-mdc-form-field-wrapper .mat-form-field-flex
|
|
64
|
-
.mat-form-field-infix { width: initial; }
|
|
65
|
-
`],
|
|
66
|
-
})
|
|
67
|
-
export class MaterialInputComponent implements OnInit {
|
|
68
|
-
formControl: AbstractControl;
|
|
69
|
-
controlName: string;
|
|
70
|
-
controlValue: string;
|
|
71
|
-
controlDisabled = false;
|
|
72
|
-
boundControl = false;
|
|
73
|
-
options: any;
|
|
74
|
-
autoCompleteList: string[] = [];
|
|
75
|
-
@Input() layoutNode: any;
|
|
76
|
-
@Input() layoutIndex: number[];
|
|
77
|
-
@Input() dataIndex: number[];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
constructor(
|
|
81
|
-
@Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) @Optional() public matFormFieldDefaultOptions,
|
|
82
|
-
private jsf: JsonSchemaFormService
|
|
83
|
-
) {
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
ngOnInit() {
|
|
87
|
-
this.options = this.layoutNode.options || {};
|
|
88
|
-
this.jsf.initializeControl(this);
|
|
89
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
90
|
-
this.options.description = this.options.placeholder;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
updateValue(event) {
|
|
95
|
-
this.jsf.updateValue(this, event.target.value);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
4
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'material-number-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'fill'"
|
|
11
|
-
[class]="options?.htmlClass || ''"
|
|
12
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
13
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
14
|
-
[style.width]="'100%'">
|
|
15
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
16
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
17
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
18
|
-
<input matInput *ngIf="boundControl"
|
|
19
|
-
[formControl]="formControl"
|
|
20
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
21
|
-
[attr.max]="options?.maximum"
|
|
22
|
-
[attr.min]="options?.minimum"
|
|
23
|
-
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
24
|
-
[id]="'control' + layoutNode?._id"
|
|
25
|
-
[name]="controlName"
|
|
26
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
27
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
28
|
-
[required]="options?.required"
|
|
29
|
-
[style.width]="'100%'"
|
|
30
|
-
[type]="'number'"
|
|
31
|
-
(blur)="options.showErrors = true">
|
|
32
|
-
<input matInput *ngIf="!boundControl"
|
|
33
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
34
|
-
[attr.max]="options?.maximum"
|
|
35
|
-
[attr.min]="options?.minimum"
|
|
36
|
-
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
37
|
-
[disabled]="controlDisabled"
|
|
38
|
-
[id]="'control' + layoutNode?._id"
|
|
39
|
-
[name]="controlName"
|
|
40
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
41
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
42
|
-
[required]="options?.required"
|
|
43
|
-
[style.width]="'100%'"
|
|
44
|
-
[type]="'number'"
|
|
45
|
-
[value]="controlValue"
|
|
46
|
-
(input)="updateValue($event)"
|
|
47
|
-
(blur)="options.showErrors = true">
|
|
48
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
49
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
50
|
-
<mat-hint *ngIf="layoutNode?.type === 'range'" align="start"
|
|
51
|
-
[innerHTML]="controlValue"></mat-hint>
|
|
52
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
53
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
54
|
-
</mat-form-field>
|
|
55
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
56
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
57
|
-
styles: [`
|
|
58
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
59
|
-
::ng-deep json-schema-form mat-form-field .mat-mdc-form-field-wrapper .mat-form-field-flex
|
|
60
|
-
.mat-form-field-infix { width: initial; }
|
|
61
|
-
`],
|
|
62
|
-
})
|
|
63
|
-
export class MaterialNumberComponent implements OnInit {
|
|
64
|
-
formControl: AbstractControl;
|
|
65
|
-
controlName: string;
|
|
66
|
-
controlValue: any;
|
|
67
|
-
controlDisabled = false;
|
|
68
|
-
boundControl = false;
|
|
69
|
-
options: any;
|
|
70
|
-
allowNegative = true;
|
|
71
|
-
allowDecimal = true;
|
|
72
|
-
allowExponents = false;
|
|
73
|
-
lastValidNumber = '';
|
|
74
|
-
@Input() layoutNode: any;
|
|
75
|
-
@Input() layoutIndex: number[];
|
|
76
|
-
@Input() dataIndex: number[];
|
|
77
|
-
|
|
78
|
-
constructor(
|
|
79
|
-
@Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) @Optional() public matFormFieldDefaultOptions,
|
|
80
|
-
private jsf: JsonSchemaFormService
|
|
81
|
-
) { }
|
|
82
|
-
|
|
83
|
-
ngOnInit() {
|
|
84
|
-
this.options = this.layoutNode.options || {};
|
|
85
|
-
this.jsf.initializeControl(this);
|
|
86
|
-
if (this.layoutNode.dataType === 'integer') { this.allowDecimal = false; }
|
|
87
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
88
|
-
this.options.description = this.options.placeholder;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
updateValue(event) {
|
|
93
|
-
this.jsf.updateValue(this, event.target.value);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
4
|
-
|
|
5
|
-
// TODO: Add this control
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
// tslint:disable-next-line:component-selector
|
|
9
|
-
selector: 'material-one-of-widget',
|
|
10
|
-
template: ``,
|
|
11
|
-
})
|
|
12
|
-
export class MaterialOneOfComponent implements OnInit {
|
|
13
|
-
formControl: AbstractControl;
|
|
14
|
-
controlName: string;
|
|
15
|
-
controlValue: any;
|
|
16
|
-
controlDisabled = false;
|
|
17
|
-
boundControl = false;
|
|
18
|
-
options: any;
|
|
19
|
-
@Input() layoutNode: any;
|
|
20
|
-
@Input() layoutIndex: number[];
|
|
21
|
-
@Input() dataIndex: number[];
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
private jsf: JsonSchemaFormService
|
|
25
|
-
) { }
|
|
26
|
-
|
|
27
|
-
ngOnInit() {
|
|
28
|
-
this.options = this.layoutNode.options || {};
|
|
29
|
-
this.jsf.initializeControl(this);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
updateValue(event) {
|
|
33
|
-
this.jsf.updateValue(this, event.target.value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { JsonSchemaFormService, buildTitleMap } from '@ng-formworks/core';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'material-radios-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<div>
|
|
11
|
-
<div *ngIf="options?.title">
|
|
12
|
-
<label
|
|
13
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
14
|
-
[class]="options?.labelHtmlClass || ''"
|
|
15
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
16
|
-
[innerHTML]="options?.title"></label>
|
|
17
|
-
</div>
|
|
18
|
-
<mat-radio-group *ngIf="boundControl"
|
|
19
|
-
[formControl]="formControl"
|
|
20
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
21
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
22
|
-
[attr.required]="options?.required"
|
|
23
|
-
[style.flex-direction]="flexDirection"
|
|
24
|
-
[name]="controlName"
|
|
25
|
-
(blur)="options.showErrors = true">
|
|
26
|
-
<mat-radio-button *ngFor="let radioItem of radiosList"
|
|
27
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.name"
|
|
28
|
-
[value]="radioItem?.value">
|
|
29
|
-
<span [innerHTML]="radioItem?.name"></span>
|
|
30
|
-
</mat-radio-button>
|
|
31
|
-
</mat-radio-group>
|
|
32
|
-
<mat-radio-group *ngIf="!boundControl"
|
|
33
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
34
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
35
|
-
[attr.required]="options?.required"
|
|
36
|
-
[style.flex-direction]="flexDirection"
|
|
37
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
38
|
-
[name]="controlName"
|
|
39
|
-
[value]="controlValue">
|
|
40
|
-
<mat-radio-button *ngFor="let radioItem of radiosList"
|
|
41
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.name"
|
|
42
|
-
[value]="radioItem?.value"
|
|
43
|
-
(click)="updateValue(radioItem?.value)">
|
|
44
|
-
<span [innerHTML]="radioItem?.name"></span>
|
|
45
|
-
</mat-radio-button>
|
|
46
|
-
</mat-radio-group>
|
|
47
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
48
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
49
|
-
</div>`,
|
|
50
|
-
styles: [`
|
|
51
|
-
/* TODO(mdc-migration): The following rule targets internal classes of radio that may no longer apply for the MDC version. */
|
|
52
|
-
mat-radio-group { display: inline-flex; }
|
|
53
|
-
/* TODO(mdc-migration): The following rule targets internal classes of radio that may no longer apply for the MDC version. */
|
|
54
|
-
mat-radio-button { margin: 2px; }
|
|
55
|
-
mat-error { font-size: 75%; }
|
|
56
|
-
`]
|
|
57
|
-
})
|
|
58
|
-
export class MaterialRadiosComponent implements OnInit {
|
|
59
|
-
formControl: AbstractControl;
|
|
60
|
-
controlName: string;
|
|
61
|
-
controlValue: any;
|
|
62
|
-
controlDisabled = false;
|
|
63
|
-
boundControl = false;
|
|
64
|
-
options: any;
|
|
65
|
-
flexDirection = 'column';
|
|
66
|
-
radiosList: any[] = [];
|
|
67
|
-
@Input() layoutNode: any;
|
|
68
|
-
@Input() layoutIndex: number[];
|
|
69
|
-
@Input() dataIndex: number[];
|
|
70
|
-
|
|
71
|
-
constructor(
|
|
72
|
-
private jsf: JsonSchemaFormService
|
|
73
|
-
) { }
|
|
74
|
-
|
|
75
|
-
ngOnInit() {
|
|
76
|
-
this.options = this.layoutNode.options || {};
|
|
77
|
-
if (this.layoutNode.type === 'radios-inline') {
|
|
78
|
-
this.flexDirection = 'row';
|
|
79
|
-
}
|
|
80
|
-
this.radiosList = buildTitleMap(
|
|
81
|
-
this.options.titleMap || this.options.enumNames,
|
|
82
|
-
this.options.enum, true
|
|
83
|
-
);
|
|
84
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
updateValue(value) {
|
|
88
|
-
this.options.showErrors = true;
|
|
89
|
-
this.jsf.updateValue(this, value);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
4
|
-
import { JsonSchemaFormService, buildTitleMap, isArray } from '@ng-formworks/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
// tslint:disable-next-line:component-selector
|
|
8
|
-
selector: 'material-select-widget',
|
|
9
|
-
template: `
|
|
10
|
-
<mat-form-field
|
|
11
|
-
[appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'fill'"
|
|
12
|
-
[class]="options?.htmlClass || ''"
|
|
13
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
14
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
15
|
-
[style.width]="'100%'">
|
|
16
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
17
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
18
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
19
|
-
<mat-select *ngIf="boundControl"
|
|
20
|
-
[formControl]="formControl"
|
|
21
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
22
|
-
[attr.name]="controlName"
|
|
23
|
-
[id]="'control' + layoutNode?._id"
|
|
24
|
-
[multiple]="options?.multiple"
|
|
25
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
26
|
-
[required]="options?.required"
|
|
27
|
-
[style.width]="'100%'"
|
|
28
|
-
(blur)="options.showErrors = true">
|
|
29
|
-
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
30
|
-
<mat-option *ngIf="!isArray(selectItem?.items)"
|
|
31
|
-
[value]="selectItem?.value">
|
|
32
|
-
<span [innerHTML]="selectItem?.name"></span>
|
|
33
|
-
</mat-option>
|
|
34
|
-
<mat-optgroup *ngIf="isArray(selectItem?.items)"
|
|
35
|
-
[label]="selectItem?.group">
|
|
36
|
-
<mat-option *ngFor="let subItem of selectItem.items"
|
|
37
|
-
[value]="subItem?.value">
|
|
38
|
-
<span [innerHTML]="subItem?.name"></span>
|
|
39
|
-
</mat-option>
|
|
40
|
-
</mat-optgroup>
|
|
41
|
-
</ng-template>
|
|
42
|
-
</mat-select>
|
|
43
|
-
<mat-select *ngIf="!boundControl"
|
|
44
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
45
|
-
[attr.name]="controlName"
|
|
46
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
47
|
-
[id]="'control' + layoutNode?._id"
|
|
48
|
-
[multiple]="options?.multiple"
|
|
49
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
50
|
-
[required]="options?.required"
|
|
51
|
-
[style.width]="'100%'"
|
|
52
|
-
[value]="controlValue"
|
|
53
|
-
(blur)="options.showErrors = true"
|
|
54
|
-
(change)="updateValue($event)">
|
|
55
|
-
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
56
|
-
<mat-option *ngIf="!isArray(selectItem?.items)"
|
|
57
|
-
[attr.selected]="selectItem?.value === controlValue"
|
|
58
|
-
[value]="selectItem?.value">
|
|
59
|
-
<span [innerHTML]="selectItem?.name"></span>
|
|
60
|
-
</mat-option>
|
|
61
|
-
<mat-optgroup *ngIf="isArray(selectItem?.items)"
|
|
62
|
-
[label]="selectItem?.group">
|
|
63
|
-
<mat-option *ngFor="let subItem of selectItem.items"
|
|
64
|
-
[attr.selected]="subItem?.value === controlValue"
|
|
65
|
-
[value]="subItem?.value">
|
|
66
|
-
<span [innerHTML]="subItem?.name"></span>
|
|
67
|
-
</mat-option>
|
|
68
|
-
</mat-optgroup>
|
|
69
|
-
</ng-template>
|
|
70
|
-
</mat-select>
|
|
71
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
72
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
73
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
74
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
75
|
-
</mat-form-field>
|
|
76
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
77
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
78
|
-
styles: [`
|
|
79
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
80
|
-
::ng-deep json-schema-form mat-form-field .mat-mdc-form-field-wrapper .mat-form-field-flex
|
|
81
|
-
.mat-form-field-infix { width: initial; }
|
|
82
|
-
`],
|
|
83
|
-
})
|
|
84
|
-
export class MaterialSelectComponent implements OnInit {
|
|
85
|
-
formControl: AbstractControl;
|
|
86
|
-
controlName: string;
|
|
87
|
-
controlValue: any;
|
|
88
|
-
controlDisabled = false;
|
|
89
|
-
boundControl = false;
|
|
90
|
-
options: any;
|
|
91
|
-
selectList: any[] = [];
|
|
92
|
-
isArray = isArray;
|
|
93
|
-
@Input() layoutNode: any;
|
|
94
|
-
@Input() layoutIndex: number[];
|
|
95
|
-
@Input() dataIndex: number[];
|
|
96
|
-
|
|
97
|
-
constructor(
|
|
98
|
-
@Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) @Optional() public matFormFieldDefaultOptions,
|
|
99
|
-
private jsf: JsonSchemaFormService
|
|
100
|
-
) { }
|
|
101
|
-
|
|
102
|
-
ngOnInit() {
|
|
103
|
-
this.options = this.layoutNode.options || {};
|
|
104
|
-
this.selectList = buildTitleMap(
|
|
105
|
-
this.options.titleMap || this.options.enumNames,
|
|
106
|
-
this.options.enum, !!this.options.required, !!this.options.flatList
|
|
107
|
-
);
|
|
108
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
109
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
110
|
-
this.options.description = this.options.placeholder;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
updateValue(event) {
|
|
115
|
-
this.options.showErrors = true;
|
|
116
|
-
this.jsf.updateValue(this, event.value);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
// tslint:disable-next-line:component-selector
|
|
7
|
-
selector: 'material-slider-widget',
|
|
8
|
-
template: `
|
|
9
|
-
<mat-slider discrete *ngIf="boundControl"
|
|
10
|
-
|
|
11
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
12
|
-
[id]="'control' + layoutNode?._id"
|
|
13
|
-
[max]="options?.maximum"
|
|
14
|
-
[min]="options?.minimum"
|
|
15
|
-
[step]="options?.multipleOf || options?.step || 'any'"
|
|
16
|
-
[style.width]="'100%'"
|
|
17
|
-
(blur)="options.showErrors = true">
|
|
18
|
-
<input matSliderThumb [formControl]="formControl" />
|
|
19
|
-
</mat-slider>
|
|
20
|
-
<mat-slider discrete *ngIf="!boundControl"
|
|
21
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
22
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
23
|
-
[id]="'control' + layoutNode?._id"
|
|
24
|
-
[max]="options?.maximum"
|
|
25
|
-
[min]="options?.minimum"
|
|
26
|
-
[step]="options?.multipleOf || options?.step || 'any'"
|
|
27
|
-
[style.width]="'100%'"
|
|
28
|
-
(blur)="options.showErrors = true" #ngSlider>
|
|
29
|
-
<input matSliderThumb [value]="controlValue"
|
|
30
|
-
(change)="updateValue({source: ngSliderThumb, parent: ngSlider, value: ngSliderThumb.value})"
|
|
31
|
-
#ngSliderThumb="matSliderThumb" />
|
|
32
|
-
</mat-slider>
|
|
33
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
34
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
35
|
-
styles: [` mat-error { font-size: 75%; } `],
|
|
36
|
-
})
|
|
37
|
-
export class MaterialSliderComponent implements OnInit {
|
|
38
|
-
formControl: AbstractControl;
|
|
39
|
-
controlName: string;
|
|
40
|
-
controlValue: any;
|
|
41
|
-
controlDisabled = false;
|
|
42
|
-
boundControl = false;
|
|
43
|
-
options: any;
|
|
44
|
-
allowNegative = true;
|
|
45
|
-
allowDecimal = true;
|
|
46
|
-
allowExponents = false;
|
|
47
|
-
lastValidNumber = '';
|
|
48
|
-
@Input() layoutNode: any;
|
|
49
|
-
@Input() layoutIndex: number[];
|
|
50
|
-
@Input() dataIndex: number[];
|
|
51
|
-
|
|
52
|
-
constructor(
|
|
53
|
-
private jsf: JsonSchemaFormService
|
|
54
|
-
) { }
|
|
55
|
-
|
|
56
|
-
ngOnInit() {
|
|
57
|
-
this.options = this.layoutNode.options || {};
|
|
58
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
updateValue(event) {
|
|
62
|
-
this.options.showErrors = true;
|
|
63
|
-
this.jsf.updateValue(this, event.value);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
|
-
import { JsonSchemaFormService } from '@ng-formworks/core';
|
|
4
|
-
|
|
5
|
-
// TODO: Add this control
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
// tslint:disable-next-line:component-selector
|
|
9
|
-
selector: 'material-stepper-widget',
|
|
10
|
-
template: ``,
|
|
11
|
-
})
|
|
12
|
-
export class MaterialStepperComponent implements OnInit {
|
|
13
|
-
formControl: AbstractControl;
|
|
14
|
-
controlName: string;
|
|
15
|
-
controlValue: any;
|
|
16
|
-
controlDisabled = false;
|
|
17
|
-
boundControl = false;
|
|
18
|
-
options: any;
|
|
19
|
-
@Input() layoutNode: any;
|
|
20
|
-
@Input() layoutIndex: number[];
|
|
21
|
-
@Input() dataIndex: number[];
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
private jsf: JsonSchemaFormService
|
|
25
|
-
) { }
|
|
26
|
-
|
|
27
|
-
ngOnInit() {
|
|
28
|
-
this.options = this.layoutNode.options || {};
|
|
29
|
-
this.jsf.initializeControl(this);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
updateValue(event) {
|
|
33
|
-
this.jsf.updateValue(this, event.target.value);
|
|
34
|
-
}
|
|
35
|
-
}
|