mirror of https://github.com/Squidex/squidex.git
Browse Source
* Array editor virtualization. * Mini improvement. * Some refactorings. * Fix imports.pull/855/head
committed by
GitHub
66 changed files with 1605 additions and 329 deletions
File diff suppressed because it is too large
@ -0,0 +1,43 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Pipe, PipeTransform } from '@angular/core'; |
|||
import { SimulatedRuleEventDto } from '@app/shared'; |
|||
|
|||
@Pipe({ |
|||
name: 'sqxRuleClass', |
|||
pure: true, |
|||
}) |
|||
export class RuleClassPipe implements PipeTransform { |
|||
public transform(value: string) { |
|||
if (value === 'Retry' || value === 'Skipped') { |
|||
return 'warning'; |
|||
} else if (value === 'Failed' || value === 'Cancelled') { |
|||
return 'danger'; |
|||
} else if (value === 'Pending') { |
|||
return 'secondary'; |
|||
} else { |
|||
return value.toLowerCase(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Pipe({ |
|||
name: 'sqxSimulatedRuleEventStatus', |
|||
pure: true, |
|||
}) |
|||
export class SimulatedRuleEventStatusPipe implements PipeTransform { |
|||
public transform(value: SimulatedRuleEventDto) { |
|||
if (value.error) { |
|||
return 'Failed'; |
|||
} else if (value.skipReasons.length > 0) { |
|||
return 'Skipped'; |
|||
} else { |
|||
return 'Success'; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; |
|||
|
|||
@Directive({ |
|||
selector: '[sqxIfOnce]', |
|||
}) |
|||
export class IfOnceDirective { |
|||
private hasView = false; |
|||
|
|||
@Input('sqxIfOnce') |
|||
public set condition(value: boolean) { |
|||
if (value && !this.hasView) { |
|||
this.viewContainer.createEmbeddedView(this.templateRef); |
|||
|
|||
this.hasView = true; |
|||
} |
|||
} |
|||
|
|||
constructor( |
|||
private templateRef: TemplateRef<any>, |
|||
private viewContainer: ViewContainerRef, |
|||
) { |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
/* |
|||
* Squidex Headless CMS |
|||
* |
|||
* @license |
|||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|||
*/ |
|||
|
|||
import { Pipe, PipeTransform } from '@angular/core'; |
|||
|
|||
@Pipe({ |
|||
name: 'sqxJoin', |
|||
pure: true, |
|||
}) |
|||
export class JoinPipe implements PipeTransform { |
|||
public transform(value: ReadonlyArray<string>) { |
|||
return value?.join(', ') || ''; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue