Fixed #1651 - disabled props for Inplace
parent
8e28af05ad
commit
be0f826707
|
@ -10,6 +10,12 @@ const InplaceProps = [
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
default: "false",
|
default: "false",
|
||||||
description: "Displays a button to switch back to display mode."
|
description: "Displays a button to switch back to display mode."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "diabled",
|
||||||
|
type: "boolean",
|
||||||
|
default: "false",
|
||||||
|
description: "When present, it specifies that the element should be disabled."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { VNode } from 'vue';
|
||||||
interface InplaceProps {
|
interface InplaceProps {
|
||||||
closable?: boolean;
|
closable?: boolean;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Inplace {
|
declare class Inplace {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="containerClass">
|
<div :class="containerClass">
|
||||||
<div class="p-inplace-display" :tabindex="$attrs.tabindex||'0'" v-if="!d_active" @click="open" @keydown.enter="open">
|
<div :class="displayClass" :tabindex="$attrs.tabindex||'0'" v-if="!d_active" @click="open" @keydown.enter="open">
|
||||||
<slot name="display"></slot>
|
<slot name="display"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-inplace-content" v-else>
|
<div class="p-inplace-content" v-else>
|
||||||
|
@ -24,6 +24,10 @@ export default {
|
||||||
active: {
|
active: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -38,6 +42,10 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open(event) {
|
open(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('open', event);
|
this.$emit('open', event);
|
||||||
this.d_active = true;
|
this.d_active = true;
|
||||||
this.$emit('update:active', true);
|
this.$emit('update:active', true);
|
||||||
|
@ -51,6 +59,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
containerClass() {
|
containerClass() {
|
||||||
return ['p-inplace p-component', {'p-inplace-closable': this.closable}];
|
return ['p-inplace p-component', {'p-inplace-closable': this.closable}];
|
||||||
|
},
|
||||||
|
displayClass() {
|
||||||
|
return ['p-inplace-display', {'p-disabled': this.disabled}];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -101,6 +101,12 @@ export default {
|
||||||
<td>boolean</td>
|
<td>boolean</td>
|
||||||
<td>false</td>
|
<td>false</td>
|
||||||
<td>Displays a button to switch back to display mode.</td>
|
<td>Displays a button to switch back to display mode.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>disabled</td>
|
||||||
|
<td>boolean</td>
|
||||||
|
<td>false</td>
|
||||||
|
<td>When present, it specifies that the element should be disabled.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue