evcc-io/assets/js/components/Config/PropertyEntry.vue
Maschga d07a0741ec
chore: use vite+ (#32297)
Co-authored-by: Michael Geers <michael@geers.tv>
2026-07-31 11:43:57 +02:00

74 lines
1.5 KiB
Vue

<template>
<FormRow
:id="id"
:optional="!Required"
:deprecated="Deprecated"
:label="label"
:help="help"
:example="example"
>
<PropertyField
:id="id"
v-model="value"
:masked="Mask"
:property="Name"
:type="Type"
:unit="Unit"
:required="Required"
:pattern="Pattern"
:choice="Choice"
:service-values="serviceValues"
:label="label"
:currency="currency"
/>
</FormRow>
</template>
<script>
/* oxlint-disable vue/prop-name-casing */
import FormRow from "./FormRow.vue";
import PropertyField from "./PropertyField.vue";
export default {
name: "PropertyEntry",
components: { FormRow, PropertyField },
props: {
id: String,
Name: String,
Required: Boolean,
Deprecated: Boolean,
Description: String,
Help: String,
Example: String,
Type: String,
Unit: String,
Mask: Boolean,
Pattern: { type: Object, default: () => ({}) },
Choice: Array,
serviceValues: Array,
modelValue: [String, Number, Boolean, Object],
currency: { type: String, default: "EUR" },
},
emits: ["update:modelValue"],
computed: {
value: {
get() {
return this.modelValue;
},
set(value) {
this.$emit("update:modelValue", value);
},
},
label() {
return this.Description || `[${this.Name}]`;
},
help() {
return this.Description === this.Help ? undefined : this.Help;
},
example() {
// hide example text since config ui doesnt use go duration format (e.g. 5m)
return this.Type === "Duration" ? undefined : this.Example;
},
},
};
</script>