quasar-ui-danx 0.0.26 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/components/ActionTable/ActionMenu.vue +2 -16
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +2 -2
- package/src/components/ActionTable/Filters/{FilterGroupList.vue → FilterFieldList.vue} +3 -3
- package/src/components/ActionTable/Filters/index.ts +1 -1
- package/src/components/ActionTable/Layouts/ActionTableLayout.vue +15 -0
- package/src/components/ActionTable/Layouts/index.ts +1 -0
- package/src/components/ActionTable/index.ts +1 -0
- package/src/components/ActionTable/listActions.ts +2 -4
- package/src/components/Utility/Tools/ActionPerformerTool.vue +42 -0
- package/src/components/Utility/Tools/index.ts +1 -0
- package/src/components/Utility/index.ts +1 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/performAction.ts +10 -0
- /package/src/components/ActionTable/Filters/{FilterGroupItem.vue → FilterFieldItem.vue} +0 -0
package/package.json
CHANGED
@@ -5,19 +5,11 @@
|
|
5
5
|
:items="items"
|
6
6
|
@action-item="onAction"
|
7
7
|
/>
|
8
|
-
<Component
|
9
|
-
v-if="confirmDialog"
|
10
|
-
:is="confirmDialog.is"
|
11
|
-
v-bind="confirmDialog.props"
|
12
|
-
:is-saving="isSaving"
|
13
|
-
@close="onCancel"
|
14
|
-
@confirm="onConfirmAction"
|
15
|
-
/>
|
16
8
|
</div>
|
17
9
|
</template>
|
18
10
|
<script setup>
|
19
11
|
import { ref, shallowRef } from 'vue';
|
20
|
-
import { FlashMessages } from '../../helpers';
|
12
|
+
import { FlashMessages, performAction } from '../../helpers';
|
21
13
|
import { PopoverMenu } from '../Utility';
|
22
14
|
|
23
15
|
const emit = defineEmits(['action']);
|
@@ -40,13 +32,7 @@ const isSaving = ref(false);
|
|
40
32
|
function onAction(item) {
|
41
33
|
emit('action', item);
|
42
34
|
|
43
|
-
|
44
|
-
|
45
|
-
if (item.confirmDialog) {
|
46
|
-
confirmDialog.value = typeof item.confirmDialog === 'function' ? item.confirmDialog(props.rows) : item.confirmDialog;
|
47
|
-
} else {
|
48
|
-
console.log('handle default action');
|
49
|
-
}
|
35
|
+
performAction(item, props.rows);
|
50
36
|
}
|
51
37
|
|
52
38
|
function onCancel() {
|
@@ -7,7 +7,7 @@
|
|
7
7
|
name="admin-ads"
|
8
8
|
@update:collapse="$emit('update:show-filters', !$event)"
|
9
9
|
>
|
10
|
-
<
|
10
|
+
<FilterFieldList
|
11
11
|
:filter="filter"
|
12
12
|
:filter-fields="filterFields"
|
13
13
|
@update:filter="$emit('update:filter', $event)"
|
@@ -15,7 +15,7 @@
|
|
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']);
|
@@ -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,7 +31,7 @@
|
|
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
37
|
v-if="index < (filterFields.length - 1)"
|
@@ -44,7 +44,7 @@
|
|
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({
|
@@ -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 "./FilterFieldList.vue";
|
5
5
|
export { default as FilterListToggle } from "./FilterListToggle.vue";
|
6
6
|
export { default as FilterToolbarLayout } from "./FilterToolbarLayout.vue";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="flex flex-grow flex-col flex-nowrap overflow-hidden h-full bg-white">
|
3
|
+
<slot name="top" />
|
4
|
+
<slot name="toolbar" />
|
5
|
+
<div class="flex flex-nowrap flex-grow overflow-hidden w-full">
|
6
|
+
<slot name="filters" />
|
7
|
+
<slot />
|
8
|
+
</div>
|
9
|
+
<ActionPerformerTool v-if="activeAction" :targets="actionTargets" :action="activeAction" />
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
<script setup>
|
13
|
+
import { actionTargets, activeAction } from '../../../helpers';
|
14
|
+
import { ActionPerformerTool } from '../../Utility';
|
15
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as ActionTableLayout } from "./ActionTableLayout.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,
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<Component v-if="confirmDialog" :is="confirmDialog" :is-saving="isSaving" @confirm="onConfirmAction" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
<script setup>
|
7
|
+
import { onMounted, ref, shallowRef } from 'vue';
|
8
|
+
|
9
|
+
const props = defineProps({
|
10
|
+
action: {
|
11
|
+
type: Object,
|
12
|
+
required: true
|
13
|
+
},
|
14
|
+
targets: {
|
15
|
+
type: Array,
|
16
|
+
required: true
|
17
|
+
}
|
18
|
+
});
|
19
|
+
|
20
|
+
const confirmDialog = shallowRef(props.action.confirmDialog ? props.action.confirmDialog(props.targets) : null);
|
21
|
+
const isSaving = ref(null);
|
22
|
+
|
23
|
+
onMounted(async () => {
|
24
|
+
console.log('mounting action', props.action, props.targets);
|
25
|
+
// If there is no dialog, we auto-confirm the action
|
26
|
+
if (!confirmDialog.value) {
|
27
|
+
onConfirmAction();
|
28
|
+
}
|
29
|
+
});
|
30
|
+
|
31
|
+
function onConfirmAction(input) {
|
32
|
+
console.log('action confirmed', input);
|
33
|
+
if (!props.action.onAction) {
|
34
|
+
throw new Error('No onAction handler found for the selected action:' + props.action.name);
|
35
|
+
}
|
36
|
+
|
37
|
+
isSaving.value = true;
|
38
|
+
props.action.onAction().then(() => {
|
39
|
+
isSaving.value = false;
|
40
|
+
});
|
41
|
+
}
|
42
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as ActionPerformerTool } from "./ActionPerformerTool.vue";
|
package/src/helpers/index.ts
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ref } from "vue";
|
2
|
+
|
3
|
+
export const activeAction = ref(null);
|
4
|
+
export const actionTargets = ref([]);
|
5
|
+
|
6
|
+
export async function performAction(action, targets) {
|
7
|
+
console.log("performing action", action, targets);
|
8
|
+
activeAction.value = action;
|
9
|
+
actionTargets.value = targets;
|
10
|
+
}
|
File without changes
|