|
|
@ -8,6 +8,7 @@ |
|
|
// tslint:disable:prefer-for-of
|
|
|
// tslint:disable:prefer-for-of
|
|
|
|
|
|
|
|
|
import { FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'; |
|
|
import { FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'; |
|
|
|
|
|
import { BehaviorSubject } from 'rxjs'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
DateTime, |
|
|
DateTime, |
|
|
@ -15,8 +16,7 @@ import { |
|
|
formControls, |
|
|
formControls, |
|
|
ImmutableArray, |
|
|
ImmutableArray, |
|
|
Types, |
|
|
Types, |
|
|
ValidatorsEx, |
|
|
ValidatorsEx |
|
|
value$ |
|
|
|
|
|
} from '@app/framework'; |
|
|
} from '@app/framework'; |
|
|
|
|
|
|
|
|
import { ContentDto, ContentReferencesValue } from '../services/contents.service'; |
|
|
import { ContentDto, ContentReferencesValue } from '../services/contents.service'; |
|
|
@ -53,8 +53,7 @@ export class SaveQueryForm extends Form<FormGroup, any> { |
|
|
[ |
|
|
[ |
|
|
Validators.required |
|
|
Validators.required |
|
|
] |
|
|
] |
|
|
], |
|
|
] |
|
|
user: false |
|
|
|
|
|
})); |
|
|
})); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -346,9 +345,9 @@ export class FieldDefaultValue implements FieldPropertiesVisitor<any> { |
|
|
const now = this.now || DateTime.now(); |
|
|
const now = this.now || DateTime.now(); |
|
|
|
|
|
|
|
|
if (properties.calculatedDefaultValue === 'Now') { |
|
|
if (properties.calculatedDefaultValue === 'Now') { |
|
|
return `${now.toUTCStringFormat('YYYY-MM-DDTHH:mm:ss')}Z`; |
|
|
return now.toUTCStringFormat('YYYY-MM-DDTHH:mm:ss') + 'Z'; |
|
|
} else if (properties.calculatedDefaultValue === 'Today') { |
|
|
} else if (properties.calculatedDefaultValue === 'Today') { |
|
|
return `${now.toUTCStringFormat('YYYY-MM-DD')}T00:00:00Z`; |
|
|
return now.toUTCStringFormat('YYYY-MM-DD'); |
|
|
} else { |
|
|
} else { |
|
|
return properties.defaultValue; |
|
|
return properties.defaultValue; |
|
|
} |
|
|
} |
|
|
@ -425,13 +424,17 @@ export class EditContentForm extends Form<FormGroup, any> { |
|
|
private readonly partitions: PartitionConfig; |
|
|
private readonly partitions: PartitionConfig; |
|
|
private initialData: any; |
|
|
private initialData: any; |
|
|
|
|
|
|
|
|
public value = value$(this.form); |
|
|
public value = new BehaviorSubject<any>(this.form.value); |
|
|
|
|
|
|
|
|
constructor(languages: ImmutableArray<AppLanguageDto>, |
|
|
constructor(languages: ImmutableArray<AppLanguageDto>, |
|
|
private readonly schema: SchemaDetailsDto |
|
|
private readonly schema: SchemaDetailsDto |
|
|
) { |
|
|
) { |
|
|
super(new FormGroup({})); |
|
|
super(new FormGroup({})); |
|
|
|
|
|
|
|
|
|
|
|
this.form.valueChanges.subscribe(value => { |
|
|
|
|
|
this.value.next(value); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
this.partitions = new PartitionConfig(languages); |
|
|
this.partitions = new PartitionConfig(languages); |
|
|
|
|
|
|
|
|
for (const field of schema.fields) { |
|
|
for (const field of schema.fields) { |
|
|
@ -563,6 +566,10 @@ export class EditContentForm extends Form<FormGroup, any> { |
|
|
if (isInitial) { |
|
|
if (isInitial) { |
|
|
this.extractPrevData(); |
|
|
this.extractPrevData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.value.subscribe(x => { |
|
|
|
|
|
JSON.stringify(x); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public submitCompleted(options?: { newValue?: any, noReset?: boolean }) { |
|
|
public submitCompleted(options?: { newValue?: any, noReset?: boolean }) { |
|
|
|