Files
xCLI/templates/view/view.component.ts.hbs
2026-11-10 15:59:29 +03:30

54 lines
1.3 KiB
Handlebars

{{! templates/view/view.component.ts.hbs }}
import {
Component,
ChangeDetectionStrategy,
} from '@angular/core';
import {
getFieldNames,
XExceptionIDs,
isNullOrUndefined,
isNullOrEmptyString,
} from 'x-framework-core';
import {
X__CLASS__Dto,
default__CLASS__Dto,
prepare__CLASS__DtoFields,
} from 'x-saherelm-api-sdk';
import {
VBaseDtoComponent,
VModelFieldDescriptor,
VModelValidationResult,
} from '../../v-dto/v-dto.typings';
@Component({
selector: 'v-__NAME__',
templateUrl: './v-__NAME__.component.html',
styleUrls: ['./v-__NAME__.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class V__CLASS__Component extends VBaseDtoComponent<X__CLASS__Dto> {
readonly defaultModel: X__CLASS__Dto = { ...default__CLASS__Dto };
readonly FieldNames = getFieldNames(this.defaultModel);
defaultFieldDescriptors: VModelFieldDescriptor<any>[] = [
// TODO: Add field descriptors
];
validate(
model?: Partial<X__CLASS__Dto>
): VModelValidationResult<X__CLASS__Dto> {
// TODO: Implement validation
const normalized = this.normalize(model);
return {
isValid: true,
normalized,
isValidForAdd: true,
isValidForUpdate: true,
validationErrors: [],
};
}
prepare(model?: X__CLASS__Dto): X__CLASS__Dto {
return prepare__CLASS__DtoFields(model);
}
}