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

View File

@ -1,5 +1,5 @@
<template> <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> </template>
<script> <script>

View File

@ -192,6 +192,12 @@ export default {
<td>true</td> <td>true</td>
<td>Whether background scroll should be blocked when dialog is visible.</td> <td>Whether background scroll should be blocked when dialog is visible.</td>
</tr> </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> </tbody>
</table> </table>
</div> </div>