lvl++
class StarRatingDefinition extends DorfFieldDefinition<number> { /*...*/ }
class StarRatingMetadata extends DorfFieldMetadata<number, StarRatingDefinition> { /*...*/ }
class StarRatingComponent extends AbstractDorfFieldComponent<number, StarRatingMetadata> { /*...*/ }
// @DorfForm()
export function DorfForm(options?: IDorfFormOptions) { return function <D extends Function>(targetConstructor: D) { Object .defineProperties(targetConstructor.prototype, { /* props */ }); } }
import { Input } from '@angular/core';
export function DorfObjectInput() { return function (targetProto: any, propName: string) { Input()(targetProto, propName); targetProto.dorfObjectInForm = propName; }; }
@View
and @Component
// @Component on the subclass
export abstract class AbstractDorfFieldComponent<T,
M extends DorfFieldMetadata<T, IDorfFieldDefinition<T>>> {
@Input()
metadata: M;
/* ... */
}
export type InputType = 'color' | 'date' | 'datetime' | 'email' | /* ... */;
export interface IDorfInputDefinition<T> extends IDorfFieldDefinition<T> {
type: InputType;
}
setDomainObjValue: (val: DomObj[keyof DomObj]) => { obj[propertyName] = val; }
// order is defined as order?: number;
get order(): number | undefined { return this.definition.order; }
dorf/config
karma
ts
webpack
"test": "karma start config/karma/conf.js"
webpackConfig = require('../webpack/tests')
Prio | What | How |
---|---|---|
1 | Visibility at npmjs.com | Frequent updates (maintenance) |
2 | Nice README | Quick win + online examples |
3 | Documentation | Existing and visible just in case |
4 | Downloadable examples | Inside the repo |
5 | Clean source code | The less important part, but e.g. the documentation is a consequence of the code |