|
|
@ -20,7 +20,8 @@ import { |
|
|
SchemaDetailsDto, |
|
|
SchemaDetailsDto, |
|
|
SchemasService, |
|
|
SchemasService, |
|
|
StatefulControlComponent, |
|
|
StatefulControlComponent, |
|
|
Types |
|
|
Types, |
|
|
|
|
|
UIOptions |
|
|
} from '@app/shared/internal'; |
|
|
} from '@app/shared/internal'; |
|
|
|
|
|
|
|
|
export const SQX_REFERENCES_DROPDOWN_CONTROL_VALUE_ACCESSOR: any = { |
|
|
export const SQX_REFERENCES_DROPDOWN_CONTROL_VALUE_ACCESSOR: any = { |
|
|
@ -57,6 +58,7 @@ const NO_EMIT = { emitEvent: false }; |
|
|
export class ReferencesDropdownComponent extends StatefulControlComponent<State, string[] | string> implements OnInit { |
|
|
export class ReferencesDropdownComponent extends StatefulControlComponent<State, string[] | string> implements OnInit { |
|
|
private languageField: AppLanguageDto; |
|
|
private languageField: AppLanguageDto; |
|
|
private selectedId: string | undefined; |
|
|
private selectedId: string | undefined; |
|
|
|
|
|
private itemCount: number; |
|
|
|
|
|
|
|
|
@Input() |
|
|
@Input() |
|
|
public schemaId: string; |
|
|
public schemaId: string; |
|
|
@ -73,7 +75,7 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State, |
|
|
|
|
|
|
|
|
public selectionControl = new FormControl(''); |
|
|
public selectionControl = new FormControl(''); |
|
|
|
|
|
|
|
|
constructor(changeDetector: ChangeDetectorRef, |
|
|
constructor(changeDetector: ChangeDetectorRef, uiOptions: UIOptions, |
|
|
private readonly appsState: AppsState, |
|
|
private readonly appsState: AppsState, |
|
|
private readonly contentsService: ContentsService, |
|
|
private readonly contentsService: ContentsService, |
|
|
private readonly schemasService: SchemasService |
|
|
private readonly schemasService: SchemasService |
|
|
@ -84,6 +86,8 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State, |
|
|
contentNames: [] |
|
|
contentNames: [] |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.itemCount = uiOptions.get('referencesDropdownItemCount'); |
|
|
|
|
|
|
|
|
this.own( |
|
|
this.own( |
|
|
this.selectionControl.valueChanges |
|
|
this.selectionControl.valueChanges |
|
|
.subscribe((value: ContentName) => { |
|
|
.subscribe((value: ContentName) => { |
|
|
@ -116,7 +120,7 @@ export class ReferencesDropdownComponent extends StatefulControlComponent<State, |
|
|
this.schemasService.getSchema(this.appsState.appName, this.schemaId).pipe( |
|
|
this.schemasService.getSchema(this.appsState.appName, this.schemaId).pipe( |
|
|
switchMap(schema => { |
|
|
switchMap(schema => { |
|
|
if (schema) { |
|
|
if (schema) { |
|
|
return this.contentsService.getContents(this.appsState.appName, this.schemaId, 100, 0); |
|
|
return this.contentsService.getContents(this.appsState.appName, this.schemaId, this.itemCount, 0); |
|
|
} else { |
|
|
} else { |
|
|
return throwError('Invalid schema'); |
|
|
return throwError('Invalid schema'); |
|
|
} |
|
|
} |
|
|
|