fantasia-archive/src/components/fields/Field_Number.vue

95 lines
2.3 KiB
Vue
Raw Normal View History

2021-01-31 02:43:13 +13:00
<template>
<div>
<div class="flex justify-start items-center text-weight-bolder q-mb-sm q-mt-md">
2021-02-09 15:21:48 +13:00
<q-icon v-if="inputIcon" :name="inputIcon" :size="inputIcon.includes('fas')? '15px': '20px'" class="q-mr-md" min="1"/>
2021-01-31 02:43:13 +13:00
{{inputDataBluePrint.name}}
2021-03-18 10:26:08 +13:00
<q-icon v-if="toolTip && !disableDocumentToolTips" name="mdi-help-circle" size="16px" class="q-ml-md">
2021-02-26 14:50:46 +13:00
<q-tooltip :delay="500">
2021-02-21 01:06:21 +13:00
<span v-html="toolTip"/>
</q-tooltip>
</q-icon>
2021-01-31 02:43:13 +13:00
</div>
<q-list
v-if="!editMode"
2021-03-08 11:07:40 +13:00
class="fieldNumber_list"
2021-01-31 02:43:13 +13:00
dense>
<q-item>
<q-item-section>
2021-03-08 11:07:40 +13:00
<span class="text-weight-medium">
2021-01-31 02:43:13 +13:00
{{localInput}}
2021-03-08 11:07:40 +13:00
</span>
2021-01-31 02:43:13 +13:00
</q-item-section>
</q-item>
</q-list>
<q-input
v-if="editMode"
v-model.number="localInput"
type="number"
@keyup="signalInput"
2021-03-18 10:26:08 +13:00
:outlined="!isDarkMode"
:filled="isDarkMode"
2021-01-31 02:43:13 +13:00
dense
/>
2021-02-09 15:21:48 +13:00
<div class="separatorWrapper">
2021-03-08 11:07:40 +13:00
<q-separator color="grey q-mt-md" />
2021-02-09 15:21:48 +13:00
</div>
2021-01-31 02:43:13 +13:00
</div>
</template>
<script lang="ts">
import { Component, Emit, Prop, Watch } from "vue-property-decorator"
2021-04-04 09:25:27 +12:00
import FieldBase from "src/components/fields/_FieldBase"
2021-01-31 02:43:13 +13:00
@Component({
components: { }
})
2021-04-04 09:25:27 +12:00
export default class Field_Number extends FieldBase {
/****************************************************************/
// BASIC FIELD DATA
/****************************************************************/
2021-01-31 02:43:13 +13:00
2021-04-04 09:25:27 +12:00
/**
* Already existing value in the input field (IF one is there right now)
*/
@Prop({ default: null }) readonly inputDataValue!: null|number
2021-01-31 02:43:13 +13:00
2021-04-04 09:25:27 +12:00
/****************************************************************/
// INPUT HANDLING
/****************************************************************/
2021-03-18 10:26:08 +13:00
2021-04-04 09:25:27 +12:00
/**
* Watch changes to the prefilled data already existing in the field and update local input accordingly
*/
@Watch("inputDataValue", { deep: true, immediate: true })
reactToInputChanges () {
this.localInput = this.inputDataValue
2021-03-18 10:26:08 +13:00
}
2021-04-04 09:25:27 +12:00
/**
* Model for the local input
*/
localInput: null|number = null
/**
* Signals the input change to the document body parent component
*/
2021-01-31 02:43:13 +13:00
@Emit()
signalInput () {
return this.localInput
}
}
</script>
2021-03-08 11:07:40 +13:00
<style lang='scss'>
.fieldNumber_list {
.q-item {
padding-right: 10px;
padding-left: 10px;
}
}
</style>