本文整理汇总了TypeScript中@nakedobjects/view-models.FieldViewModel类的典型用法代码示例。如果您正苦于以下问题:TypeScript FieldViewModel类的具体用法?TypeScript FieldViewModel怎么用?TypeScript FieldViewModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FieldViewModel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: dropOn
export function dropOn(draggableVm: IDraggableViewModel, droppable: FieldViewModel, component: { canDrop: boolean, control: AbstractControl }) {
if (component.canDrop) {
droppable.drop(draggableVm)
.then((success) => {
component.control.setValue(droppable.selectedChoice);
});
}
}
示例2: paste
export function paste(event: KeyboardEvent, droppable: FieldViewModel, component: { control: AbstractControl }, get: () => IDraggableViewModel | null, clear: () => void) {
const vKeyCode = 86;
const deleteKeyCode = 46;
if (event && (event.keyCode === vKeyCode && event.ctrlKey)) {
const cvm = get();
if (cvm) {
droppable.drop(cvm)
.then((success) => {
component.control.setValue(droppable.selectedChoice);
});
event.preventDefault();
}
}
if (event && event.keyCode === deleteKeyCode) {
clear();
}
}
示例3: handleInvalidTimeEvent
handleInvalidTimeEvent(data: string) {
if (this.control) {
this.control.setValue('');
this.model.setInvalidTime();
this.model.clientValid = false;
this.control.setErrors({ [this.model.getMessage()]: true });
}
}
示例4: handleTimeClearedEvent
handleTimeClearedEvent() {
if (this.control) {
this.model.resetMessage();
this.model.clientValid = true;
this.control.setValue('');
}
}
示例5: setValueIfChanged
setValueIfChanged(time: string) {
const oldValue = this.control.value;
const newValue = time ? time : '';
if (newValue !== oldValue) {
this.model.resetMessage();
this.model.clientValid = true;
this.control.setValue(newValue);
}
}