@geode/opengeodeweb-front 8.1.1 → 8.2.0-rc.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.
@@ -2,7 +2,7 @@
2
2
  <FetchingData v-if="loading" />
3
3
  <FileUploader
4
4
  v-else
5
- v-bind="{ multiple, accept }"
5
+ v-bind="{ multiple, accept, files }"
6
6
  @files_uploaded="files_uploaded_event"
7
7
  />
8
8
  </template>
@@ -20,6 +20,7 @@
20
20
  const props = defineProps({
21
21
  multiple: { type: Boolean, required: true },
22
22
  supported_feature: { type: String, required: false, default: null },
23
+ files: { type: Array, required: false, default: [] },
23
24
  })
24
25
 
25
26
  const { multiple, supported_feature } = props
@@ -51,6 +52,5 @@
51
52
  )
52
53
  toggle_loading()
53
54
  }
54
-
55
55
  await get_allowed_files()
56
56
  </script>
@@ -39,7 +39,9 @@
39
39
  const props = defineProps({
40
40
  multiple: { type: Boolean, required: true },
41
41
  accept: { type: String, required: true },
42
+ files: { type: Array, required: false, default: [] },
42
43
  })
44
+
43
45
  const { multiple, accept } = toRefs(props)
44
46
 
45
47
  const label = multiple ? "Please select file(s)" : "Please select a file"
@@ -77,6 +79,11 @@
77
79
  toggle_loading()
78
80
  }
79
81
 
82
+ if (props.files.length) {
83
+ files.value = props.files
84
+ upload_files()
85
+ }
86
+
80
87
  function clear() {
81
88
  files.value = []
82
89
  emit("files_uploaded", files.value)
package/package.json CHANGED
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "description": "OpenSource Vue/Vuetify framework for web applications",
37
37
  "type": "module",
38
- "version": "8.1.1",
38
+ "version": "8.2.0-rc.1",
39
39
  "main": "./nuxt.config.js",
40
40
  "dependencies": {
41
41
  "@geode/opengeodeweb-back": "4.3.0",
@@ -57,4 +57,34 @@ describe("FileSelector.vue", async () => {
57
57
  files,
58
58
  })
59
59
  })
60
+
61
+ test(`Files prop`, async () => {
62
+ registerEndpoint(allowed_files_schema.$id, {
63
+ method: allowed_files_schema.methods[0],
64
+ handler: () => ({
65
+ extensions: ["1", "2", "3"],
66
+ }),
67
+ })
68
+
69
+ const files = [new File(["fake_file"], "fake_file.txt")]
70
+
71
+ const wrapper = await mountSuspended(FileSelector, {
72
+ global: {
73
+ plugins: [vuetify],
74
+ },
75
+ props: { multiple: false, supported_feature: "test", files: files },
76
+ })
77
+ registerEndpoint(upload_file_schema.$id, {
78
+ method: upload_file_schema.methods[1],
79
+ handler: () => ({}),
80
+ })
81
+
82
+ await flushPromises()
83
+
84
+ expect(wrapper.emitted()).toHaveProperty("update_values")
85
+ expect(wrapper.emitted().update_values).toHaveLength(1)
86
+ expect(wrapper.emitted().update_values[0][0]).toEqual({
87
+ files,
88
+ })
89
+ })
60
90
  })