Browse Source

UI improvements.

pull/327/head
Sebastian 8 years ago
parent
commit
fe25efbb76
  1. 10
      src/Squidex/app/features/content/shared/assets-editor.component.ts
  2. 8
      src/Squidex/app/features/content/shared/contents-selector.component.html
  3. 20
      src/Squidex/app/features/content/shared/references-editor.component.ts
  4. 5
      src/Squidex/app/framework/angular/forms/autocomplete.component.ts
  5. 14
      src/Squidex/app/framework/angular/forms/date-time-editor.component.ts
  6. 5
      src/Squidex/app/framework/angular/forms/dropdown.component.ts
  7. 4
      src/Squidex/app/framework/angular/forms/iframe-editor.component.ts
  8. 5
      src/Squidex/app/framework/angular/forms/jscript-editor.component.ts
  9. 5
      src/Squidex/app/framework/angular/forms/json-editor.component.ts
  10. 8
      src/Squidex/app/framework/angular/forms/progress-bar.component.ts
  11. 5
      src/Squidex/app/framework/angular/forms/slider.component.ts
  12. 5
      src/Squidex/app/framework/angular/forms/stars.component.ts
  13. 5
      src/Squidex/app/framework/angular/forms/tag-editor.component.ts
  14. 5
      src/Squidex/app/framework/angular/forms/toggle.component.ts
  15. 7
      src/Squidex/app/shared/components/app-form.component.ts
  16. 4
      src/Squidex/app/shared/components/asset.component.html
  17. 20
      src/Squidex/app/shared/components/asset.component.scss
  18. 24
      src/Squidex/app/shared/components/asset.component.ts
  19. 5
      src/Squidex/app/shared/components/assets-list.component.ts
  20. 5
      src/Squidex/app/shared/components/assets-selector.component.ts
  21. 5
      src/Squidex/app/shared/components/geolocation-editor.component.ts
  22. 5
      src/Squidex/app/shared/components/help.component.ts
  23. 5
      src/Squidex/app/shared/components/history-list.component.ts
  24. 7
      src/Squidex/app/shared/components/history.component.ts

10
src/Squidex/app/features/content/shared/assets-editor.component.ts

