quasar-ui-danx 0.0.37 → 0.0.38

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.37",
3
+ "version": "0.0.38",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <PopoverMenu
3
3
  class="px-2 flex action-button"
4
- :items="activeItems"
4
+ :items="activeActions"
5
5
  :disabled="targets.length === 0"
6
6
  :tooltip="targets.length === 0 ? tooltip : null"
7
- :loading="isSaving"
7
+ :loading="loading || isSaving"
8
8
  :loading-component="loadingComponent"
9
9
  @action-item="onAction"
10
10
  />
@@ -16,7 +16,7 @@ import { PopoverMenu } from '../Utility';
16
16
 
17
17
  const emit = defineEmits(['action']);
18
18
  const props = defineProps({
19
- items: {
19
+ actions: {
20
20
  type: Array,
21
21
  required: true
22
22
  },
@@ -28,22 +28,23 @@ const props = defineProps({
28
28
  type: String,
29
29
  default: 'First select records to perform a batch action'
30
30
  },
31
+ loading: Boolean,
31
32
  loadingComponent: {
32
33
  type: [Function, Object],
33
34
  default: undefined
34
35
  }
35
36
  });
36
37
 
37
- const activeItems = computed(() => props.items.filter(item => {
38
- if (item.enabled === undefined) return true;
39
- return typeof item.enabled === 'function' ? !!item.enabled(props.targets?.[0] ?? null, props.targets) : !!item.enabled;
38
+ const activeActions = computed(() => props.actions.filter(action => {
39
+ if (action.enabled === undefined) return true;
40
+ return typeof action.enabled === 'function' ? !!action.enabled(props.targets?.[0] ?? null, props.targets) : !!action.enabled;
40
41
  }));
41
42
 
42
43
  const isSaving = ref(false);
43
- async function onAction(item) {
44
- emit('action', item);
44
+ async function onAction(action) {
45
+ emit('action', action);
45
46
  isSaving.value = true;
46
- await performAction(item, props.targets);
47
+ await performAction(action, props.targets);
47
48
  isSaving.value = false;
48
49
  }
49
50
  </script>
@@ -75,8 +75,9 @@
75
75
  </div>
76
76
  <div v-if="rowProps.col.actions" class="flex-grow flex justify-end pl-2">
77
77
  <ActionMenu
78
- :items="rowProps.col.actions"
78
+ :actions="rowProps.col.actions"
79
79
  :targets="[rowProps.row]"
80
+ :loading="isSavingItem?.id === rowProps.row.id"
80
81
  @action="(action) => $emit('action', {action: action, row: rowProps.row})"
81
82
  />
82
83
  </div>
@@ -112,6 +113,10 @@ const props = defineProps({
112
113
  type: Object,
113
114
  required: true
114
115
  },
116
+ isSavingItem: {
117
+ type: Object,
118
+ default: null
119
+ },
115
120
  isLoadingList: Boolean,
116
121
  pagedItems: {
117
122
  type: Object,
@@ -228,11 +228,11 @@ export function useListActions(name: string, {
228
228
  /**
229
229
  * Applies an action to an item.
230
230
  */
231
- const isApplyingActionToItem = ref(null);
231
+ const isSavingItem = ref(null);
232
232
  let actionResultCount = 0;
233
233
 
234
234
  async function applyAction(item, input, itemData = {}) {
235
- isApplyingActionToItem.value = item;
235
+ isSavingItem.value = item;
236
236
  const resultNumber = ++actionResultCount;
237
237
  setItemInPagedList({ ...item, ...input, ...itemData });
238
238
  const result = await applyActionRoute(item, input);
@@ -248,7 +248,7 @@ export function useListActions(name: string, {
248
248
  activeItem.value = { ...activeItem.value, ...result.item };
249
249
  }
250
250
  }
251
- isApplyingActionToItem.value = null;
251
+ isSavingItem.value = null;
252
252
  return result;
253
253
  }
254
254
 
@@ -355,7 +355,7 @@ export function useListActions(name: string, {
355
355
  isLoadingSummary,
356
356
  pager,
357
357
  quasarPagination,
358
- isApplyingActionToItem,
358
+ isSavingItem,
359
359
  activeItem,
360
360
  activePanel,
361
361