ichec-angular-core 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ichec-angular-core.mjs +100 -31
- package/fesm2022/ichec-angular-core.mjs.map +1 -1
- package/index.d.ts +15 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { map, catchError, tap, mergeMap, throwError, BehaviorSubject,
|
|
1
|
+
import { map, catchError, tap, mergeMap, throwError, BehaviorSubject, of, mergeAll, merge, debounceTime, distinctUntilChanged, Subscription, finalize } from 'rxjs';
|
|
2
2
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, inject, Injectable, signal, input, Component, viewChild, computed, output } from '@angular/core';
|
|
4
|
+
import { InjectionToken, inject, DOCUMENT, Injectable, signal, input, Component, viewChild, computed, output } from '@angular/core';
|
|
5
5
|
import * as i1$3 from '@angular/forms';
|
|
6
6
|
import { FormControl, Validators, FormGroup, FormsModule, ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
|
7
7
|
import * as i1 from '@angular/router';
|
|
@@ -156,13 +156,16 @@ function getFieldTypeFromKey(key) {
|
|
|
156
156
|
return FieldType.Char;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const
|
|
159
|
+
const REST_SERVICE_CONFIG = new InjectionToken("Config for the rest service");
|
|
160
160
|
class RestService {
|
|
161
161
|
_url = "";
|
|
162
|
-
|
|
162
|
+
config = inject(REST_SERVICE_CONFIG);
|
|
163
163
|
_http = inject(HttpClient);
|
|
164
164
|
deleteItem(id) {
|
|
165
|
-
return this._http.delete(this.getBaseUrl() + id + "/", {
|
|
165
|
+
return this._http.delete(this.getBaseUrl() + id + "/", {
|
|
166
|
+
headers: this.getHeaders(),
|
|
167
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
168
|
+
}).pipe(map(_response => { return void (0); }), catchError(this.handleError));
|
|
166
169
|
}
|
|
167
170
|
getForUser(user, query = new ItemQuery()) {
|
|
168
171
|
query.queries.set('user', user.id.toString());
|
|
@@ -192,23 +195,40 @@ class RestService {
|
|
|
192
195
|
console.log(params);
|
|
193
196
|
return this._http.get(this.getBaseUrl(), {
|
|
194
197
|
headers: this.getHeaders(),
|
|
198
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin',
|
|
195
199
|
params: new HttpParams({ fromObject: Object.fromEntries(params) })
|
|
196
200
|
}).pipe(tap(response => console.log(response)), catchError(this.handleError));
|
|
197
201
|
}
|
|
198
202
|
getItem(id) {
|
|
199
|
-
return this._http.get(this.getBaseUrl() + id, {
|
|
203
|
+
return this._http.get(this.getBaseUrl() + id, {
|
|
204
|
+
headers: this.getHeaders(),
|
|
205
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
206
|
+
}).pipe(catchError(this.handleError));
|
|
200
207
|
}
|
|
201
208
|
getUrl(url) {
|
|
202
|
-
|
|
209
|
+
console.log(this.config.allow_cross_origin ? 'include' : 'same-origin');
|
|
210
|
+
return this._http.get(url, {
|
|
211
|
+
headers: this.getHeaders(),
|
|
212
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
213
|
+
}).pipe(catchError(this.handleError));
|
|
203
214
|
}
|
|
204
215
|
getPaginatedUrl(url) {
|
|
205
|
-
return this._http.get(url, {
|
|
216
|
+
return this._http.get(url, {
|
|
217
|
+
headers: this.getHeaders(),
|
|
218
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
219
|
+
}).pipe(catchError(this.handleError));
|
|
206
220
|
}
|
|
207
221
|
getOptions() {
|
|
208
|
-
return this._http.options(this.getBaseUrl(), {
|
|
222
|
+
return this._http.options(this.getBaseUrl(), {
|
|
223
|
+
headers: this.getHeaders(),
|
|
224
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
225
|
+
}).pipe(catchError(this.handleError));
|
|
209
226
|
}
|
|
210
227
|
putItem(item, content_type = "application/json") {
|
|
211
|
-
return this._http.put(this.getBaseUrl() + item.id + "/", item, {
|
|
228
|
+
return this._http.put(this.getBaseUrl() + item.id + "/", item, {
|
|
229
|
+
headers: this.getHeaders(content_type),
|
|
230
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
231
|
+
}).pipe(catchError(this.handleError));
|
|
212
232
|
}
|
|
213
233
|
patchItemMedia(id, form) {
|
|
214
234
|
const token = "Token " + localStorage.getItem("api_token");
|
|
@@ -216,7 +236,10 @@ class RestService {
|
|
|
216
236
|
'Authorization': token,
|
|
217
237
|
'Accept': 'application/json'
|
|
218
238
|
});
|
|
219
|
-
return this._http.patch(this.getMediaUrl() + id + "/", form, {
|
|
239
|
+
return this._http.patch(this.getMediaUrl() + id + "/", form, {
|
|
240
|
+
headers: headers,
|
|
241
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
242
|
+
}).pipe(mergeMap(_ => this.getItem(id)), catchError(this.handleError));
|
|
220
243
|
}
|
|
221
244
|
postFile(id, field, file) {
|
|
222
245
|
const token = "Token " + localStorage.getItem("api_token");
|
|
@@ -226,7 +249,10 @@ class RestService {
|
|
|
226
249
|
});
|
|
227
250
|
const form = new FormData();
|
|
228
251
|
form.append("file", file);
|
|
229
|
-
return this._http.post(this.getBaseUrl() + id + "/" + field + "/upload", form, {
|
|
252
|
+
return this._http.post(this.getBaseUrl() + id + "/" + field + "/upload", form, {
|
|
253
|
+
headers: headers,
|
|
254
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
255
|
+
}).pipe(mergeMap(_ => this.getItem(id)), catchError(this.handleError));
|
|
230
256
|
}
|
|
231
257
|
putFile(id, field, file) {
|
|
232
258
|
const token = "Token " + localStorage.getItem("api_token");
|
|
@@ -235,7 +261,10 @@ class RestService {
|
|
|
235
261
|
'Accept': 'application/json',
|
|
236
262
|
'Content-Disposition': 'attachment; filename=' + file.name
|
|
237
263
|
});
|
|
238
|
-
return this._http.put(this.getBaseUrl() + id + "/" + field + "/upload", file, {
|
|
264
|
+
return this._http.put(this.getBaseUrl() + id + "/" + field + "/upload", file, {
|
|
265
|
+
headers: headers,
|
|
266
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
267
|
+
}).pipe(mergeMap(_ => this.getItem(id)), catchError(this.handleError));
|
|
239
268
|
}
|
|
240
269
|
putFileStandalone(url, file) {
|
|
241
270
|
const token = "Token " + localStorage.getItem("api_token");
|
|
@@ -244,7 +273,10 @@ class RestService {
|
|
|
244
273
|
'Accept': 'application/json',
|
|
245
274
|
'Content-Disposition': 'attachment; filename=' + file.name
|
|
246
275
|
});
|
|
247
|
-
return this._http.put(this.
|
|
276
|
+
return this._http.put(this.config.endpoint_url + "/api/" + url + "/upload", file, {
|
|
277
|
+
headers: headers,
|
|
278
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
279
|
+
}).pipe(map(_response => { return void (0); }), catchError(this.handleError));
|
|
248
280
|
}
|
|
249
281
|
patchItem(item, include_keys, exclude_keys) {
|
|
250
282
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -256,24 +288,37 @@ class RestService {
|
|
|
256
288
|
return value;
|
|
257
289
|
}
|
|
258
290
|
}
|
|
259
|
-
return this._http.patch(this.getBaseUrl() + item.id + "/", JSON.stringify(item, replacer), {
|
|
291
|
+
return this._http.patch(this.getBaseUrl() + item.id + "/", JSON.stringify(item, replacer), {
|
|
292
|
+
headers: this.getHeaders(),
|
|
293
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
294
|
+
}).pipe(map(response => response), catchError(this.handleError));
|
|
260
295
|
}
|
|
261
296
|
postItem(item) {
|
|
262
|
-
return this._http.post(this.getBaseUrl(), item, {
|
|
297
|
+
return this._http.post(this.getBaseUrl(), item, {
|
|
298
|
+
headers: this.getHeaders(),
|
|
299
|
+
credentials: this.config.allow_cross_origin ? 'include' : 'same-origin'
|
|
300
|
+
}).pipe(catchError(this.handleError));
|
|
263
301
|
}
|
|
264
302
|
getHeaders(content_type = "application/json") {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
303
|
+
if (this.config.auth_type === "token") {
|
|
304
|
+
return new HttpHeaders({
|
|
305
|
+
'Authorization': "Token " + localStorage.getItem("api_token"),
|
|
306
|
+
'Content-Type': content_type,
|
|
307
|
+
'Accept': 'application/json'
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
return new HttpHeaders({
|
|
312
|
+
'Content-Type': content_type,
|
|
313
|
+
'Accept': 'application/json'
|
|
314
|
+
});
|
|
315
|
+
}
|
|
271
316
|
}
|
|
272
317
|
getBaseUrl() {
|
|
273
|
-
return this.
|
|
318
|
+
return this.config.endpoint_url + "/api/" + this._url + "/";
|
|
274
319
|
}
|
|
275
320
|
getMediaUrl() {
|
|
276
|
-
return this.
|
|
321
|
+
return this.config.endpoint_url + "/api/" + this._url.slice(0, -1) + "_media/";
|
|
277
322
|
}
|
|
278
323
|
handleError(error) {
|
|
279
324
|
if (error.status === 0) {
|
|
@@ -319,17 +364,38 @@ class UserService extends ItemService {
|
|
|
319
364
|
Service to handle IPortalMember via REST and also handle logins.
|
|
320
365
|
*/
|
|
321
366
|
loggedInUser = new BehaviorSubject(null);
|
|
367
|
+
document = inject(DOCUMENT);
|
|
322
368
|
_url = PortalMember.plural;
|
|
323
369
|
typename = PortalMember.typename;
|
|
324
370
|
permissions = new Map();
|
|
371
|
+
get authType() {
|
|
372
|
+
return this.config.auth_type;
|
|
373
|
+
}
|
|
374
|
+
sessionLogin() {
|
|
375
|
+
console.log("Attempting session login");
|
|
376
|
+
return this.getUrl(this.config.endpoint_url + "/api/self/").pipe(tap(user => this.onLoggedIn(user)), map(_response => { return void (0); }), catchError(e => this.onSessionLoginError(e)));
|
|
377
|
+
}
|
|
378
|
+
onSessionLoginError(error) {
|
|
379
|
+
console.log("session login error");
|
|
380
|
+
if (error.status == 401) {
|
|
381
|
+
console.log("Couldn't authenticate - redirect to portal login", error);
|
|
382
|
+
// Redirect to portal login url
|
|
383
|
+
// this.document.location.href = this.config.endpoint_url + "/api-auth/login/?next=/";
|
|
384
|
+
this.document.location.href = this.config.endpoint_url + "/oidc/authenticate/?next=/";
|
|
385
|
+
return of(void 0);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
console.log("Session login error", error);
|
|
389
|
+
return throwError(() => error);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
325
392
|
login(username, password) {
|
|
326
|
-
console.log("Attempting login");
|
|
393
|
+
console.log("Attempting token login");
|
|
327
394
|
const body = new URLSearchParams();
|
|
328
395
|
body.set('username', username);
|
|
329
396
|
body.set('password', password);
|
|
330
397
|
const headers = new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' });
|
|
331
|
-
|
|
332
|
-
return this._http.post(api_auth_endpoint, body.toString(), { headers: headers }).pipe(map(token => this.onLoginToken(token)), mergeAll(), catchError(this.handleError));
|
|
398
|
+
return this._http.post(this.config.endpoint_url + "/api-token-auth/", body.toString(), { headers: headers }).pipe(map(token => this.onLoginToken(token)), mergeAll(), catchError(this.handleError));
|
|
333
399
|
}
|
|
334
400
|
hasAddPermission(feature) {
|
|
335
401
|
const perm = this.permissions.get(feature);
|
|
@@ -367,6 +433,10 @@ class UserService extends ItemService {
|
|
|
367
433
|
localStorage.removeItem("api_token");
|
|
368
434
|
this.loggedInUser.next(null);
|
|
369
435
|
}
|
|
436
|
+
onLoginCookie() {
|
|
437
|
+
console.log("Got login cookie - fetching corresponding user.");
|
|
438
|
+
return this.getUrl(this.getBaseUrl() + "self").pipe(tap(user => this.onLoggedIn(user)), map(_response => { return void (0); }), catchError(this.handleError));
|
|
439
|
+
}
|
|
370
440
|
onLoginToken(token_response) {
|
|
371
441
|
console.log("Got login token - fetching corresponding user.");
|
|
372
442
|
localStorage.setItem("api_token", token_response.token);
|
|
@@ -403,7 +473,6 @@ class UserService extends ItemService {
|
|
|
403
473
|
this.permissions.get(permission.feature).canAdd = true;
|
|
404
474
|
}
|
|
405
475
|
});
|
|
406
|
-
console.log("Got permissions:", this.permissions);
|
|
407
476
|
}
|
|
408
477
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.1", ngImport: i0, type: UserService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
409
478
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.1", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
@@ -1084,7 +1153,7 @@ class FormFieldDetailComponent {
|
|
|
1084
1153
|
return this.form().get(this.key);
|
|
1085
1154
|
}
|
|
1086
1155
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.1", ngImport: i0, type: FormFieldDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1087
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.1", type: FormFieldDetailComponent, isStandalone: true, selector: "lib-form-field-detail", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div [formGroup]=\"form()\">\n <h3>{{ field().label }}</h3>\n <p>{{field().description}}</p>\n <div>\n @switch (field().field_type) {\n @case ('TEXT') {\n <mat-form-field class=\"form-field-wide\">\n <mat-label [attr.for]=\"key\">{{ field().label }}</mat-label>\n <textarea matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n style=\"min-height:150px\"\n [formControlName]=\"key\"\n [name]=\"key\"></textarea>\n </mat-form-field>\n }\n @case('BOOLEAN')\n {\n <mat-checkbox\n class=\"form-field\"\n [name]=\"key\"\n [formControlName]=\"key\">\n {{ field().label }}\n </mat-checkbox>\n }\n @case ('INTEGER') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"number\"\n max=\"10\" min=\"1\"\n [formControlName]=\"key\"\n name=\"trl_stage\">\n </mat-form-field>\n }\n @case ('
|
|
1156
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.1", type: FormFieldDetailComponent, isStandalone: true, selector: "lib-form-field-detail", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div [formGroup]=\"form()\">\n <h3>{{ field().label }}</h3>\n <p>{{field().description}}</p>\n <div>\n @switch (field().field_type) {\n @case ('TEXT') {\n <mat-form-field class=\"form-field-wide\">\n <mat-label [attr.for]=\"key\">{{ field().label }}</mat-label>\n <textarea matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n style=\"min-height:150px\"\n [formControlName]=\"key\"\n [name]=\"key\"></textarea>\n </mat-form-field>\n }\n @case('BOOLEAN')\n {\n <mat-checkbox\n class=\"form-field\"\n [name]=\"key\"\n [formControlName]=\"key\">\n {{ field().label }}\n </mat-checkbox>\n }\n @case ('INTEGER') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"number\"\n max=\"10\" min=\"1\"\n [formControlName]=\"key\"\n name=\"trl_stage\">\n </mat-form-field>\n }\n @case ('CHAR') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n [formControlName]=\"key\"\n name=\"key\">\n </mat-form-field>\n }\n @case('FILE') {\n <div class=\"form-field\">\n @if(field().template)\n {\n <a href=\"{{field().template}}\" matFab extended aria-label=\"Download template\">\n <mat-icon>download</mat-icon>\n Download Form\n </a>\n }\n <h4>Upload Completed Form</h4>\n <lib-file-upload [control]=\"control\"></lib-file-upload>\n </div>\n } \n }\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatFabButton, selector: "button[mat-fab], a[mat-fab], button[matFab], a[matFab]", inputs: ["extended"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i5$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FileUploadComponent, selector: "lib-file-upload", inputs: ["control"] }] });
|
|
1088
1157
|
}
|
|
1089
1158
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.1", ngImport: i0, type: FormFieldDetailComponent, decorators: [{
|
|
1090
1159
|
type: Component,
|
|
@@ -1092,7 +1161,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.1", ngImpor
|
|
|
1092
1161
|
MatFormFieldModule,
|
|
1093
1162
|
MatInputModule,
|
|
1094
1163
|
MatButtonModule,
|
|
1095
|
-
MatCheckboxModule, MatIconModule, FileUploadComponent], template: "<div [formGroup]=\"form()\">\n <h3>{{ field().label }}</h3>\n <p>{{field().description}}</p>\n <div>\n @switch (field().field_type) {\n @case ('TEXT') {\n <mat-form-field class=\"form-field-wide\">\n <mat-label [attr.for]=\"key\">{{ field().label }}</mat-label>\n <textarea matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n style=\"min-height:150px\"\n [formControlName]=\"key\"\n [name]=\"key\"></textarea>\n </mat-form-field>\n }\n @case('BOOLEAN')\n {\n <mat-checkbox\n class=\"form-field\"\n [name]=\"key\"\n [formControlName]=\"key\">\n {{ field().label }}\n </mat-checkbox>\n }\n @case ('INTEGER') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"number\"\n max=\"10\" min=\"1\"\n [formControlName]=\"key\"\n name=\"trl_stage\">\n </mat-form-field>\n }\n @case ('
|
|
1164
|
+
MatCheckboxModule, MatIconModule, FileUploadComponent], template: "<div [formGroup]=\"form()\">\n <h3>{{ field().label }}</h3>\n <p>{{field().description}}</p>\n <div>\n @switch (field().field_type) {\n @case ('TEXT') {\n <mat-form-field class=\"form-field-wide\">\n <mat-label [attr.for]=\"key\">{{ field().label }}</mat-label>\n <textarea matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n style=\"min-height:150px\"\n [formControlName]=\"key\"\n [name]=\"key\"></textarea>\n </mat-form-field>\n }\n @case('BOOLEAN')\n {\n <mat-checkbox\n class=\"form-field\"\n [name]=\"key\"\n [formControlName]=\"key\">\n {{ field().label }}\n </mat-checkbox>\n }\n @case ('INTEGER') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"number\"\n max=\"10\" min=\"1\"\n [formControlName]=\"key\"\n name=\"trl_stage\">\n </mat-form-field>\n }\n @case ('CHAR') {\n <mat-form-field class=\"form-field\">\n <mat-label>{{ field().label }}</mat-label>\n <input matInput\n [placeholder]=\"field().default\"\n type=\"text\"\n [formControlName]=\"key\"\n name=\"key\">\n </mat-form-field>\n }\n @case('FILE') {\n <div class=\"form-field\">\n @if(field().template)\n {\n <a href=\"{{field().template}}\" matFab extended aria-label=\"Download template\">\n <mat-icon>download</mat-icon>\n Download Form\n </a>\n }\n <h4>Upload Completed Form</h4>\n <lib-file-upload [control]=\"control\"></lib-file-upload>\n </div>\n } \n }\n </div>\n</div>\n" }]
|
|
1096
1165
|
}] });
|
|
1097
1166
|
|
|
1098
1167
|
class FormFieldEditComponent {
|
|
@@ -2391,5 +2460,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.1", ngImpor
|
|
|
2391
2460
|
* Generated bundle index. Do not edit.
|
|
2392
2461
|
*/
|
|
2393
2462
|
|
|
2394
|
-
export { Address, AddressDetailComponent, AddressEditComponent, AddressForm, AddressService, ApiError, AvatarComponent, BackButtonComponent, DetailHeaderComponent, DetailView, DynamicFormBuilderComponent, DynamicFormComponent, DynamicFormForm,
|
|
2463
|
+
export { Address, AddressDetailComponent, AddressEditComponent, AddressForm, AddressService, ApiError, AvatarComponent, BackButtonComponent, DetailHeaderComponent, DetailView, DynamicFormBuilderComponent, DynamicFormComponent, DynamicFormForm, EditView, ErrorCode, FORM_FIELD_CHOICES, FeedbackComponent, FieldType, FileRecord, FileUploadComponent, FormFieldDetailComponent, FormFieldEditComponent, FormFieldValueForm, FormService, Group, GroupComponent, GroupDetailComponent, GroupService, ItemQuery, ItemService, ItemWithUserService, LOGIN_USER, LandingComponent, LeftNavComponent, LeftNavService, ListTableViewComponent, ListViewComponent, MemberSelectionManager, MockItemService, Organization, OrganizationComponent, OrganizationDetailComponent, OrganizationEditComponent, OrganizationService, Paginated, Permission, PopulatedFormComponent, PopulatedFormForm, PortalMember, REST_SERVICE_CONFIG, ResolvedPermission, RestService, SearchBarComponent, SelectTableComponent, SelectionManager, TopBarComponent, UserComponent, UserDetailComponent, UserEditComponent, UserService, getFieldTypeFromKey };
|
|
2395
2464
|
//# sourceMappingURL=ichec-angular-core.mjs.map
|