2023-08-21 01:51:35 -04:00
|
|
|
<script setup lang="ts">
|
2023-10-17 16:32:59 -04:00
|
|
|
import TooltippedLabel from "@/components/common/pv-tooltipped-label.vue";
|
2023-08-21 01:51:35 -04:00
|
|
|
import { computed } from "vue";
|
|
|
|
|
|
2023-08-31 16:56:58 -04:00
|
|
|
const props = withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
label?: string;
|
|
|
|
|
tooltip?: string;
|
|
|
|
|
// TODO fully update v-model usage in custom components on Vue3 update
|
|
|
|
|
value: number;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
labelCols?: number;
|
|
|
|
|
rules?: ((v: number) => boolean | string)[];
|
|
|
|
|
step?: number;
|
|
|
|
|
}>(),
|
|
|
|
|
{
|
|
|
|
|
disabled: false,
|
|
|
|
|
labelCols: 2,
|
|
|
|
|
step: 1
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-08-21 01:51:35 -04:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2023-08-31 16:56:58 -04:00
|
|
|
(e: "input", value: number): void;
|
2023-08-21 01:51:35 -04:00
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const localValue = computed({
|
|
|
|
|
get: () => props.value,
|
2023-08-31 16:56:58 -04:00
|
|
|
set: (v) => emit("input", parseFloat(v as unknown as string))
|
2023-08-21 01:51:35 -04:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2019-09-28 21:42:04 +03:00
|
|
|
<template>
|
2020-06-26 04:39:14 -07:00
|
|
|
<div>
|
2023-08-31 16:56:58 -04:00
|
|
|
<v-row dense align="center">
|
2023-08-21 01:51:35 -04:00
|
|
|
<v-col :cols="labelCols">
|
2023-08-31 16:56:58 -04:00
|
|
|
<tooltipped-label :tooltip="tooltip" :label="label" />
|
2020-06-26 04:39:14 -07:00
|
|
|
</v-col>
|
|
|
|
|
<v-col>
|
|
|
|
|
<v-text-field
|
|
|
|
|
v-model="localValue"
|
|
|
|
|
dark
|
|
|
|
|
class="mt-0 pt-0"
|
|
|
|
|
hide-details
|
|
|
|
|
single-line
|
2020-07-31 13:50:50 -07:00
|
|
|
color="accent"
|
2020-06-26 04:39:14 -07:00
|
|
|
type="number"
|
|
|
|
|
style="width: 70px"
|
|
|
|
|
:step="step"
|
2020-08-14 12:39:21 -07:00
|
|
|
:disabled="disabled"
|
2020-07-31 13:50:50 -07:00
|
|
|
:rules="rules"
|
2020-06-26 04:39:14 -07:00
|
|
|
/>
|
|
|
|
|
</v-col>
|
|
|
|
|
</v-row>
|
|
|
|
|
</div>
|
2019-09-28 21:42:04 +03:00
|
|
|
</template>
|