pull/1751/head
Cagatay Civici 2021-11-11 14:31:39 +03:00
commit bcf326e0d9
3 changed files with 16 additions and 3 deletions

View File

@ -4,8 +4,8 @@
<i :class="iconClass" />
<span class="p-confirm-dialog-message">{{message}}</span>
<template #footer>
<CDButton :label="rejectLabel" :icon="rejectIcon" :class="rejectClass" @click="reject()"/>
<CDButton :label="acceptLabel" :icon="acceptIcon" :class="acceptClass" @click="accept()" autofocus />
<CDButton :label="rejectLabel" :icon="rejectIcon" :class="rejectClass" @click="reject()" :autofocus="autoFocusReject"/>
<CDButton :label="acceptLabel" :icon="acceptIcon" :class="acceptClass" @click="accept()" :autofocus="autoFocusAccept" />
</template>
</CDialog>
</template>
@ -104,6 +104,13 @@ export default {
},
rejectClass() {
return ['p-confirm-dialog-reject', this.confirmation ? (this.confirmation.rejectClass || 'p-button-text') : null];
},
autoFocusAccept() {
return this.confirmation.defaultFocus === 'accept' ? true : false;
},
autoFocusReject() {
// backward compatibility
return this.confirmation.defaultFocus !== 'accept' ? true : false;
}
},
components: {

View File

@ -1,5 +1,5 @@
<template>
<input :class="['p-inputtext p-component', {'p-filled': filled}]" :value="modelValue" @input="onInput" />
<input :class="['p-inputtext p-component', {'p-filled': filled}]" :value="modelValue" @input="onInput" v-bind="$attrs" />
</template>
<script>

View File

@ -192,6 +192,12 @@ export default {
<td>true</td>
<td>Whether background scroll should be blocked when dialog is visible.</td>
</tr>
<tr>
<td>defaultFocus</td>
<td>string</td>
<td>null</td>
<td>Element to receive the focus when the dialog gets visible, valid values are "accept" and "reject".</td>
</tr>
</tbody>
</table>
</div>