Browse Source

Make item count for dropdown selector configurable.

pull/410/head
Sebastian Stehle 6 years ago
parent
commit
5a48d62061
  1. 2
      src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs
  2. 10
      src/Squidex/app/shared/components/references-dropdown.component.ts
  3. 6
      src/Squidex/appsettings.json

2
src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs

@ -17,6 +17,8 @@ namespace Squidex.Areas.Api.Controllers.UI
public MapOptions Map { get; set; } public MapOptions Map { get; set; }
public int ReferencesDropdownItemCount { get; set; } = 100;
public bool ShowInfo { get; set; } public bool ShowInfo { get; set; }
public bool HideNews { get; set; } public bool HideNews { get; set; }

10
src/Squidex/app/shared/components/references-dropdown.component.ts

@ -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');
} }

6
src/Squidex/appsettings.json

@ -96,7 +96,11 @@
/* /*
* Show the exposed values as information on the apps overview page. * Show the exposed values as information on the apps overview page.
*/ */
"showInfo": false "showInfo": false,
/*
* The number of content items for dropdown selector.
*/
"referencesDropdownItemCount": 100
}, },
"email": { "email": {

Loading…
Cancel
Save