25 lines
803 B
TypeScript
25 lines
803 B
TypeScript
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator';
|
|
import { Measure, MeasureConfig, MeasureType, Measurement, MeasurementMeta } from '@/models';
|
|
|
|
@Component({})
|
|
export class SimpleEntry extends Vue {
|
|
@Prop() public measure!: Measure<MeasureConfig>;
|
|
@Prop() public value!: Measurement<MeasurementMeta>;
|
|
@Prop() public disabled!: boolean;
|
|
private editTimestamp: boolean = false;
|
|
|
|
@Watch('value', { immediate: true, deep: true })
|
|
@Emit('input')
|
|
private onMeasurementChanged(newVal: Measurement<MeasurementMeta>, oldVal: Measurement<MeasurementMeta>) {
|
|
newVal.extData.measureType = 'simple' as MeasureType;
|
|
|
|
if (typeof(newVal.value) === 'string' ) {
|
|
newVal.value = parseInt(newVal.value, 10);
|
|
}
|
|
return newVal;
|
|
}
|
|
|
|
}
|
|
|
|
export default SimpleEntry;
|