quasar-ui-danx 0.0.27 → 0.0.28

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -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
- activeAction.value = item;
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() {
@@ -1,6 +1,6 @@
1
1
  export {
2
2
  default as CollapsableFiltersSidebar
3
3
  } from "./CollapsableFiltersSidebar.vue";
4
- export { default as FilterFieldList } from "src/components/ActionTable/Filters/FilterFieldList.vue";
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";
@@ -1,5 +1,6 @@
1
1
  export * from "./Filters";
2
2
  export * from "./Form";
3
+ export * from "./Layouts";
3
4
  export * from "./listActions";
4
5
  export * from "./listHelpers";
5
6
  export * from "./tableColumns";
@@ -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";
@@ -4,4 +4,5 @@ export * from "./Files";
4
4
  export * from "./Formats";
5
5
  export * from "./Layouts";
6
6
  export * from "./Popovers";
7
+ export * from "./Tools";
7
8
  export * from "./Transitions";
@@ -9,6 +9,7 @@ export * from "./FlashMessages";
9
9
  export * from "./formats";
10
10
  export * from "./http";
11
11
  export * from "./multiFileUpload";
12
+ export * from "./performAction";
12
13
  export * from "./singleFileUpload";
13
14
  export * from "./storage";
14
15
  export * from "./utils";
@@ -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
+ }