multiapi_cli 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/multiapi_cli/version.rb +1 -1
- data/lib/multiapi_cli.rb +28 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 100e91cc9c6117a7bb228b3af08db5de1b34502513e469ad294d05b217e5b5b9
|
4
|
+
data.tar.gz: 8480f8ddd3d650abaa156c203ffa4a455670f48b2b0491c920c37511ebe89c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb784511f30f4fd1148dee361b6e81bb2019201acde897e7de2ff3ee125586979fe208904f9ec8d04eab8a65972a87cde5e1899ca9152769ad3c636c3c7ddde
|
7
|
+
data.tar.gz: b5320860d77e3794f1e42bccf5f2dc6d480c0e0b97eff248461281542487a2e9ecc3e4a6f53821ce8c091dde32e50904718c117d6ef42fc2ed75914f7c127740
|
data/lib/multiapi_cli/version.rb
CHANGED
data/lib/multiapi_cli.rb
CHANGED
@@ -905,7 +905,6 @@ module MultiapiCli
|
|
905
905
|
v-else
|
906
906
|
@submit="onSubmit"
|
907
907
|
:validation-schema="schema"
|
908
|
-
:initial-values="formData"
|
909
908
|
v-slot="{ errors }"
|
910
909
|
>
|
911
910
|
<div class="space-y-4">
|
@@ -923,10 +922,16 @@ module MultiapiCli
|
|
923
922
|
v-bind="formField"
|
924
923
|
:placeholder="field.placeholder"
|
925
924
|
:required="field.required"
|
925
|
+
:value="formData[field.name]"
|
926
|
+
@input="formData[field.name] = $event.target.value"
|
926
927
|
/>
|
927
928
|
</template>
|
928
929
|
<template v-else-if="field.type === 'select'">
|
929
|
-
<Select
|
930
|
+
<Select
|
931
|
+
v-bind="formField"
|
932
|
+
:value="formData[field.name]"
|
933
|
+
@update:value="formData[field.name] = $event"
|
934
|
+
>
|
930
935
|
<SelectTrigger>
|
931
936
|
<SelectValue :placeholder="field.placeholder" />
|
932
937
|
</SelectTrigger>
|
@@ -941,7 +946,11 @@ module MultiapiCli
|
|
941
946
|
</Select>
|
942
947
|
</template>
|
943
948
|
<template v-else-if="field.type === 'checkbox'">
|
944
|
-
<Checkbox
|
949
|
+
<Checkbox
|
950
|
+
v-bind="formField"
|
951
|
+
:checked="formData[field.name]"
|
952
|
+
@update:checked="formData[field.name] = $event"
|
953
|
+
/>
|
945
954
|
</template>
|
946
955
|
<template v-else>
|
947
956
|
<Input
|
@@ -949,6 +958,8 @@ module MultiapiCli
|
|
949
958
|
:type="field.type"
|
950
959
|
:placeholder="field.placeholder"
|
951
960
|
:required="field.required"
|
961
|
+
:value="formData[field.name]"
|
962
|
+
@input="formData[field.name] = $event.target.value"
|
952
963
|
/>
|
953
964
|
</template>
|
954
965
|
</FormControl>
|
@@ -970,7 +981,7 @@ module MultiapiCli
|
|
970
981
|
</template>
|
971
982
|
|
972
983
|
<script setup lang="ts">
|
973
|
-
import { ref, onMounted } from 'vue'
|
984
|
+
import { ref, onMounted, watch } from 'vue'
|
974
985
|
import { Form } from 'vee-validate'
|
975
986
|
import * as z from 'zod'
|
976
987
|
import { toFormValidator } from '@vee-validate/zod'
|
@@ -1012,7 +1023,7 @@ module MultiapiCli
|
|
1012
1023
|
console.log('[Edit] ============ CICLO DE CARREGAMENTO ============')
|
1013
1024
|
console.log('[Edit] Estado atual:', {
|
1014
1025
|
id: props.id,
|
1015
|
-
|
1026
|
+
#{plural_name}: store.get#{plural_name.camelize}.length
|
1016
1027
|
})
|
1017
1028
|
|
1018
1029
|
if (!props.id) {
|
@@ -1032,13 +1043,13 @@ module MultiapiCli
|
|
1032
1043
|
|
1033
1044
|
console.log('[Edit] Item encontrado no store:', item)
|
1034
1045
|
|
1035
|
-
|
1046
|
+
// Atualiza formData com os valores do item
|
1047
|
+
formData.value = {
|
1036
1048
|
id: item.id,
|
1037
|
-
#{fields.map { |f| "#{f[:name]}: String(item.#{f[:name]}
|
1049
|
+
#{fields.map { |f| "#{f[:name]}: item.#{f[:name]} ? String(item.#{f[:name]}) : ''" }.join(",\n ")}
|
1038
1050
|
}
|
1039
1051
|
|
1040
|
-
console.log('[Edit] Atualizando formData:',
|
1041
|
-
formData.value = formattedData
|
1052
|
+
console.log('[Edit] Atualizando formData:', formData.value)
|
1042
1053
|
isLoading.value = false
|
1043
1054
|
}
|
1044
1055
|
|
@@ -1047,13 +1058,20 @@ module MultiapiCli
|
|
1047
1058
|
loadData()
|
1048
1059
|
})
|
1049
1060
|
|
1061
|
+
// Observa mudanças no ID para recarregar os dados
|
1062
|
+
watch(() => props.id, () => {
|
1063
|
+
if (props.id) {
|
1064
|
+
loadData()
|
1065
|
+
}
|
1066
|
+
})
|
1067
|
+
|
1050
1068
|
const onSubmit = async (values) => {
|
1051
1069
|
if (!props.id) return
|
1052
1070
|
|
1053
1071
|
try {
|
1054
1072
|
console.log('[Edit] Iniciando submissão do formulário com valores:', values)
|
1055
1073
|
isSubmitting.value = true
|
1056
|
-
await store.update#{singular_name.camelize}(props.id,
|
1074
|
+
await store.update#{singular_name.camelize}(props.id, formData.value)
|
1057
1075
|
console.log('[Edit] Item atualizado com sucesso')
|
1058
1076
|
emit('success')
|
1059
1077
|
} catch (error) {
|