quasar-ui-danx 0.0.25 → 0.0.27
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/package.json +1 -1
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +4 -4
- package/src/components/ActionTable/Filters/{FilterGroupList.vue → FilterFieldList.vue} +8 -8
- package/src/components/ActionTable/Filters/index.ts +1 -1
- package/src/components/ActionTable/listActions.ts +2 -4
- /package/src/components/ActionTable/Filters/{FilterGroupItem.vue → FilterFieldItem.vue} +0 -0
package/package.json
CHANGED
@@ -7,15 +7,15 @@
|
|
7
7
|
name="admin-ads"
|
8
8
|
@update:collapse="$emit('update:show-filters', !$event)"
|
9
9
|
>
|
10
|
-
<
|
10
|
+
<FilterFieldList
|
11
11
|
:filter="filter"
|
12
|
-
:filter-
|
12
|
+
:filter-fields="filterFields"
|
13
13
|
@update:filter="$emit('update:filter', $event)"
|
14
14
|
/>
|
15
15
|
</CollapsableSidebar>
|
16
16
|
</template>
|
17
17
|
<script setup>
|
18
|
-
import {
|
18
|
+
import { FilterFieldList } from '.';
|
19
19
|
import { CollapsableSidebar } from '../../Utility';
|
20
20
|
|
21
21
|
defineEmits(['update:filter', 'update:show-filters']);
|
@@ -29,7 +29,7 @@ defineProps({
|
|
29
29
|
type: Object,
|
30
30
|
default: null
|
31
31
|
},
|
32
|
-
|
32
|
+
filterFields: {
|
33
33
|
type: Array,
|
34
34
|
default: () => []
|
35
35
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<q-list>
|
3
3
|
<div class="px-4 py-2 max-w-full">
|
4
4
|
<template
|
5
|
-
v-for="(group, index) in
|
5
|
+
v-for="(group, index) in filterFields"
|
6
6
|
:key="'group-' + group.name"
|
7
7
|
>
|
8
8
|
<template v-if="group.flat">
|
@@ -17,7 +17,7 @@
|
|
17
17
|
/>
|
18
18
|
</template>
|
19
19
|
|
20
|
-
<
|
20
|
+
<FilterFieldItem
|
21
21
|
v-else
|
22
22
|
:name="group.name"
|
23
23
|
:count="activeCountByGroup[group.name]"
|
@@ -31,24 +31,24 @@
|
|
31
31
|
class="mb-4"
|
32
32
|
@update:model-value="updateFilter(field, $event)"
|
33
33
|
/>
|
34
|
-
</
|
34
|
+
</FilterFieldItem>
|
35
35
|
|
36
36
|
<q-separator
|
37
|
-
v-if="index < (
|
37
|
+
v-if="index < (filterFields.length - 1)"
|
38
38
|
class="my-2"
|
39
39
|
/>
|
40
40
|
</template>
|
41
41
|
</div>
|
42
|
-
|
42
|
+
</q-list>
|
43
43
|
</template>
|
44
44
|
<script setup>
|
45
45
|
import { computed } from 'vue';
|
46
46
|
import FilterableField from './FilterableField';
|
47
|
-
import
|
47
|
+
import FilterFieldItem from './FilterFieldItem';
|
48
48
|
|
49
49
|
const emit = defineEmits(['update:filter']);
|
50
50
|
const props = defineProps({
|
51
|
-
|
51
|
+
filterFields: {
|
52
52
|
type: Array,
|
53
53
|
required: true
|
54
54
|
},
|
@@ -61,7 +61,7 @@ const props = defineProps({
|
|
61
61
|
|
62
62
|
const activeCountByGroup = computed(() => {
|
63
63
|
const activeCountByGroup = {};
|
64
|
-
for (const group of props.
|
64
|
+
for (const group of props.filterFields) {
|
65
65
|
activeCountByGroup[group.name] = group.fields.filter(field => props.filter[field.name] !== undefined).length;
|
66
66
|
}
|
67
67
|
return activeCountByGroup;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export {
|
2
2
|
default as CollapsableFiltersSidebar
|
3
3
|
} from "./CollapsableFiltersSidebar.vue";
|
4
|
-
export { default as
|
4
|
+
export { default as FilterFieldList } from "src/components/ActionTable/Filters/FilterFieldList.vue";
|
5
5
|
export { default as FilterListToggle } from "./FilterListToggle.vue";
|
6
6
|
export { default as FilterToolbarLayout } from "./FilterToolbarLayout.vue";
|
@@ -10,7 +10,6 @@ export function useListActions(name, {
|
|
10
10
|
applyActionRoute = null,
|
11
11
|
applyBatchActionRoute = null,
|
12
12
|
itemDetailsRoute = null,
|
13
|
-
filterGroups = null,
|
14
13
|
refreshFilters = false,
|
15
14
|
urlPattern = null,
|
16
15
|
filterDefaults = {}
|
@@ -98,10 +97,10 @@ export function useListActions(name, {
|
|
98
97
|
/**
|
99
98
|
* Watches for a filter URL parameter and applies the filter if it is set.
|
100
99
|
*/
|
101
|
-
function applyFilterFromUrl(url,
|
100
|
+
function applyFilterFromUrl(url, filterFields = null) {
|
102
101
|
if (url.match(urlPattern)) {
|
103
102
|
// A flat list of valid filterable field names
|
104
|
-
const validFilterKeys =
|
103
|
+
const validFilterKeys = filterFields?.value?.map(group => group.fields.map(field => field.name)).flat();
|
105
104
|
|
106
105
|
const urlFilter = getFilterFromUrl(url, validFilterKeys);
|
107
106
|
|
@@ -352,7 +351,6 @@ export function useListActions(name, {
|
|
352
351
|
isApplyingBatchAction,
|
353
352
|
activeItem,
|
354
353
|
formTab,
|
355
|
-
filterGroups,
|
356
354
|
|
357
355
|
// Actions
|
358
356
|
loadSummary,
|
File without changes
|