Skip to content

Commit 684d944

Browse files
Updating variable name and response to emit update on doNotSave
1 parent 8004bbd commit 684d944

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

src/plugin/VInlineCheckbox.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@click="toggleField"
1212
>
1313
<BooleanIcons
14-
v-model="value"
14+
v-model="displayValue"
1515
:icon-false="settings.iconFalse"
1616
:icon-false-color="settings.iconFalseColor"
1717
:icon-false-title="settings.iconFalseTitle"
@@ -28,7 +28,7 @@
2828
:style="fieldDisplayStyle"
2929
@click="toggleField"
3030
>
31-
{{ value }}
31+
{{ displayValue }}
3232
</span>
3333
</div>
3434

@@ -114,7 +114,7 @@ import inlineEmits from './utils/emits';
114114
115115
const modelValue = defineModel<FieldValue>();
116116
117-
const value = computed(() => {
117+
const displayValue = computed(() => {
118118
return modelValue.value == settings.trueValue;
119119
});
120120
@@ -174,7 +174,7 @@ function saveValue(value: undefined) {
174174
loading.value = true;
175175
emit('loading', loading.value);
176176
177-
useSaveValue(settings, emit as keyof UseSaveValue, settings.name, modelValue.value as keyof UseSaveValue)
177+
useSaveValue(settings, emit as keyof UseSaveValue, settings.name, value as keyof UseSaveValue)
178178
.then((response) => {
179179
error.value = response?.error as boolean ?? false;
180180
loading.value = false;

src/plugin/VInlineSelect.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:style="fieldDisplayStyle"
1010
@click="toggleField"
1111
>
12-
{{ value }}
12+
{{ displayValue }}
1313
</span>
1414
</div>
1515

@@ -36,7 +36,6 @@
3636
:loading="loading"
3737
:variant="settings.variant"
3838
width="100%"
39-
@keyup.enter="saveValue"
4039
@keyup.esc="closeField"
4140
>
4241
<!-- Pass on all scoped slots -->
@@ -108,7 +107,7 @@ import inlineEmits from './utils/emits';
108107
109108
const modelValue = defineModel<FieldValue>();
110109
111-
const value = computed(() => {
110+
const displayValue = computed(() => {
112111
if (modelValue.value && modelValue.value[settings.itemTitle as string]) {
113112
empty.value = false;
114113
return modelValue.value[settings.itemTitle as string];

src/plugin/VInlineSwitch.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
>
66
<span
77
v-if="icons"
8-
class="inline-field-value-icons pb-1"
8+
class="v-inline-field-value-icons pb-1"
99
:class="fieldDisplayClass"
1010
:style="fieldDisplayStyle"
1111
@click="toggleField"
1212
>
1313
<BooleanIcons
14-
v-model="value"
14+
v-model="displayValue"
1515
:icon-false="settings.iconFalse"
1616
:icon-false-color="settings.iconFalseColor"
1717
:icon-false-title="settings.iconFalseTitle"
@@ -28,7 +28,7 @@
2828
:style="fieldDisplayStyle"
2929
@click="toggleField"
3030
>
31-
{{ value }}
31+
{{ displayValue }}
3232
</span>
3333
</div>
3434

@@ -115,7 +115,7 @@ import inlineEmits from './utils/emits';
115115
116116
const modelValue = defineModel<FieldValue>();
117117
118-
const value = computed(() => {
118+
const displayValue = computed(() => {
119119
return modelValue.value == settings.trueValue;
120120
});
121121
@@ -173,7 +173,7 @@ function saveValue(value: undefined) {
173173
loading.value = true;
174174
emit('loading', loading.value);
175175
176-
useSaveValue(settings, emit as keyof UseSaveValue, settings.name, modelValue.value as keyof UseSaveValue)
176+
useSaveValue(settings, emit as keyof UseSaveValue, settings.name, value as keyof UseSaveValue)
177177
.then((response) => {
178178
error.value = response?.error as boolean ?? false;
179179
loading.value = false;

src/plugin/VInlineTextField.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:style="fieldDisplayStyle"
1010
@click="toggleField"
1111
>
12-
{{ value }}
12+
{{ displayValue }}
1313
</span>
1414
</div>
1515

@@ -101,7 +101,7 @@ import inlineEmits from './utils/emits';
101101
102102
const modelValue = defineModel<FieldValue>();
103103
104-
const value = computed(() => {
104+
const displayValue = computed(() => {
105105
if (modelValue.value) {
106106
empty.value = false;
107107
return modelValue.value;

src/plugin/VInlineTextarea.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
class="d-inline-flex align-center justify-center"
55
>
66
<span
7-
class="inline-field-value pb-1 d-inline-flex align-center justify-center"
7+
class="pb-1 d-inline-flex align-center justify-center"
88
:class="fieldDisplayClass"
99
:style="fieldDisplayStyle"
1010
@click="toggleField"
1111
>
12-
{{ value }}
12+
{{ displayValue }}
1313
</span>
1414
</div>
1515

@@ -103,7 +103,7 @@ import inlineEmits from './utils/emits';
103103
104104
const modelValue = defineModel<FieldValue>();
105105
106-
const value = computed(() => {
106+
const displayValue = computed(() => {
107107
if (modelValue.value) {
108108
empty.value = false;
109109
return modelValue.value;

src/plugin/composables/methods.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const useSaveValue: UseSaveValue = async (settings, emit, name, value) => {
3434
const submitData = buildResponseItem(allSettings.item as object, name, value);
3535

3636
if (allSettings.doNotSave) {
37-
return;
37+
emit('update', value);
38+
return {
39+
error: false,
40+
value,
41+
};
3842
}
3943

4044
if (allSettings.apiRoute === '') {

0 commit comments

Comments
 (0)