import { Component, inject } from '@angular/core';
import { YelonFormModule, SFSchema, SFTextareaWidgetSchema } from '@yelon/form';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'form-textarea-simple',
template: ` <sf [schema]="schema" (formSubmit)="submit($event)" /> `,
standalone: true,
imports: [YelonFormModule]
})
export class FormTextareaSimpleComponent {
private readonly msg = inject(NzMessageService);
schema: SFSchema = {
properties: {
remark: {
type: 'string',
title: '描述',
ui: {
widget: 'textarea',
autosize: { minRows: 2, maxRows: 6 },
change: val => console.log('change', val),
focus: ev => console.log('focus', ev),
blur: ev => console.log('blur', ev)
} as SFTextareaWidgetSchema
},
max: {
type: 'string',
title: 'Max',
ui: {
widget: 'textarea',
maxCharacterCount: 100
} as SFTextareaWidgetSchema
}
}
};
submit(value: {}): void {
this.msg.success(JSON.stringify(value));
}
}