@stubber/form-fields 2.0.0 → 2.0.1
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.
|
@@ -11,7 +11,7 @@ export const file_field_param_spec = {
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script>import { Button } from "@stubber/ui/button";
|
|
14
|
-
import { isEmpty, isUndefined } from "lodash-es";
|
|
14
|
+
import { isEmpty, isEqual, isUndefined } from "lodash-es";
|
|
15
15
|
import Dropzone from "svelte-file-dropzone";
|
|
16
16
|
import FieldLabel from "../FieldLabel.svelte";
|
|
17
17
|
import FieldMessage from "../FieldMessage.svelte";
|
|
@@ -65,6 +65,14 @@ function update_fieldStore(uploaded_files2) {
|
|
|
65
65
|
if (isEmpty(uploaded_files2) && isUndefined($fieldStore.value)) return;
|
|
66
66
|
$fieldStore.value = uploaded_files2;
|
|
67
67
|
}
|
|
68
|
+
$: update_uploaded_files($fieldStore.value);
|
|
69
|
+
function update_uploaded_files(value) {
|
|
70
|
+
if (isEmpty(value)) {
|
|
71
|
+
uploaded_files = [];
|
|
72
|
+
} else if (Array.isArray(value) && !isEqual(value, uploaded_files)) {
|
|
73
|
+
uploaded_files = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
68
76
|
$: all_files = [
|
|
69
77
|
...uploaded_files.map((f) => ({ ...f, is_uploaded: true, is_failed: false })),
|
|
70
78
|
...failed_files.map((f) => ({ ...f, is_failed: true, is_uploaded: false })),
|