diff --git a/packages/kotti-ui/source/kotti-field-select/hooks/use-select-tippy.ts b/packages/kotti-ui/source/kotti-field-select/hooks/use-select-tippy.ts index 10f362f15e..93efd86654 100644 --- a/packages/kotti-ui/source/kotti-field-select/hooks/use-select-tippy.ts +++ b/packages/kotti-ui/source/kotti-field-select/hooks/use-select-tippy.ts @@ -44,7 +44,7 @@ export const useSelectTippy = (field: KottiField.Hook.Returns) => { isDropdownOpen.value = false }, onShow: () => { - if (field.isDisabled) return false + if (field.isDisabled || field.isLoading) return false // More correct here, don't move to `onShown()` isDropdownMounted.value = true diff --git a/packages/kotti-ui/source/kotti-field-toggle/KtFieldToggle.vue b/packages/kotti-ui/source/kotti-field-toggle/KtFieldToggle.vue index 699b796015..4f3200fc2b 100644 --- a/packages/kotti-ui/source/kotti-field-toggle/KtFieldToggle.vue +++ b/packages/kotti-ui/source/kotti-field-toggle/KtFieldToggle.vue @@ -72,7 +72,8 @@ export default defineComponent({ forceUpdateKey: forceUpdateKey.value, })), onInput: (newValue: boolean | undefined) => { - field.setValue(newValue ?? null) + if (!field.isDisabled && !field.isLoading) + field.setValue(newValue ?? null) forceUpdate() }, diff --git a/packages/kotti-ui/source/kotti-field/hooks.ts b/packages/kotti-ui/source/kotti-field/hooks.ts index 052d6a98c5..c47ba99dad 100644 --- a/packages/kotti-ui/source/kotti-field/hooks.ts +++ b/packages/kotti-ui/source/kotti-field/hooks.ts @@ -70,11 +70,13 @@ const useValue = ({ context, emit, isDisabled, + isLoading, isEmpty, props, }: Pick, 'emit' | 'isEmpty' | 'props'> & { context: KottiForm.Context | null isDisabled: Ref + isLoading: Ref }) => { watch( () => props.formKey, @@ -114,7 +116,7 @@ const useValue = ({ * @param options defines forceUpdate to set value even when the field is disabled */ setValue: ref((newValue: unknown, options?: { forceUpdate: boolean }) => { - if (isDisabled.value && !options?.forceUpdate) + if ((isDisabled.value || isLoading.value) && !options?.forceUpdate) throw new KtFieldErrors.DisabledSetValueCalled(props) if ( @@ -256,6 +258,7 @@ export const useField = ({ emit, isEmpty, isDisabled: sharedProperties.isDisabled, + isLoading: sharedProperties.isLoading, props, })