fix: hide label of textarea in right side panel + align switch to the left

This commit is contained in:
Rizumu Ayaka
2026-01-23 21:19:54 +08:00
parent f647c8f9ee
commit c38e0c2ffe
2 changed files with 13 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
<template> <template>
<FloatLabel <FloatLabel
variant="in" variant="in"
:unstyled="hideLayoutField"
:class=" :class="
cn( cn(
'rounded-lg space-y-1 focus-within:ring focus-within:ring-component-node-widget-background-highlighted transition-all', 'rounded-lg space-y-1 focus-within:ring focus-within:ring-component-node-widget-background-highlighted transition-all',
@@ -23,14 +24,14 @@
@pointerup.capture.stop @pointerup.capture.stop
@contextmenu.capture.stop @contextmenu.capture.stop
/> />
<label :for="id">{{ displayName }}</label> <label v-if="!hideLayoutField" :for="id">{{ displayName }}</label>
</FloatLabel> </FloatLabel>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import FloatLabel from 'primevue/floatlabel' import FloatLabel from 'primevue/floatlabel'
import Textarea from 'primevue/textarea' import Textarea from 'primevue/textarea'
import { computed, useId } from 'vue' import { computed, inject, useId } from 'vue'
import type { SimplifiedWidget } from '@/types/simplifiedWidget' import type { SimplifiedWidget } from '@/types/simplifiedWidget'
import { cn } from '@/utils/tailwindUtil' import { cn } from '@/utils/tailwindUtil'
@@ -48,6 +49,8 @@ const { widget, placeholder = '' } = defineProps<{
const modelValue = defineModel<string>({ default: '' }) const modelValue = defineModel<string>({ default: '' })
const hideLayoutField = inject<boolean>('hideLayoutField', false)
const filteredProps = computed(() => const filteredProps = computed(() =>
filterWidgetProps(widget.options, INPUT_EXCLUDED_PROPS) filterWidgetProps(widget.options, INPUT_EXCLUDED_PROPS)
) )

View File

@@ -1,6 +1,10 @@
<template> <template>
<WidgetLayoutField :widget> <WidgetLayoutField :widget>
<div class="ml-auto flex w-fit items-center gap-2"> <div
:class="
cn('flex w-fit items-center gap-2', { 'ml-auto': !hideLayoutField })
"
>
<span <span
v-if="stateLabel" v-if="stateLabel"
:class=" :class="
@@ -25,7 +29,7 @@
<script setup lang="ts"> <script setup lang="ts">
import ToggleSwitch from 'primevue/toggleswitch' import ToggleSwitch from 'primevue/toggleswitch'
import { computed } from 'vue' import { computed, inject } from 'vue'
import type { IWidgetOptions } from '@/lib/litegraph/src/types/widgets' import type { IWidgetOptions } from '@/lib/litegraph/src/types/widgets'
import type { SimplifiedWidget } from '@/types/simplifiedWidget' import type { SimplifiedWidget } from '@/types/simplifiedWidget'
@@ -43,6 +47,8 @@ const { widget } = defineProps<{
const modelValue = defineModel<boolean>() const modelValue = defineModel<boolean>()
const hideLayoutField = inject<boolean>('hideLayoutField', false)
const filteredProps = computed(() => const filteredProps = computed(() =>
filterWidgetProps(widget.options, STANDARD_EXCLUDED_PROPS) filterWidgetProps(widget.options, STANDARD_EXCLUDED_PROPS)
) )