@ajsf/material 0.5.1-beta.1 → 0.5.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.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -2
  3. package/ajsf-material.d.ts +4 -0
  4. package/ajsf-material.metadata.json +1 -0
  5. package/bundles/ajsf-material.umd.js +1422 -0
  6. package/bundles/ajsf-material.umd.js.map +1 -0
  7. package/esm2015/ajsf-material.js +5 -0
  8. package/esm2015/lib/angular-flex-monkey-patch.js +12 -0
  9. package/esm2015/lib/material-design-framework.component.js +101 -0
  10. package/esm2015/lib/material-design-framework.module.js +80 -0
  11. package/esm2015/lib/material-design.framework.js +54 -0
  12. package/esm2015/lib/widgets/flex-layout-root.component.js +55 -0
  13. package/esm2015/lib/widgets/flex-layout-section.component.js +221 -0
  14. package/esm2015/lib/widgets/material-add-reference.component.js +53 -0
  15. package/esm2015/lib/widgets/material-button-group.component.js +63 -0
  16. package/esm2015/lib/widgets/material-button.component.js +60 -0
  17. package/esm2015/lib/widgets/material-checkbox.component.js +109 -0
  18. package/esm2015/lib/widgets/material-checkboxes.component.js +101 -0
  19. package/esm2015/lib/widgets/material-chip-list.component.js +33 -0
  20. package/esm2015/lib/widgets/material-datepicker.component.js +90 -0
  21. package/esm2015/lib/widgets/material-file.component.js +33 -0
  22. package/esm2015/lib/widgets/material-input.component.js +95 -0
  23. package/esm2015/lib/widgets/material-number.component.js +97 -0
  24. package/esm2015/lib/widgets/material-one-of.component.js +33 -0
  25. package/esm2015/lib/widgets/material-radios.component.js +84 -0
  26. package/esm2015/lib/widgets/material-select.component.js +115 -0
  27. package/esm2015/lib/widgets/material-slider.component.js +60 -0
  28. package/esm2015/lib/widgets/material-stepper.component.js +33 -0
  29. package/esm2015/lib/widgets/material-tabs.component.js +69 -0
  30. package/esm2015/lib/widgets/material-textarea.component.js +88 -0
  31. package/esm2015/lib/widgets/public_api.js +52 -0
  32. package/esm2015/public_api.js +8 -0
  33. package/fesm2015/ajsf-material.js +1710 -0
  34. package/fesm2015/ajsf-material.js.map +1 -0
  35. package/lib/angular-flex-monkey-patch.d.ts +1 -0
  36. package/lib/material-design-framework.component.d.ts +25 -0
  37. package/lib/material-design-framework.module.d.ts +12 -0
  38. package/lib/material-design.framework.d.ts +41 -0
  39. package/lib/widgets/flex-layout-root.component.d.ts +12 -0
  40. package/lib/widgets/flex-layout-section.component.d.ts +22 -0
  41. package/lib/widgets/material-add-reference.component.d.ts +17 -0
  42. package/lib/widgets/material-button-group.component.d.ts +20 -0
  43. package/lib/widgets/material-button.component.d.ts +18 -0
  44. package/lib/widgets/material-checkbox.component.d.ts +22 -0
  45. package/lib/widgets/material-checkboxes.component.d.ts +24 -0
  46. package/lib/widgets/material-chip-list.component.d.ts +18 -0
  47. package/lib/widgets/material-datepicker.component.d.ts +19 -0
  48. package/lib/widgets/material-file.component.d.ts +18 -0
  49. package/lib/widgets/material-input.component.d.ts +20 -0
  50. package/lib/widgets/material-number.component.d.ts +23 -0
  51. package/lib/widgets/material-one-of.component.d.ts +18 -0
  52. package/lib/widgets/material-radios.component.d.ts +20 -0
  53. package/lib/widgets/material-select.component.d.ts +21 -0
  54. package/lib/widgets/material-slider.component.d.ts +22 -0
  55. package/lib/widgets/material-stepper.component.d.ts +18 -0
  56. package/lib/widgets/material-tabs.component.d.ts +17 -0
  57. package/lib/widgets/material-textarea.component.d.ts +19 -0
  58. package/{src/lib/widgets/public_api.ts → lib/widgets/public_api.d.ts} +1 -14
  59. package/package.json +12 -4
  60. package/{src/public_api.ts → public_api.d.ts} +0 -4
  61. package/karma.conf.js +0 -37
  62. package/ng-package.json +0 -16
  63. package/src/lib/angular-flex-monkey-patch.ts +0 -13
  64. package/src/lib/material-design-framework.component.html +0 -20
  65. package/src/lib/material-design-framework.component.scss +0 -51
  66. package/src/lib/material-design-framework.component.spec.ts +0 -37
  67. package/src/lib/material-design-framework.component.ts +0 -121
  68. package/src/lib/material-design-framework.module.ts +0 -84
  69. package/src/lib/material-design.framework.ts +0 -75
  70. package/src/lib/widgets/flex-layout-root.component.html +0 -11
  71. package/src/lib/widgets/flex-layout-root.component.ts +0 -52
  72. package/src/lib/widgets/flex-layout-section.component.ts +0 -216
  73. package/src/lib/widgets/material-add-reference.component.ts +0 -56
  74. package/src/lib/widgets/material-button-group.component.ts +0 -68
  75. package/src/lib/widgets/material-button.component.ts +0 -59
  76. package/src/lib/widgets/material-checkbox.component.ts +0 -112
  77. package/src/lib/widgets/material-checkboxes.component.ts +0 -109
  78. package/src/lib/widgets/material-chip-list.component.ts +0 -35
  79. package/src/lib/widgets/material-datepicker.component.ts +0 -103
  80. package/src/lib/widgets/material-file.component.ts +0 -35
  81. package/src/lib/widgets/material-input.component.ts +0 -97
  82. package/src/lib/widgets/material-number.component.ts +0 -95
  83. package/src/lib/widgets/material-one-of.component.ts +0 -35
  84. package/src/lib/widgets/material-radios.component.ts +0 -89
  85. package/src/lib/widgets/material-select.component.ts +0 -118
  86. package/src/lib/widgets/material-slider.component.ts +0 -61
  87. package/src/lib/widgets/material-stepper.component.ts +0 -35
  88. package/src/lib/widgets/material-tabs.component.ts +0 -69
  89. package/src/lib/widgets/material-textarea.component.ts +0 -88
  90. package/src/test.ts +0 -21
  91. package/tsconfig.lib.json +0 -26
  92. package/tsconfig.lib.prod.json +0 -9
  93. package/tsconfig.spec.json +0 -17
  94. package/tslint.json +0 -11
