mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 17:32:36 +00:00
Refactor #5553 - For Inplace
This commit is contained in:
parent
014dc680f0
commit
6b605f6b57
6 changed files with 17 additions and 105 deletions
|
@ -1,25 +1,15 @@
|
|||
<template>
|
||||
<div v-focustrap :class="cx('root')" aria-live="polite" v-bind="ptmi('root')">
|
||||
<div :class="cx('root')" aria-live="polite" v-bind="ptmi('root')">
|
||||
<div v-if="!d_active" ref="display" :class="cx('display')" :tabindex="$attrs.tabindex || '0'" role="button" @click="open" @keydown.enter="open" v-bind="{ ...displayProps, ...ptm('display') }">
|
||||
<slot name="display"></slot>
|
||||
</div>
|
||||
<div v-else :class="cx('content')" v-bind="ptm('content')">
|
||||
<slot name="content"></slot>
|
||||
<IPButton v-if="closable" :aria-label="closeAriaLabel" @click="close" :unstyled="unstyled" :pt="ptm('closeButton')" v-bind="closeButtonProps">
|
||||
<template #icon>
|
||||
<slot name="closeicon">
|
||||
<component :is="closeIcon ? 'span' : 'TimesIcon'" :class="closeIcon" v-bind="ptm('closeButton')['icon']" data-pc-section="closebuttonicon"></component>
|
||||
</slot>
|
||||
</template>
|
||||
</IPButton>
|
||||
<slot name="content" :closeCallback="close" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Button from 'primevue/button';
|
||||
import FocusTrap from 'primevue/focustrap';
|
||||
import TimesIcon from 'primevue/icons/times';
|
||||
import BaseInplace from './BaseInplace.vue';
|
||||
|
||||
export default {
|
||||
|
@ -43,30 +33,21 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
this.$emit('open', event);
|
||||
this.d_active = true;
|
||||
|
||||
this.$emit('open', event);
|
||||
this.$emit('update:active', true);
|
||||
},
|
||||
close(event) {
|
||||
this.$emit('close', event);
|
||||
this.d_active = false;
|
||||
|
||||
this.$emit('close', event);
|
||||
this.$emit('update:active', false);
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.display.focus();
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
closeAriaLabel() {
|
||||
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
IPButton: Button,
|
||||
TimesIcon
|
||||
},
|
||||
directives: {
|
||||
focustrap: FocusTrap
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue