Consolidate property control menu into own component

This commit is contained in:
Julian Stirling 2026-07-01 14:57:28 +01:00
parent a2ebed1006
commit 697a121275
6 changed files with 109 additions and 161 deletions

View file

@ -315,6 +315,12 @@
cursor: pointer; cursor: pointer;
color: @global-color; color: @global-color;
} }
.ofm-hidden-link.disabled{
cursor: default;
color: @global-muted-color;
}
.hook-inverse() { .hook-inverse() {
.ofm-hidden-link{ .ofm-hidden-link{
color: @inverse-global-color; color: @inverse-global-color;

View file

@ -1,9 +1,9 @@
<template> <template>
<a class="sync-button" @click.prevent="$emit('click')"> <a class="sync-button" :class="{ disabled: disabled }" @click.prevent="$emit('click')">
<span class="material-symbols-outlined sync-icon"> <span class="material-symbols-outlined sync-icon">
{{ icon }} {{ icon }}
</span> </span>
<span v-if="showLabel" class="icon-label ofm-hidden-link"> <span v-if="showLabel" class="icon-label ofm-hidden-link" :class="{ disabled: disabled }">
{{ label }} {{ label }}
</span> </span>
</a> </a>
@ -16,7 +16,7 @@ export default {
props: { props: {
icon: { icon: {
type: String, type: String,
default: "sync", default: "sync_alt",
}, },
showLabel: { showLabel: {
type: Boolean, type: Boolean,
@ -26,6 +26,10 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
disabled: {
type: Boolean,
default: false,
},
}, },
emits: ["click"], emits: ["click"],
@ -44,15 +48,21 @@ export default {
text-decoration: none !important; text-decoration: none !important;
} }
.material-symbols-outlined.sync-icon { .sync-button.disabled {
color: #888; cursor: default;
transition:
transform 0.3s ease,
color 0.3s ease;
} }
.material-symbols-outlined.sync-icon:hover { .sync-button .material-symbols-outlined.sync-icon {
transform: rotate(-90deg); color: #888;
transition: color 0.3s ease;
}
.sync-button.disabled .material-symbols-outlined.sync-icon {
color: #aaa;
transition: color 0.3s ease;
}
.sync-button:not(.disabled):hover .material-symbols-outlined.sync-icon {
color: #c5247f; color: #c5247f;
text-decoration: none !important; text-decoration: none !important;
} }

View file

@ -56,7 +56,7 @@ export default {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 4px; border-radius: 4px;
max-height: 250px; max-height: 250px;
width: 200px; width: 180px;
overflow-y: auto; overflow-y: auto;
z-index: 1000; z-index: 1000;
padding-top: 5px; padding-top: 5px;

View file

@ -14,30 +14,11 @@
{{ display }} {{ display }}
</option> </option>
</select> </select>
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'number'"> <label v-if="!useDropdown && dataType == 'number'">
@ -69,30 +50,11 @@
</button> </button>
</div> </div>
</div> </div>
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</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">
@ -109,30 +71,11 @@
{{ label }} {{ label }}
</span> </span>
</label> </label>
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</div> </div>
<label v-if="!useDropdown && dataType == 'number_array'"> <label v-if="!useDropdown && dataType == 'number_array'">
<span class="uk-form-label" :class="{ 'ofm-highlighted-label': isChangedFomDefault }"> <span class="uk-form-label" :class="{ 'ofm-highlighted-label': isChangedFomDefault }">
@ -152,30 +95,11 @@
@keydown="keyDown" @keydown="keyDown"
@animationend="animationEnd" @animationend="animationEnd"
/> />
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'number_object'"> <label v-if="!useDropdown && dataType == 'number_object'">
@ -196,30 +120,11 @@
@keydown="keyDown" @keydown="keyDown"
@animationend="animationEnd" @animationend="animationEnd"
/> />
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</div> </div>
</div> </div>
</label> </label>
@ -238,30 +143,11 @@
@keydown="keyDown" @keydown="keyDown"
@animationend="animationEnd" @animationend="animationEnd"
/> />
<mini-menu v-slot="{ close }"> <property-control-menu
<p> :can-reset="isChangedFomDefault"
<icon-button @reset-default="resetDefault"
icon="refresh" @request-update="requestUpdate"
:show-label="true" />
label="Reset to default"
@click="
resetDefault();
close();
"
/>
</p>
<p>
<icon-button
icon="sync"
:show-label="true"
label="Re-sync value"
@click="
requestUpdate;
close();
"
/>
</p>
</mini-menu>
</div> </div>
</label> </label>
<label v-if="!useDropdown && dataType == 'other'"> <label v-if="!useDropdown && dataType == 'other'">
@ -281,15 +167,13 @@
</template> </template>
<script> <script>
import iconButton from "@/components/genericComponents/iconButton.vue"; import PropertyControlMenu from "./propertyControlMenu.vue";
import MiniMenu from "@/components/genericComponents/miniMenu.vue";
export default { export default {
name: "InputFromSchema", name: "InputFromSchema",
components: { components: {
iconButton, PropertyControlMenu,
MiniMenu,
}, },
props: { props: {
dataSchema: { dataSchema: {
@ -322,7 +206,7 @@ export default {
}, },
}, },
emits: ["requestUpdate", "resetDefault", "sendValue", "animationShown"], emits: ["requestUpdate", "sendValue", "animationShown"],
compatConfig: { COMPONENT_V_MODEL: false }, compatConfig: { COMPONENT_V_MODEL: false },

View file

@ -0,0 +1,48 @@
<template>
<mini-menu v-slot="{ close }">
<p>
<icon-button
icon="refresh"
:show-label="true"
label="Reset to default"
:disabled="!canReset"
@click="
$emit('reset-default');
close();
"
/>
</p>
<p>
<icon-button
icon="sync_alt"
:show-label="true"
label="Re-sync value"
@click="
$emit('request-update');
close();
"
/>
</p>
</mini-menu>
</template>
<script>
import iconButton from "@/components/genericComponents/iconButton.vue";
import MiniMenu from "@/components/genericComponents/miniMenu.vue";
export default {
name: "PropertyControlMenu",
components: {
iconButton,
MiniMenu,
},
props: {
canReset: {
type: Boolean,
default: null,
},
},
emits: ["request-update", "reset-default"],
};
</script>

View file

@ -22,7 +22,7 @@ and zero position buttons. It also includes the d-pad.
type="number" type="number"
@keyup.enter="startMoveTask" @keyup.enter="startMoveTask"
/> />
<icon-button icon="sync" @click="updatePosition" /> <icon-button icon="sync_alt" @click="updatePosition" />
</div> </div>
<p> <p>
<action-button <action-button