adminforth 4.17.0 → 4.18.0
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.
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
<div v-if="$slots.filters" class="order-last basis-full flex flex-wrap items-center gap-2 @4xl/header:order-none @4xl/header:basis-auto @4xl/header:ms-auto">
|
|
10
10
|
<slot name="filters"></slot>
|
|
11
11
|
</div>
|
|
12
|
-
<!-- actions for the checked rows get a row of their own above the table, so the buttons next to the title stay in place -->
|
|
13
|
-
<div v-if="$slots.selection" class="order-last basis-full flex flex-wrap items-center gap-2">
|
|
14
|
-
<slot name="selection"></slot>
|
|
15
|
-
</div>
|
|
16
12
|
<div class="flex items-center gap-2 flex-wrap">
|
|
17
13
|
<slot></slot>
|
|
18
14
|
</div>
|
|
@@ -273,8 +273,9 @@
|
|
|
273
273
|
</div>
|
|
274
274
|
<!-- pagination
|
|
275
275
|
totalRows in v-if is used to not hide page input during loading when user puts cursor into it and edit directly (rows gets null there during edit)
|
|
276
|
+
hidden pagination keeps its room, e.g. the bar of checked rows covers it
|
|
276
277
|
-->
|
|
277
|
-
<div class="af-pagination-container flex flex-row items-center mt-4 xs:flex-row xs:justify-between xs:items-center gap-3">
|
|
278
|
+
<div class="af-pagination-container flex flex-row items-center mt-4 xs:flex-row xs:justify-between xs:items-center gap-3" :class="{ invisible: hidePagination }">
|
|
278
279
|
|
|
279
280
|
<!-- one hairline frame around 26px buttons split by lighter dividers, the current page is an inset field -->
|
|
280
281
|
<div class="af-pagination-buttons-container af-button-shadow inline-flex overflow-hidden rounded-default border border-lightListTablePaginationBorder bg-lightListTablePaginationBackgoround divide-x rtl:divide-x-reverse divide-lightListTablePaginationBorder/60 dark:border-darkListTablePaginationBorder dark:bg-darkListTablePaginationBackgoround dark:divide-darkListTablePaginationBorder/60"
|
|
@@ -433,6 +434,7 @@ const props = withDefaults(defineProps<{
|
|
|
433
434
|
checkboxes: any[],
|
|
434
435
|
sort: any[],
|
|
435
436
|
noRoundings?: boolean,
|
|
437
|
+
hidePagination?: boolean,
|
|
436
438
|
customActionsInjection?: any[],
|
|
437
439
|
tableBodyStartInjection?: any[],
|
|
438
440
|
containerHeight?: number,
|
|
@@ -32,65 +32,6 @@
|
|
|
32
32
|
:clearCheckboxes="clearCheckboxes"
|
|
33
33
|
/>
|
|
34
34
|
</template>
|
|
35
|
-
<template v-if="isResourceReady && checkboxes.length" #selection>
|
|
36
|
-
<Button
|
|
37
|
-
@click="()=>{checkboxes = []}"
|
|
38
|
-
variant="secondary"
|
|
39
|
-
iconOnly
|
|
40
|
-
>
|
|
41
|
-
<Tooltip>
|
|
42
|
-
<IconBan class="w-4 h-4"/>
|
|
43
|
-
<template #tooltip >
|
|
44
|
-
Remove selection
|
|
45
|
-
</template>
|
|
46
|
-
</Tooltip>
|
|
47
|
-
</Button>
|
|
48
|
-
|
|
49
|
-
<div
|
|
50
|
-
v-for="(action,i) in coreStore.resource?.options?.bulkActions?.filter(a => !a.showInThreeDotsDropdown)"
|
|
51
|
-
>
|
|
52
|
-
<Button
|
|
53
|
-
:key="action.id"
|
|
54
|
-
@click="startBulkActionInner(action.id!)"
|
|
55
|
-
class="h-[2.125rem] px-2.5"
|
|
56
|
-
:class="action.buttonCustomCssClass || ''"
|
|
57
|
-
variant="secondary"
|
|
58
|
-
>
|
|
59
|
-
<component
|
|
60
|
-
v-if="action.icon && !bulkActionLoadingStates[action.id!]"
|
|
61
|
-
:is="getIcon(action.icon)"
|
|
62
|
-
class="w-4 h-4 transition duration-75"></component>
|
|
63
|
-
<Spinner
|
|
64
|
-
v-if="bulkActionLoadingStates[action.id!]"
|
|
65
|
-
class="w-4 h-4"
|
|
66
|
-
/>
|
|
67
|
-
{{ `${action.label} (${checkboxes.length})` }}
|
|
68
|
-
<div v-if="action.badge" class="inline-flex items-center h-[1.125rem] px-1.5 ml-1 rounded-full bg-purple-600 text-white text-[11px] font-semibold">
|
|
69
|
-
{{ action.badge }}
|
|
70
|
-
</div>
|
|
71
|
-
</Button>
|
|
72
|
-
</div>
|
|
73
|
-
<div
|
|
74
|
-
v-for="(action,i) in coreStore.resource?.options?.actions?.filter(a => a.showIn?.bulkButton)"
|
|
75
|
-
>
|
|
76
|
-
<Button
|
|
77
|
-
:key="action.id"
|
|
78
|
-
@click="startCustomBulkActionInner(action.id!)"
|
|
79
|
-
class="h-[2.125rem] px-2.5"
|
|
80
|
-
variant="secondary"
|
|
81
|
-
>
|
|
82
|
-
<component
|
|
83
|
-
v-if="action.icon && !customActionLoadingStates[action.id!]"
|
|
84
|
-
:is="getIcon(action.icon)"
|
|
85
|
-
class="w-4 h-4 transition duration-75"></component>
|
|
86
|
-
<Spinner
|
|
87
|
-
v-if="customActionLoadingStates[action.id!]"
|
|
88
|
-
class="w-4 h-4"
|
|
89
|
-
/>
|
|
90
|
-
{{ `${action.name} (${checkboxes.length})` }}
|
|
91
|
-
</Button>
|
|
92
|
-
</div>
|
|
93
|
-
</template>
|
|
94
35
|
<template v-if="isResourceReady">
|
|
95
36
|
<LinkButton v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
96
37
|
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
@@ -183,8 +124,77 @@
|
|
|
183
124
|
:item-height="52.5"
|
|
184
125
|
:buffer-size="listBufferSize"
|
|
185
126
|
:isVirtualScrollEnabled="isVirtualScrollEnabled"
|
|
127
|
+
:hidePagination="checkboxes.length > 0"
|
|
186
128
|
/>
|
|
187
129
|
|
|
130
|
+
<Transition
|
|
131
|
+
enter-from-class="opacity-0 translate-y-2"
|
|
132
|
+
enter-active-class="transition duration-150 ease-out"
|
|
133
|
+
leave-active-class="transition duration-100 ease-in"
|
|
134
|
+
leave-to-class="opacity-0 translate-y-2"
|
|
135
|
+
>
|
|
136
|
+
<!--
|
|
137
|
+
the bar of checked rows takes the place of the pagination, which keeps its room: changing the page drops the checked rows anyway.
|
|
138
|
+
So it takes no room itself and covers no rows, over a long table it sticks to the bottom of the screen.
|
|
139
|
+
All actions stay in sight: on a narrow screen they wrap between the count and Clear, and the bar grows up over the last rows
|
|
140
|
+
-->
|
|
141
|
+
<div v-if="isResourceReady && checkboxes.length" class="af-bulk-actions-bar-container sticky bottom-4 z-30 h-0">
|
|
142
|
+
<div class="absolute inset-x-0 bottom-0 flex justify-center px-4 pointer-events-none">
|
|
143
|
+
<div
|
|
144
|
+
role="toolbar"
|
|
145
|
+
:aria-label="$t('Bulk actions')"
|
|
146
|
+
class="af-bulk-actions-bar pointer-events-auto flex items-center gap-1 max-w-full p-1 ps-3.5 rounded-lg bg-lightTooltipBackground text-lightTooltipText shadow-popover dark:bg-darkTooltipBackground dark:text-darkTooltipText dark:shadow-darkPopover"
|
|
147
|
+
>
|
|
148
|
+
<span class="af-bulk-actions-count shrink-0 me-1.5 text-[13px] font-medium tabular-nums whitespace-nowrap">{{ $t('{count} selected', { count: checkboxes.length }) }}</span>
|
|
149
|
+
<!-- dividers take the height of the wrapped actions -->
|
|
150
|
+
<span class="shrink-0 self-stretch w-px my-1 mx-1 bg-lightTooltipText/20 dark:bg-darkTooltipText/20" aria-hidden="true"></span>
|
|
151
|
+
<div class="flex flex-wrap items-center gap-1">
|
|
152
|
+
<Button
|
|
153
|
+
v-for="action in coreStore.resource?.options?.bulkActions?.filter(a => !a.showInThreeDotsDropdown)"
|
|
154
|
+
:key="action.id"
|
|
155
|
+
@click="startBulkActionInner(action.id!)"
|
|
156
|
+
:loader="bulkActionLoadingStates[action.id!]"
|
|
157
|
+
variant="ghost"
|
|
158
|
+
size="sm"
|
|
159
|
+
class="af-bulk-action-button"
|
|
160
|
+
:class="[BULK_BAR_BUTTON_CLASSES, action.dangerous && BULK_BAR_DANGER_CLASSES, action.buttonCustomCssClass]"
|
|
161
|
+
>
|
|
162
|
+
<component v-if="action.icon && !bulkActionLoadingStates[action.id!]" :is="getIcon(action.icon)" class="w-4 h-4" />
|
|
163
|
+
{{ action.label }}
|
|
164
|
+
<span v-if="action.badge" class="inline-flex items-center h-[1.125rem] px-1.5 rounded-full text-[11px] font-semibold bg-lightPrimary text-lightPrimaryContrast dark:bg-darkPrimary dark:text-darkPrimaryContrast">
|
|
165
|
+
{{ action.badge }}
|
|
166
|
+
</span>
|
|
167
|
+
</Button>
|
|
168
|
+
<Button
|
|
169
|
+
v-for="action in coreStore.resource?.options?.actions?.filter(a => a.showIn?.bulkButton)"
|
|
170
|
+
:key="action.id"
|
|
171
|
+
@click="startCustomBulkActionInner(action.id!)"
|
|
172
|
+
:loader="customActionLoadingStates[action.id!]"
|
|
173
|
+
variant="ghost"
|
|
174
|
+
size="sm"
|
|
175
|
+
class="af-bulk-action-button"
|
|
176
|
+
:class="[BULK_BAR_BUTTON_CLASSES, action.bulkDangerous && BULK_BAR_DANGER_CLASSES]"
|
|
177
|
+
>
|
|
178
|
+
<component v-if="action.icon && !customActionLoadingStates[action.id!]" :is="getIcon(action.icon)" class="w-4 h-4" />
|
|
179
|
+
{{ action.name }}
|
|
180
|
+
</Button>
|
|
181
|
+
</div>
|
|
182
|
+
<span class="shrink-0 self-stretch w-px my-1 mx-1 bg-lightTooltipText/20 dark:bg-darkTooltipText/20" aria-hidden="true"></span>
|
|
183
|
+
<Button
|
|
184
|
+
@click="clearCheckboxes"
|
|
185
|
+
variant="ghost"
|
|
186
|
+
size="sm"
|
|
187
|
+
class="af-bulk-actions-clear-button shrink-0"
|
|
188
|
+
:class="BULK_BAR_BUTTON_CLASSES"
|
|
189
|
+
>
|
|
190
|
+
<IconX class="w-4 h-4" />
|
|
191
|
+
{{ $t('Clear') }}
|
|
192
|
+
</Button>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</Transition>
|
|
197
|
+
|
|
188
198
|
<component
|
|
189
199
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom as AdminForthComponentDeclaration[] || []"
|
|
190
200
|
:is="getCustomComponent(formatComponent(c))"
|
|
@@ -207,12 +217,11 @@ import { computed, onMounted, onUnmounted, ref, watch, type Ref } from 'vue';
|
|
|
207
217
|
import { useRoute } from 'vue-router';
|
|
208
218
|
import { getCustomComponent, getList, startBulkAction, lsKey } from '@/utils';
|
|
209
219
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
210
|
-
import {
|
|
220
|
+
import { Button, LinkButton } from '@/afcl'
|
|
211
221
|
import type { AdminForthComponentDeclaration, AdminForthComponentDeclarationFull, AdminForthFilterOperators, AdminForthResourceColumnCommon } from '@/types/Common';
|
|
212
222
|
import { useI18n } from 'vue-i18n';
|
|
213
223
|
|
|
214
224
|
import {
|
|
215
|
-
IconBan,
|
|
216
225
|
IconListFilter,
|
|
217
226
|
IconPlus,
|
|
218
227
|
IconX
|
|
@@ -233,6 +242,11 @@ const route = useRoute();
|
|
|
233
242
|
const isResourceReady = computed(() => coreStore.resource?.resourceId === route.params.resourceId);
|
|
234
243
|
const beforeActionButtons = computed(() => (coreStore.resourceOptions?.pageInjections?.list?.beforeActionButtons || []) as AdminForthComponentDeclaration[]);
|
|
235
244
|
|
|
245
|
+
// ghost buttons on the bar of checked rows take its text color, the bar is dark in the light theme and light in the dark one
|
|
246
|
+
const BULK_BAR_BUTTON_CLASSES = 'text-lightTooltipText hover:bg-lightTooltipText/10 hover:text-lightTooltipText dark:text-darkTooltipText dark:hover:bg-darkTooltipText/10 dark:hover:text-darkTooltipText';
|
|
247
|
+
// so a destructive action on it takes the danger color of the opposite theme
|
|
248
|
+
const BULK_BAR_DANGER_CLASSES = 'text-darkDanger hover:text-darkDanger dark:text-lightDanger dark:hover:text-lightDanger';
|
|
249
|
+
|
|
236
250
|
const page = ref(1);
|
|
237
251
|
const columnsMinMax = ref({});
|
|
238
252
|
const sort = ref();
|