-
Notifications
You must be signed in to change notification settings - Fork 21
Feat/bulk action component #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e850dee
c83ee3b
e65f705
a5defaf
c95b1b6
b9a4d32
41eea76
28d3d04
afe97c6
8d28950
195ff77
e02ba0c
fa004e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <template> | ||
| <div @click="onClick"> | ||
| <slot /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| const props = defineProps<{ disabled?: boolean }>(); | ||
| const emit = defineEmits<{ (e: 'callAction', extra?: any ): void }>(); | ||
| function onClick() { | ||
| if (props.disabled) return; | ||
| const extra = { someData: 'example' }; | ||
| emit('callAction', extra); | ||
| } | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -176,13 +176,36 @@ | |||||
| </template> | ||||||
|
|
||||||
| <template v-if="resource.options?.actions"> | ||||||
| <Tooltip v-for="action in resource.options.actions.filter(a => a.showIn?.list)" :key="action.id"> | ||||||
| <button | ||||||
| @click="startCustomAction(action.id, row)" | ||||||
| <Tooltip | ||||||
| v-for="action in resource.options.actions.filter(a => a.showIn?.list)" | ||||||
| :key="action.id" | ||||||
| > | ||||||
| <CallActionWrapper | ||||||
| :disabled="rowActionLoadingStates?.[action.id]" | ||||||
| @callAction="startCustomAction(action.id, row)" | ||||||
| > | ||||||
| <component v-if="action.icon" :is="getIcon(action.icon)" class="w-5 h-5 mr-2 text-lightPrimary dark:text-darkPrimary"></component> | ||||||
| </button> | ||||||
| <template v-slot:tooltip> | ||||||
| <component | ||||||
| :is="action.customComponent ? getCustomComponent(action.customComponent) : 'span'" | ||||||
| :meta="action.customComponent?.meta" | ||||||
| :row="row" | ||||||
| :resource="resource" | ||||||
| :adminUser="adminUser" | ||||||
| > | ||||||
| <button | ||||||
| type="button" | ||||||
| :disabled="rowActionLoadingStates?.[action.id]" | ||||||
| @click.stop.prevent="startCustomAction(action.id, row)" | ||||||
|
||||||
| @click.stop.prevent="startCustomAction(action.id, row)" | |
| @click.stop="startCustomAction(action.id, row)" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -185,14 +185,37 @@ | |||||
| /> | ||||||
| </template> | ||||||
|
|
||||||
| <template v-if="resource.options?.actions"> | ||||||
| <Tooltip v-for="action in resource.options.actions.filter(a => a.showIn?.list)" :key="action.id"> | ||||||
| <button | ||||||
| @click="startCustomAction(action.id, row)" | ||||||
| <template v-if="resource.options?.actions"> | ||||||
| <Tooltip | ||||||
| v-for="action in resource.options.actions.filter(a => a.showIn?.list)" | ||||||
| :key="action.id" | ||||||
| > | ||||||
| <CallActionWrapper | ||||||
| :disabled="rowActionLoadingStates?.[action.id]" | ||||||
| @callAction="startCustomAction(action.id, row)" | ||||||
| > | ||||||
| <component v-if="action.icon" :is="getIcon(action.icon)" class="w-5 h-5 mr-2 text-lightPrimary dark:text-darkPrimary"></component> | ||||||
| </button> | ||||||
| <template v-slot:tooltip> | ||||||
| <component | ||||||
| :is="action.customComponent ? getCustomComponent(action.customComponent) : 'span'" | ||||||
| :meta="action.customComponent?.meta" | ||||||
| :row="row" | ||||||
| :resource="resource" | ||||||
| :adminUser="adminUser" | ||||||
| > | ||||||
| <button | ||||||
| type="button" | ||||||
| :disabled="rowActionLoadingStates?.[action.id]" | ||||||
| @click.stop.prevent="startCustomAction(action.id, row)" | ||||||
|
||||||
| @click.stop.prevent="startCustomAction(action.id, row)" | |
| @click.prevent="startCustomAction(action.id, row)" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,18 +24,24 @@ | |||||
| </a> | ||||||
| </li> | ||||||
| <li v-for="action in customActions" :key="action.id"> | ||||||
| <a href="#" @click.prevent="handleActionClick(action)" class="block px-4 py-2 hover:text-lightThreeDotsMenuBodyTextHover hover:bg-lightThreeDotsMenuBodyBackgroundHover dark:hover:bg-darkThreeDotsMenuBodyBackgroundHover dark:hover:text-darkThreeDotsMenuBodyTextHover"> | ||||||
| <div class="flex items-center gap-2"> | ||||||
| <component | ||||||
| v-if="action.icon" | ||||||
| :is="getIcon(action.icon)" | ||||||
| class="w-4 h-4 text-lightPrimary dark:text-darkPrimary" | ||||||
| /> | ||||||
| {{ action.name }} | ||||||
| </div> | ||||||
| </a> | ||||||
| <component | ||||||
| :is="(action.customComponent && getCustomComponent(action.customComponent)) || CallActionWrapper" | ||||||
| :meta="action.customComponent?.meta" | ||||||
| @callAction="handleActionClick(action)" | ||||||
| > | ||||||
| <a href="#" @click.prevent class="block px-4 py-2 hover:text-lightThreeDotsMenuBodyTextHover hover:bg-lightThreeDotsMenuBodyBackgroundHover dark:hover:bg-darkThreeDotsMenuBodyBackgroundHover dark:hover:text-darkThreeDotsMenuBodyTextHover"> | ||||||
| <div class="flex items-center gap-2"> | ||||||
| <component | ||||||
| v-if="action.icon" | ||||||
| :is="getIcon(action.icon)" | ||||||
| class="w-4 h-4 text-lightPrimary dark:text-darkPrimary" | ||||||
| /> | ||||||
| {{ action.name }} | ||||||
| </div> | ||||||
| </a> | ||||||
| </component> | ||||||
| </li> | ||||||
| <li v-for="action in bulkActions.filter(a => a.showInThreeDotsDropdown)" :key="action.id"> | ||||||
| <li v-for="action in bulkActions?.filter(a => a.showInThreeDotsDropdown)" :key="action.id"> | ||||||
|
||||||
| <li v-for="action in bulkActions?.filter(a => a.showInThreeDotsDropdown)" :key="action.id"> | |
| <li v-for="action in (bulkActions ?? []).filter(a => a.showInThreeDotsDropdown)" :key="action.id"> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <span> TEST CUSTOM COMPONENT </span> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -50,7 +50,7 @@ export default { | |||||
| dataSource: "maindb", | ||||||
| table: "users", | ||||||
| resourceId: "users", | ||||||
| label: "Users", | ||||||
| label: "Users1", | ||||||
|
||||||
| label: "Users1", | |
| label: "Users", |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Corrected 'submit' to 'Submit' for consistency with action name capitalization conventions.
| name: 'Auto submit', // Display name of the action | |
| name: 'Auto Submit', // Display name of the action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded 'extra' object with example data appears to be placeholder code that should be removed or made configurable.