ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
32 lines (28 loc) • 787 B
text/typescript
import { Component } from '@angular/core';
import { SFDateWidgetSchema, SFSchema } from '@ohayo/form';
import subWeeks from 'date-fns/subWeeks';
import { NzMessageService } from 'ng-zorro-antd/message';
({
selector: 'app-demo',
template: ` <sf [schema]="schema" (formSubmit)="submit($event)"></sf> `,
})
export class DemoComponent {
schema: SFSchema = {
properties: {
start: {
type: 'string',
ui: { widget: 'date', end: 'end' } as SFDateWidgetSchema,
default: new Date(),
},
end: {
type: 'string',
default: subWeeks(new Date(), 6),
},
},
required: ['start'],
};
constructor(private msg: NzMessageService) { }
submit(value: {}): void {
this.msg.success(JSON.stringify(value));
}
}