diff --git a/api-generator/components/dialog.js b/api-generator/components/dialog.js index 7e53088a9..970eff2ad 100644 --- a/api-generator/components/dialog.js +++ b/api-generator/components/dialog.js @@ -189,6 +189,14 @@ const DialogSlots = [ { name: 'footer', description: "Custom content for the component's footer" + }, + { + name: 'closeicon', + description: 'Custom close icon template.' + }, + { + name: 'maximizeicon', + description: 'Custom maximizeicon icon template of dialog.' } ]; diff --git a/components/lib/dialog/Dialog.d.ts b/components/lib/dialog/Dialog.d.ts index bc24c3541..019d301ee 100755 --- a/components/lib/dialog/Dialog.d.ts +++ b/components/lib/dialog/Dialog.d.ts @@ -146,17 +146,14 @@ export interface DialogProps { style?: any; /** * Icon to display in the dialog close button. - * @defaultValue pi pi-times */ closeIcon?: string | undefined; /** * Icon to display in the dialog maximize button when dialog is not maximized. - * @defaultValue pi pi-window-maximize */ maximizeIcon?: string | undefined; /** * Icon to display in the dialog maximize button when dialog is maximized. - * @defaultValue pi pi-window-minimize */ minimizeIcon?: string | undefined; } @@ -177,6 +174,20 @@ export interface DialogSlots { * Custom footer template. */ footer(): VNode[]; + /** + * Custom close icon template. + */ + closeicon(): VNode[]; + /** + * Custom maximizeicon icon template of dialog. + * @param {Object} scope - maximizeicon icon slot's params. + */ + maximizeicon(scope: { + /** + * Maximized state as a boolean + */ + maximized: boolean; + }): VNode[]; } /** diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index 19bc83445..bc540d825 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -9,7 +9,9 @@
@@ -44,6 +48,9 @@ import Portal from 'primevue/portal'; import Ripple from 'primevue/ripple'; import { DomHandler, UniqueComponentId, ZIndexUtils } from 'primevue/utils'; import { computed } from 'vue'; +import TimesIcon from 'primevue/icon/times'; +import WindowMaximizeIcon from 'primevue/icon/windowmaximize'; +import WindowMinimizeIcon from 'primevue/icon/windowminimize'; export default { name: 'Dialog', @@ -140,15 +147,15 @@ export default { }, closeIcon: { type: String, - default: 'pi pi-times' + default: undefined }, maximizeIcon: { type: String, - default: 'pi pi-window-maximize' + default: undefined }, minimizeIcon: { type: String, - default: 'pi pi-window-minimize' + default: undefined }, closeButtonProps: { type: null, @@ -169,20 +176,6 @@ export default { focusableClose: null }; }, - documentKeydownListener: null, - container: null, - mask: null, - content: null, - headerContainer: null, - footerContainer: null, - maximizableButton: null, - closeButton: null, - styleElement: null, - dragging: null, - documentDragListener: null, - documentDragEndListener: null, - lastPageX: null, - lastPageY: null, updated() { if (this.visible) { this.containerVisible = this.visible; @@ -475,14 +468,13 @@ export default { } ]; }, + maximizeIconComponent() { + return this.maximized ? (this.minimizeIcon ? 'span' : 'WindowMinimizeIcon') : this.maximizeIcon ? 'span' : 'WindowMaximizeIcon'; + }, maximizeIconClass() { - return [ - 'p-dialog-header-maximize-icon', - { - [this.maximizeIcon]: !this.maximized, - [this.minimizeIcon]: this.maximized - } - ]; + const maximizeClasses = this.maximized ? this.minimizeIcon : this.maximizeIcon; + + return `p-dialog-header-maximize-icon ${maximizeClasses}`; }, ariaId() { return UniqueComponentId(); @@ -500,12 +492,29 @@ export default { return ['p-dialog-content', this.contentClass]; } }, + documentKeydownListener: null, + container: null, + mask: null, + content: null, + headerContainer: null, + footerContainer: null, + maximizableButton: null, + closeButton: null, + styleElement: null, + dragging: null, + documentDragListener: null, + documentDragEndListener: null, + lastPageX: null, + lastPageY: null, directives: { ripple: Ripple, focustrap: FocusTrap }, components: { - Portal: Portal + Portal: Portal, + WindowMinimizeIcon, + WindowMaximizeIcon, + TimesIcon } }; diff --git a/components/lib/tabview/TabView.vue b/components/lib/tabview/TabView.vue index 0c06389aa..74e7743e2 100755 --- a/components/lib/tabview/TabView.vue +++ b/components/lib/tabview/TabView.vue @@ -13,7 +13,7 @@ v-bind="{ ...previousButtonProps, ...ptm('prevbutton') }" > -
@@ -59,7 +59,7 @@ v-bind="{ ...nextButtonProps, ...ptm('nextbutton') }" > -