@@ -1,35 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { AbstractControl } from '@angular/forms';
3
- import { JsonSchemaFormService } from '@ajsf/core';
4
-
5
- // TODO: Add this control
6
-
7
- @Component({
8
- // tslint:disable-next-line:component-selector
9
- selector: 'material-chip-list-widget',
10
- template: ``,
11
- })
12
- export class MaterialChipListComponent 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,103 +0,0 @@
1
- import { Component, Inject, Input, OnInit, Optional } from '@angular/core';
2
- import { AbstractControl } from '@angular/forms';
3
- import { JsonSchemaFormService, dateToString } from '@ajsf/core';
4
- import { MatDatepickerInputEvent } from '@angular/material/datepicker';
5
- import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
6
-
7
- @Component({
8
- // tslint:disable-next-line:component-selector
9
- selector: 'material-datepicker-widget',
10
- template: `
11
- <mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
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
- <input matInput *ngIf="boundControl"
20
- [formControl]="formControl"
21
- [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
22
- [attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
23
- [attr.readonly]="options?.readonly ? 'readonly' : null"
24
- [id]="'control' + layoutNode?._id"
25
- [max]="options?.maximum"
26
- [matDatepicker]="picker"
27
- [min]="options?.minimum"
28
- [name]="controlName"
29
- [placeholder]="options?.title"
30
- [readonly]="options?.readonly"
31
- [required]="options?.required"
32
- [style.width]="'100%'"
33
- (blur)="options.showErrors = true"
34
- (dateChange)="updateValue($event)"
35
- (dateInput)="updateValue($event)">
36
- <input matInput *ngIf="!boundControl"
37
- [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
38
- [attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
39
- [attr.readonly]="options?.readonly ? 'readonly' : null"
40
- [disabled]="controlDisabled || options?.readonly"
41
- [id]="'control' + layoutNode?._id"
42
- [max]="options?.maximum"
43
- [matDatepicker]="picker"
44
- [min]="options?.minimum"
45
- [name]="controlName"
46
- [placeholder]="options?.title"
47
- [required]="options?.required"
48
- [style.width]="'100%'"
49
- [readonly]="options?.readonly"
50
- (blur)="options.showErrors = true"
51
- (dateChange)="updateValue($event)"
52
- (dateInput)="updateValue($event)">
53
- <span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
54
- [innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
55
- <mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
56
- align="end" [innerHTML]="options?.description"></mat-hint>
57
- <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
58
- </mat-form-field>
59
- <mat-datepicker #picker ></mat-datepicker>
60
- <mat-error *ngIf="options?.showErrors && options?.errorMessage"
61
- [innerHTML]="options?.errorMessage"></mat-error>`,
62
- styles: [`
63
- mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
64
- ::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
65
- .mat-form-field-infix { width: initial; }
66
- `],
67
- })
68
- export class MaterialDatepickerComponent implements OnInit {
69
- formControl: AbstractControl;
70
- controlName: string;
71
- controlValue: string;
72
- dateValue: any;
73
- controlDisabled = false;
74
- boundControl = false;
75
- options: any;
76
- autoCompleteList: string[] = [];
77
- @Input() layoutNode: any;
78
- @Input() layoutIndex: number[];
79
- @Input() dataIndex: number[];
80
-
81
- constructor(
82
- @Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) @Optional() public matFormFieldDefaultOptions,
83
- private jsf: JsonSchemaFormService
84
- ) { }
85
-
86
- ngOnInit() {
87
- this.options = this.layoutNode.options || {};
88
- this.jsf.initializeControl(this, !this.options.readonly);
89
- if (this.controlValue) {
90
- this.formControl.setValue(dateToString(this.controlValue, this.options));
91
- }
92
- if (!this.options.notitle && !this.options.description && this.options.placeholder) {
93
- this.options.description = this.options.placeholder;
94
- }
95
- }
96
-
97
- updateValue(event: MatDatepickerInputEvent<Date>) {
98
- this.options.showErrors = true;
99
- if (event.value) {
100
- this.formControl.setValue(dateToString(event.value, this.options));
101
- }
102
- }
103
- }
@@ -1,35 +0,0 @@
1
- import { AbstractControl } from '@angular/forms';
2
- import { Component, Input, OnInit } from '@angular/core';
3
- import { JsonSchemaFormService } from '@ajsf/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 { AbstractControl } from '@angular/forms';
2
- import {Component, Inject, Input, OnInit, Optional} from '@angular/core';
3
- import { JsonSchemaFormService } from '@ajsf/core';
4
- import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
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 || 'standard'"
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-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 { JsonSchemaFormService } from '@ajsf/core';
4
- import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
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 || 'standard'"
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-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 '@ajsf/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,89 +0,0 @@
1
- import { AbstractControl } from '@angular/forms';
2
- import { Component, Input, OnInit } from '@angular/core';
3
- import { JsonSchemaFormService, buildTitleMap } from '@ajsf/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
- mat-radio-group { display: inline-flex; }
52
- mat-radio-button { margin: 2px; }
53
- mat-error { font-size: 75%; }
54
- `]
55
- })
56
- export class MaterialRadiosComponent implements OnInit {
57
- formControl: AbstractControl;
58
- controlName: string;
59
- controlValue: any;
60
- controlDisabled = false;
61
- boundControl = false;
62
- options: any;
63
- flexDirection = 'column';
64
- radiosList: any[] = [];
65
- @Input() layoutNode: any;
66
- @Input() layoutIndex: number[];
67
- @Input() dataIndex: number[];
68
-
69
- constructor(
70
- private jsf: JsonSchemaFormService
71
- ) { }
72
-
73
- ngOnInit() {
74
- this.options = this.layoutNode.options || {};
75
- if (this.layoutNode.type === 'radios-inline') {
76
- this.flexDirection = 'row';
77
- }
78
- this.radiosList = buildTitleMap(
79
- this.options.titleMap || this.options.enumNames,
80
- this.options.enum, true
81
- );
82
- this.jsf.initializeControl(this, !this.options.readonly);
83
- }
84
-
85
- updateValue(value) {
86
- this.options.showErrors = true;
87
- this.jsf.updateValue(this, value);
88
- }
89
- }
@@ -1,118 +0,0 @@
1
- import { AbstractControl } from '@angular/forms';
2
- import {Component, Inject, Input, OnInit, Optional} from '@angular/core';
3
- import { JsonSchemaFormService, buildTitleMap, isArray } from '@ajsf/core';
4
- import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
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 || 'standard'"
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-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,61 +0,0 @@
1
- import { AbstractControl } from '@angular/forms';
2
- import { Component, Input, OnInit } from '@angular/core';
3
- import { JsonSchemaFormService } from '@ajsf/core';
4
-
5
- @Component({
6
- // tslint:disable-next-line:component-selector
7
- selector: 'material-slider-widget',
8
- template: `
9
- <mat-slider thumbLabel *ngIf="boundControl"
10
- [formControl]="formControl"
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"></mat-slider>
18
- <mat-slider thumbLabel *ngIf="!boundControl"
19
- [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
20
- [disabled]="controlDisabled || options?.readonly"
21
- [id]="'control' + layoutNode?._id"
22
- [max]="options?.maximum"
23
- [min]="options?.minimum"
24
- [step]="options?.multipleOf || options?.step || 'any'"
25
- [style.width]="'100%'"
26
- [value]="controlValue"
27
- (blur)="options.showErrors = true"
28
- (change)="updateValue($event)"></mat-slider>
29
- <mat-error *ngIf="options?.showErrors && options?.errorMessage"
30
- [innerHTML]="options?.errorMessage"></mat-error>`,
31
- styles: [` mat-error { font-size: 75%; } `],
32
- })
33
- export class MaterialSliderComponent implements OnInit {
34
- formControl: AbstractControl;
35
- controlName: string;
36
- controlValue: any;
37
- controlDisabled = false;
38
- boundControl = false;
39
- options: any;
40
- allowNegative = true;
41
- allowDecimal = true;
42
- allowExponents = false;
43
- lastValidNumber = '';
44
- @Input() layoutNode: any;
45
- @Input() layoutIndex: number[];
46
- @Input() dataIndex: number[];
47
-
48
- constructor(
49
- private jsf: JsonSchemaFormService
50
- ) { }
51
-
52
- ngOnInit() {
53
- this.options = this.layoutNode.options || {};
54
- this.jsf.initializeControl(this, !this.options.readonly);
55
- }
56
-
57
- updateValue(event) {
58
- this.options.showErrors = true;
59
- this.jsf.updateValue(this, event.value);
60
- }
61
- }