Add visual feedback that properties have changed from default

This commit is contained in:
Julian Stirling 2026-07-01 12:17:19 +01:00
parent 6ae8f8d970
commit ace42bcf2e
2 changed files with 64 additions and 12 deletions

View file

@ -15,6 +15,8 @@
@darkened-primary-color: darken(@global-primary-background, 15%); @darkened-primary-color: darken(@global-primary-background, 15%);
@inverse-global-color: fade(@global-inverse-color, 80%); @inverse-global-color: fade(@global-inverse-color, 80%);
@very-light-primary-color: lighten(@global-primary-background, 40%);
@global-border: #d5d5d5; @global-border: #d5d5d5;
// UIkit // UIkit
@ -265,6 +267,22 @@
} }
} }
/*
* Text
*/
// A text label for an input control that is highlighted
.ofm-highlighted-label {
color: @darkened-primary-color;
font-weight: 500;
}
.hook-inverse() {
.ofm-highlighted-label{
color: @very-light-primary-color;
}
}
/* /*
* Links * Links

View file

@ -1,6 +1,10 @@
<template> <template>
<div> <div>
<label v-if="useDropdown" class="uk-form-label"> <label
v-if="useDropdown"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }} {{ label }}
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<select <select
@ -15,8 +19,12 @@
<sync-property-button @click="requestUpdate" /> <sync-property-button @click="requestUpdate" />
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'number'" class="uk-form-label" <label
>{{ label }} v-if="!useDropdown && dataType == 'number'"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }}
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<div class="uk-inline number-wrapper"> <div class="uk-inline number-wrapper">
<input <input
@ -46,7 +54,10 @@
</div> </div>
</label> </label>
<div v-if="!useDropdown && dataType == 'boolean'" class="input-and-buttons-container"> <div v-if="!useDropdown && dataType == 'boolean'" class="input-and-buttons-container">
<label class="uk-form-label property-input"> <label
class="uk-form-label property-input"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
<input <input
ref="checkbox" ref="checkbox"
v-model="internalValue" v-model="internalValue"
@ -59,8 +70,12 @@
</label> </label>
<sync-property-button @click="requestUpdate" /> <sync-property-button @click="requestUpdate" />
</div> </div>
<label v-if="!useDropdown && dataType == 'number_array'" class="uk-form-label" <label
>{{ label }} v-if="!useDropdown && dataType == 'number_array'"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }}
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-for="i in valueLength" v-for="i in valueLength"
@ -78,8 +93,12 @@
<sync-property-button @click="requestUpdate" /> <sync-property-button @click="requestUpdate" />
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'number_object'" class="uk-form-label" <label
>{{ label }} v-if="!useDropdown && dataType == 'number_object'"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }}
<div v-for="(val, key) in modelValue" :key="key"> <div v-for="(val, key) in modelValue" :key="key">
<label>{{ internalLabels[key] }}</label> <label>{{ internalLabels[key] }}</label>
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
@ -98,8 +117,12 @@
</div> </div>
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'string'" class="uk-form-label" <label
>{{ label }} v-if="!useDropdown && dataType == 'string'"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }}
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-model="internalValue" v-model="internalValue"
@ -114,8 +137,12 @@
<sync-property-button @click="requestUpdate" /> <sync-property-button @click="requestUpdate" />
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'other'" class="uk-form-label" <label
>{{ label }} v-if="!useDropdown && dataType == 'other'"
class="uk-form-label"
:class="{ 'ofm-highlighted-label': isChangedFomDefault }"
>
{{ label }}
<div class="input-and-buttons-container"> <div class="input-and-buttons-container">
<input <input
v-model="internalValue" v-model="internalValue"
@ -267,6 +294,13 @@ export default {
if (this.dataType !== "number") return undefined; if (this.dataType !== "number") return undefined;
return this.dataSchema.minimum; return this.dataSchema.minimum;
}, },
/**
* Is changed from default (or has no default set)
*/
isChangedFomDefault() {
if (this.dataSchema.default === undefined) return false;
return this.dataSchema.default !== this.modelValue;
},
/** /**
* The step size for numerical spinners. * The step size for numerical spinners.
* *