|
|
@ -5,16 +5,10 @@ |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
import { |
|
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; |
|
|
Component, |
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
ElementRef, |
|
|
import { onErrorResumeNext } from 'rxjs/operators'; |
|
|
EventEmitter, |
|
|
|
|
|
Input, |
|
|
|
|
|
OnInit, |
|
|
|
|
|
Output, |
|
|
|
|
|
ViewChild |
|
|
|
|
|
} from "@angular/core"; |
|
|
|
|
|
import { FormBuilder } from "@angular/forms"; |
|
|
|
|
|
import { |
|
|
import { |
|
|
AddFieldForm, |
|
|
AddFieldForm, |
|
|
AppPatternDto, |
|
|
AppPatternDto, |
|
|
@ -29,16 +23,15 @@ import { |
|
|
SchemasState, |
|
|
SchemasState, |
|
|
Types, |
|
|
Types, |
|
|
UpdateFieldDto |
|
|
UpdateFieldDto |
|
|
} from "@app/shared"; |
|
|
} from '@app/shared'; |
|
|
import { onErrorResumeNext } from "rxjs/operators"; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: "sqx-field-wizard", |
|
|
selector: 'sqx-field-wizard', |
|
|
styleUrls: ["./field-wizard.component.scss"], |
|
|
styleUrls: ['./field-wizard.component.scss'], |
|
|
templateUrl: "./field-wizard.component.html" |
|
|
templateUrl: './field-wizard.component.html' |
|
|
}) |
|
|
}) |
|
|
export class FieldWizardComponent implements OnInit { |
|
|
export class FieldWizardComponent implements OnInit { |
|
|
@ViewChild("nameInput") |
|
|
@ViewChild('nameInput') |
|
|
public nameInput: ElementRef; |
|
|
public nameInput: ElementRef; |
|
|
|
|
|
|
|
|
@Input() |
|
|
@Input() |
|
|
@ -59,8 +52,6 @@ export class FieldWizardComponent implements OnInit { |
|
|
public selectedTab = 0; |
|
|
public selectedTab = 0; |
|
|
public patterns: ImmutableArray<AppPatternDto>; |
|
|
public patterns: ImmutableArray<AppPatternDto>; |
|
|
|
|
|
|
|
|
public step = 1; |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private readonly formBuilder: FormBuilder, |
|
|
private readonly formBuilder: FormBuilder, |
|
|
private readonly schemasState: SchemasState, |
|
|
private readonly schemasState: SchemasState, |
|
|
@ -69,7 +60,7 @@ export class FieldWizardComponent implements OnInit { |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
if (this.parent) { |
|
|
if (this.parent) { |
|
|
this.fieldTypes = this.fieldTypes.filter(x => x.type !== "Array"); |
|
|
this.fieldTypes = this.fieldTypes.filter(x => x.type !== 'Array'); |
|
|
} |
|
|
} |
|
|
this.patternsState |
|
|
this.patternsState |
|
|
.load() |
|
|
.load() |
|
|
@ -96,7 +87,7 @@ export class FieldWizardComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
} else if (edit) { |
|
|
} else if (edit) { |
|
|
this.selectTab(0); |
|
|
this.selectTab(0); |
|
|
this.step++; |
|
|
this.isEditing = true; |
|
|
} else { |
|
|
} else { |
|
|
this.complete(); |
|
|
this.complete(); |
|
|
} |
|
|
} |
|
|
@ -117,7 +108,7 @@ export class FieldWizardComponent implements OnInit { |
|
|
|
|
|
|
|
|
if (value) { |
|
|
if (value) { |
|
|
const properties = createProperties( |
|
|
const properties = createProperties( |
|
|
this.field.properties["fieldType"], |
|
|
this.field.properties['fieldType'], |
|
|
value |
|
|
value |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
@ -129,10 +120,9 @@ export class FieldWizardComponent implements OnInit { |
|
|
) |
|
|
) |
|
|
.subscribe( |
|
|
.subscribe( |
|
|
() => { |
|
|
() => { |
|
|
this.isEditing = false; |
|
|
|
|
|
this.editForm.submitCompleted(); |
|
|
this.editForm.submitCompleted(); |
|
|
if (addNew) { |
|
|
if (addNew) { |
|
|
this.step--; |
|
|
this.isEditing = false; |
|
|
} else { |
|
|
} else { |
|
|
this.complete(); |
|
|
this.complete(); |
|
|
} |
|
|
} |
|
|
|