@ -7,7 +7,7 @@
// tslint:disable:prefer-for-of // tslint:disable:prefer-for-of
import { Component, forwardRef } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { import {
@ -28,9 +28,8 @@ export const SQX_ASSETS_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-assets-editor', selector: 'sqx-assets-editor',
styleUrls: ['./assets-editor.component.scss'], styleUrls: ['./assets-editor.component.scss'],
templateUrl: './assets-editor.component.html', templateUrl: './assets-editor.component.html',
providers: [ providers: [SQX_ASSETS_EDITOR_CONTROL_VALUE_ACCESSOR],
SQX_ASSETS_EDITOR_CONTROL_VALUE_ACCESSOR changeDetection: ChangeDetectionStrategy.OnPush
]
}) })
export class AssetsEditorComponent implements ControlValueAccessor { export class AssetsEditorComponent implements ControlValueAccessor {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };
@ -47,6 +46,7 @@ export class AssetsEditorComponent implements ControlValueAccessor {
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,
private readonly assetsService: AssetsService, private readonly assetsService: AssetsService,
private readonly changeDetector: ChangeDetectorRef,
private readonly localStore: LocalStoreService private readonly localStore: LocalStoreService
) { ) {
this.isListView = this.localStore.get('assetView') === 'List'; this.isListView = this.localStore.get('assetView') === 'List';
@ -131,6 +131,8 @@ export class AssetsEditorComponent implements ControlValueAccessor {
this.callTouched(); this.callTouched();
this.callChange(ids); this.callChange(ids);
this.changeDetector.markForCheck();
} }
public sort(assets: AssetDto[]) { public sort(assets: AssetDto[]) {

8
src/Squidex/app/features/content/shared/contents-selector.component.html

@ -16,10 +16,10 @@
(queryChanged)="search($event)" (queryChanged)="search($event)"
expandable="true"> expandable="true">
</sqx-search-form> </sqx-search-form>
</div>
<ng-container *ngIf="languages.length > 1">
<sqx-language-selector class="languages-buttons" (selectedLanguageChange)="selectLanguage($event)" [languages]="languages.values"></sqx-language-selector> <div class="col pl-1" *ngIf="languages.length > 1">
</ng-container> <sqx-language-selector class="languages-buttons" (selectedLanguageChange)="selectLanguage($event)" [languages]="languages.values"></sqx-language-selector>
</div> </div>
</div> </div>
</ng-container> </ng-container>

20
src/Squidex/app/features/content/shared/references-editor.component.ts

@ -7,7 +7,7 @@
// tslint:disable:prefer-for-of // tslint:disable:prefer-for-of
import { Component, forwardRef, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { import {
@ -31,9 +31,8 @@ export const SQX_REFERENCES_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-references-editor', selector: 'sqx-references-editor',
styleUrls: ['./references-editor.component.scss'], styleUrls: ['./references-editor.component.scss'],
templateUrl: './references-editor.component.html', templateUrl: './references-editor.component.html',
providers: [ providers: [SQX_REFERENCES_EDITOR_CONTROL_VALUE_ACCESSOR],
SQX_REFERENCES_EDITOR_CONTROL_VALUE_ACCESSOR changeDetection: ChangeDetectionStrategy.OnPush
]
}) })
export class ReferencesEditorComponent implements ControlValueAccessor, OnInit { export class ReferencesEditorComponent implements ControlValueAccessor, OnInit {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };
@ -59,6 +58,7 @@ export class ReferencesEditorComponent implements ControlValueAccessor, OnInit {
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,
private readonly changeDetector: ChangeDetectorRef,
private readonly contentsService: ContentsService, private readonly contentsService: ContentsService,
private readonly schemasService: SchemasService private readonly schemasService: SchemasService
) { ) {
@ -73,8 +73,12 @@ export class ReferencesEditorComponent implements ControlValueAccessor, OnInit {
this.schemasService.getSchema(this.appsState.appName, this.schemaId) this.schemasService.getSchema(this.appsState.appName, this.schemaId)
.subscribe(dto => { .subscribe(dto => {
this.schema = dto; this.schema = dto;
}, error => {
this.changeDetector.markForCheck();
}, () => {
this.isInvalidSchema = true; this.isInvalidSchema = true;
this.changeDetector.markForCheck();
}); });
} }
@ -90,8 +94,12 @@ export class ReferencesEditorComponent implements ControlValueAccessor, OnInit {
if (this.contentItems.length !== contentIds.length) { if (this.contentItems.length !== contentIds.length) {
this.updateValue(); this.updateValue();
} }
this.changeDetector.markForCheck();
}, () => { }, () => {
this.contentItems = ImmutableArray.empty(); this.contentItems = ImmutableArray.empty();
this.changeDetector.markForCheck();
}); });
} }
} else { } else {
@ -148,5 +156,7 @@ export class ReferencesEditorComponent implements ControlValueAccessor, OnInit {
this.callTouched(); this.callTouched();
this.callChange(ids); this.callChange(ids);
this.changeDetector.markForCheck();
} }
} }

5
src/Squidex/app/framework/angular/forms/autocomplete.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, ContentChild, forwardRef, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core'; import { ChangeDetectionStrategy, Component, ContentChild, forwardRef, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Observable, of, Subscription } from 'rxjs'; import { Observable, of, Subscription } from 'rxjs';
import { catchError, debounceTime, distinctUntilChanged, filter, map, switchMap, tap } from 'rxjs/operators'; import { catchError, debounceTime, distinctUntilChanged, filter, map, switchMap, tap } from 'rxjs/operators';
@ -27,7 +27,8 @@ export const SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-autocomplete', selector: 'sqx-autocomplete',
styleUrls: ['./autocomplete.component.scss'], styleUrls: ['./autocomplete.component.scss'],
templateUrl: './autocomplete.component.html', templateUrl: './autocomplete.component.html',
providers: [SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR] providers: [SQX_AUTOCOMPLETE_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class AutocompleteComponent implements ControlValueAccessor, OnDestroy, OnInit { export class AutocompleteComponent implements ControlValueAccessor, OnDestroy, OnInit {
private subscription: Subscription; private subscription: Subscription;

14
src/Squidex/app/framework/angular/forms/date-time-editor.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import * as moment from 'moment'; import * as moment from 'moment';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
@ -22,7 +22,8 @@ export const SQX_DATE_TIME_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-date-time-editor', selector: 'sqx-date-time-editor',
styleUrls: ['./date-time-editor.component.scss'], styleUrls: ['./date-time-editor.component.scss'],
templateUrl: './date-time-editor.component.html', templateUrl: './date-time-editor.component.html',
providers: [SQX_DATE_TIME_EDITOR_CONTROL_VALUE_ACCESSOR] providers: [SQX_DATE_TIME_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy, OnInit, AfterViewInit { export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy, OnInit, AfterViewInit {
private timeSubscription: Subscription; private timeSubscription: Subscription;
@ -60,6 +61,11 @@ export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy,
public isDisabled = false; public isDisabled = false;
constructor(
private readonly changeDetector: ChangeDetectorRef
) {
}
public ngOnDestroy() { public ngOnDestroy() {
this.dateSubscription.unsubscribe(); this.dateSubscription.unsubscribe();
this.timeSubscription.unsubscribe(); this.timeSubscription.unsubscribe();
@ -136,6 +142,10 @@ export class DateTimeEditorComponent implements ControlValueAccessor, OnDestroy,
this.updateValue(); this.updateValue();
this.touched(); this.touched();
if (false) {
this.changeDetector.markForCheck();
}
} }
}); });

5
src/Squidex/app/framework/angular/forms/dropdown.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterContentInit, Component, ContentChildren, forwardRef, Input, QueryList, TemplateRef } from '@angular/core'; import { AfterContentInit, ChangeDetectionStrategy, Component, ContentChildren, forwardRef, Input, QueryList, TemplateRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
const KEY_ENTER = 13; const KEY_ENTER = 13;
@ -23,7 +23,8 @@ export const SQX_DROPDOWN_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-dropdown', selector: 'sqx-dropdown',
styleUrls: ['./dropdown.component.scss'], styleUrls: ['./dropdown.component.scss'],
templateUrl: './dropdown.component.html', templateUrl: './dropdown.component.html',
providers: [SQX_DROPDOWN_CONTROL_VALUE_ACCESSOR] providers: [SQX_DROPDOWN_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class DropdownComponent implements AfterContentInit, ControlValueAccessor { export class DropdownComponent implements AfterContentInit, ControlValueAccessor {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

4
src/Squidex/app/framework/angular/forms/iframe-editor.component.ts

@ -19,8 +19,8 @@ export const SQX_IFRAME_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-iframe-editor', selector: 'sqx-iframe-editor',
styleUrls: ['./iframe-editor.component.scss'], styleUrls: ['./iframe-editor.component.scss'],
templateUrl: './iframe-editor.component.html', templateUrl: './iframe-editor.component.html',
changeDetection: ChangeDetectionStrategy.OnPush, providers: [SQX_IFRAME_EDITOR_CONTROL_VALUE_ACCESSOR],
providers: [SQX_IFRAME_EDITOR_CONTROL_VALUE_ACCESSOR] changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class IFrameEditorComponent implements ControlValueAccessor, AfterViewInit, OnInit, OnDestroy { export class IFrameEditorComponent implements ControlValueAccessor, AfterViewInit, OnInit, OnDestroy {
private windowMessageListener: Function; private windowMessageListener: Function;

5
src/Squidex/app/framework/angular/forms/jscript-editor.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Component, ElementRef, forwardRef, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, forwardRef, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
@ -22,7 +22,8 @@ export const SQX_JSCRIPT_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-jscript-editor', selector: 'sqx-jscript-editor',
styleUrls: ['./jscript-editor.component.scss'], styleUrls: ['./jscript-editor.component.scss'],
templateUrl: './jscript-editor.component.html', templateUrl: './jscript-editor.component.html',
providers: [SQX_JSCRIPT_EDITOR_CONTROL_VALUE_ACCESSOR] providers: [SQX_JSCRIPT_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class JscriptEditorComponent implements ControlValueAccessor, AfterViewInit { export class JscriptEditorComponent implements ControlValueAccessor, AfterViewInit {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

5
src/Squidex/app/framework/angular/forms/json-editor.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Component, ElementRef, forwardRef, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, forwardRef, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
@ -22,7 +22,8 @@ export const SQX_JSON_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-json-editor', selector: 'sqx-json-editor',
styleUrls: ['./json-editor.component.scss'], styleUrls: ['./json-editor.component.scss'],
templateUrl: './json-editor.component.html', templateUrl: './json-editor.component.html',
providers: [SQX_JSON_EDITOR_CONTROL_VALUE_ACCESSOR] providers: [SQX_JSON_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class JsonEditorComponent implements ControlValueAccessor, AfterViewInit { export class JsonEditorComponent implements ControlValueAccessor, AfterViewInit {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

8
src/Squidex/app/framework/angular/forms/progress-bar.component.ts

@ -32,6 +32,9 @@ export class ProgressBarComponent implements OnChanges, OnInit {
@Input() @Input()
public strokeWidth = 4; public strokeWidth = 4;
@Input()
public showText = true;
@Input() @Input()
public value = 0; public value = 0;
@ -46,7 +49,8 @@ export class ProgressBarComponent implements OnChanges, OnInit {
color: this.color, color: this.color,
trailColor: this.trailColor, trailColor: this.trailColor,
trailWidth: this.trailWidth, trailWidth: this.trailWidth,
strokeWidth: this.strokeWidth strokeWidth: this.strokeWidth,
svgStyle: { width: '100%', height: '100%' }
}; };
this.renderer.setStyle(this.element.nativeElement, 'display', 'block'); this.renderer.setStyle(this.element.nativeElement, 'display', 'block');
@ -71,7 +75,7 @@ export class ProgressBarComponent implements OnChanges, OnInit {
this.progressBar.animate(value / 100); this.progressBar.animate(value / 100);
if (value > 0) { if (value > 0 && this.showText) {
this.progressBar.setText(Math.round(value) + '%'); this.progressBar.setText(Math.round(value) + '%');
} }
} }

5
src/Squidex/app/framework/angular/forms/slider.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, ElementRef, forwardRef, Input, Renderer2, ViewChild } from '@angular/core'; import { ChangeDetectionStrategy, Component, ElementRef, forwardRef, Input, Renderer2, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Types } from '@app/framework/internal'; import { Types } from '@app/framework/internal';
@ -18,7 +18,8 @@ export const SQX_SLIDER_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-slider', selector: 'sqx-slider',
styleUrls: ['./slider.component.scss'], styleUrls: ['./slider.component.scss'],
templateUrl: './slider.component.html', templateUrl: './slider.component.html',
providers: [SQX_SLIDER_CONTROL_VALUE_ACCESSOR] providers: [SQX_SLIDER_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SliderComponent implements ControlValueAccessor { export class SliderComponent implements ControlValueAccessor {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

5
src/Squidex/app/framework/angular/forms/stars.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, forwardRef, Input } from '@angular/core'; import { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Types } from '@app/framework/internal'; import { Types } from '@app/framework/internal';
@ -18,7 +18,8 @@ export const SQX_STARS_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-stars', selector: 'sqx-stars',
styleUrls: ['./stars.component.scss'], styleUrls: ['./stars.component.scss'],
templateUrl: './stars.component.html', templateUrl: './stars.component.html',
providers: [SQX_STARS_CONTROL_VALUE_ACCESSOR] providers: [SQX_STARS_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class StarsComponent implements ControlValueAccessor { export class StarsComponent implements ControlValueAccessor {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

5
src/Squidex/app/framework/angular/forms/tag-editor.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { distinctUntilChanged, map, tap } from 'rxjs/operators'; import { distinctUntilChanged, map, tap } from 'rxjs/operators';
@ -75,7 +75,8 @@ export const SQX_TAG_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-tag-editor', selector: 'sqx-tag-editor',
styleUrls: ['./tag-editor.component.scss'], styleUrls: ['./tag-editor.component.scss'],
templateUrl: './tag-editor.component.html', templateUrl: './tag-editor.component.html',
providers: [SQX_TAG_EDITOR_CONTROL_VALUE_ACCESSOR] providers: [SQX_TAG_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class TagEditorComponent implements AfterViewInit, ControlValueAccessor, OnDestroy, OnInit { export class TagEditorComponent implements AfterViewInit, ControlValueAccessor, OnDestroy, OnInit {
private subscription: Subscription; private subscription: Subscription;

5
src/Squidex/app/framework/angular/forms/toggle.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, forwardRef } from '@angular/core'; import { ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Types } from '@app/framework/internal'; import { Types } from '@app/framework/internal';
@ -18,7 +18,8 @@ export const SQX_TOGGLE_CONTROL_VALUE_ACCESSOR: any = {
selector: 'sqx-toggle', selector: 'sqx-toggle',
styleUrls: ['./toggle.component.scss'], styleUrls: ['./toggle.component.scss'],
templateUrl: './toggle.component.html', templateUrl: './toggle.component.html',
providers: [SQX_TOGGLE_CONTROL_VALUE_ACCESSOR] providers: [SQX_TOGGLE_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class ToggleComponent implements ControlValueAccessor { export class ToggleComponent implements ControlValueAccessor {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

7
src/Squidex/app/shared/components/app-form.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { import {
@ -18,7 +18,8 @@ import {
@Component({ @Component({
selector: 'sqx-app-form', selector: 'sqx-app-form',
styleUrls: ['./app-form.component.scss'], styleUrls: ['./app-form.component.scss'],
templateUrl: './app-form.component.html' templateUrl: './app-form.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class AppFormComponent { export class AppFormComponent {
@Output() @Output()
@ -46,7 +47,7 @@ export class AppFormComponent {
const request = new CreateAppDto(value.name, this.template); const request = new CreateAppDto(value.name, this.template);
this.appsStore.create(request) this.appsStore.create(request)
.subscribe(dto => { .subscribe(() => {
this.complete(); this.complete();
}, error => { }, error => {
this.createForm.submitFailed(error); this.createForm.submitFailed(error);

4
src/Squidex/app/shared/components/asset.component.html

@ -130,9 +130,7 @@
</div> </div>
<div class="upload-progress" *ngIf="progress > 0"> <div class="upload-progress" *ngIf="progress > 0">
<div class="progress-background"> <sqx-progress-bar [value]="50" [trailWidth]="0.8" [strokeWidth]="0.8" [showText]="false"></sqx-progress-bar>
<div class="progress-bar" [style.width]="(progress + 40) + '%'"></div>
</div>
</div> </div>
<div class="drop-overlay align-items-center justify-content-center" *ngIf="asset && progress === 0"> <div class="drop-overlay align-items-center justify-content-center" *ngIf="asset && progress === 0">

20
src/Squidex/app/shared/components/asset.component.scss

@ -254,6 +254,10 @@ $list-height: 2.375rem;
min-width: 12rem; min-width: 12rem;
} }
} }
.upload-progress {
padding: .25rem 0;
}
} }
.drop-overlay { .drop-overlay {
@ -279,22 +283,6 @@ $list-height: 2.375rem;
} }
} }
.progress {
&-background {
background: $color-border;
margin: (($list-height - .25rem) / 2) 0;
}
&-bar {
background: $color-theme-blue;
}
&-background,
&-bar {
height: .25rem;
}
}
.selectable { .selectable {
cursor: pointer; cursor: pointer;
} }

24
src/Squidex/app/shared/components/asset.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, EventEmitter, HostBinding, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, HostBinding, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { FormBuilder, FormControl } from '@angular/forms'; import { FormBuilder, FormControl } from '@angular/forms';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@ -31,7 +31,8 @@ import {
templateUrl: './asset.component.html', templateUrl: './asset.component.html',
animations: [ animations: [
fadeAnimation fadeAnimation
] ],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class AssetComponent implements OnDestroy, OnInit { export class AssetComponent implements OnDestroy, OnInit {
private tagSubscription: Subscription; private tagSubscription: Subscription;
@ -91,6 +92,7 @@ export class AssetComponent implements OnDestroy, OnInit {
private readonly appsState: AppsState, private readonly appsState: AppsState,
private readonly assetsService: AssetsService, private readonly assetsService: AssetsService,
private readonly authState: AuthService, private readonly authState: AuthService,
private readonly changeDetector: ChangeDetectorRef,
private readonly dialogs: DialogService, private readonly dialogs: DialogService,
private readonly formBuilder: FormBuilder private readonly formBuilder: FormBuilder
) { ) {
@ -105,7 +107,7 @@ export class AssetComponent implements OnDestroy, OnInit {
if (Types.is(dto, AssetDto)) { if (Types.is(dto, AssetDto)) {
this.emitLoaded(dto); this.emitLoaded(dto);
} else { } else {
this.progress = dto; this.setProgress(dto);
} }
}, error => { }, error => {
this.dialogs.notifyError(error); this.dialogs.notifyError(error);
@ -145,7 +147,7 @@ export class AssetComponent implements OnDestroy, OnInit {
}, error => { }, error => {
this.dialogs.notifyError(error); this.dialogs.notifyError(error);
this.setProgress(); this.setProgress(0);
}); });
} }
} }
@ -159,8 +161,6 @@ export class AssetComponent implements OnDestroy, OnInit {
this.assetsService.putAsset(this.appsState.appName, this.asset.id, requestDto, this.asset.version) this.assetsService.putAsset(this.appsState.appName, this.asset.id, requestDto, this.asset.version)
.subscribe(dto => { .subscribe(dto => {
this.updateAsset(this.asset.rename(requestDto.fileName, this.authState.user!.token, dto.version), true); this.updateAsset(this.asset.rename(requestDto.fileName, this.authState.user!.token, dto.version), true);
this.renameCancel();
}, error => { }, error => {
this.dialogs.notifyError(error); this.dialogs.notifyError(error);
@ -194,10 +194,6 @@ export class AssetComponent implements OnDestroy, OnInit {
this.renaming = false; this.renaming = false;
} }
private setProgress(progress = 0) {
this.progress = progress;
}
private emitFailed(error: any) { private emitFailed(error: any) {
this.failed.emit(error); this.failed.emit(error);
} }
@ -210,6 +206,12 @@ export class AssetComponent implements OnDestroy, OnInit {
this.updated.emit(asset); this.updated.emit(asset);
} }
private setProgress(progress: number) {
this.progress = progress;
this.changeDetector.markForCheck();
}
private updateAsset(asset: AssetDto, emitEvent: boolean) { private updateAsset(asset: AssetDto, emitEvent: boolean) {
this.asset = asset; this.asset = asset;
this.progress = 0; this.progress = 0;
@ -221,5 +223,7 @@ export class AssetComponent implements OnDestroy, OnInit {
} }
this.renameCancel(); this.renameCancel();
this.changeDetector.markForCheck();
} }
} }

5
src/Squidex/app/shared/components/assets-list.component.ts

@ -7,7 +7,7 @@
// tslint:disable:prefer-for-of // tslint:disable:prefer-for-of
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { onErrorResumeNext } from 'rxjs/operators'; import { onErrorResumeNext } from 'rxjs/operators';
import { import {
@ -19,7 +19,8 @@ import {
@Component({ @Component({
selector: 'sqx-assets-list', selector: 'sqx-assets-list',
styleUrls: ['./assets-list.component.scss'], styleUrls: ['./assets-list.component.scss'],
templateUrl: './assets-list.component.html' templateUrl: './assets-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class AssetsListComponent { export class AssetsListComponent {
public newFiles = ImmutableArray.empty<File>(); public newFiles = ImmutableArray.empty<File>();

5
src/Squidex/app/shared/components/assets-selector.component.ts

@ -7,7 +7,7 @@
// tslint:disable:prefer-for-of // tslint:disable:prefer-for-of
import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, OnInit, Output } from '@angular/core';
import { onErrorResumeNext } from 'rxjs/operators'; import { onErrorResumeNext } from 'rxjs/operators';
import { import {
@ -23,7 +23,8 @@ import {
templateUrl: './assets-selector.component.html', templateUrl: './assets-selector.component.html',
animations: [ animations: [
fadeAnimation fadeAnimation
] ],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class AssetsSelectorComponent implements OnInit { export class AssetsSelectorComponent implements OnInit {
public selectedAssets: { [id: string]: AssetDto } = {}; public selectedAssets: { [id: string]: AssetDto } = {};

5
src/Squidex/app/shared/components/geolocation-editor.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Component, ElementRef, forwardRef, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, forwardRef, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms';
import { import {
@ -31,7 +31,8 @@ interface Geolocation {
selector: 'sqx-geolocation-editor', selector: 'sqx-geolocation-editor',
styleUrls: ['./geolocation-editor.component.scss'], styleUrls: ['./geolocation-editor.component.scss'],
templateUrl: './geolocation-editor.component.html', templateUrl: './geolocation-editor.component.html',
providers: [SQX_GEOLOCATION_EDITOR_CONTROL_VALUE_ACCESSOR] providers: [SQX_GEOLOCATION_EDITOR_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class GeolocationEditorComponent implements ControlValueAccessor, AfterViewInit { export class GeolocationEditorComponent implements ControlValueAccessor, AfterViewInit {
private callChange = (v: any) => { /* NOOP */ }; private callChange = (v: any) => { /* NOOP */ };

5
src/Squidex/app/shared/components/help.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component } from '@angular/core'; import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { HelpService } from '@app/shared/internal'; import { HelpService } from '@app/shared/internal';
@ -13,7 +13,8 @@ import { HelpService } from '@app/shared/internal';
@Component({ @Component({
selector: 'sqx-help', selector: 'sqx-help',
styleUrls: ['./help.component.scss'], styleUrls: ['./help.component.scss'],
templateUrl: './help.component.html' templateUrl: './help.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class HelpComponent { export class HelpComponent {
public helpSections = public helpSections =

5
src/Squidex/app/shared/components/history-list.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component, Input } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
@ -17,7 +17,8 @@ import {
@Component({ @Component({
selector: 'sqx-history-list', selector: 'sqx-history-list',
styleUrls: ['./history-list.component.scss'], styleUrls: ['./history-list.component.scss'],
templateUrl: './history-list.component.html' templateUrl: './history-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class HistoryListComponent { export class HistoryListComponent {
@Input() @Input()

7
src/Squidex/app/shared/components/history.component.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Component } from '@angular/core'; import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { merge, Observable, timer } from 'rxjs'; import { merge, Observable, timer } from 'rxjs';
import { delay, switchMap } from 'rxjs/operators'; import { delay, switchMap } from 'rxjs/operators';
@ -22,7 +22,8 @@ import {
@Component({ @Component({
selector: 'sqx-history', selector: 'sqx-history',
styleUrls: ['./history.component.scss'], styleUrls: ['./history.component.scss'],
templateUrl: './history.component.html' templateUrl: './history.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class HistoryComponent { export class HistoryComponent {
private readonly channel = this.calculateChannel(); private readonly channel = this.calculateChannel();
@ -32,7 +33,7 @@ export class HistoryComponent {
timer(0, 10000), timer(0, 10000),
this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000)) this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000))
).pipe( ).pipe(
switchMap(app => this.historyService.getHistory(this.appsState.appName, this.channel))); switchMap(() => this.historyService.getHistory(this.appsState.appName, this.channel)));
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,

Loading…
Cancel
Save