@ajsf/material 0.5.1-beta.4 → 0.7.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/ajsf-material.d.ts +1 -0
- package/{esm2015/ajsf-material.js → esm2020/ajsf-material.mjs} +0 -0
- package/{esm2015/lib/angular-flex-monkey-patch.js → esm2020/lib/angular-flex-monkey-patch.mjs} +0 -0
- package/esm2020/lib/material-design-framework.component.mjs +102 -0
- package/esm2020/lib/material-design-framework.module.mjs +123 -0
- package/esm2020/lib/material-design.framework.mjs +57 -0
- package/esm2020/lib/widgets/flex-layout-root.component.mjs +76 -0
- package/esm2020/lib/widgets/flex-layout-section.component.mjs +359 -0
- package/esm2020/lib/widgets/material-add-reference.component.mjs +66 -0
- package/esm2020/lib/widgets/material-button-group.component.mjs +95 -0
- package/esm2020/lib/widgets/material-button.component.mjs +81 -0
- package/esm2020/lib/widgets/material-checkbox.component.mjs +174 -0
- package/esm2020/lib/widgets/material-checkboxes.component.mjs +140 -0
- package/esm2020/lib/widgets/material-chip-list.component.mjs +35 -0
- package/esm2020/lib/widgets/material-datepicker.component.mjs +150 -0
- package/esm2020/lib/widgets/material-file.component.mjs +35 -0
- package/esm2020/lib/widgets/material-input.component.mjs +158 -0
- package/esm2020/lib/widgets/material-number.component.mjs +154 -0
- package/esm2020/lib/widgets/material-one-of.component.mjs +35 -0
- package/esm2020/lib/widgets/material-radios.component.mjs +131 -0
- package/esm2020/lib/widgets/material-select.component.mjs +195 -0
- package/esm2020/lib/widgets/material-slider.component.mjs +88 -0
- package/esm2020/lib/widgets/material-stepper.component.mjs +35 -0
- package/esm2020/lib/widgets/material-tabs.component.mjs +91 -0
- package/esm2020/lib/widgets/material-textarea.component.mjs +143 -0
- package/{esm2015/lib/widgets/public_api.js → esm2020/lib/widgets/public_api.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/fesm2015/ajsf-material.mjs +2427 -0
- package/fesm2015/ajsf-material.mjs.map +1 -0
- package/fesm2020/ajsf-material.mjs +2420 -0
- package/fesm2020/ajsf-material.mjs.map +1 -0
- package/lib/material-design-framework.component.d.ts +3 -0
- package/lib/material-design-framework.module.d.ts +51 -2
- package/lib/material-design.framework.d.ts +3 -0
- package/lib/widgets/flex-layout-root.component.d.ts +3 -0
- package/lib/widgets/flex-layout-section.component.d.ts +3 -0
- package/lib/widgets/material-add-reference.component.d.ts +3 -0
- package/lib/widgets/material-button-group.component.d.ts +3 -0
- package/lib/widgets/material-button.component.d.ts +3 -0
- package/lib/widgets/material-checkbox.component.d.ts +3 -0
- package/lib/widgets/material-checkboxes.component.d.ts +3 -0
- package/lib/widgets/material-chip-list.component.d.ts +3 -0
- package/lib/widgets/material-datepicker.component.d.ts +3 -0
- package/lib/widgets/material-file.component.d.ts +3 -0
- package/lib/widgets/material-input.component.d.ts +3 -0
- package/lib/widgets/material-number.component.d.ts +3 -0
- package/lib/widgets/material-one-of.component.d.ts +3 -0
- package/lib/widgets/material-radios.component.d.ts +3 -0
- package/lib/widgets/material-select.component.d.ts +3 -0
- package/lib/widgets/material-slider.component.d.ts +3 -0
- package/lib/widgets/material-stepper.component.d.ts +3 -0
- package/lib/widgets/material-tabs.component.d.ts +3 -0
- package/lib/widgets/material-textarea.component.d.ts +3 -0
- package/package.json +26 -14
- package/ajsf-material.metadata.json +0 -1
- package/bundles/ajsf-material.umd.js +0 -1422
- package/bundles/ajsf-material.umd.js.map +0 -1
- package/esm2015/lib/material-design-framework.component.js +0 -101
- package/esm2015/lib/material-design-framework.module.js +0 -80
- package/esm2015/lib/material-design.framework.js +0 -54
- package/esm2015/lib/widgets/flex-layout-root.component.js +0 -55
- package/esm2015/lib/widgets/flex-layout-section.component.js +0 -221
- package/esm2015/lib/widgets/material-add-reference.component.js +0 -53
- package/esm2015/lib/widgets/material-button-group.component.js +0 -63
- package/esm2015/lib/widgets/material-button.component.js +0 -60
- package/esm2015/lib/widgets/material-checkbox.component.js +0 -109
- package/esm2015/lib/widgets/material-checkboxes.component.js +0 -101
- package/esm2015/lib/widgets/material-chip-list.component.js +0 -33
- package/esm2015/lib/widgets/material-datepicker.component.js +0 -90
- package/esm2015/lib/widgets/material-file.component.js +0 -33
- package/esm2015/lib/widgets/material-input.component.js +0 -95
- package/esm2015/lib/widgets/material-number.component.js +0 -97
- package/esm2015/lib/widgets/material-one-of.component.js +0 -33
- package/esm2015/lib/widgets/material-radios.component.js +0 -84
- package/esm2015/lib/widgets/material-select.component.js +0 -115
- package/esm2015/lib/widgets/material-slider.component.js +0 -60
- package/esm2015/lib/widgets/material-stepper.component.js +0 -33
- package/esm2015/lib/widgets/material-tabs.component.js +0 -69
- package/esm2015/lib/widgets/material-textarea.component.js +0 -88
- package/fesm2015/ajsf-material.js +0 -1710
- package/fesm2015/ajsf-material.js.map +0 -1
|
@@ -1,1710 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, Input, Inject, Optional, ChangeDetectorRef, Injectable, NgModule } from '@angular/core';
|
|
2
|
-
import { JsonSchemaFormService, hasOwn, buildTitleMap, isDefined, isArray, Framework, WidgetLibraryModule, JsonSchemaFormModule, FrameworkLibraryService, WidgetLibraryService } from '@ajsf/core';
|
|
3
|
-
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
|
|
4
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
5
|
-
import { CommonModule } from '@angular/common';
|
|
6
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
8
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
9
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
-
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
11
|
-
import { MatCardModule } from '@angular/material/card';
|
|
12
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
13
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
14
|
-
import { MatNativeDateModule } from '@angular/material/core';
|
|
15
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
16
|
-
import { MatExpansionModule } from '@angular/material/expansion';
|
|
17
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
18
|
-
import { MatInputModule } from '@angular/material/input';
|
|
19
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
20
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
21
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
22
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
23
|
-
import { MatStepperModule } from '@angular/material/stepper';
|
|
24
|
-
import { MatTabsModule } from '@angular/material/tabs';
|
|
25
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
26
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
27
|
-
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
28
|
-
import { MediaMarshaller } from '@angular/flex-layout/core';
|
|
29
|
-
|
|
30
|
-
class FlexLayoutRootComponent {
|
|
31
|
-
constructor(jsf) {
|
|
32
|
-
this.jsf = jsf;
|
|
33
|
-
this.isFlexItem = false;
|
|
34
|
-
}
|
|
35
|
-
removeItem(item) {
|
|
36
|
-
this.jsf.removeItem(item);
|
|
37
|
-
}
|
|
38
|
-
// Set attributes for flexbox child
|
|
39
|
-
// (container attributes are set in flex-layout-section.component)
|
|
40
|
-
getFlexAttribute(node, attribute) {
|
|
41
|
-
const index = ['flex-grow', 'flex-shrink', 'flex-basis'].indexOf(attribute);
|
|
42
|
-
return ((node.options || {}).flex || '').split(/\s+/)[index] ||
|
|
43
|
-
(node.options || {})[attribute] || ['1', '1', 'auto'][index];
|
|
44
|
-
}
|
|
45
|
-
showWidget(layoutNode) {
|
|
46
|
-
return this.jsf.evaluateCondition(layoutNode, this.dataIndex);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
FlexLayoutRootComponent.decorators = [
|
|
50
|
-
{ type: Component, args: [{
|
|
51
|
-
// tslint:disable-next-line:component-selector
|
|
52
|
-
selector: 'flex-layout-root-widget',
|
|
53
|
-
template: `
|
|
54
|
-
<div *ngFor="let layoutNode of layout; let i = index"
|
|
55
|
-
[class.form-flex-item]="isFlexItem"
|
|
56
|
-
[style.flex-grow]="getFlexAttribute(layoutNode, 'flex-grow')"
|
|
57
|
-
[style.flex-shrink]="getFlexAttribute(layoutNode, 'flex-shrink')"
|
|
58
|
-
[style.flex-basis]="getFlexAttribute(layoutNode, 'flex-basis')"
|
|
59
|
-
[style.align-self]="(layoutNode?.options || {})['align-self']"
|
|
60
|
-
[style.order]="layoutNode?.options?.order"
|
|
61
|
-
[fxFlex]="layoutNode?.options?.fxFlex"
|
|
62
|
-
[fxFlexOrder]="layoutNode?.options?.fxFlexOrder"
|
|
63
|
-
[fxFlexOffset]="layoutNode?.options?.fxFlexOffset"
|
|
64
|
-
[fxFlexAlign]="layoutNode?.options?.fxFlexAlign">
|
|
65
|
-
<select-framework-widget *ngIf="showWidget(layoutNode)"
|
|
66
|
-
[dataIndex]="layoutNode?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
67
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
68
|
-
[layoutNode]="layoutNode"></select-framework-widget>
|
|
69
|
-
<div>`,
|
|
70
|
-
changeDetection: ChangeDetectionStrategy.Default
|
|
71
|
-
},] }
|
|
72
|
-
];
|
|
73
|
-
FlexLayoutRootComponent.ctorParameters = () => [
|
|
74
|
-
{ type: JsonSchemaFormService }
|
|
75
|
-
];
|
|
76
|
-
FlexLayoutRootComponent.propDecorators = {
|
|
77
|
-
dataIndex: [{ type: Input }],
|
|
78
|
-
layoutIndex: [{ type: Input }],
|
|
79
|
-
layout: [{ type: Input }],
|
|
80
|
-
isFlexItem: [{ type: Input }]
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
class FlexLayoutSectionComponent {
|
|
84
|
-
constructor(jsf) {
|
|
85
|
-
this.jsf = jsf;
|
|
86
|
-
this.controlDisabled = false;
|
|
87
|
-
this.boundControl = false;
|
|
88
|
-
this.expanded = true;
|
|
89
|
-
this.containerType = 'div';
|
|
90
|
-
}
|
|
91
|
-
get sectionTitle() {
|
|
92
|
-
return this.options.notitle ? null : this.jsf.setItemTitle(this);
|
|
93
|
-
}
|
|
94
|
-
ngOnInit() {
|
|
95
|
-
this.jsf.initializeControl(this);
|
|
96
|
-
this.options = this.layoutNode.options || {};
|
|
97
|
-
this.expanded = typeof this.options.expanded === 'boolean' ?
|
|
98
|
-
this.options.expanded : !this.options.expandable;
|
|
99
|
-
switch (this.layoutNode.type) {
|
|
100
|
-
case 'section':
|
|
101
|
-
case 'array':
|
|
102
|
-
case 'fieldset':
|
|
103
|
-
case 'advancedfieldset':
|
|
104
|
-
case 'authfieldset':
|
|
105
|
-
case 'optionfieldset':
|
|
106
|
-
case 'selectfieldset':
|
|
107
|
-
this.containerType = 'fieldset';
|
|
108
|
-
break;
|
|
109
|
-
case 'card':
|
|
110
|
-
this.containerType = 'card';
|
|
111
|
-
break;
|
|
112
|
-
case 'expansion-panel':
|
|
113
|
-
this.containerType = 'expansion-panel';
|
|
114
|
-
break;
|
|
115
|
-
default: // 'div', 'flex', 'tab', 'conditional', 'actions'
|
|
116
|
-
this.containerType = 'div';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
toggleExpanded() {
|
|
120
|
-
if (this.options.expandable) {
|
|
121
|
-
this.expanded = !this.expanded;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// Set attributes for flexbox container
|
|
125
|
-
// (child attributes are set in flex-layout-root.component)
|
|
126
|
-
getFlexAttribute(attribute) {
|
|
127
|
-
const flexActive = this.layoutNode.type === 'flex' ||
|
|
128
|
-
!!this.options.displayFlex ||
|
|
129
|
-
this.options.display === 'flex';
|
|
130
|
-
// if (attribute !== 'flex' && !flexActive) { return null; }
|
|
131
|
-
switch (attribute) {
|
|
132
|
-
case 'is-flex':
|
|
133
|
-
return flexActive;
|
|
134
|
-
case 'display':
|
|
135
|
-
return flexActive ? 'flex' : 'initial';
|
|
136
|
-
case 'flex-direction':
|
|
137
|
-
case 'flex-wrap':
|
|
138
|
-
const index = ['flex-direction', 'flex-wrap'].indexOf(attribute);
|
|
139
|
-
return (this.options['flex-flow'] || '').split(/\s+/)[index] ||
|
|
140
|
-
this.options[attribute] || ['column', 'nowrap'][index];
|
|
141
|
-
case 'justify-content':
|
|
142
|
-
case 'align-items':
|
|
143
|
-
case 'align-content':
|
|
144
|
-
return this.options[attribute];
|
|
145
|
-
case 'layout':
|
|
146
|
-
return (this.options.fxLayout || 'row') +
|
|
147
|
-
this.options.fxLayoutWrap ? ' ' + this.options.fxLayoutWrap : '';
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
FlexLayoutSectionComponent.decorators = [
|
|
152
|
-
{ type: Component, args: [{
|
|
153
|
-
// tslint:disable-next-line:component-selector
|
|
154
|
-
selector: 'flex-layout-section-widget',
|
|
155
|
-
template: `
|
|
156
|
-
<div *ngIf="containerType === 'div'"
|
|
157
|
-
[class]="options?.htmlClass || ''"
|
|
158
|
-
[class.expandable]="options?.expandable && !expanded"
|
|
159
|
-
[class.expanded]="options?.expandable && expanded">
|
|
160
|
-
<label *ngIf="sectionTitle"
|
|
161
|
-
[class]="'legend ' + (options?.labelHtmlClass || '')"
|
|
162
|
-
[innerHTML]="sectionTitle"
|
|
163
|
-
(click)="toggleExpanded()"></label>
|
|
164
|
-
<flex-layout-root-widget *ngIf="expanded"
|
|
165
|
-
[layout]="layoutNode.items"
|
|
166
|
-
[dataIndex]="dataIndex"
|
|
167
|
-
[layoutIndex]="layoutIndex"
|
|
168
|
-
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
169
|
-
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
170
|
-
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
171
|
-
[style.display]="getFlexAttribute('display')"
|
|
172
|
-
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
173
|
-
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
174
|
-
[style.justify-content]="getFlexAttribute('justify-content')"
|
|
175
|
-
[style.align-items]="getFlexAttribute('align-items')"
|
|
176
|
-
[style.align-content]="getFlexAttribute('align-content')"
|
|
177
|
-
[fxLayout]="getFlexAttribute('layout')"
|
|
178
|
-
[fxLayoutGap]="options?.fxLayoutGap"
|
|
179
|
-
[fxLayoutAlign]="options?.fxLayoutAlign"
|
|
180
|
-
[attr.fxFlexFill]="options?.fxLayoutAlign"></flex-layout-root-widget>
|
|
181
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
182
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
<fieldset *ngIf="containerType === 'fieldset'"
|
|
186
|
-
[class]="options?.htmlClass || ''"
|
|
187
|
-
[class.expandable]="options?.expandable && !expanded"
|
|
188
|
-
[class.expanded]="options?.expandable && expanded"
|
|
189
|
-
[disabled]="options?.readonly">
|
|
190
|
-
<legend *ngIf="sectionTitle"
|
|
191
|
-
[class]="'legend ' + (options?.labelHtmlClass || '')"
|
|
192
|
-
[innerHTML]="sectionTitle"
|
|
193
|
-
(click)="toggleExpanded()"></legend>
|
|
194
|
-
<flex-layout-root-widget *ngIf="expanded"
|
|
195
|
-
[layout]="layoutNode.items"
|
|
196
|
-
[dataIndex]="dataIndex"
|
|
197
|
-
[layoutIndex]="layoutIndex"
|
|
198
|
-
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
199
|
-
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
200
|
-
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
201
|
-
[style.display]="getFlexAttribute('display')"
|
|
202
|
-
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
203
|
-
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
204
|
-
[style.justify-content]="getFlexAttribute('justify-content')"
|
|
205
|
-
[style.align-items]="getFlexAttribute('align-items')"
|
|
206
|
-
[style.align-content]="getFlexAttribute('align-content')"
|
|
207
|
-
[fxLayout]="getFlexAttribute('layout')"
|
|
208
|
-
[fxLayoutGap]="options?.fxLayoutGap"
|
|
209
|
-
[fxLayoutAlign]="options?.fxLayoutAlign"
|
|
210
|
-
[attr.fxFlexFill]="options?.fxLayoutAlign"></flex-layout-root-widget>
|
|
211
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
212
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
213
|
-
</fieldset>
|
|
214
|
-
|
|
215
|
-
<mat-card *ngIf="containerType === 'card'"
|
|
216
|
-
[ngClass]="options?.htmlClass || ''"
|
|
217
|
-
[class.expandable]="options?.expandable && !expanded"
|
|
218
|
-
[class.expanded]="options?.expandable && expanded">
|
|
219
|
-
<mat-card-header *ngIf="sectionTitle">
|
|
220
|
-
<legend
|
|
221
|
-
[class]="'legend ' + (options?.labelHtmlClass || '')"
|
|
222
|
-
[innerHTML]="sectionTitle"
|
|
223
|
-
(click)="toggleExpanded()"></legend>
|
|
224
|
-
</mat-card-header>
|
|
225
|
-
<mat-card-content *ngIf="expanded">
|
|
226
|
-
<fieldset [disabled]="options?.readonly">
|
|
227
|
-
<flex-layout-root-widget *ngIf="expanded"
|
|
228
|
-
[layout]="layoutNode.items"
|
|
229
|
-
[dataIndex]="dataIndex"
|
|
230
|
-
[layoutIndex]="layoutIndex"
|
|
231
|
-
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
232
|
-
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
233
|
-
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
234
|
-
[style.display]="getFlexAttribute('display')"
|
|
235
|
-
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
236
|
-
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
237
|
-
[style.justify-content]="getFlexAttribute('justify-content')"
|
|
238
|
-
[style.align-items]="getFlexAttribute('align-items')"
|
|
239
|
-
[style.align-content]="getFlexAttribute('align-content')"
|
|
240
|
-
[fxLayout]="getFlexAttribute('layout')"
|
|
241
|
-
[fxLayoutGap]="options?.fxLayoutGap"
|
|
242
|
-
[fxLayoutAlign]="options?.fxLayoutAlign"
|
|
243
|
-
[attr.fxFlexFill]="options?.fxLayoutAlign"></flex-layout-root-widget>
|
|
244
|
-
</fieldset>
|
|
245
|
-
</mat-card-content>
|
|
246
|
-
<mat-card-footer>
|
|
247
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
248
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
249
|
-
</mat-card-footer>
|
|
250
|
-
</mat-card>
|
|
251
|
-
|
|
252
|
-
<mat-expansion-panel *ngIf="containerType === 'expansion-panel'"
|
|
253
|
-
[expanded]="expanded"
|
|
254
|
-
[hideToggle]="!options?.expandable">
|
|
255
|
-
<mat-expansion-panel-header>
|
|
256
|
-
<mat-panel-title>
|
|
257
|
-
<legend *ngIf="sectionTitle"
|
|
258
|
-
[class]="options?.labelHtmlClass"
|
|
259
|
-
[innerHTML]="sectionTitle"
|
|
260
|
-
(click)="toggleExpanded()"></legend>
|
|
261
|
-
</mat-panel-title>
|
|
262
|
-
</mat-expansion-panel-header>
|
|
263
|
-
<fieldset [disabled]="options?.readonly">
|
|
264
|
-
<flex-layout-root-widget *ngIf="expanded"
|
|
265
|
-
[layout]="layoutNode.items"
|
|
266
|
-
[dataIndex]="dataIndex"
|
|
267
|
-
[layoutIndex]="layoutIndex"
|
|
268
|
-
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
269
|
-
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
270
|
-
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
271
|
-
[style.display]="getFlexAttribute('display')"
|
|
272
|
-
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
273
|
-
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
274
|
-
[style.justify-content]="getFlexAttribute('justify-content')"
|
|
275
|
-
[style.align-items]="getFlexAttribute('align-items')"
|
|
276
|
-
[style.align-content]="getFlexAttribute('align-content')"
|
|
277
|
-
[fxLayout]="getFlexAttribute('layout')"
|
|
278
|
-
[fxLayoutGap]="options?.fxLayoutGap"
|
|
279
|
-
[fxLayoutAlign]="options?.fxLayoutAlign"
|
|
280
|
-
[attr.fxFlexFill]="options?.fxLayoutAlign"></flex-layout-root-widget>
|
|
281
|
-
</fieldset>
|
|
282
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
283
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
284
|
-
</mat-expansion-panel>`,
|
|
285
|
-
styles: [`
|
|
286
|
-
fieldset { border: 0; margin: 0; padding: 0; }
|
|
287
|
-
.legend { font-weight: bold; }
|
|
288
|
-
.expandable > .legend:before { content: '▶'; padding-right: .3em; }
|
|
289
|
-
.expanded > .legend:before { content: '▼'; padding-right: .2em; }
|
|
290
|
-
`]
|
|
291
|
-
},] }
|
|
292
|
-
];
|
|
293
|
-
FlexLayoutSectionComponent.ctorParameters = () => [
|
|
294
|
-
{ type: JsonSchemaFormService }
|
|
295
|
-
];
|
|
296
|
-
FlexLayoutSectionComponent.propDecorators = {
|
|
297
|
-
layoutNode: [{ type: Input }],
|
|
298
|
-
layoutIndex: [{ type: Input }],
|
|
299
|
-
dataIndex: [{ type: Input }]
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
class MaterialAddReferenceComponent {
|
|
303
|
-
constructor(jsf) {
|
|
304
|
-
this.jsf = jsf;
|
|
305
|
-
}
|
|
306
|
-
ngOnInit() {
|
|
307
|
-
this.options = this.layoutNode.options || {};
|
|
308
|
-
}
|
|
309
|
-
get showAddButton() {
|
|
310
|
-
return !this.layoutNode.arrayItem ||
|
|
311
|
-
this.layoutIndex[this.layoutIndex.length - 1] < this.options.maxItems;
|
|
312
|
-
}
|
|
313
|
-
addItem(event) {
|
|
314
|
-
event.preventDefault();
|
|
315
|
-
this.jsf.addItem(this);
|
|
316
|
-
}
|
|
317
|
-
get buttonText() {
|
|
318
|
-
const parent = {
|
|
319
|
-
dataIndex: this.dataIndex.slice(0, -1),
|
|
320
|
-
layoutIndex: this.layoutIndex.slice(0, -1),
|
|
321
|
-
layoutNode: this.jsf.getParentNode(this),
|
|
322
|
-
};
|
|
323
|
-
return parent.layoutNode.add ||
|
|
324
|
-
this.jsf.setArrayItemTitle(parent, this.layoutNode, this.itemCount);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
MaterialAddReferenceComponent.decorators = [
|
|
328
|
-
{ type: Component, args: [{
|
|
329
|
-
// tslint:disable-next-line:component-selector
|
|
330
|
-
selector: 'material-add-reference-widget',
|
|
331
|
-
template: `
|
|
332
|
-
<section [class]="options?.htmlClass || ''" align="end">
|
|
333
|
-
<button mat-raised-button *ngIf="showAddButton"
|
|
334
|
-
[color]="options?.color || 'accent'"
|
|
335
|
-
[disabled]="options?.readonly"
|
|
336
|
-
(click)="addItem($event)">
|
|
337
|
-
<span *ngIf="options?.icon" [class]="options?.icon"></span>
|
|
338
|
-
<span *ngIf="options?.title" [innerHTML]="buttonText"></span>
|
|
339
|
-
</button>
|
|
340
|
-
</section>`,
|
|
341
|
-
changeDetection: ChangeDetectionStrategy.Default
|
|
342
|
-
},] }
|
|
343
|
-
];
|
|
344
|
-
MaterialAddReferenceComponent.ctorParameters = () => [
|
|
345
|
-
{ type: JsonSchemaFormService }
|
|
346
|
-
];
|
|
347
|
-
MaterialAddReferenceComponent.propDecorators = {
|
|
348
|
-
layoutNode: [{ type: Input }],
|
|
349
|
-
layoutIndex: [{ type: Input }],
|
|
350
|
-
dataIndex: [{ type: Input }]
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
class MaterialButtonComponent {
|
|
354
|
-
constructor(jsf) {
|
|
355
|
-
this.jsf = jsf;
|
|
356
|
-
this.controlDisabled = false;
|
|
357
|
-
this.boundControl = false;
|
|
358
|
-
}
|
|
359
|
-
ngOnInit() {
|
|
360
|
-
this.options = this.layoutNode.options || {};
|
|
361
|
-
this.jsf.initializeControl(this);
|
|
362
|
-
if (hasOwn(this.options, 'disabled')) {
|
|
363
|
-
this.controlDisabled = this.options.disabled;
|
|
364
|
-
}
|
|
365
|
-
else if (this.jsf.formOptions.disableInvalidSubmit) {
|
|
366
|
-
this.controlDisabled = !this.jsf.isValid;
|
|
367
|
-
this.jsf.isValidChanges.subscribe(isValid => this.controlDisabled = !isValid);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
updateValue(event) {
|
|
371
|
-
if (typeof this.options.onClick === 'function') {
|
|
372
|
-
this.options.onClick(event);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
this.jsf.updateValue(this, event.target.value);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
MaterialButtonComponent.decorators = [
|
|
380
|
-
{ type: Component, args: [{
|
|
381
|
-
// tslint:disable-next-line:component-selector
|
|
382
|
-
selector: 'material-button-widget',
|
|
383
|
-
template: `
|
|
384
|
-
<div class="button-row" [class]="options?.htmlClass || ''">
|
|
385
|
-
<button mat-raised-button
|
|
386
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
387
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
388
|
-
[color]="options?.color || 'primary'"
|
|
389
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
390
|
-
[id]="'control' + layoutNode?._id"
|
|
391
|
-
[name]="controlName"
|
|
392
|
-
[type]="layoutNode?.type"
|
|
393
|
-
[value]="controlValue"
|
|
394
|
-
(click)="updateValue($event)">
|
|
395
|
-
<mat-icon *ngIf="options?.icon" class="mat-24">{{options?.icon}}</mat-icon>
|
|
396
|
-
<span *ngIf="options?.title" [innerHTML]="options?.title"></span>
|
|
397
|
-
</button>
|
|
398
|
-
</div>`,
|
|
399
|
-
styles: [` button { margin-top: 10px; } `]
|
|
400
|
-
},] }
|
|
401
|
-
];
|
|
402
|
-
MaterialButtonComponent.ctorParameters = () => [
|
|
403
|
-
{ type: JsonSchemaFormService }
|
|
404
|
-
];
|
|
405
|
-
MaterialButtonComponent.propDecorators = {
|
|
406
|
-
layoutNode: [{ type: Input }],
|
|
407
|
-
layoutIndex: [{ type: Input }],
|
|
408
|
-
dataIndex: [{ type: Input }]
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
class MaterialButtonGroupComponent {
|
|
412
|
-
constructor(jsf) {
|
|
413
|
-
this.jsf = jsf;
|
|
414
|
-
this.controlDisabled = false;
|
|
415
|
-
this.boundControl = false;
|
|
416
|
-
this.radiosList = [];
|
|
417
|
-
this.vertical = false;
|
|
418
|
-
}
|
|
419
|
-
ngOnInit() {
|
|
420
|
-
this.options = this.layoutNode.options || {};
|
|
421
|
-
this.radiosList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true);
|
|
422
|
-
this.jsf.initializeControl(this);
|
|
423
|
-
}
|
|
424
|
-
updateValue(value) {
|
|
425
|
-
this.options.showErrors = true;
|
|
426
|
-
this.jsf.updateValue(this, value);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
MaterialButtonGroupComponent.decorators = [
|
|
430
|
-
{ type: Component, args: [{
|
|
431
|
-
// tslint:disable-next-line:component-selector
|
|
432
|
-
selector: 'material-button-group-widget',
|
|
433
|
-
template: `
|
|
434
|
-
<div>
|
|
435
|
-
<div *ngIf="options?.title">
|
|
436
|
-
<label
|
|
437
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
438
|
-
[class]="options?.labelHtmlClass || ''"
|
|
439
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
440
|
-
[innerHTML]="options?.title"></label>
|
|
441
|
-
</div>
|
|
442
|
-
<mat-button-toggle-group
|
|
443
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
444
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
445
|
-
[attr.required]="options?.required"
|
|
446
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
447
|
-
[name]="controlName"
|
|
448
|
-
[value]="controlValue"
|
|
449
|
-
[vertical]="!!options.vertical">
|
|
450
|
-
<mat-button-toggle *ngFor="let radioItem of radiosList"
|
|
451
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.name"
|
|
452
|
-
[value]="radioItem?.value"
|
|
453
|
-
(click)="updateValue(radioItem?.value)">
|
|
454
|
-
<span [innerHTML]="radioItem?.name"></span>
|
|
455
|
-
</mat-button-toggle>
|
|
456
|
-
</mat-button-toggle-group>
|
|
457
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
458
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
459
|
-
</div>`,
|
|
460
|
-
styles: [` mat-error { font-size: 75%; } `]
|
|
461
|
-
},] }
|
|
462
|
-
];
|
|
463
|
-
MaterialButtonGroupComponent.ctorParameters = () => [
|
|
464
|
-
{ type: JsonSchemaFormService }
|
|
465
|
-
];
|
|
466
|
-
MaterialButtonGroupComponent.propDecorators = {
|
|
467
|
-
layoutNode: [{ type: Input }],
|
|
468
|
-
layoutIndex: [{ type: Input }],
|
|
469
|
-
dataIndex: [{ type: Input }]
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
class MaterialCheckboxComponent {
|
|
473
|
-
constructor(jsf) {
|
|
474
|
-
this.jsf = jsf;
|
|
475
|
-
this.controlDisabled = false;
|
|
476
|
-
this.boundControl = false;
|
|
477
|
-
this.trueValue = true;
|
|
478
|
-
this.falseValue = false;
|
|
479
|
-
this.showSlideToggle = false;
|
|
480
|
-
}
|
|
481
|
-
ngOnInit() {
|
|
482
|
-
this.options = this.layoutNode.options || {};
|
|
483
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
484
|
-
if (this.controlValue === null || this.controlValue === undefined) {
|
|
485
|
-
this.controlValue = false;
|
|
486
|
-
this.jsf.updateValue(this, this.falseValue);
|
|
487
|
-
}
|
|
488
|
-
if (this.layoutNode.type === 'slide-toggle' ||
|
|
489
|
-
this.layoutNode.format === 'slide-toggle') {
|
|
490
|
-
this.showSlideToggle = true;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
updateValue(event) {
|
|
494
|
-
this.options.showErrors = true;
|
|
495
|
-
this.jsf.updateValue(this, event.checked ? this.trueValue : this.falseValue);
|
|
496
|
-
}
|
|
497
|
-
get isChecked() {
|
|
498
|
-
return this.jsf.getFormControlValue(this) === this.trueValue;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
MaterialCheckboxComponent.decorators = [
|
|
502
|
-
{ type: Component, args: [{
|
|
503
|
-
// tslint:disable-next-line:component-selector
|
|
504
|
-
selector: 'material-checkbox-widget',
|
|
505
|
-
template: `
|
|
506
|
-
<mat-checkbox *ngIf="boundControl && !showSlideToggle"
|
|
507
|
-
[formControl]="formControl"
|
|
508
|
-
align="left"
|
|
509
|
-
[color]="options?.color || 'primary'"
|
|
510
|
-
[id]="'control' + layoutNode?._id"
|
|
511
|
-
labelPosition="after"
|
|
512
|
-
[name]="controlName"
|
|
513
|
-
(blur)="options.showErrors = true">
|
|
514
|
-
<span *ngIf="options?.title"
|
|
515
|
-
class="checkbox-name"
|
|
516
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
517
|
-
[innerHTML]="options?.title"></span>
|
|
518
|
-
</mat-checkbox>
|
|
519
|
-
<mat-checkbox *ngIf="!boundControl && !showSlideToggle"
|
|
520
|
-
align="left"
|
|
521
|
-
[color]="options?.color || 'primary'"
|
|
522
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
523
|
-
[id]="'control' + layoutNode?._id"
|
|
524
|
-
labelPosition="after"
|
|
525
|
-
[name]="controlName"
|
|
526
|
-
[checked]="isChecked"
|
|
527
|
-
(blur)="options.showErrors = true"
|
|
528
|
-
(change)="updateValue($event)">
|
|
529
|
-
<span *ngIf="options?.title"
|
|
530
|
-
class="checkbox-name"
|
|
531
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
532
|
-
[innerHTML]="options?.title"></span>
|
|
533
|
-
</mat-checkbox>
|
|
534
|
-
<mat-slide-toggle *ngIf="boundControl && showSlideToggle"
|
|
535
|
-
[formControl]="formControl"
|
|
536
|
-
align="left"
|
|
537
|
-
[color]="options?.color || 'primary'"
|
|
538
|
-
[id]="'control' + layoutNode?._id"
|
|
539
|
-
labelPosition="after"
|
|
540
|
-
[name]="controlName"
|
|
541
|
-
(blur)="options.showErrors = true">
|
|
542
|
-
<span *ngIf="options?.title"
|
|
543
|
-
class="checkbox-name"
|
|
544
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
545
|
-
[innerHTML]="options?.title"></span>
|
|
546
|
-
</mat-slide-toggle>
|
|
547
|
-
<mat-slide-toggle *ngIf="!boundControl && showSlideToggle"
|
|
548
|
-
align="left"
|
|
549
|
-
[color]="options?.color || 'primary'"
|
|
550
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
551
|
-
[id]="'control' + layoutNode?._id"
|
|
552
|
-
labelPosition="after"
|
|
553
|
-
[name]="controlName"
|
|
554
|
-
[checked]="isChecked"
|
|
555
|
-
(blur)="options.showErrors = true"
|
|
556
|
-
(change)="updateValue($event)">
|
|
557
|
-
<span *ngIf="options?.title"
|
|
558
|
-
class="checkbox-name"
|
|
559
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
560
|
-
[innerHTML]="options?.title"></span>
|
|
561
|
-
</mat-slide-toggle>
|
|
562
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
563
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
564
|
-
styles: [`
|
|
565
|
-
.checkbox-name { white-space: nowrap; }
|
|
566
|
-
mat-error { font-size: 75%; }
|
|
567
|
-
`]
|
|
568
|
-
},] }
|
|
569
|
-
];
|
|
570
|
-
MaterialCheckboxComponent.ctorParameters = () => [
|
|
571
|
-
{ type: JsonSchemaFormService }
|
|
572
|
-
];
|
|
573
|
-
MaterialCheckboxComponent.propDecorators = {
|
|
574
|
-
layoutNode: [{ type: Input }],
|
|
575
|
-
layoutIndex: [{ type: Input }],
|
|
576
|
-
dataIndex: [{ type: Input }]
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// TODO: Change this to use a Selection List instead?
|
|
580
|
-
// https://material.angular.io/components/list/overview
|
|
581
|
-
class MaterialCheckboxesComponent {
|
|
582
|
-
constructor(jsf) {
|
|
583
|
-
this.jsf = jsf;
|
|
584
|
-
this.controlDisabled = false;
|
|
585
|
-
this.boundControl = false;
|
|
586
|
-
this.horizontalList = false;
|
|
587
|
-
this.checkboxList = [];
|
|
588
|
-
}
|
|
589
|
-
ngOnInit() {
|
|
590
|
-
this.options = this.layoutNode.options || {};
|
|
591
|
-
this.horizontalList = this.layoutNode.type === 'checkboxes-inline' ||
|
|
592
|
-
this.layoutNode.type === 'checkboxbuttons';
|
|
593
|
-
this.jsf.initializeControl(this);
|
|
594
|
-
this.checkboxList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true);
|
|
595
|
-
if (this.boundControl) {
|
|
596
|
-
const formArray = this.jsf.getFormControl(this);
|
|
597
|
-
for (const checkboxItem of this.checkboxList) {
|
|
598
|
-
checkboxItem.checked = formArray.value.includes(checkboxItem.value);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
get allChecked() {
|
|
603
|
-
return this.checkboxList.filter(t => t.checked).length === this.checkboxList.length;
|
|
604
|
-
}
|
|
605
|
-
get someChecked() {
|
|
606
|
-
const checkedItems = this.checkboxList.filter(t => t.checked).length;
|
|
607
|
-
return checkedItems > 0 && checkedItems < this.checkboxList.length;
|
|
608
|
-
}
|
|
609
|
-
updateValue() {
|
|
610
|
-
this.options.showErrors = true;
|
|
611
|
-
if (this.boundControl) {
|
|
612
|
-
this.jsf.updateArrayCheckboxList(this, this.checkboxList);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
updateAllValues(event) {
|
|
616
|
-
this.options.showErrors = true;
|
|
617
|
-
this.checkboxList.forEach(t => t.checked = event.checked);
|
|
618
|
-
this.updateValue();
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
MaterialCheckboxesComponent.decorators = [
|
|
622
|
-
{ type: Component, args: [{
|
|
623
|
-
// tslint:disable-next-line:component-selector
|
|
624
|
-
selector: 'material-checkboxes-widget',
|
|
625
|
-
template: `
|
|
626
|
-
<div>
|
|
627
|
-
<mat-checkbox type="checkbox"
|
|
628
|
-
[checked]="allChecked"
|
|
629
|
-
[color]="options?.color || 'primary'"
|
|
630
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
631
|
-
[indeterminate]="someChecked"
|
|
632
|
-
[name]="options?.name"
|
|
633
|
-
(blur)="options.showErrors = true"
|
|
634
|
-
(change)="updateAllValues($event)">
|
|
635
|
-
<span class="checkbox-name" [innerHTML]="options?.name"></span>
|
|
636
|
-
</mat-checkbox>
|
|
637
|
-
<label *ngIf="options?.title"
|
|
638
|
-
class="title"
|
|
639
|
-
[class]="options?.labelHtmlClass || ''"
|
|
640
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
641
|
-
[innerHTML]="options?.title"></label>
|
|
642
|
-
<ul class="checkbox-list" [class.horizontal-list]="horizontalList">
|
|
643
|
-
<li *ngFor="let checkboxItem of checkboxList"
|
|
644
|
-
[class]="options?.htmlClass || ''">
|
|
645
|
-
<mat-checkbox type="checkbox"
|
|
646
|
-
[(ngModel)]="checkboxItem.checked"
|
|
647
|
-
[color]="options?.color || 'primary'"
|
|
648
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
649
|
-
[name]="checkboxItem?.name"
|
|
650
|
-
(blur)="options.showErrors = true"
|
|
651
|
-
(change)="updateValue()">
|
|
652
|
-
<span class="checkbox-name" [innerHTML]="checkboxItem?.name"></span>
|
|
653
|
-
</mat-checkbox>
|
|
654
|
-
</li>
|
|
655
|
-
</ul>
|
|
656
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
657
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
658
|
-
</div>`,
|
|
659
|
-
styles: [`
|
|
660
|
-
.title { font-weight: bold; }
|
|
661
|
-
.checkbox-list { list-style-type: none; }
|
|
662
|
-
.horizontal-list > li { display: inline-block; margin-right: 10px; zoom: 1; }
|
|
663
|
-
.checkbox-name { white-space: nowrap; }
|
|
664
|
-
mat-error { font-size: 75%; }
|
|
665
|
-
`]
|
|
666
|
-
},] }
|
|
667
|
-
];
|
|
668
|
-
MaterialCheckboxesComponent.ctorParameters = () => [
|
|
669
|
-
{ type: JsonSchemaFormService }
|
|
670
|
-
];
|
|
671
|
-
MaterialCheckboxesComponent.propDecorators = {
|
|
672
|
-
layoutNode: [{ type: Input }],
|
|
673
|
-
layoutIndex: [{ type: Input }],
|
|
674
|
-
dataIndex: [{ type: Input }]
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
// TODO: Add this control
|
|
678
|
-
class MaterialChipListComponent {
|
|
679
|
-
constructor(jsf) {
|
|
680
|
-
this.jsf = jsf;
|
|
681
|
-
this.controlDisabled = false;
|
|
682
|
-
this.boundControl = false;
|
|
683
|
-
}
|
|
684
|
-
ngOnInit() {
|
|
685
|
-
this.options = this.layoutNode.options || {};
|
|
686
|
-
this.jsf.initializeControl(this);
|
|
687
|
-
}
|
|
688
|
-
updateValue(event) {
|
|
689
|
-
this.jsf.updateValue(this, event.target.value);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
MaterialChipListComponent.decorators = [
|
|
693
|
-
{ type: Component, args: [{
|
|
694
|
-
// tslint:disable-next-line:component-selector
|
|
695
|
-
selector: 'material-chip-list-widget',
|
|
696
|
-
template: ``
|
|
697
|
-
},] }
|
|
698
|
-
];
|
|
699
|
-
MaterialChipListComponent.ctorParameters = () => [
|
|
700
|
-
{ type: JsonSchemaFormService }
|
|
701
|
-
];
|
|
702
|
-
MaterialChipListComponent.propDecorators = {
|
|
703
|
-
layoutNode: [{ type: Input }],
|
|
704
|
-
layoutIndex: [{ type: Input }],
|
|
705
|
-
dataIndex: [{ type: Input }]
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
class MaterialDatepickerComponent {
|
|
709
|
-
constructor(matFormFieldDefaultOptions, jsf) {
|
|
710
|
-
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
711
|
-
this.jsf = jsf;
|
|
712
|
-
this.controlDisabled = false;
|
|
713
|
-
this.boundControl = false;
|
|
714
|
-
this.autoCompleteList = [];
|
|
715
|
-
}
|
|
716
|
-
ngOnInit() {
|
|
717
|
-
this.options = this.layoutNode.options || {};
|
|
718
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
719
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
720
|
-
this.options.description = this.options.placeholder;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
MaterialDatepickerComponent.decorators = [
|
|
725
|
-
{ type: Component, args: [{
|
|
726
|
-
// tslint:disable-next-line:component-selector
|
|
727
|
-
selector: 'material-datepicker-widget',
|
|
728
|
-
template: `
|
|
729
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
|
|
730
|
-
[class]="options?.htmlClass || ''"
|
|
731
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
732
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
733
|
-
[style.width]="'100%'">
|
|
734
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
735
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
736
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
737
|
-
<input matInput *ngIf="boundControl"
|
|
738
|
-
[formControl]="formControl"
|
|
739
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
740
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
741
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
742
|
-
[id]="'control' + layoutNode?._id"
|
|
743
|
-
[max]="options?.maximum"
|
|
744
|
-
[matDatepicker]="picker"
|
|
745
|
-
[min]="options?.minimum"
|
|
746
|
-
[name]="controlName"
|
|
747
|
-
[placeholder]="options?.title"
|
|
748
|
-
[readonly]="options?.readonly"
|
|
749
|
-
[required]="options?.required"
|
|
750
|
-
[style.width]="'100%'"
|
|
751
|
-
(blur)="options.showErrors = true"
|
|
752
|
-
>
|
|
753
|
-
<input matInput *ngIf="!boundControl"
|
|
754
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
755
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
756
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
757
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
758
|
-
[id]="'control' + layoutNode?._id"
|
|
759
|
-
[max]="options?.maximum"
|
|
760
|
-
[matDatepicker]="picker"
|
|
761
|
-
[min]="options?.minimum"
|
|
762
|
-
[name]="controlName"
|
|
763
|
-
[placeholder]="options?.title"
|
|
764
|
-
[required]="options?.required"
|
|
765
|
-
[style.width]="'100%'"
|
|
766
|
-
[readonly]="options?.readonly"
|
|
767
|
-
(blur)="options.showErrors = true"
|
|
768
|
-
>
|
|
769
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
770
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
771
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
772
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
773
|
-
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
|
774
|
-
</mat-form-field>
|
|
775
|
-
<mat-datepicker #picker ></mat-datepicker>
|
|
776
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
777
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
778
|
-
styles: [`
|
|
779
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
780
|
-
::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
|
|
781
|
-
.mat-form-field-infix { width: initial; }
|
|
782
|
-
`]
|
|
783
|
-
},] }
|
|
784
|
-
];
|
|
785
|
-
MaterialDatepickerComponent.ctorParameters = () => [
|
|
786
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }, { type: Optional }] },
|
|
787
|
-
{ type: JsonSchemaFormService }
|
|
788
|
-
];
|
|
789
|
-
MaterialDatepickerComponent.propDecorators = {
|
|
790
|
-
layoutNode: [{ type: Input }],
|
|
791
|
-
layoutIndex: [{ type: Input }],
|
|
792
|
-
dataIndex: [{ type: Input }]
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
class MaterialDesignFrameworkComponent {
|
|
796
|
-
constructor(changeDetector, jsf) {
|
|
797
|
-
this.changeDetector = changeDetector;
|
|
798
|
-
this.jsf = jsf;
|
|
799
|
-
this.frameworkInitialized = false;
|
|
800
|
-
this.formControl = null;
|
|
801
|
-
this.parentArray = null;
|
|
802
|
-
this.isOrderable = false;
|
|
803
|
-
this.dynamicTitle = null;
|
|
804
|
-
}
|
|
805
|
-
get showRemoveButton() {
|
|
806
|
-
if (!this.layoutNode || !this.widgetOptions.removable ||
|
|
807
|
-
this.widgetOptions.readonly || this.layoutNode.type === '$ref') {
|
|
808
|
-
return false;
|
|
809
|
-
}
|
|
810
|
-
if (this.layoutNode.recursiveReference) {
|
|
811
|
-
return true;
|
|
812
|
-
}
|
|
813
|
-
if (!this.layoutNode.arrayItem || !this.parentArray) {
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
// If array length <= minItems, don't allow removing any items
|
|
817
|
-
return this.parentArray.items.length - 1 <= this.parentArray.options.minItems ? false :
|
|
818
|
-
// For removable list items, allow removing any item
|
|
819
|
-
this.layoutNode.arrayItemType === 'list' ? true :
|
|
820
|
-
// For removable tuple items, only allow removing last item in list
|
|
821
|
-
this.layoutIndex[this.layoutIndex.length - 1] === this.parentArray.items.length - 2;
|
|
822
|
-
}
|
|
823
|
-
ngOnInit() {
|
|
824
|
-
this.initializeFramework();
|
|
825
|
-
}
|
|
826
|
-
ngOnChanges() {
|
|
827
|
-
if (!this.frameworkInitialized) {
|
|
828
|
-
this.initializeFramework();
|
|
829
|
-
}
|
|
830
|
-
if (this.dynamicTitle) {
|
|
831
|
-
this.updateTitle();
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
initializeFramework() {
|
|
835
|
-
if (this.layoutNode) {
|
|
836
|
-
this.options = cloneDeep(this.layoutNode.options || {});
|
|
837
|
-
this.widgetLayoutNode = Object.assign(Object.assign({}, this.layoutNode), { options: cloneDeep(this.layoutNode.options || {}) });
|
|
838
|
-
this.widgetOptions = this.widgetLayoutNode.options;
|
|
839
|
-
this.formControl = this.jsf.getFormControl(this);
|
|
840
|
-
if (isDefined(this.widgetOptions.minimum) &&
|
|
841
|
-
isDefined(this.widgetOptions.maximum) &&
|
|
842
|
-
this.widgetOptions.multipleOf >= 1) {
|
|
843
|
-
this.layoutNode.type = 'range';
|
|
844
|
-
}
|
|
845
|
-
if (!['$ref', 'advancedfieldset', 'authfieldset', 'button', 'card',
|
|
846
|
-
'checkbox', 'expansion-panel', 'help', 'message', 'msg', 'section',
|
|
847
|
-
'submit', 'tabarray', 'tabs'].includes(this.layoutNode.type) &&
|
|
848
|
-
/{{.+?}}/.test(this.widgetOptions.title || '')) {
|
|
849
|
-
this.dynamicTitle = this.widgetOptions.title;
|
|
850
|
-
this.updateTitle();
|
|
851
|
-
}
|
|
852
|
-
if (this.layoutNode.arrayItem && this.layoutNode.type !== '$ref') {
|
|
853
|
-
this.parentArray = this.jsf.getParentNode(this);
|
|
854
|
-
if (this.parentArray) {
|
|
855
|
-
this.isOrderable =
|
|
856
|
-
this.parentArray.type.slice(0, 3) !== 'tab' &&
|
|
857
|
-
this.layoutNode.arrayItemType === 'list' &&
|
|
858
|
-
!this.widgetOptions.readonly &&
|
|
859
|
-
this.parentArray.options.orderable;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
this.frameworkInitialized = true;
|
|
863
|
-
}
|
|
864
|
-
else {
|
|
865
|
-
this.options = {};
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
updateTitle() {
|
|
869
|
-
this.widgetLayoutNode.options.title = this.jsf.parseText(this.dynamicTitle, this.jsf.getFormControlValue(this), this.jsf.getFormControlGroup(this).value, this.dataIndex[this.dataIndex.length - 1]);
|
|
870
|
-
}
|
|
871
|
-
removeItem() {
|
|
872
|
-
this.jsf.removeItem(this);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
MaterialDesignFrameworkComponent.decorators = [
|
|
876
|
-
{ type: Component, args: [{
|
|
877
|
-
// tslint:disable-next-line:component-selector
|
|
878
|
-
selector: 'material-design-framework',
|
|
879
|
-
template: "<div\n [class.array-item]=\"widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'\"\n [orderable]=\"isOrderable\"\n [dataIndex]=\"dataIndex\"\n [layoutIndex]=\"layoutIndex\"\n [layoutNode]=\"widgetLayoutNode\">\n <svg *ngIf=\"showRemoveButton\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"18\" width=\"18\" viewBox=\"0 0 24 24\"\n class=\"close-button\"\n (click)=\"removeItem()\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/>\n </svg>\n <select-widget-widget\n [dataIndex]=\"dataIndex\"\n [layoutIndex]=\"layoutIndex\"\n [layoutNode]=\"widgetLayoutNode\"></select-widget-widget>\n</div>\n<div class=\"spacer\" *ngIf=\"widgetLayoutNode?.arrayItem && widgetLayoutNode?.type !== '$ref'\"></div>\n",
|
|
880
|
-
styles: [".array-item{border-radius:2px;box-shadow:0 3px 1px -2px #0003,0 2px 2px #00000024,0 1px 5px #0000001f;padding:6px;position:relative;transition:all .28s cubic-bezier(.4,0,.2,1)}.close-button{cursor:pointer;position:absolute;top:6px;right:6px;fill:#0006;visibility:hidden;z-index:500}.close-button:hover{fill:#000c}.array-item:hover>.close-button{visibility:visible}.spacer{margin:6px 0}[draggable=true]:hover{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f;cursor:move;z-index:10}[draggable=true].drag-target-top{box-shadow:0 -2px #000;position:relative;z-index:20}[draggable=true].drag-target-bottom{box-shadow:0 2px #000;position:relative;z-index:20}\n"]
|
|
881
|
-
},] }
|
|
882
|
-
];
|
|
883
|
-
MaterialDesignFrameworkComponent.ctorParameters = () => [
|
|
884
|
-
{ type: ChangeDetectorRef },
|
|
885
|
-
{ type: JsonSchemaFormService }
|
|
886
|
-
];
|
|
887
|
-
MaterialDesignFrameworkComponent.propDecorators = {
|
|
888
|
-
layoutNode: [{ type: Input }],
|
|
889
|
-
layoutIndex: [{ type: Input }],
|
|
890
|
-
dataIndex: [{ type: Input }]
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
// TODO: Add this control
|
|
894
|
-
class MaterialFileComponent {
|
|
895
|
-
constructor(jsf) {
|
|
896
|
-
this.jsf = jsf;
|
|
897
|
-
this.controlDisabled = false;
|
|
898
|
-
this.boundControl = false;
|
|
899
|
-
}
|
|
900
|
-
ngOnInit() {
|
|
901
|
-
this.options = this.layoutNode.options || {};
|
|
902
|
-
this.jsf.initializeControl(this);
|
|
903
|
-
}
|
|
904
|
-
updateValue(event) {
|
|
905
|
-
this.jsf.updateValue(this, event.target.value);
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
MaterialFileComponent.decorators = [
|
|
909
|
-
{ type: Component, args: [{
|
|
910
|
-
// tslint:disable-next-line:component-selector
|
|
911
|
-
selector: 'material-file-widget',
|
|
912
|
-
template: ``
|
|
913
|
-
},] }
|
|
914
|
-
];
|
|
915
|
-
MaterialFileComponent.ctorParameters = () => [
|
|
916
|
-
{ type: JsonSchemaFormService }
|
|
917
|
-
];
|
|
918
|
-
MaterialFileComponent.propDecorators = {
|
|
919
|
-
layoutNode: [{ type: Input }],
|
|
920
|
-
layoutIndex: [{ type: Input }],
|
|
921
|
-
dataIndex: [{ type: Input }]
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
class MaterialInputComponent {
|
|
925
|
-
constructor(matFormFieldDefaultOptions, jsf) {
|
|
926
|
-
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
927
|
-
this.jsf = jsf;
|
|
928
|
-
this.controlDisabled = false;
|
|
929
|
-
this.boundControl = false;
|
|
930
|
-
this.autoCompleteList = [];
|
|
931
|
-
}
|
|
932
|
-
ngOnInit() {
|
|
933
|
-
this.options = this.layoutNode.options || {};
|
|
934
|
-
this.jsf.initializeControl(this);
|
|
935
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
936
|
-
this.options.description = this.options.placeholder;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
updateValue(event) {
|
|
940
|
-
this.jsf.updateValue(this, event.target.value);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
MaterialInputComponent.decorators = [
|
|
944
|
-
{ type: Component, args: [{
|
|
945
|
-
// tslint:disable-next-line:component-selector
|
|
946
|
-
selector: 'material-input-widget',
|
|
947
|
-
template: `
|
|
948
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
|
|
949
|
-
[class]="options?.htmlClass || ''"
|
|
950
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
951
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
952
|
-
[style.width]="'100%'">
|
|
953
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
954
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
955
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
956
|
-
<input matInput *ngIf="boundControl"
|
|
957
|
-
[formControl]="formControl"
|
|
958
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
959
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
960
|
-
[attr.maxlength]="options?.maxLength"
|
|
961
|
-
[attr.minlength]="options?.minLength"
|
|
962
|
-
[attr.pattern]="options?.pattern"
|
|
963
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
964
|
-
[id]="'control' + layoutNode?._id"
|
|
965
|
-
[name]="controlName"
|
|
966
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
967
|
-
[required]="options?.required"
|
|
968
|
-
[style.width]="'100%'"
|
|
969
|
-
[type]="layoutNode?.type"
|
|
970
|
-
(blur)="options.showErrors = true">
|
|
971
|
-
<input matInput *ngIf="!boundControl"
|
|
972
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
973
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
974
|
-
[attr.maxlength]="options?.maxLength"
|
|
975
|
-
[attr.minlength]="options?.minLength"
|
|
976
|
-
[attr.pattern]="options?.pattern"
|
|
977
|
-
[disabled]="controlDisabled"
|
|
978
|
-
[id]="'control' + layoutNode?._id"
|
|
979
|
-
[name]="controlName"
|
|
980
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
981
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
982
|
-
[required]="options?.required"
|
|
983
|
-
[style.width]="'100%'"
|
|
984
|
-
[type]="layoutNode?.type"
|
|
985
|
-
[value]="controlValue"
|
|
986
|
-
(input)="updateValue($event)"
|
|
987
|
-
(blur)="options.showErrors = true">
|
|
988
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
989
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
990
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
991
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
992
|
-
<mat-autocomplete *ngIf="options?.typeahead?.source">
|
|
993
|
-
<mat-option *ngFor="let word of options?.typeahead?.source"
|
|
994
|
-
[value]="word">{{word}}</mat-option>
|
|
995
|
-
</mat-autocomplete>
|
|
996
|
-
</mat-form-field>
|
|
997
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
998
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
999
|
-
styles: [`
|
|
1000
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
1001
|
-
::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
|
|
1002
|
-
.mat-form-field-infix { width: initial; }
|
|
1003
|
-
`]
|
|
1004
|
-
},] }
|
|
1005
|
-
];
|
|
1006
|
-
MaterialInputComponent.ctorParameters = () => [
|
|
1007
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }, { type: Optional }] },
|
|
1008
|
-
{ type: JsonSchemaFormService }
|
|
1009
|
-
];
|
|
1010
|
-
MaterialInputComponent.propDecorators = {
|
|
1011
|
-
layoutNode: [{ type: Input }],
|
|
1012
|
-
layoutIndex: [{ type: Input }],
|
|
1013
|
-
dataIndex: [{ type: Input }]
|
|
1014
|
-
};
|
|
1015
|
-
|
|
1016
|
-
class MaterialNumberComponent {
|
|
1017
|
-
constructor(matFormFieldDefaultOptions, jsf) {
|
|
1018
|
-
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
1019
|
-
this.jsf = jsf;
|
|
1020
|
-
this.controlDisabled = false;
|
|
1021
|
-
this.boundControl = false;
|
|
1022
|
-
this.allowNegative = true;
|
|
1023
|
-
this.allowDecimal = true;
|
|
1024
|
-
this.allowExponents = false;
|
|
1025
|
-
this.lastValidNumber = '';
|
|
1026
|
-
}
|
|
1027
|
-
ngOnInit() {
|
|
1028
|
-
this.options = this.layoutNode.options || {};
|
|
1029
|
-
this.jsf.initializeControl(this);
|
|
1030
|
-
if (this.layoutNode.dataType === 'integer') {
|
|
1031
|
-
this.allowDecimal = false;
|
|
1032
|
-
}
|
|
1033
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
1034
|
-
this.options.description = this.options.placeholder;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
updateValue(event) {
|
|
1038
|
-
this.jsf.updateValue(this, event.target.value);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
MaterialNumberComponent.decorators = [
|
|
1042
|
-
{ type: Component, args: [{
|
|
1043
|
-
// tslint:disable-next-line:component-selector
|
|
1044
|
-
selector: 'material-number-widget',
|
|
1045
|
-
template: `
|
|
1046
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
|
|
1047
|
-
[class]="options?.htmlClass || ''"
|
|
1048
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
1049
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
1050
|
-
[style.width]="'100%'">
|
|
1051
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
1052
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
1053
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
1054
|
-
<input matInput *ngIf="boundControl"
|
|
1055
|
-
[formControl]="formControl"
|
|
1056
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1057
|
-
[attr.max]="options?.maximum"
|
|
1058
|
-
[attr.min]="options?.minimum"
|
|
1059
|
-
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
1060
|
-
[id]="'control' + layoutNode?._id"
|
|
1061
|
-
[name]="controlName"
|
|
1062
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1063
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
1064
|
-
[required]="options?.required"
|
|
1065
|
-
[style.width]="'100%'"
|
|
1066
|
-
[type]="'number'"
|
|
1067
|
-
(blur)="options.showErrors = true">
|
|
1068
|
-
<input matInput *ngIf="!boundControl"
|
|
1069
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1070
|
-
[attr.max]="options?.maximum"
|
|
1071
|
-
[attr.min]="options?.minimum"
|
|
1072
|
-
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
1073
|
-
[disabled]="controlDisabled"
|
|
1074
|
-
[id]="'control' + layoutNode?._id"
|
|
1075
|
-
[name]="controlName"
|
|
1076
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1077
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
1078
|
-
[required]="options?.required"
|
|
1079
|
-
[style.width]="'100%'"
|
|
1080
|
-
[type]="'number'"
|
|
1081
|
-
[value]="controlValue"
|
|
1082
|
-
(input)="updateValue($event)"
|
|
1083
|
-
(blur)="options.showErrors = true">
|
|
1084
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
1085
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
1086
|
-
<mat-hint *ngIf="layoutNode?.type === 'range'" align="start"
|
|
1087
|
-
[innerHTML]="controlValue"></mat-hint>
|
|
1088
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
1089
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
1090
|
-
</mat-form-field>
|
|
1091
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
1092
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
1093
|
-
styles: [`
|
|
1094
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
1095
|
-
::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
|
|
1096
|
-
.mat-form-field-infix { width: initial; }
|
|
1097
|
-
`]
|
|
1098
|
-
},] }
|
|
1099
|
-
];
|
|
1100
|
-
MaterialNumberComponent.ctorParameters = () => [
|
|
1101
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }, { type: Optional }] },
|
|
1102
|
-
{ type: JsonSchemaFormService }
|
|
1103
|
-
];
|
|
1104
|
-
MaterialNumberComponent.propDecorators = {
|
|
1105
|
-
layoutNode: [{ type: Input }],
|
|
1106
|
-
layoutIndex: [{ type: Input }],
|
|
1107
|
-
dataIndex: [{ type: Input }]
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1110
|
-
// TODO: Add this control
|
|
1111
|
-
class MaterialOneOfComponent {
|
|
1112
|
-
constructor(jsf) {
|
|
1113
|
-
this.jsf = jsf;
|
|
1114
|
-
this.controlDisabled = false;
|
|
1115
|
-
this.boundControl = false;
|
|
1116
|
-
}
|
|
1117
|
-
ngOnInit() {
|
|
1118
|
-
this.options = this.layoutNode.options || {};
|
|
1119
|
-
this.jsf.initializeControl(this);
|
|
1120
|
-
}
|
|
1121
|
-
updateValue(event) {
|
|
1122
|
-
this.jsf.updateValue(this, event.target.value);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
MaterialOneOfComponent.decorators = [
|
|
1126
|
-
{ type: Component, args: [{
|
|
1127
|
-
// tslint:disable-next-line:component-selector
|
|
1128
|
-
selector: 'material-one-of-widget',
|
|
1129
|
-
template: ``
|
|
1130
|
-
},] }
|
|
1131
|
-
];
|
|
1132
|
-
MaterialOneOfComponent.ctorParameters = () => [
|
|
1133
|
-
{ type: JsonSchemaFormService }
|
|
1134
|
-
];
|
|
1135
|
-
MaterialOneOfComponent.propDecorators = {
|
|
1136
|
-
layoutNode: [{ type: Input }],
|
|
1137
|
-
layoutIndex: [{ type: Input }],
|
|
1138
|
-
dataIndex: [{ type: Input }]
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
class MaterialRadiosComponent {
|
|
1142
|
-
constructor(jsf) {
|
|
1143
|
-
this.jsf = jsf;
|
|
1144
|
-
this.controlDisabled = false;
|
|
1145
|
-
this.boundControl = false;
|
|
1146
|
-
this.flexDirection = 'column';
|
|
1147
|
-
this.radiosList = [];
|
|
1148
|
-
}
|
|
1149
|
-
ngOnInit() {
|
|
1150
|
-
this.options = this.layoutNode.options || {};
|
|
1151
|
-
if (this.layoutNode.type === 'radios-inline') {
|
|
1152
|
-
this.flexDirection = 'row';
|
|
1153
|
-
}
|
|
1154
|
-
this.radiosList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true);
|
|
1155
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
1156
|
-
}
|
|
1157
|
-
updateValue(value) {
|
|
1158
|
-
this.options.showErrors = true;
|
|
1159
|
-
this.jsf.updateValue(this, value);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
MaterialRadiosComponent.decorators = [
|
|
1163
|
-
{ type: Component, args: [{
|
|
1164
|
-
// tslint:disable-next-line:component-selector
|
|
1165
|
-
selector: 'material-radios-widget',
|
|
1166
|
-
template: `
|
|
1167
|
-
<div>
|
|
1168
|
-
<div *ngIf="options?.title">
|
|
1169
|
-
<label
|
|
1170
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
1171
|
-
[class]="options?.labelHtmlClass || ''"
|
|
1172
|
-
[style.display]="options?.notitle ? 'none' : ''"
|
|
1173
|
-
[innerHTML]="options?.title"></label>
|
|
1174
|
-
</div>
|
|
1175
|
-
<mat-radio-group *ngIf="boundControl"
|
|
1176
|
-
[formControl]="formControl"
|
|
1177
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1178
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
1179
|
-
[attr.required]="options?.required"
|
|
1180
|
-
[style.flex-direction]="flexDirection"
|
|
1181
|
-
[name]="controlName"
|
|
1182
|
-
(blur)="options.showErrors = true">
|
|
1183
|
-
<mat-radio-button *ngFor="let radioItem of radiosList"
|
|
1184
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.name"
|
|
1185
|
-
[value]="radioItem?.value">
|
|
1186
|
-
<span [innerHTML]="radioItem?.name"></span>
|
|
1187
|
-
</mat-radio-button>
|
|
1188
|
-
</mat-radio-group>
|
|
1189
|
-
<mat-radio-group *ngIf="!boundControl"
|
|
1190
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1191
|
-
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
1192
|
-
[attr.required]="options?.required"
|
|
1193
|
-
[style.flex-direction]="flexDirection"
|
|
1194
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
1195
|
-
[name]="controlName"
|
|
1196
|
-
[value]="controlValue">
|
|
1197
|
-
<mat-radio-button *ngFor="let radioItem of radiosList"
|
|
1198
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.name"
|
|
1199
|
-
[value]="radioItem?.value"
|
|
1200
|
-
(click)="updateValue(radioItem?.value)">
|
|
1201
|
-
<span [innerHTML]="radioItem?.name"></span>
|
|
1202
|
-
</mat-radio-button>
|
|
1203
|
-
</mat-radio-group>
|
|
1204
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
1205
|
-
[innerHTML]="options?.errorMessage"></mat-error>
|
|
1206
|
-
</div>`,
|
|
1207
|
-
styles: [`
|
|
1208
|
-
mat-radio-group { display: inline-flex; }
|
|
1209
|
-
mat-radio-button { margin: 2px; }
|
|
1210
|
-
mat-error { font-size: 75%; }
|
|
1211
|
-
`]
|
|
1212
|
-
},] }
|
|
1213
|
-
];
|
|
1214
|
-
MaterialRadiosComponent.ctorParameters = () => [
|
|
1215
|
-
{ type: JsonSchemaFormService }
|
|
1216
|
-
];
|
|
1217
|
-
MaterialRadiosComponent.propDecorators = {
|
|
1218
|
-
layoutNode: [{ type: Input }],
|
|
1219
|
-
layoutIndex: [{ type: Input }],
|
|
1220
|
-
dataIndex: [{ type: Input }]
|
|
1221
|
-
};
|
|
1222
|
-
|
|
1223
|
-
class MaterialSelectComponent {
|
|
1224
|
-
constructor(matFormFieldDefaultOptions, jsf) {
|
|
1225
|
-
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
1226
|
-
this.jsf = jsf;
|
|
1227
|
-
this.controlDisabled = false;
|
|
1228
|
-
this.boundControl = false;
|
|
1229
|
-
this.selectList = [];
|
|
1230
|
-
this.isArray = isArray;
|
|
1231
|
-
}
|
|
1232
|
-
ngOnInit() {
|
|
1233
|
-
this.options = this.layoutNode.options || {};
|
|
1234
|
-
this.selectList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, !!this.options.flatList);
|
|
1235
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
1236
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
1237
|
-
this.options.description = this.options.placeholder;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
updateValue(event) {
|
|
1241
|
-
this.options.showErrors = true;
|
|
1242
|
-
this.jsf.updateValue(this, event.value);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
MaterialSelectComponent.decorators = [
|
|
1246
|
-
{ type: Component, args: [{
|
|
1247
|
-
// tslint:disable-next-line:component-selector
|
|
1248
|
-
selector: 'material-select-widget',
|
|
1249
|
-
template: `
|
|
1250
|
-
<mat-form-field
|
|
1251
|
-
[appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
|
|
1252
|
-
[class]="options?.htmlClass || ''"
|
|
1253
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
1254
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
1255
|
-
[style.width]="'100%'">
|
|
1256
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
1257
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
1258
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
1259
|
-
<mat-select *ngIf="boundControl"
|
|
1260
|
-
[formControl]="formControl"
|
|
1261
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1262
|
-
[attr.name]="controlName"
|
|
1263
|
-
[id]="'control' + layoutNode?._id"
|
|
1264
|
-
[multiple]="options?.multiple"
|
|
1265
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1266
|
-
[required]="options?.required"
|
|
1267
|
-
[style.width]="'100%'"
|
|
1268
|
-
(blur)="options.showErrors = true">
|
|
1269
|
-
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
1270
|
-
<mat-option *ngIf="!isArray(selectItem?.items)"
|
|
1271
|
-
[value]="selectItem?.value">
|
|
1272
|
-
<span [innerHTML]="selectItem?.name"></span>
|
|
1273
|
-
</mat-option>
|
|
1274
|
-
<mat-optgroup *ngIf="isArray(selectItem?.items)"
|
|
1275
|
-
[label]="selectItem?.group">
|
|
1276
|
-
<mat-option *ngFor="let subItem of selectItem.items"
|
|
1277
|
-
[value]="subItem?.value">
|
|
1278
|
-
<span [innerHTML]="subItem?.name"></span>
|
|
1279
|
-
</mat-option>
|
|
1280
|
-
</mat-optgroup>
|
|
1281
|
-
</ng-template>
|
|
1282
|
-
</mat-select>
|
|
1283
|
-
<mat-select *ngIf="!boundControl"
|
|
1284
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1285
|
-
[attr.name]="controlName"
|
|
1286
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
1287
|
-
[id]="'control' + layoutNode?._id"
|
|
1288
|
-
[multiple]="options?.multiple"
|
|
1289
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1290
|
-
[required]="options?.required"
|
|
1291
|
-
[style.width]="'100%'"
|
|
1292
|
-
[value]="controlValue"
|
|
1293
|
-
(blur)="options.showErrors = true"
|
|
1294
|
-
(change)="updateValue($event)">
|
|
1295
|
-
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
1296
|
-
<mat-option *ngIf="!isArray(selectItem?.items)"
|
|
1297
|
-
[attr.selected]="selectItem?.value === controlValue"
|
|
1298
|
-
[value]="selectItem?.value">
|
|
1299
|
-
<span [innerHTML]="selectItem?.name"></span>
|
|
1300
|
-
</mat-option>
|
|
1301
|
-
<mat-optgroup *ngIf="isArray(selectItem?.items)"
|
|
1302
|
-
[label]="selectItem?.group">
|
|
1303
|
-
<mat-option *ngFor="let subItem of selectItem.items"
|
|
1304
|
-
[attr.selected]="subItem?.value === controlValue"
|
|
1305
|
-
[value]="subItem?.value">
|
|
1306
|
-
<span [innerHTML]="subItem?.name"></span>
|
|
1307
|
-
</mat-option>
|
|
1308
|
-
</mat-optgroup>
|
|
1309
|
-
</ng-template>
|
|
1310
|
-
</mat-select>
|
|
1311
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
1312
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
1313
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
1314
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
1315
|
-
</mat-form-field>
|
|
1316
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
1317
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
1318
|
-
styles: [`
|
|
1319
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
1320
|
-
::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
|
|
1321
|
-
.mat-form-field-infix { width: initial; }
|
|
1322
|
-
`]
|
|
1323
|
-
},] }
|
|
1324
|
-
];
|
|
1325
|
-
MaterialSelectComponent.ctorParameters = () => [
|
|
1326
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }, { type: Optional }] },
|
|
1327
|
-
{ type: JsonSchemaFormService }
|
|
1328
|
-
];
|
|
1329
|
-
MaterialSelectComponent.propDecorators = {
|
|
1330
|
-
layoutNode: [{ type: Input }],
|
|
1331
|
-
layoutIndex: [{ type: Input }],
|
|
1332
|
-
dataIndex: [{ type: Input }]
|
|
1333
|
-
};
|
|
1334
|
-
|
|
1335
|
-
class MaterialSliderComponent {
|
|
1336
|
-
constructor(jsf) {
|
|
1337
|
-
this.jsf = jsf;
|
|
1338
|
-
this.controlDisabled = false;
|
|
1339
|
-
this.boundControl = false;
|
|
1340
|
-
this.allowNegative = true;
|
|
1341
|
-
this.allowDecimal = true;
|
|
1342
|
-
this.allowExponents = false;
|
|
1343
|
-
this.lastValidNumber = '';
|
|
1344
|
-
}
|
|
1345
|
-
ngOnInit() {
|
|
1346
|
-
this.options = this.layoutNode.options || {};
|
|
1347
|
-
this.jsf.initializeControl(this, !this.options.readonly);
|
|
1348
|
-
}
|
|
1349
|
-
updateValue(event) {
|
|
1350
|
-
this.options.showErrors = true;
|
|
1351
|
-
this.jsf.updateValue(this, event.value);
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
MaterialSliderComponent.decorators = [
|
|
1355
|
-
{ type: Component, args: [{
|
|
1356
|
-
// tslint:disable-next-line:component-selector
|
|
1357
|
-
selector: 'material-slider-widget',
|
|
1358
|
-
template: `
|
|
1359
|
-
<mat-slider thumbLabel *ngIf="boundControl"
|
|
1360
|
-
[formControl]="formControl"
|
|
1361
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1362
|
-
[id]="'control' + layoutNode?._id"
|
|
1363
|
-
[max]="options?.maximum"
|
|
1364
|
-
[min]="options?.minimum"
|
|
1365
|
-
[step]="options?.multipleOf || options?.step || 'any'"
|
|
1366
|
-
[style.width]="'100%'"
|
|
1367
|
-
(blur)="options.showErrors = true"></mat-slider>
|
|
1368
|
-
<mat-slider thumbLabel *ngIf="!boundControl"
|
|
1369
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1370
|
-
[disabled]="controlDisabled || options?.readonly"
|
|
1371
|
-
[id]="'control' + layoutNode?._id"
|
|
1372
|
-
[max]="options?.maximum"
|
|
1373
|
-
[min]="options?.minimum"
|
|
1374
|
-
[step]="options?.multipleOf || options?.step || 'any'"
|
|
1375
|
-
[style.width]="'100%'"
|
|
1376
|
-
[value]="controlValue"
|
|
1377
|
-
(blur)="options.showErrors = true"
|
|
1378
|
-
(change)="updateValue($event)"></mat-slider>
|
|
1379
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
1380
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
1381
|
-
styles: [` mat-error { font-size: 75%; } `]
|
|
1382
|
-
},] }
|
|
1383
|
-
];
|
|
1384
|
-
MaterialSliderComponent.ctorParameters = () => [
|
|
1385
|
-
{ type: JsonSchemaFormService }
|
|
1386
|
-
];
|
|
1387
|
-
MaterialSliderComponent.propDecorators = {
|
|
1388
|
-
layoutNode: [{ type: Input }],
|
|
1389
|
-
layoutIndex: [{ type: Input }],
|
|
1390
|
-
dataIndex: [{ type: Input }]
|
|
1391
|
-
};
|
|
1392
|
-
|
|
1393
|
-
// TODO: Add this control
|
|
1394
|
-
class MaterialStepperComponent {
|
|
1395
|
-
constructor(jsf) {
|
|
1396
|
-
this.jsf = jsf;
|
|
1397
|
-
this.controlDisabled = false;
|
|
1398
|
-
this.boundControl = false;
|
|
1399
|
-
}
|
|
1400
|
-
ngOnInit() {
|
|
1401
|
-
this.options = this.layoutNode.options || {};
|
|
1402
|
-
this.jsf.initializeControl(this);
|
|
1403
|
-
}
|
|
1404
|
-
updateValue(event) {
|
|
1405
|
-
this.jsf.updateValue(this, event.target.value);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
MaterialStepperComponent.decorators = [
|
|
1409
|
-
{ type: Component, args: [{
|
|
1410
|
-
// tslint:disable-next-line:component-selector
|
|
1411
|
-
selector: 'material-stepper-widget',
|
|
1412
|
-
template: ``
|
|
1413
|
-
},] }
|
|
1414
|
-
];
|
|
1415
|
-
MaterialStepperComponent.ctorParameters = () => [
|
|
1416
|
-
{ type: JsonSchemaFormService }
|
|
1417
|
-
];
|
|
1418
|
-
MaterialStepperComponent.propDecorators = {
|
|
1419
|
-
layoutNode: [{ type: Input }],
|
|
1420
|
-
layoutIndex: [{ type: Input }],
|
|
1421
|
-
dataIndex: [{ type: Input }]
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
class MaterialTabsComponent {
|
|
1425
|
-
constructor(jsf) {
|
|
1426
|
-
this.jsf = jsf;
|
|
1427
|
-
this.selectedItem = 0;
|
|
1428
|
-
this.showAddTab = true;
|
|
1429
|
-
}
|
|
1430
|
-
ngOnInit() {
|
|
1431
|
-
this.options = this.layoutNode.options || {};
|
|
1432
|
-
this.itemCount = this.layoutNode.items.length - 1;
|
|
1433
|
-
this.updateControl();
|
|
1434
|
-
}
|
|
1435
|
-
select(index) {
|
|
1436
|
-
if (this.layoutNode.items[index].type === '$ref') {
|
|
1437
|
-
this.jsf.addItem({
|
|
1438
|
-
layoutNode: this.layoutNode.items[index],
|
|
1439
|
-
layoutIndex: this.layoutIndex.concat(index),
|
|
1440
|
-
dataIndex: this.dataIndex.concat(index)
|
|
1441
|
-
});
|
|
1442
|
-
this.updateControl();
|
|
1443
|
-
}
|
|
1444
|
-
this.selectedItem = index;
|
|
1445
|
-
}
|
|
1446
|
-
updateControl() {
|
|
1447
|
-
this.itemCount = this.layoutNode.items.length - 1;
|
|
1448
|
-
const lastItem = this.layoutNode.items[this.layoutNode.items.length - 1];
|
|
1449
|
-
this.showAddTab = lastItem.type === '$ref' &&
|
|
1450
|
-
this.itemCount < (lastItem.options.maxItems || 1000);
|
|
1451
|
-
}
|
|
1452
|
-
setTabTitle(item, index) {
|
|
1453
|
-
return this.jsf.setArrayItemTitle(this, item, index);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
MaterialTabsComponent.decorators = [
|
|
1457
|
-
{ type: Component, args: [{
|
|
1458
|
-
// tslint:disable-next-line:component-selector
|
|
1459
|
-
selector: 'material-tabs-widget',
|
|
1460
|
-
template: `
|
|
1461
|
-
<nav mat-tab-nav-bar
|
|
1462
|
-
[attr.aria-label]="options?.label || options?.title || ''"
|
|
1463
|
-
[style.width]="'100%'">
|
|
1464
|
-
<a mat-tab-link *ngFor="let item of layoutNode?.items; let i = index"
|
|
1465
|
-
[active]="selectedItem === i"
|
|
1466
|
-
(click)="select(i)">
|
|
1467
|
-
<span *ngIf="showAddTab || item.type !== '$ref'"
|
|
1468
|
-
[innerHTML]="setTabTitle(item, i)"></span>
|
|
1469
|
-
</a>
|
|
1470
|
-
</nav>
|
|
1471
|
-
<div *ngFor="let layoutItem of layoutNode?.items; let i = index"
|
|
1472
|
-
[class]="options?.htmlClass || ''">
|
|
1473
|
-
<select-framework-widget *ngIf="selectedItem === i"
|
|
1474
|
-
[class]="(options?.fieldHtmlClass || '') + ' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')"
|
|
1475
|
-
[dataIndex]="layoutNode?.dataType === 'array' ? (dataIndex || []).concat(i) : dataIndex"
|
|
1476
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
1477
|
-
[layoutNode]="layoutItem"></select-framework-widget>
|
|
1478
|
-
</div>`,
|
|
1479
|
-
styles: [` a { cursor: pointer; } `]
|
|
1480
|
-
},] }
|
|
1481
|
-
];
|
|
1482
|
-
MaterialTabsComponent.ctorParameters = () => [
|
|
1483
|
-
{ type: JsonSchemaFormService }
|
|
1484
|
-
];
|
|
1485
|
-
MaterialTabsComponent.propDecorators = {
|
|
1486
|
-
layoutNode: [{ type: Input }],
|
|
1487
|
-
layoutIndex: [{ type: Input }],
|
|
1488
|
-
dataIndex: [{ type: Input }]
|
|
1489
|
-
};
|
|
1490
|
-
|
|
1491
|
-
class MaterialTextareaComponent {
|
|
1492
|
-
constructor(matFormFieldDefaultOptions, jsf) {
|
|
1493
|
-
this.matFormFieldDefaultOptions = matFormFieldDefaultOptions;
|
|
1494
|
-
this.jsf = jsf;
|
|
1495
|
-
this.controlDisabled = false;
|
|
1496
|
-
this.boundControl = false;
|
|
1497
|
-
}
|
|
1498
|
-
ngOnInit() {
|
|
1499
|
-
this.options = this.layoutNode.options || {};
|
|
1500
|
-
this.jsf.initializeControl(this);
|
|
1501
|
-
if (!this.options.notitle && !this.options.description && this.options.placeholder) {
|
|
1502
|
-
this.options.description = this.options.placeholder;
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
updateValue(event) {
|
|
1506
|
-
this.jsf.updateValue(this, event.target.value);
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
MaterialTextareaComponent.decorators = [
|
|
1510
|
-
{ type: Component, args: [{
|
|
1511
|
-
// tslint:disable-next-line:component-selector
|
|
1512
|
-
selector: 'material-textarea-widget',
|
|
1513
|
-
template: `
|
|
1514
|
-
<mat-form-field [appearance]="options?.appearance || matFormFieldDefaultOptions?.appearance || 'standard'"
|
|
1515
|
-
[class]="options?.htmlClass || ''"
|
|
1516
|
-
[floatLabel]="options?.floatLabel || matFormFieldDefaultOptions?.floatLabel || (options?.notitle ? 'never' : 'auto')"
|
|
1517
|
-
[hideRequiredMarker]="options?.hideRequired ? 'true' : 'false'"
|
|
1518
|
-
[style.width]="'100%'">
|
|
1519
|
-
<mat-label *ngIf="!options?.notitle">{{options?.title}}</mat-label>
|
|
1520
|
-
<span matPrefix *ngIf="options?.prefix || options?.fieldAddonLeft"
|
|
1521
|
-
[innerHTML]="options?.prefix || options?.fieldAddonLeft"></span>
|
|
1522
|
-
<textarea matInput *ngIf="boundControl"
|
|
1523
|
-
[formControl]="formControl"
|
|
1524
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1525
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
1526
|
-
[attr.maxlength]="options?.maxLength"
|
|
1527
|
-
[attr.minlength]="options?.minLength"
|
|
1528
|
-
[attr.pattern]="options?.pattern"
|
|
1529
|
-
[required]="options?.required"
|
|
1530
|
-
[id]="'control' + layoutNode?._id"
|
|
1531
|
-
[name]="controlName"
|
|
1532
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1533
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
1534
|
-
[style.width]="'100%'"
|
|
1535
|
-
(blur)="options.showErrors = true"></textarea>
|
|
1536
|
-
<textarea matInput *ngIf="!boundControl"
|
|
1537
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
1538
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
1539
|
-
[attr.maxlength]="options?.maxLength"
|
|
1540
|
-
[attr.minlength]="options?.minLength"
|
|
1541
|
-
[attr.pattern]="options?.pattern"
|
|
1542
|
-
[required]="options?.required"
|
|
1543
|
-
[disabled]="controlDisabled"
|
|
1544
|
-
[id]="'control' + layoutNode?._id"
|
|
1545
|
-
[name]="controlName"
|
|
1546
|
-
[placeholder]="options?.notitle ? options?.placeholder : options?.title"
|
|
1547
|
-
[readonly]="options?.readonly ? 'readonly' : null"
|
|
1548
|
-
[style.width]="'100%'"
|
|
1549
|
-
[value]="controlValue"
|
|
1550
|
-
(input)="updateValue($event)"
|
|
1551
|
-
(blur)="options.showErrors = true"></textarea>
|
|
1552
|
-
<span matSuffix *ngIf="options?.suffix || options?.fieldAddonRight"
|
|
1553
|
-
[innerHTML]="options?.suffix || options?.fieldAddonRight"></span>
|
|
1554
|
-
<mat-hint *ngIf="options?.description && (!options?.showErrors || !options?.errorMessage)"
|
|
1555
|
-
align="end" [innerHTML]="options?.description"></mat-hint>
|
|
1556
|
-
</mat-form-field>
|
|
1557
|
-
<mat-error *ngIf="options?.showErrors && options?.errorMessage"
|
|
1558
|
-
[innerHTML]="options?.errorMessage"></mat-error>`,
|
|
1559
|
-
styles: [`
|
|
1560
|
-
mat-error { font-size: 75%; margin-top: -1rem; margin-bottom: 0.5rem; }
|
|
1561
|
-
::ng-deep json-schema-form mat-form-field .mat-form-field-wrapper .mat-form-field-flex
|
|
1562
|
-
.mat-form-field-infix { width: initial; }
|
|
1563
|
-
`]
|
|
1564
|
-
},] }
|
|
1565
|
-
];
|
|
1566
|
-
MaterialTextareaComponent.ctorParameters = () => [
|
|
1567
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }, { type: Optional }] },
|
|
1568
|
-
{ type: JsonSchemaFormService }
|
|
1569
|
-
];
|
|
1570
|
-
MaterialTextareaComponent.propDecorators = {
|
|
1571
|
-
layoutNode: [{ type: Input }],
|
|
1572
|
-
layoutIndex: [{ type: Input }],
|
|
1573
|
-
dataIndex: [{ type: Input }]
|
|
1574
|
-
};
|
|
1575
|
-
|
|
1576
|
-
const MATERIAL_FRAMEWORK_COMPONENTS = [
|
|
1577
|
-
FlexLayoutRootComponent, FlexLayoutSectionComponent,
|
|
1578
|
-
MaterialAddReferenceComponent, MaterialOneOfComponent,
|
|
1579
|
-
MaterialButtonComponent, MaterialButtonGroupComponent,
|
|
1580
|
-
MaterialCheckboxComponent, MaterialCheckboxesComponent,
|
|
1581
|
-
MaterialChipListComponent, MaterialDatepickerComponent,
|
|
1582
|
-
MaterialFileComponent, MaterialInputComponent, MaterialNumberComponent,
|
|
1583
|
-
MaterialRadiosComponent, MaterialSelectComponent, MaterialSliderComponent,
|
|
1584
|
-
MaterialStepperComponent, MaterialTabsComponent, MaterialTextareaComponent,
|
|
1585
|
-
MaterialDesignFrameworkComponent
|
|
1586
|
-
];
|
|
1587
|
-
|
|
1588
|
-
// Material Design Framework
|
|
1589
|
-
// https://github.com/angular/material2
|
|
1590
|
-
class MaterialDesignFramework extends Framework {
|
|
1591
|
-
constructor() {
|
|
1592
|
-
super(...arguments);
|
|
1593
|
-
this.name = 'material-design';
|
|
1594
|
-
this.framework = MaterialDesignFrameworkComponent;
|
|
1595
|
-
this.stylesheets = [
|
|
1596
|
-
'//fonts.googleapis.com/icon?family=Material+Icons',
|
|
1597
|
-
'//fonts.googleapis.com/css?family=Roboto:300,400,500,700',
|
|
1598
|
-
];
|
|
1599
|
-
this.widgets = {
|
|
1600
|
-
'root': FlexLayoutRootComponent,
|
|
1601
|
-
'section': FlexLayoutSectionComponent,
|
|
1602
|
-
'$ref': MaterialAddReferenceComponent,
|
|
1603
|
-
'button': MaterialButtonComponent,
|
|
1604
|
-
'button-group': MaterialButtonGroupComponent,
|
|
1605
|
-
'checkbox': MaterialCheckboxComponent,
|
|
1606
|
-
'checkboxes': MaterialCheckboxesComponent,
|
|
1607
|
-
'chip-list': MaterialChipListComponent,
|
|
1608
|
-
'date': MaterialDatepickerComponent,
|
|
1609
|
-
'file': MaterialFileComponent,
|
|
1610
|
-
'number': MaterialNumberComponent,
|
|
1611
|
-
'one-of': MaterialOneOfComponent,
|
|
1612
|
-
'radios': MaterialRadiosComponent,
|
|
1613
|
-
'select': MaterialSelectComponent,
|
|
1614
|
-
'slider': MaterialSliderComponent,
|
|
1615
|
-
'stepper': MaterialStepperComponent,
|
|
1616
|
-
'tabs': MaterialTabsComponent,
|
|
1617
|
-
'text': MaterialInputComponent,
|
|
1618
|
-
'textarea': MaterialTextareaComponent,
|
|
1619
|
-
'alt-date': 'date',
|
|
1620
|
-
'any-of': 'one-of',
|
|
1621
|
-
'card': 'section',
|
|
1622
|
-
'color': 'text',
|
|
1623
|
-
'expansion-panel': 'section',
|
|
1624
|
-
'hidden': 'none',
|
|
1625
|
-
'image': 'none',
|
|
1626
|
-
'integer': 'number',
|
|
1627
|
-
'radiobuttons': 'button-group',
|
|
1628
|
-
'range': 'slider',
|
|
1629
|
-
'submit': 'button',
|
|
1630
|
-
'tagsinput': 'chip-list',
|
|
1631
|
-
'wizard': 'stepper',
|
|
1632
|
-
};
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
MaterialDesignFramework.decorators = [
|
|
1636
|
-
{ type: Injectable }
|
|
1637
|
-
];
|
|
1638
|
-
|
|
1639
|
-
function fixAngularFlex() {
|
|
1640
|
-
// monkey patch based on errors in console - https://github.com/angular/flex-layout/issues/1011
|
|
1641
|
-
const MediaMarshallerUpdateElement = MediaMarshaller.prototype.updateElement;
|
|
1642
|
-
MediaMarshaller.prototype.updateElement = function (element, key, value) {
|
|
1643
|
-
if (key === 'layout-gap' && (value === null || value === undefined)) {
|
|
1644
|
-
value = '0px';
|
|
1645
|
-
}
|
|
1646
|
-
MediaMarshallerUpdateElement.apply(this, [element, key, value]);
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
/**
|
|
1651
|
-
* unused @angular/material modules:
|
|
1652
|
-
* MatDialogModule, MatGridListModule, MatListModule, MatMenuModule,
|
|
1653
|
-
* MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule,
|
|
1654
|
-
* MatSidenavModule, MatSnackBarModule, MatSortModule, MatTableModule,
|
|
1655
|
-
* ,
|
|
1656
|
-
*/
|
|
1657
|
-
const ANGULAR_MATERIAL_MODULES = [
|
|
1658
|
-
MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule,
|
|
1659
|
-
MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatExpansionModule,
|
|
1660
|
-
MatFormFieldModule, MatIconModule, MatInputModule, MatNativeDateModule,
|
|
1661
|
-
MatRadioModule, MatSelectModule, MatSliderModule, MatSlideToggleModule,
|
|
1662
|
-
MatStepperModule, MatTabsModule, MatTooltipModule,
|
|
1663
|
-
MatToolbarModule, MatMenuModule, MatToolbarModule,
|
|
1664
|
-
];
|
|
1665
|
-
class MaterialDesignFrameworkModule {
|
|
1666
|
-
constructor() {
|
|
1667
|
-
fixAngularFlex();
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
MaterialDesignFrameworkModule.decorators = [
|
|
1671
|
-
{ type: NgModule, args: [{
|
|
1672
|
-
imports: [
|
|
1673
|
-
CommonModule,
|
|
1674
|
-
FormsModule,
|
|
1675
|
-
ReactiveFormsModule,
|
|
1676
|
-
FlexLayoutModule,
|
|
1677
|
-
...ANGULAR_MATERIAL_MODULES,
|
|
1678
|
-
WidgetLibraryModule,
|
|
1679
|
-
JsonSchemaFormModule,
|
|
1680
|
-
],
|
|
1681
|
-
declarations: [
|
|
1682
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
1683
|
-
],
|
|
1684
|
-
exports: [
|
|
1685
|
-
JsonSchemaFormModule,
|
|
1686
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
1687
|
-
],
|
|
1688
|
-
providers: [
|
|
1689
|
-
JsonSchemaFormService,
|
|
1690
|
-
FrameworkLibraryService,
|
|
1691
|
-
WidgetLibraryService,
|
|
1692
|
-
{ provide: Framework, useClass: MaterialDesignFramework, multi: true },
|
|
1693
|
-
],
|
|
1694
|
-
entryComponents: [
|
|
1695
|
-
...MATERIAL_FRAMEWORK_COMPONENTS,
|
|
1696
|
-
]
|
|
1697
|
-
},] }
|
|
1698
|
-
];
|
|
1699
|
-
MaterialDesignFrameworkModule.ctorParameters = () => [];
|
|
1700
|
-
|
|
1701
|
-
/*
|
|
1702
|
-
* Public API Surface of @ajsf/material-framework
|
|
1703
|
-
*/
|
|
1704
|
-
|
|
1705
|
-
/**
|
|
1706
|
-
* Generated bundle index. Do not edit.
|
|
1707
|
-
*/
|
|
1708
|
-
|
|
1709
|
-
export { ANGULAR_MATERIAL_MODULES, FlexLayoutRootComponent, FlexLayoutSectionComponent, MATERIAL_FRAMEWORK_COMPONENTS, MaterialAddReferenceComponent, MaterialButtonComponent, MaterialButtonGroupComponent, MaterialCheckboxComponent, MaterialCheckboxesComponent, MaterialChipListComponent, MaterialDatepickerComponent, MaterialDesignFramework, MaterialDesignFrameworkComponent, MaterialDesignFrameworkModule, MaterialFileComponent, MaterialInputComponent, MaterialNumberComponent, MaterialOneOfComponent, MaterialRadiosComponent, MaterialSelectComponent, MaterialSliderComponent, MaterialStepperComponent, MaterialTabsComponent, MaterialTextareaComponent };
|
|
1710
|
-
//# sourceMappingURL=ajsf-material.js.map
|