Skip to content

Commit

Permalink
Refactor #6075
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jul 26, 2024
1 parent d697f82 commit 573c041
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 53 deletions.
31 changes: 6 additions & 25 deletions packages/primevue/src/confirmdialog/ConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ export default {
}
this.visible = false;
},
getCXOptions(icon, iconProps) {
return { contenxt: { icon, iconClass: iconProps.class } };
}
},
computed: {
Expand All @@ -141,35 +138,19 @@ export default {
return this.confirmation ? this.confirmation.position : null;
},
acceptLabel() {
if (!this.confirmation) {
return null;
}
const confirmation = this.confirmation;
if (confirmation.acceptLabel) {
return confirmation.acceptLabel;
}
if (this.confirmation) {
const confirmation = this.confirmation;
if (confirmation.acceptProps?.label) {
return confirmation.acceptProps.label;
return confirmation.acceptLabel || confirmation.acceptProps?.label || this.$primevue.config.locale.accept;
}
return this.$primevue.config.locale.accept;
},
rejectLabel() {
if (!this.confirmation) {
return null;
}
const confirmation = this.confirmation;
if (confirmation.rejectLabel) {
return confirmation.rejectLabel;
}
if (this.confirmation) {
const confirmation = this.confirmation;
if (confirmation.rejectProps?.label) {
return confirmation.rejectProps.label;
return confirmation.rejectLabel || confirmation.rejectProps?.label || this.$primevue.config.locale.reject;
}
return this.$primevue.config.locale.reject;
Expand Down
37 changes: 9 additions & 28 deletions packages/primevue/src/confirmpopup/ConfirmPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
</template>

<script>
import { ConnectedOverlayScrollHandler } from '@primevue/core/utils';
import { focus, absolutePosition, getOffset, addClass, isTouchDevice } from '@primeuix/utils/dom';
import { ZIndex } from '@primeuix/utils/zindex';
import { $dt } from '@primeuix/styled';
import { absolutePosition, addClass, focus, getOffset, isTouchDevice } from '@primeuix/utils/dom';
import { ZIndex } from '@primeuix/utils/zindex';
import { ConnectedOverlayScrollHandler } from '@primevue/core/utils';
import Button from 'primevue/button';
import ConfirmationEventBus from 'primevue/confirmationeventbus';
import FocusTrap from 'primevue/focustrap';
Expand Down Expand Up @@ -293,45 +293,26 @@ export default {
ConfirmationEventBus.emit('close', this.closeListener);
focus(this.target);
}
},
getCXOptions(icon, iconProps) {
return { contenxt: { icon, iconClass: iconProps.class } };
}
},
computed: {
message() {
return this.confirmation ? this.confirmation.message : null;
},
acceptLabel() {
if (!this.confirmation) {
return null;
}
const confirmation = this.confirmation;
if (this.confirmation) {
const confirmation = this.confirmation;
if (confirmation.acceptLabel) {
return confirmation.acceptLabel;
}
if (confirmation.acceptProps?.label) {
return confirmation.acceptProps.label;
return confirmation.acceptLabel || confirmation.acceptProps?.label || this.$primevue.config.locale.accept;
}
return this.$primevue.config.locale.accept;
},
rejectLabel() {
if (!this.confirmation) {
return null;
}
const confirmation = this.confirmation;
if (confirmation.rejectLabel) {
return confirmation.rejectLabel;
}
if (this.confirmation) {
const confirmation = this.confirmation;
if (confirmation.rejectProps?.label) {
return confirmation.rejectProps.label;
return confirmation.rejectLabel || confirmation.rejectProps?.label || this.$primevue.config.locale.reject;
}
return this.$primevue.config.locale.reject;
Expand Down

0 comments on commit 573c041

Please sign in to comment.