fuma 0.4.9 → 0.4.11
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.
- package/dist/ui/form/Form.svelte +2 -2
- package/dist/ui/form/form.js +1 -1
- package/package.json +1 -1
package/dist/ui/form/Form.svelte
CHANGED
|
@@ -36,8 +36,6 @@ export let options = {};
|
|
|
36
36
|
let dataInput = initData(fields);
|
|
37
37
|
export { dataInput as data };
|
|
38
38
|
let data = dataInput;
|
|
39
|
-
$:
|
|
40
|
-
$isDirty ? dataInput = data : data = dataInput;
|
|
41
39
|
export function set(key, value) {
|
|
42
40
|
isDirty.set(true);
|
|
43
41
|
data[key] = value;
|
|
@@ -66,6 +64,8 @@ const { enhance, setError } = useForm({
|
|
|
66
64
|
});
|
|
67
65
|
const { handleInput, isDirty } = useHandleInput({ model, setError });
|
|
68
66
|
onMount(lookupValueFromParams);
|
|
67
|
+
$:
|
|
68
|
+
$isDirty ? dataInput = data : data = dataInput;
|
|
69
69
|
function lookupValueFromParams() {
|
|
70
70
|
fields.flat().forEach(({ key }) => {
|
|
71
71
|
if (data[key])
|
package/dist/ui/form/form.js
CHANGED
|
@@ -23,7 +23,6 @@ export function useHandleInput({ model, setError }) {
|
|
|
23
23
|
handleInput: ({ target }) => {
|
|
24
24
|
if (!target)
|
|
25
25
|
return;
|
|
26
|
-
isDirty.set(true);
|
|
27
26
|
if (!model)
|
|
28
27
|
return;
|
|
29
28
|
const { name, type, value, valueAsNumber, valueAsDate, checked } = target;
|
|
@@ -40,6 +39,7 @@ export function useHandleInput({ model, setError }) {
|
|
|
40
39
|
return;
|
|
41
40
|
if (!model[name])
|
|
42
41
|
return;
|
|
42
|
+
isDirty.set(true);
|
|
43
43
|
const res = model[name].safeParse(v);
|
|
44
44
|
if (res.success) {
|
|
45
45
|
setErrorDebounced.clear();
|