quasar-ui-danx 0.2.21 → 0.2.23
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/README.md +1 -0
- package/dist/danx.es.js +2447 -2443
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +5 -5
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +1 -1
- package/src/components/ActionTable/Filters/FilterListToggle.vue +1 -1
- package/src/components/ActionTable/Filters/FilterToolbarLayout.vue +6 -3
- package/src/components/ActionTable/listControls.ts +11 -10
- package/src/components/Utility/Layouts/CollapsableSidebar.vue +6 -10
- package/src/helpers/index.ts +1 -1
- package/src/helpers/{http.ts → request.ts} +32 -15
- package/tsconfig.json +1 -5
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
:show-filters="showFilters"
|
5
5
|
:filter="filter"
|
6
6
|
class="border-r p-4 flex-shrink-0"
|
7
|
-
@update:show-filters="
|
7
|
+
@update:show-filters="onFilter"
|
8
8
|
@update:filter="$emit('update:filter', $event)"
|
9
9
|
/>
|
10
10
|
|
@@ -22,12 +22,15 @@
|
|
22
22
|
import { QSeparator } from "quasar";
|
23
23
|
import { FilterListToggle } from "../Filters";
|
24
24
|
|
25
|
-
defineEmits(["update:show-filters", "update:filter"]);
|
26
|
-
defineProps({
|
25
|
+
const emit = defineEmits(["update:show-filters", "update:filter"]);
|
26
|
+
const props = defineProps({
|
27
27
|
filter: {
|
28
28
|
type: Object,
|
29
29
|
default: null
|
30
30
|
},
|
31
31
|
showFilters: Boolean
|
32
32
|
});
|
33
|
+
function onFilter() {
|
34
|
+
emit("update:show-filters", !props.showFilters);
|
35
|
+
}
|
33
36
|
</script>
|
@@ -28,12 +28,17 @@ export function useListControls(name: string, {
|
|
28
28
|
const pagedItems = ref(null);
|
29
29
|
const filter = ref({});
|
30
30
|
const globalFilter = ref({});
|
31
|
-
const showFilters = ref(
|
31
|
+
const showFilters = ref(false);
|
32
32
|
const selectedRows = ref([]);
|
33
33
|
const isLoadingList = ref(false);
|
34
34
|
const isLoadingSummary = ref(false);
|
35
35
|
const summary = ref(null);
|
36
36
|
|
37
|
+
// Filter fields are the field values available for the currently applied filter on Creative Groups
|
38
|
+
// (ie: all states available under the current filter)
|
39
|
+
const filterFieldOptions = ref({});
|
40
|
+
const isLoadingFilters = ref(false);
|
41
|
+
|
37
42
|
const filterActiveCount = computed(() => Object.keys(filter.value).filter(key => filter.value[key] !== undefined).length);
|
38
43
|
|
39
44
|
const PAGING_DEFAULT = {
|
@@ -87,15 +92,11 @@ export function useListControls(name: string, {
|
|
87
92
|
isLoadingSummary.value = false;
|
88
93
|
}
|
89
94
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
watch(() => showFilters.value, (show) => {
|
96
|
-
setItem(`${name}-show-filters`, show);
|
97
|
-
});
|
98
|
-
|
95
|
+
/**
|
96
|
+
* Loads the filter field options for the current filter.
|
97
|
+
*
|
98
|
+
* @returns {Promise<void>}
|
99
|
+
*/
|
99
100
|
async function loadFilterFieldOptions() {
|
100
101
|
if (!filterFieldOptionsRoute || !isInitialized) return;
|
101
102
|
isLoadingFilters.value = true;
|
@@ -46,6 +46,7 @@
|
|
46
46
|
<script setup>
|
47
47
|
import { ChevronLeftIcon as ToggleIcon } from "@heroicons/vue/outline";
|
48
48
|
import { computed, onMounted, ref, watch } from "vue";
|
49
|
+
import { getItem, setItem } from "../../../helpers";
|
49
50
|
|
50
51
|
const emit = defineEmits(["collapse", "update:collapse"]);
|
51
52
|
const props = defineProps({
|
@@ -76,24 +77,19 @@ const props = defineProps({
|
|
76
77
|
hideToggleOnCollapse: Boolean
|
77
78
|
});
|
78
79
|
|
79
|
-
const isCollapsed = ref(props.collapse);
|
80
|
+
const isCollapsed = ref(getItem(props.name + "-is-collapsed", props.collapse));
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
isCollapsed.value = stored === "1";
|
82
|
+
function setCollapse(state) {
|
83
|
+
isCollapsed.value = state;
|
84
|
+
setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
|
85
85
|
}
|
86
|
+
|
86
87
|
function toggleCollapse() {
|
87
88
|
setCollapse(!isCollapsed.value);
|
88
89
|
emit("collapse", isCollapsed.value);
|
89
90
|
emit("update:collapse", isCollapsed.value);
|
90
91
|
}
|
91
92
|
|
92
|
-
function setCollapse(state) {
|
93
|
-
isCollapsed.value = state;
|
94
|
-
localStorage.setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
|
95
|
-
}
|
96
|
-
|
97
93
|
onMounted(() => {
|
98
94
|
emit("collapse", isCollapsed.value);
|
99
95
|
emit("update:collapse", isCollapsed.value);
|
package/src/helpers/index.ts
CHANGED
@@ -8,9 +8,9 @@ export * from "./files";
|
|
8
8
|
export * from "./FileUpload";
|
9
9
|
export * from "./FlashMessages";
|
10
10
|
export * from "./formats";
|
11
|
-
export * from "./http";
|
12
11
|
export * from "./multiFileUpload";
|
13
12
|
export * from "./singleFileUpload";
|
14
13
|
export * from "./storage";
|
15
14
|
export * from "./styles";
|
16
15
|
export * from "./utils";
|
16
|
+
export * from "./request";
|
@@ -1,6 +1,30 @@
|
|
1
|
+
import { ref, Ref, UnwrapRef } from "vue";
|
2
|
+
|
3
|
+
interface RequestOptions {
|
4
|
+
baseUrl: string;
|
5
|
+
}
|
6
|
+
|
7
|
+
const requestOptions: Ref<UnwrapRef<RequestOptions>> = ref({
|
8
|
+
baseUrl: ""
|
9
|
+
});
|
10
|
+
/**
|
11
|
+
* A simple request helper that wraps the fetch API
|
12
|
+
* to make GET and POST requests easier w/ JSON payloads
|
13
|
+
*/
|
1
14
|
export const request = {
|
2
|
-
|
3
|
-
|
15
|
+
configure(options: RequestOptions) {
|
16
|
+
requestOptions.value = options;
|
17
|
+
},
|
18
|
+
|
19
|
+
url(url: string) {
|
20
|
+
if (url.startsWith("http")) {
|
21
|
+
return url;
|
22
|
+
}
|
23
|
+
return requestOptions.value.baseUrl + url;
|
24
|
+
},
|
25
|
+
|
26
|
+
async get(url: string, options = {}): Promise<object> {
|
27
|
+
return fetch(request.url(url), {
|
4
28
|
method: "get",
|
5
29
|
headers: {
|
6
30
|
Accept: "application/json",
|
@@ -10,8 +34,8 @@ export const request = {
|
|
10
34
|
}).then((r) => r.json());
|
11
35
|
},
|
12
36
|
|
13
|
-
async post(url, data = {}, options = {}) {
|
14
|
-
return fetch(url, {
|
37
|
+
async post(url: string, data = {}, options = {}) {
|
38
|
+
return fetch(request.url(url), {
|
15
39
|
method: "post",
|
16
40
|
body: JSON.stringify(data),
|
17
41
|
headers: {
|
@@ -29,34 +53,27 @@ export const request = {
|
|
29
53
|
* also fetches that resource record from the endpoint, then adds it to the list if it
|
30
54
|
* does not exist in the filtered list
|
31
55
|
*
|
32
|
-
* @param fetchFn
|
33
|
-
* @param list
|
34
|
-
* @param id
|
35
|
-
* @param filter
|
36
|
-
* @returns {Promise<void>}
|
37
56
|
*/
|
38
|
-
export async function fetchResourceListWithSelected(fetchFn
|
57
|
+
export async function fetchResourceListWithSelected(fetchFn: (filter: object) => Promise<any[]>, list: Ref, id: string, filter: object): Promise<void> {
|
39
58
|
// First make sure we have the selected record, so we can always add it to the list
|
40
59
|
let selectedResource;
|
41
60
|
if (id) {
|
42
|
-
selectedResource = list.value.find((c) => c.id === id) || (await fetchFn({ id }))[0];
|
61
|
+
selectedResource = list.value.find((c: { id: string }) => c.id === id) || (await fetchFn({ id }))[0];
|
43
62
|
}
|
44
63
|
|
45
64
|
// Get the filtered campaign list
|
46
65
|
list.value = await fetchFn(filter);
|
47
66
|
|
48
67
|
// If our selected campaign is not in the filtered list, add it
|
49
|
-
if (selectedResource && !list.value.find((c) => c.id === id)) {
|
68
|
+
if (selectedResource && !list.value.find((c: { id: string }) => c.id === id)) {
|
50
69
|
list.value.push(selectedResource);
|
51
70
|
}
|
52
71
|
}
|
53
72
|
|
54
73
|
/**
|
55
74
|
* Returns the value of the URL parameter (if it is set)
|
56
|
-
* @param key
|
57
|
-
* @param url
|
58
75
|
*/
|
59
|
-
export function getUrlParam(key, url
|
76
|
+
export function getUrlParam(key: string, url?: string) {
|
60
77
|
const params = new URLSearchParams(url?.replace(/.*\?/, "") || window.location.search);
|
61
78
|
return params.get(key);
|
62
79
|
}
|