quasar-ui-danx 0.3.46 → 0.3.48
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/danx.es.js +4649 -4474
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +8 -8
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/MultiFileField.vue +28 -25
- package/src/components/ActionTable/Form/Fields/TextField.vue +4 -3
- package/src/components/ActionTable/Form/RenderedForm.vue +2 -0
- package/src/components/ActionTable/listControls.ts +4 -4
- package/src/components/Utility/Dialogs/InfoDialog.vue +29 -27
- package/src/helpers/actions.ts +187 -187
- package/src/helpers/request.ts +51 -45
package/src/helpers/request.ts
CHANGED
@@ -1,50 +1,56 @@
|
|
1
1
|
import { ref, Ref } from "vue";
|
2
2
|
|
3
3
|
interface RequestOptions {
|
4
|
-
|
4
|
+
baseUrl: string;
|
5
5
|
}
|
6
6
|
|
7
7
|
const requestOptions: Ref<RequestOptions> = ref({
|
8
|
-
|
8
|
+
baseUrl: ""
|
9
9
|
});
|
10
10
|
/**
|
11
11
|
* A simple request helper that wraps the fetch API
|
12
12
|
* to make GET and POST requests easier w/ JSON payloads
|
13
13
|
*/
|
14
14
|
export const request = {
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
configure(options: RequestOptions) {
|
16
|
+
requestOptions.value = options;
|
17
|
+
},
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
url(url: string) {
|
20
|
+
if (url.startsWith("http")) {
|
21
|
+
return url;
|
22
|
+
}
|
23
|
+
return requestOptions.value.baseUrl + url;
|
24
|
+
},
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
async get(url: string, options = {}): Promise<object> {
|
27
|
+
return fetch(request.url(url), {
|
28
|
+
method: "get",
|
29
|
+
headers: {
|
30
|
+
Accept: "application/json",
|
31
|
+
"Content-Type": "application/json"
|
32
|
+
},
|
33
|
+
...options
|
34
|
+
}).then((r) => r.json());
|
35
|
+
},
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
async post(url: string, data = {}, options = {}) {
|
38
|
+
let body = "";
|
39
|
+
try {
|
40
|
+
body = JSON.stringify(data);
|
41
|
+
} catch (e) {
|
42
|
+
// fail silently
|
43
|
+
}
|
44
|
+
return fetch(request.url(url), {
|
45
|
+
method: "post",
|
46
|
+
body,
|
47
|
+
headers: {
|
48
|
+
Accept: "application/json",
|
49
|
+
"Content-Type": "application/json"
|
50
|
+
},
|
51
|
+
...options
|
52
|
+
}).then((r) => r.json());
|
53
|
+
}
|
48
54
|
};
|
49
55
|
|
50
56
|
/**
|
@@ -55,25 +61,25 @@ export const request = {
|
|
55
61
|
*
|
56
62
|
*/
|
57
63
|
export async function fetchResourceListWithSelected(fetchFn: (filter: object) => Promise<any[]>, list: Ref, id: string, filter: object): Promise<void> {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
64
|
+
// First make sure we have the selected record, so we can always add it to the list
|
65
|
+
let selectedResource;
|
66
|
+
if (id) {
|
67
|
+
selectedResource = list.value.find((c: { id: string }) => c.id === id) || (await fetchFn({ id }))[0];
|
68
|
+
}
|
63
69
|
|
64
|
-
|
65
|
-
|
70
|
+
// Get the filtered campaign list
|
71
|
+
list.value = await fetchFn(filter);
|
66
72
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
73
|
+
// If our selected campaign is not in the filtered list, add it
|
74
|
+
if (selectedResource && !list.value.find((c: { id: string }) => c.id === id)) {
|
75
|
+
list.value.push(selectedResource);
|
76
|
+
}
|
71
77
|
}
|
72
78
|
|
73
79
|
/**
|
74
80
|
* Returns the value of the URL parameter (if it is set)
|
75
81
|
*/
|
76
82
|
export function getUrlParam(key: string, url?: string) {
|
77
|
-
|
78
|
-
|
83
|
+
const params = new URLSearchParams(url?.replace(/.*\?/, "") || window.location.search);
|
84
|
+
return params.get(key);
|
79
85
|
}
|