-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16892 from guerler/grids_vue
Vueify Visualizations Grid
- Loading branch information
Showing
23 changed files
with
1,600 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script setup lang="ts"> | ||
interface Props { | ||
text: string; | ||
} | ||
defineProps<Props>(); | ||
const emit = defineEmits<{ | ||
(e: "click"): void; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<button class="ui-link font-weight-bold" @click="emit('click')">{{ text }}</button> | ||
</template> |
52 changes: 52 additions & 0 deletions
52
client/src/components/Grid/GridElements/GridOperations.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script setup lang="ts"> | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faCaretDown } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import type { Operation, RowData } from "@/components/Grid/configs/types"; | ||
library.add(faCaretDown); | ||
interface Props { | ||
rowData: RowData; | ||
operations: Array<Operation>; | ||
} | ||
const props = defineProps<Props>(); | ||
const emit = defineEmits<{ | ||
(e: "execute", operation: Operation): void; | ||
}>(); | ||
/** | ||
* Availibility of operations might required certain conditions | ||
*/ | ||
function hasCondition(conditionHandler: (rowData: RowData) => Boolean) { | ||
return conditionHandler ? conditionHandler(props.rowData) : true; | ||
} | ||
</script> | ||
|
||
<template> | ||
<span> | ||
<button | ||
id="grid-operations" | ||
data-toggle="dropdown" | ||
aria-haspopup="true" | ||
aria-expanded="false" | ||
class="ui-link font-weight-bold"> | ||
<FontAwesomeIcon icon="caret-down" class="fa-lg" /> | ||
<span class="font-weight-bold">{{ rowData.title }}</span> | ||
</button> | ||
<div v-if="operations" class="dropdown-menu" aria-labelledby="dataset-dropdown"> | ||
<span v-for="(operation, operationIndex) in operations" :key="operationIndex"> | ||
<button | ||
v-if="operation && operation.condition && hasCondition(operation.condition)" | ||
class="dropdown-item" | ||
@click.prevent="emit('execute', operation)"> | ||
<icon :icon="operation.icon" /> | ||
<span v-localize>{{ operation.title }}</span> | ||
</button> | ||
</span> | ||
</div> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup lang="ts"> | ||
interface Props { | ||
text?: string; | ||
} | ||
defineProps<Props>(); | ||
</script> | ||
|
||
<template> | ||
<span v-localize>{{ text ?? "Not available." }}</span> | ||
</template> |
Oops, something went wrong.