PT: Panel

pull/3841/head
mertsincan 2023-03-21 12:05:24 +00:00 committed by Tuğçe Küçükoğlu
parent 7a77ac84be
commit bc59eedff8
5 changed files with 39 additions and 9 deletions

View File

@ -0,0 +1,18 @@
<script>
import { ObjectUtils } from 'primevue/utils';
export default {
name: 'ComponentBase',
props: {
pt: {
type: Object,
value: {}
}
},
methods: {
ptm(key = '', params = {}) {
return ObjectUtils.getItemValue((this.pt || {})[key.toLowerCase()], { props: this.$props, state: this.$data, ...params });
}
}
};
</script>

View File

@ -0,0 +1,8 @@
{
"main": "./componentbase.cjs.js",
"module": "./componentbase.esm.js",
"unpkg": "./componentbase.min.js",
"browser": {
"./sfc": "./ComponentBase.vue"
}
}

View File

@ -1,10 +1,10 @@
<template> <template>
<div :class="containerClass"> <div :class="containerClass" v-bind="ptm('root')">
<div class="p-panel-header"> <div class="p-panel-header" v-bind="ptm('header')">
<slot name="header"> <slot name="header">
<span v-if="header" :id="ariaId + '_header'" class="p-panel-title">{{ header }}</span> <span v-if="header" :id="ariaId + '_header'" class="p-panel-title" v-bind="ptm('title')">{{ header }}</span>
</slot> </slot>
<div class="p-panel-icons"> <div class="p-panel-icons" v-bind="ptm('icons')">
<slot name="icons"></slot> <slot name="icons"></slot>
<button <button
v-if="toggleable" v-if="toggleable"
@ -12,21 +12,21 @@
v-ripple v-ripple
type="button" type="button"
role="button" role="button"
class="p-panel-header-icon p-panel-toggler p-link" class="p-panel-toggler p-link"
:aria-label="buttonAriaLabel" :aria-label="buttonAriaLabel"
:aria-controls="ariaId + '_content'" :aria-controls="ariaId + '_content'"
:aria-expanded="!d_collapsed" :aria-expanded="!d_collapsed"
@click="toggle" @click="toggle"
@keydown="onKeyDown" @keydown="onKeyDown"
v-bind="toggleButtonProps" v-bind="(toggleButtonProps, ptm('toggler'))"
> >
<span :class="{ 'pi pi-minus': !d_collapsed, 'pi pi-plus': d_collapsed }"></span> <span :class="['p-panel-header-icon', { 'pi pi-minus': !d_collapsed, 'pi pi-plus': d_collapsed }]" v-bind="ptm('headericon')"></span>
</button> </button>
</div> </div>
</div> </div>
<transition name="p-toggleable-content"> <transition name="p-toggleable-content">
<div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'"> <div v-show="!d_collapsed" :id="ariaId + '_content'" class="p-toggleable-content" role="region" :aria-labelledby="ariaId + '_header'" v-bind="ptm('toggleablecontent')">
<div class="p-panel-content"> <div class="p-panel-content" v-bind="ptm('content')">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -35,11 +35,13 @@
</template> </template>
<script> <script>
import ComponentBase from 'primevue/base';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import { UniqueComponentId } from 'primevue/utils'; import { UniqueComponentId } from 'primevue/utils';
export default { export default {
name: 'Panel', name: 'Panel',
extends: ComponentBase,
emits: ['update:collapsed', 'toggle'], emits: ['update:collapsed', 'toggle'],
props: { props: {
header: String, header: String,

View File

@ -85,6 +85,7 @@ export default defineNuxtConfig({
'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'), 'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'),
'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'), 'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'),
'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'), 'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'),
'primevue/base': path.resolve(__dirname, './components/base/ComponentBase.vue'),
'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'), 'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'),
'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'), 'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'),
'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'), 'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'),

View File

@ -23,6 +23,7 @@ export default {
'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'), 'primevue/utils': path.resolve(__dirname, './components/lib/utils/Utils.js'),
'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'), 'primevue/api': path.resolve(__dirname, './components/lib/api/Api.js'),
'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'), 'primevue/portal': path.resolve(__dirname, './components/lib/portal/Portal.vue'),
'primevue/base': path.resolve(__dirname, './components/base/ComponentBase.vue'),
'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'), 'primevue/button': path.resolve(__dirname, './components/lib/button/Button.vue'),
'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'), 'primevue/inputtext': path.resolve(__dirname, './components/lib/inputtext/InputText.vue'),
'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'), 'primevue/dialog': path.resolve(__dirname, './components/lib/dialog/Dialog.vue'),