7575 v-if =" ! slots .append "
7676 #append
7777 >
78- <v-btn
79- v-if =" !settings.fieldOnly"
80- class =" ms-1"
81- :color =" settings.cancelButtonColor"
82- :disabled =" loading"
83- icon
84- :size =" settings.cancelButtonSize"
85- :title =" settings.cancelButtonTitle"
86- :variant =" settings.cancelButtonVariant"
87- @click =" toggleField"
88- >
89- <v-icon
90- :color =" settings.cancelIconColor"
91- :icon =" theCancelIcon"
92- />
93- </v-btn >
78+ <SaveFieldButtons
79+ :cancel-button-color =" settings.cancelButtonColor"
80+ :cancel-button-size =" settings.cancelButtonSize"
81+ :cancel-button-title =" settings.cancelButtonTitle"
82+ :cancel-button-variant =" settings.cancelButtonVariant"
83+ :cancel-icon =" settings.cancelIcon"
84+ :cancel-icon-color =" settings.cancelIconColor"
85+ :error =" error"
86+ :field-only =" settings.fieldOnly"
87+ :hide-save-icon =" true"
88+ :loading =" loading"
89+ :loading-icon =" settings.loadingIcon"
90+ :loading-icon-color =" settings.loadingIconColor"
91+ :save-button-color =" settings.saveButtonColor"
92+ :save-button-size =" settings.saveButtonSize"
93+ :save-button-title =" settings.saveButtonTitle"
94+ :save-button-variant =" settings.saveButtonVariant"
95+ :save-icon =" settings.saveIcon"
96+ :save-icon-color =" settings.saveIconColor"
97+ @close =" closeField"
98+ @save =" saveValue"
99+ />
94100 </template >
95101 </v-checkbox >
96102 </div >
@@ -106,7 +112,10 @@ import {
106112} from ' @/types' ;
107113import type { IconOptions } from ' vuetify' ;
108114import { checkboxProps } from ' ./utils/props' ;
109- import { BooleanIcons } from ' ./components/index' ;
115+ import {
116+ BooleanIcons ,
117+ SaveFieldButtons ,
118+ } from ' ./components/index' ;
110119import { useToggleField } from ' ./composables/methods' ;
111120import { useGetIcon } from ' ./composables/icons' ;
112121import {
@@ -130,8 +139,6 @@ const slots = useSlots();
130139const emit = defineEmits ([... inlineEmits ]);
131140const iconOptions = inject <IconOptions >(Symbol .for (' vuetify:icons' ));
132141
133- console .log (iconOptions );
134-
135142const props = withDefaults (defineProps <VInlineCheckboxProps >(), { ... checkboxProps });
136143let settings = reactive ({ ... attrs , ... props });
137144
@@ -149,14 +156,6 @@ watch(() => props.loading, (newVal, oldVal) => {
149156
150157
151158// ------------------------------------------------ Icons //
152- const theCancelIcon = computed (() => {
153- return useGetIcon ({
154- icon: settings .cancelIcon ,
155- iconOptions ,
156- name: ' false' ,
157- });
158- });
159-
160159const theFalseIcon = computed (() => {
161160 return useGetIcon ({
162161 icon: props .trueIcon ,
@@ -225,6 +224,13 @@ const displayValueStyle = computed(() => useDisplayValueStyles({
225224}));
226225
227226
227+ // ------------------------------------------------ Key event to cancel/close field //
228+ function closeField() {
229+ error .value = false ;
230+ toggleField ();
231+ }
232+
233+
228234// ------------------------------------------------ Toggle the field //
229235function toggleField() {
230236 if (settings .disabled || (settings .loadingWait && props .loading )) {
0 commit comments