Skip to content

Commit

Permalink
feat: Allow to hide the separator in KCardSection (close #1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Jan 31, 2025
1 parent 518733a commit 40b80f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
26 changes: 3 additions & 23 deletions core/client/components/collection/KCardSection.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<q-separator />
<q-separator v-if="!hideSeparator" />
<!--
Header section
-->
Expand All @@ -26,30 +26,10 @@
<script setup>
import _ from 'lodash'
import { computed } from 'vue'
import { CardSectionProps } from '../../utils/utils.items.js'
// Props
const props = defineProps({
title: {
type: String,
default: ''
},
actions: {
type: Array,
default: () => null
},
actionsFilter: {
type: [String, Array],
default: () => null
},
hideHeader: {
type: Boolean,
default: false
},
dense: {
type: Boolean,
default: false
}
})
const props = defineProps(_.omit(CardSectionProps, ['item']))
// Computed
const filteredActions = computed(() => {
Expand Down
15 changes: 10 additions & 5 deletions core/client/components/collection/KDescriptionCardSection.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<template>
<KCardSection
:title="$t('KDescriptionCardSection.TITLE')"
:title="computedTitle"
:actions="actions"
:actionsFilter="actionsFilter"
:hideHeader="hideHeader"
:hide-separator="hideSeparator"
:hide-header="hideHeader"
:dense="dense"
>
<KTextArea
v-if="description"
:text="description"
v-if="computedDescription"
:text="computedDescription"
:minHeight="48"
:dense="dense"
/>
Expand All @@ -28,6 +29,7 @@
import _ from 'lodash'
import { computed } from 'vue'
import { CardSectionProps } from '../../utils/utils.items.js'
import { i18n } from '../../i18n.js'
import KCardSection from './KCardSection.vue'
import KTextArea from '../KTextArea.vue'
Expand All @@ -41,7 +43,10 @@ const props = defineProps({
})
// Computed
const description = computed(() => {
const computedTitle = computed(() => {
return _.isEmpty(props.title) ? i18n.t('KDescriptionCardSection.TITLE') : props.title
})
const computedDescription = computed(() => {
return _.get(props.item, props.descriptionPath)
})
</script>
4 changes: 4 additions & 0 deletions core/client/utils/utils.items.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const CardSectionProps = {
type: [String, Array],
default: () => null
},
hideSeparator: {
type: Boolean,
default: false
},
hideHeader: {
type: Boolean,
default: false
Expand Down

0 comments on commit 40b80f4

Please sign in to comment.