diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.html b/src/Squidex/app/features/content/pages/content/content-page.component.html index 2a298404e..00b0cd4e3 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.html +++ b/src/Squidex/app/features/content/pages/content/content-page.component.html @@ -1,7 +1,7 @@
- + diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.ts b/src/Squidex/app/features/content/pages/content/content-page.component.ts index 1eace2005..e00c1203c 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-page.component.ts @@ -62,7 +62,11 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD public language: AppLanguageDto; public languages: ReadonlyArray; - public trackByFieldFn: Function; + public get hasContent() { + return !!this.content; + } + + public trackByFieldFn: (index: number, field: FieldDto) => any; @ViewChild('dueTimeSelector', { static: false }) public dueTimeSelector: DueTimeSelectorComponent; diff --git a/src/Squidex/app/features/content/shared/content-selector-item.component.ts b/src/Squidex/app/features/content/shared/content-selector-item.component.ts index 67db6d578..a18cdbcb8 100644 --- a/src/Squidex/app/features/content/shared/content-selector-item.component.ts +++ b/src/Squidex/app/features/content/shared/content-selector-item.component.ts @@ -8,9 +8,9 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { - AppLanguageDto, ContentDto, getContentValue, + LanguageDto, RootFieldDto } from '@app/shared'; @@ -62,7 +62,7 @@ export class ContentSelectorItemComponent implements OnChanges { public selectable = true; @Input() - public language: AppLanguageDto; + public language: LanguageDto; @Input() public fields: ReadonlyArray; diff --git a/src/Squidex/app/features/content/shared/content.component.ts b/src/Squidex/app/features/content/shared/content.component.ts index 58fe946fa..c30b7ee73 100644 --- a/src/Squidex/app/features/content/shared/content.component.ts +++ b/src/Squidex/app/features/content/shared/content.component.ts @@ -68,7 +68,7 @@ export class ContentComponent implements OnChanges { @Input('sqxContent') public content: ContentDto; - public trackByFieldFn: Function; + public trackByFieldFn: (index: number, field: FieldDto) => any; public patchForm: PatchContentForm; public patchAllowed = false; diff --git a/src/Squidex/app/features/content/shared/contents-selector.component.html b/src/Squidex/app/features/content/shared/contents-selector.component.html index f7859a974..bf63eb851 100644 --- a/src/Squidex/app/features/content/shared/contents-selector.component.html +++ b/src/Squidex/app/features/content/shared/contents-selector.component.html @@ -60,7 +60,6 @@ Disabled - +
@@ -22,53 +22,53 @@ - + - + - + - + - + - + - + - + -
- + @@ -80,7 +80,7 @@ @@ -100,52 +100,52 @@ - + - + - + - + - + - + -
- +
- +
- + - + - diff --git a/src/Squidex/app/features/content/shared/field-editor.component.ts b/src/Squidex/app/features/content/shared/field-editor.component.ts index 8b8ed088c..3cb9441e8 100644 --- a/src/Squidex/app/features/content/shared/field-editor.component.ts +++ b/src/Squidex/app/features/content/shared/field-editor.component.ts @@ -6,13 +6,14 @@ */ import { Component, Input } from '@angular/core'; -import { FormControl } from '@angular/forms'; +import { AbstractControl, FormArray, FormControl } from '@angular/forms'; import { AppLanguageDto, EditContentForm, FieldDto, - MathHelper + MathHelper, + RootFieldDto } from '@app/shared'; @Component({ @@ -31,7 +32,7 @@ export class FieldEditorComponent { public field: FieldDto; @Input() - public control: FormControl; + public control: AbstractControl; @Input() public language: AppLanguageDto; @@ -45,5 +46,17 @@ export class FieldEditorComponent { @Input() public displaySuffix: string; + public get arrayControl() { + return this.control as FormArray; + } + + public get editorControl() { + return this.control as FormControl; + } + + public get rootField() { + return this.field as RootFieldDto; + } + public uniqueId = MathHelper.guid(); } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/field.component.ts b/src/Squidex/app/features/schemas/pages/schema/field.component.ts index f059c8570..c53a2ebc3 100644 --- a/src/Squidex/app/features/schemas/pages/schema/field.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/field.component.ts @@ -45,7 +45,7 @@ export class FieldComponent implements OnChanges { public dropdown = new ModalModel(); - public trackByFieldFn: Function; + public trackByFieldFn: (index: number, field: NestedFieldDto) => any; public isEditing = false; public isEditable = false; diff --git a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-ui.component.ts index 173d51b6e..2aa811127 100644 --- a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-ui.component.ts @@ -13,30 +13,30 @@ import { FieldDto } from '@app/shared'; @Component({ selector: 'sqx-field-form-ui', template: ` - + - + - + - + - + - + - + - + - + ` }) diff --git a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-validation.component.ts index 986778df7..fd0ba685a 100644 --- a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-validation.component.ts @@ -13,33 +13,33 @@ import { FieldDto, PatternDto } from '@app/shared'; @Component({ selector: 'sqx-field-form-validation', template: ` - + - + - + - + - + - + - + - + - + - + ` }) diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts index ab7a9ac61..f591ef185 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts @@ -49,7 +49,7 @@ export class SchemaPageComponent extends ResourceOwner implements OnInit { public editSchemaDialog = new DialogModel(); public exportDialog = new DialogModel(); - public trackByFieldFn: Function; + public trackByFieldFn: (index: number, field: FieldDto) => any; constructor( public readonly schemasState: SchemasState, diff --git a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts index 0dd9ea0e3..23420c795 100644 --- a/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts +++ b/src/Squidex/app/features/settings/pages/clients/clients-page.component.ts @@ -35,7 +35,7 @@ export class ClientsPageComponent implements OnInit { this.clientsState.load(true); } - public trackByClient(item: ClientDto) { - return item.id; + public trackByClient(index: number, client: ClientDto) { + return client.id; } } \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/languages/language.component.ts b/src/Squidex/app/features/settings/pages/languages/language.component.ts index ff421fa98..1f49cc0ae 100644 --- a/src/Squidex/app/features/settings/pages/languages/language.component.ts +++ b/src/Squidex/app/features/settings/pages/languages/language.component.ts @@ -13,6 +13,7 @@ import { AppLanguageDto, EditLanguageForm, fadeAnimation, + LanguageDto, LanguagesState, sorted } from '@app/shared'; @@ -30,12 +31,12 @@ export class LanguageComponent implements OnChanges { public language: AppLanguageDto; @Input() - public fallbackLanguages: ReadonlyArray; + public fallbackLanguages: ReadonlyArray; @Input() - public fallbackLanguagesNew: ReadonlyArray; + public fallbackLanguagesNew: ReadonlyArray; - public otherLanguage: AppLanguageDto; + public otherLanguage: LanguageDto; public isEditing = false; public isEditable = false; diff --git a/src/Squidex/app/features/settings/pages/roles/role.component.html b/src/Squidex/app/features/settings/pages/roles/role.component.html index a24b3a5fa..c3fed1c0a 100644 --- a/src/Squidex/app/features/settings/pages/roles/role.component.html +++ b/src/Squidex/app/features/settings/pages/roles/role.component.html @@ -29,7 +29,7 @@
- +
@@ -38,7 +38,7 @@
-
+
diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts index 53ffd8671..299e3f773 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-step.component.ts @@ -23,6 +23,8 @@ import { templateUrl: './workflow-step.component.html' }) export class WorkflowStepComponent implements OnChanges { + public readonly onBlur: { updateOn: 'blur' } = { updateOn: 'blur' }; + @Output() public makeInitial = new EventEmitter(); @@ -56,8 +58,6 @@ export class WorkflowStepComponent implements OnChanges { @Input() public disabled: boolean; - public onBlur = { updateOn: 'blur' }; - public openSteps: ReadonlyArray; public openStep: WorkflowStep; diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts index 87b84d1e6..5c8223fb4 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow-transition.component.ts @@ -19,6 +19,8 @@ import { templateUrl: './workflow-transition.component.html' }) export class WorkflowTransitionComponent { + public readonly onBlur: { updateOn: 'blur' } = { updateOn: 'blur' }; + @Output() public update = new EventEmitter(); @@ -34,8 +36,6 @@ export class WorkflowTransitionComponent { @Input() public disabled: boolean; - public onBlur = { updateOn: 'blur' }; - public changeExpression(expression: string) { this.update.emit({ expression }); } diff --git a/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts b/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts index fde261ecc..e6b83c07d 100644 --- a/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts +++ b/src/Squidex/app/features/settings/pages/workflows/workflow.component.ts @@ -28,6 +28,8 @@ import { templateUrl: './workflow.component.html' }) export class WorkflowComponent implements OnChanges { + public readonly onBlur: { updateOn: 'blur' } = { updateOn: 'blur' }; + @Input() public workflow: WorkflowDto; @@ -39,8 +41,6 @@ export class WorkflowComponent implements OnChanges { public error: string | null; - public onBlur = { updateOn: 'blur' }; - public isEditing = false; public isEditable = false; @@ -123,7 +123,7 @@ export class WorkflowComponent implements OnChanges { this.workflow = this.workflow.removeStep(step.name); } - public trackByStep(step: WorkflowStep) { + public trackByStep(index: number, step: WorkflowStep) { return step.name; } } \ No newline at end of file diff --git a/src/Squidex/app/framework/angular/forms/form-error.component.ts b/src/Squidex/app/framework/angular/forms/form-error.component.ts index f465ce8d8..ab22b0d87 100644 --- a/src/Squidex/app/framework/angular/forms/form-error.component.ts +++ b/src/Squidex/app/framework/angular/forms/form-error.component.ts @@ -17,5 +17,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; }) export class FormErrorComponent { @Input() - public error: string; + public error: string | null | undefined; } \ No newline at end of file diff --git a/src/Squidex/app/framework/angular/status-icon.component.ts b/src/Squidex/app/framework/angular/status-icon.component.ts index 0ea13974e..d3aaa98a5 100644 --- a/src/Squidex/app/framework/angular/status-icon.component.ts +++ b/src/Squidex/app/framework/angular/status-icon.component.ts @@ -15,7 +15,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; }) export class StatusIconComponent { @Input() - public status: 'Started' | 'Failed' | 'Success' | 'Completed' | 'Failed' | 'Pending'; + public status: 'Started' | 'Failed' | 'Success' | 'Completed' | 'Pending'; @Input() public statusText: string; diff --git a/src/Squidex/app/shared/components/assets-list.component.html b/src/Squidex/app/shared/components/assets-list.component.html index c59d20174..a50c98f24 100644 --- a/src/Squidex/app/shared/components/assets-list.component.html +++ b/src/Squidex/app/shared/components/assets-list.component.html @@ -25,7 +25,7 @@ ; public trackByEvent(index: number, event: HistoryEventDto) { return event.eventId; diff --git a/src/Squidex/app/shared/components/pipes.ts b/src/Squidex/app/shared/components/pipes.ts index 447cc061f..670e62e36 100644 --- a/src/Squidex/app/shared/components/pipes.ts +++ b/src/Squidex/app/shared/components/pipes.ts @@ -67,7 +67,7 @@ export class HistoryMessagePipe implements OnDestroy, PipeTransform { class UserAsyncPipe implements OnDestroy { private lastUserId: string; - private lastValue: string | null = null; + private lastValue: string | undefined = undefined; private subscription: Subscription; constructor(loading: string, @@ -83,7 +83,7 @@ class UserAsyncPipe implements OnDestroy { } } - protected transformInternal(userId: string, transform: (users: UsersProviderService) => Observable): string | null { + protected transformInternal(userId: string, transform: (users: UsersProviderService) => Observable) { if (this.lastUserId !== userId) { this.lastUserId = userId; @@ -92,7 +92,7 @@ class UserAsyncPipe implements OnDestroy { } this.subscription = transform(this.users).subscribe(value => { - this.lastValue = value; + this.lastValue = value || undefined; this.changeDetector.markForCheck(); }); @@ -111,7 +111,7 @@ export class UserNamePipe extends UserAsyncPipe implements PipeTransform { super('Loading...', users, changeDetector); } - public transform(userId: string, placeholder = 'Me'): string | null { + public transform(userId: string, placeholder = 'Me') { return super.transformInternal(userId, users => users.getUser(userId, placeholder).pipe(map(u => u.displayName))); } } @@ -125,7 +125,7 @@ export class UserNameRefPipe extends UserAsyncPipe implements PipeTransform { super('Loading...', users, changeDetector); } - public transform(userId: string, placeholder: string | null = 'Me'): string | null { + public transform(userId: string, placeholder: string | null = 'Me') { return super.transformInternal(userId, users => { const parts = userId.split(':'); @@ -183,7 +183,7 @@ export class UserPicturePipe extends UserAsyncPipe implements PipeTransform { super('', users, changeDetector); } - public transform(userId: string): string | null { + public transform(userId: string) { return super.transformInternal(userId, users => users.getUser(userId).pipe(map(u => this.apiUrl.buildUrl(`api/users/${u.id}/picture`)))); } } @@ -199,7 +199,7 @@ export class UserPictureRefPipe extends UserAsyncPipe implements PipeTransform { super('', users, changeDetector); } - public transform(userId: string): string | null { + public transform(userId: string) { return super.transformInternal(userId, users => { const parts = userId.split(':'); diff --git a/src/Squidex/app/shared/components/queries/filter-logical.component.html b/src/Squidex/app/shared/components/queries/filter-logical.component.html index b2f535f16..4ab99e218 100644 --- a/src/Squidex/app/shared/components/queries/filter-logical.component.html +++ b/src/Squidex/app/shared/components/queries/filter-logical.component.html @@ -2,10 +2,10 @@
- -
diff --git a/src/Squidex/app/shared/components/queries/filter-logical.component.ts b/src/Squidex/app/shared/components/queries/filter-logical.component.ts index 9bbd9f3e9..4819225de 100644 --- a/src/Squidex/app/shared/components/queries/filter-logical.component.ts +++ b/src/Squidex/app/shared/components/queries/filter-logical.component.ts @@ -58,6 +58,14 @@ export class FilterLogicalComponent { return this.filterValue; } + public get isAnd() { + return !!this.filter.and; + } + + public get isOr() { + return !!this.filter.or; + } + public get nestedLevel() { return this.level + 1; } diff --git a/src/Squidex/app/shared/components/references-dropdown.component.ts b/src/Squidex/app/shared/components/references-dropdown.component.ts index 9ffefeba5..ed91da3b5 100644 --- a/src/Squidex/app/shared/components/references-dropdown.component.ts +++ b/src/Squidex/app/shared/components/references-dropdown.component.ts @@ -9,11 +9,11 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Inpu import { FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; import { - AppLanguageDto, AppsState, ContentDto, ContentsService, getContentValue, + LanguageDto, StatefulControlComponent, Types, UIOptions @@ -49,7 +49,7 @@ const NO_EMIT = { emitEvent: false }; changeDetection: ChangeDetectionStrategy.OnPush }) export class ReferencesDropdownComponent extends StatefulControlComponent | string> implements OnInit { - private languageField: AppLanguageDto; + private languageField: LanguageDto; private selectedId: string | undefined; private itemCount: number; @@ -60,7 +60,7 @@ export class ReferencesDropdownComponent extends StatefulControlComponent ({ ...s, contentNames: this.createContentNames(s.contents) })); diff --git a/src/Squidex/app/shared/services/backups.service.spec.ts b/src/Squidex/app/shared/services/backups.service.spec.ts index 68631ccb9..0a2da166f 100644 --- a/src/Squidex/app/shared/services/backups.service.spec.ts +++ b/src/Squidex/app/shared/services/backups.service.spec.ts @@ -198,7 +198,7 @@ describe('BackupsService', () => { stopped: id % 2 === 0 ? `${id % 1000 + 2000}-11-11T10:10:00` : null, handledEvents: id * 17, handledAssets: id * 23, - status: id % 2 === 0 ? 'Status' : 'Failed', + status: id % 2 === 0 ? 'Success' : 'Failed', _links: { download: { method: 'GET', href: '/api/backups/1' } } @@ -217,5 +217,5 @@ export function createBackup(id: number) { id % 2 === 0 ? DateTime.parseISO_UTC(`${id % 1000 + 2000}-11-11T10:10:00`) : null, id * 17, id * 23, - id % 2 === 0 ? 'Status' : 'Failed'); + id % 2 === 0 ? 'Success' : 'Failed'); } \ No newline at end of file diff --git a/src/Squidex/app/shared/services/backups.service.ts b/src/Squidex/app/shared/services/backups.service.ts index 876b11596..1e020f3b5 100644 --- a/src/Squidex/app/shared/services/backups.service.ts +++ b/src/Squidex/app/shared/services/backups.service.ts @@ -46,7 +46,7 @@ export class BackupDto { public readonly stopped: DateTime | null, public readonly handledEvents: number, public readonly handledAssets: number, - public readonly status: string + public readonly status: 'Started' | 'Failed' | 'Success' | 'Completed' | 'Pending' ) { this._links = links; diff --git a/src/Squidex/app/shared/services/rules.service.ts b/src/Squidex/app/shared/services/rules.service.ts index 990f52e96..ad30e726d 100644 --- a/src/Squidex/app/shared/services/rules.service.ts +++ b/src/Squidex/app/shared/services/rules.service.ts @@ -24,14 +24,14 @@ import { Version } from '@app/framework'; -export type TriggerDto = { +export type RuleElementMetadataDto = { description: string; display: string; iconColor: string; iconCode: string; }; -export type TriggersDto = { [key: string]: TriggerDto }; +export type TriggersDto = { [key: string]: RuleElementMetadataDto }; export const ALL_TRIGGERS: TriggersDto = { 'ContentChanged': { diff --git a/src/Squidex/app/shared/state/query.ts b/src/Squidex/app/shared/state/query.ts index 258baa9e6..d99f095eb 100644 --- a/src/Squidex/app/shared/state/query.ts +++ b/src/Squidex/app/shared/state/query.ts @@ -82,7 +82,7 @@ export type SortMode = 'ascending' | 'descending'; export interface Query { // The optional filter. - filter?: FilterNode; + filter?: FilterLogical; // The full text search. fullText?: string; diff --git a/src/Squidex/app/shared/state/roles.forms.ts b/src/Squidex/app/shared/state/roles.forms.ts index 0342b6432..fea150306 100644 --- a/src/Squidex/app/shared/state/roles.forms.ts +++ b/src/Squidex/app/shared/state/roles.forms.ts @@ -14,6 +14,10 @@ import { } from '@app/framework'; export class EditPermissionsForm extends Form> { + public get controls() { + return this.form.controls as FormControl[]; + } + constructor() { super(new FormArray([])); } diff --git a/src/Squidex/package.json b/src/Squidex/package.json index 912278e8b..13b16acf7 100644 --- a/src/Squidex/package.json +++ b/src/Squidex/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "@angular/animations": "8.2.9", - "@angular/cdk": "^8.2.3", + "@angular/cdk": "8.2.3", "@angular/common": "8.2.9", "@angular/core": "8.2.9", "@angular/forms": "8.2.9",