quasar-ui-danx 0.0.30 → 0.0.31

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.30",
3
+ "version": "0.0.31",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <PopoverMenu
3
3
  class="px-4 h-full flex"
4
- :items="items"
4
+ :items="activeItems"
5
5
  @action-item="onAction"
6
6
  />
7
7
  </template>
8
8
  <script setup>
9
+ import { computed } from 'vue';
9
10
  import { performAction } from '../../helpers';
10
11
  import { PopoverMenu } from '../Utility';
11
12
 
@@ -15,15 +16,19 @@ const props = defineProps({
15
16
  type: Array,
16
17
  required: true
17
18
  },
18
- rows: {
19
+ targets: {
19
20
  type: Array,
20
21
  required: true
21
22
  }
22
23
  });
23
24
 
25
+ const activeItems = computed(() => props.items.filter(item => {
26
+ if (item.enabled === undefined) return true;
27
+ return typeof item.enabled === 'function' ? !!item.enabled(props.targets) : !!item.enabled;
28
+ }));
24
29
 
25
30
  function onAction(item) {
26
31
  emit('action', item);
27
- performAction(item, props.rows);
32
+ performAction(item, props.targets);
28
33
  }
29
34
  </script>
@@ -52,6 +52,7 @@
52
52
  <component
53
53
  :is="rowProps.col.onClick ? 'a' : 'div'"
54
54
  class="flex items-center flex-nowrap"
55
+ :class="{'justify-end': rowProps.col.align === 'right', 'justify-center': rowProps.col.align === 'center', 'justify-start': rowProps.col.align === 'left'}"
55
56
  @click="() => rowProps.col.onClick && rowProps.col.onClick(rowProps.row)"
56
57
  >
57
58
  <RenderComponent
@@ -72,7 +73,7 @@
72
73
  <ActionMenu
73
74
  v-if="rowProps.col.actions" class="ml-2"
74
75
  :items="rowProps.col.actions"
75
- :rows="[rowProps.row]"
76
+ :targets="[rowProps.row]"
76
77
  @action="(action) => $emit('action', {action: action, row: rowProps.row})"
77
78
  />
78
79
  </component>
@@ -29,7 +29,9 @@ export function usePerformAction(actions: any[]) {
29
29
  targets = Array.isArray(targets) ? targets : [targets];
30
30
 
31
31
  await performAction({ ...action, ...options }, targets);
32
- }
32
+ },
33
+
34
+ batchActions: actions.filter(a => a.batch)
33
35
  };
34
36
  }
35
37