src/app/app-web-component.component.ts
BaseWebComponent
changeDetection | ChangeDetectionStrategy.OnPush |
selector | ccf-root-wc |
template |
|
Inputs |
constructor(configStore: GlobalConfigState<GlobalConfig>, cdr: ChangeDetectorRef)
|
|||||||||
Defined in src/app/app-web-component.component.ts:45
|
|||||||||
Parameters :
|
baseHref | |
Type : string
|
|
Defined in src/app/app-web-component.component.ts:31
|
cancelRegistration | |
Type : string | CancelRegistrationCallback
|
|
Defined in src/app/app-web-component.component.ts:37
|
collisionsEndpoint | |
Type : string
|
|
Defined in src/app/app-web-component.component.ts:45
|
editRegistration | |
Type : string | SpatialEntityJsonLd
|
|
Defined in src/app/app-web-component.component.ts:35
|
fetchPreviousRegistrations | |
Type : string | FetchPreviousRegistrationsCallback
|
|
Defined in src/app/app-web-component.component.ts:38
|
header | |
Type : string | boolean
|
|
Defined in src/app/app-web-component.component.ts:41
|
homeUrl | |
Type : string
|
|
Defined in src/app/app-web-component.component.ts:42
|
logoTooltip | |
Type : string
|
|
Defined in src/app/app-web-component.component.ts:43
|
organ | |
Type : string | Organ
|
|
Defined in src/app/app-web-component.component.ts:34
|
organOptions | |
Type : string | string[]
|
|
Defined in src/app/app-web-component.component.ts:44
|
register | |
Type : string | RegistrationCallback
|
|
Defined in src/app/app-web-component.component.ts:36
|
skipUnsavedChangesConfirmation | |
Type : string | boolean
|
|
Defined in src/app/app-web-component.component.ts:39
|
theme | |
Type : string
|
|
Defined in src/app/app-web-component.component.ts:40
|
useDownload | |
Type : string | boolean
|
|
Defined in src/app/app-web-component.component.ts:32
|
user | |
Type : string | User
|
|
Defined in src/app/app-web-component.component.ts:33
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input } from '@angular/core';
import { SpatialEntityJsonLd } from 'ccf-body-ui';
import { GlobalConfigState } from 'ccf-shared';
import { BaseWebComponent, BUILTIN_PARSERS } from 'ccf-shared/web-components';
import { ObservableInput } from 'rxjs';
import { GlobalConfig } from './core/services/config/config';
import { environment } from '../environments/environment';
export type User = NonNullable<GlobalConfig['user']>;
export type Organ = NonNullable<GlobalConfig['organ']>;
export type RegistrationCallback = (data: unknown) => void;
export type CancelRegistrationCallback = () => void;
export type FetchPreviousRegistrationsCallback = () => ObservableInput<Record<string, unknown>[]>;
function parseOrgan(value: unknown): string | Organ {
try {
return BUILTIN_PARSERS.json(value) as Organ;
} catch {
return '' + value;
}
}
@Component({
selector: 'ccf-root-wc',
template: '<ccf-root *ngIf="initialized"></ccf-root>',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppWebComponent extends BaseWebComponent {
@Input() baseHref!: string;
@Input() useDownload!: string | boolean;
@Input() user!: string | User;
@Input() organ!: string | Organ;
@Input() editRegistration!: string | SpatialEntityJsonLd;
@Input() register!: string | RegistrationCallback;
@Input() cancelRegistration!: string | CancelRegistrationCallback;
@Input() fetchPreviousRegistrations!: string | FetchPreviousRegistrationsCallback;
@Input() skipUnsavedChangesConfirmation!: string | boolean;
@Input() theme!: string;
@Input() header!: string | boolean;
@Input() homeUrl!: string;
@Input() logoTooltip!: string;
@Input() organOptions!: string | string[];
@Input() collisionsEndpoint!: string;
constructor(configStore: GlobalConfigState<GlobalConfig>, cdr: ChangeDetectorRef) {
const BP = BUILTIN_PARSERS;
super(configStore, cdr, {
initialConfig: {
...environment.dbOptions,
...(globalThis['ruiConfig' as never] as object),
...environment.customization,
},
parse: {
useDownload: BP.boolean,
user: BP.json,
organ: parseOrgan,
editRegistration: BP.json,
register: BP.function,
cancelRegistration: BP.function,
fetchPreviousRegistrations: BP.function,
skipUnsavedChangesConfirmation: BP.boolean,
header: BP.boolean,
organOptions: BP.stringArray,
},
});
}
}