本文整理匯總了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);
}
}