From 005d5975e92e660a127896b760cd73ab59508ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Mon, 18 Jul 2022 09:13:28 +0300 Subject: [PATCH] Fixed #2780 - appendTo prop TypeScript typing disallows usage of HTML elements --- src/components/autocomplete/AutoComplete.d.ts | 3 ++- src/components/calendar/Calendar.d.ts | 3 ++- src/components/cascadeselect/CascadeSelect.d.ts | 2 +- src/components/colorpicker/ColorPicker.d.ts | 5 +++-- src/components/contextmenu/ContextMenu.d.ts | 2 +- src/components/dialog/Dialog.d.ts | 2 +- src/components/dropdown/Dropdown.d.ts | 4 ++-- src/components/menu/Menu.d.ts | 2 +- src/components/multiselect/MultiSelect.d.ts | 8 ++++---- src/components/overlaypanel/OverlayPanel.d.ts | 2 +- src/components/password/Password.d.ts | 2 +- src/components/portal/Portal.d.ts | 2 +- src/components/splitbutton/SplitButton.d.ts | 2 +- src/components/tieredmenu/TieredMenu.d.ts | 2 +- 14 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/components/autocomplete/AutoComplete.d.ts b/src/components/autocomplete/AutoComplete.d.ts index a8950ce67..6d2f860e4 100755 --- a/src/components/autocomplete/AutoComplete.d.ts +++ b/src/components/autocomplete/AutoComplete.d.ts @@ -6,7 +6,7 @@ type AutoCompleteFieldType = string | ((data: any) => string) | undefined; type AutoCompleteDropdownMode = 'blank' | 'current' | undefined; -type AutoCompleteAppendTo = 'body' | 'self' | string | undefined; +type AutoCompleteAppendTo = 'body' | 'self' | string | undefined | HTMLElement; export interface AutoCompleteItemSelectEvent { /** @@ -104,6 +104,7 @@ export interface AutoCompleteProps { /** * A valid query selector or an HTMLElement to specify where the overlay gets attached. * Special keywords are 'body' for document body and 'self' for the element itself. + * @see AutoCompleteAppendTo * Default value is body. */ appendTo?: AutoCompleteAppendTo; diff --git a/src/components/calendar/Calendar.d.ts b/src/components/calendar/Calendar.d.ts index 1dc49ed08..21a260c8e 100755 --- a/src/components/calendar/Calendar.d.ts +++ b/src/components/calendar/Calendar.d.ts @@ -11,7 +11,7 @@ type CalendarViewType = 'date' | 'month' | 'year' | undefined; type CalendarHourFormatType = '12' | '24' | undefined; -type CalendarAppendToType = 'body' | 'self' | string | undefined; +type CalendarAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface CalendarResponsiveOptions { /** @@ -235,6 +235,7 @@ export interface CalendarProps { manualInput?: boolean | undefined; /** * A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself. + * @see CalendarAppendToType * Default value is 'body'. */ appendTo?: CalendarAppendToType; diff --git a/src/components/cascadeselect/CascadeSelect.d.ts b/src/components/cascadeselect/CascadeSelect.d.ts index 5835ea2be..fe965eeb6 100644 --- a/src/components/cascadeselect/CascadeSelect.d.ts +++ b/src/components/cascadeselect/CascadeSelect.d.ts @@ -7,7 +7,7 @@ type CascadeSelectOptionValueType = string | ((data: any) => any) | undefined; type CascadeSelectOptionChildrenType = string[] | string | ((data: any) => any[]) | undefined; -type CascadeSelectAppendToType = 'body' | 'self' | string | undefined; +type CascadeSelectAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface CascadeSelectChangeEvent { /** diff --git a/src/components/colorpicker/ColorPicker.d.ts b/src/components/colorpicker/ColorPicker.d.ts index 2dd3a081d..cf7cbaa09 100755 --- a/src/components/colorpicker/ColorPicker.d.ts +++ b/src/components/colorpicker/ColorPicker.d.ts @@ -2,7 +2,7 @@ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; type ColorPickerFormatType = 'hex' | 'rgb' | 'hsb' | undefined; -type ColorPickerAppendToType = 'body' | 'self' | string | undefined; +type ColorPickerAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface ColorPickerChangeEvent { /** @@ -63,6 +63,7 @@ export interface ColorPickerProps { panelClass?: any; /** * A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself. + * @see ColorPickerAppendToType * Default value is 'body'. */ appendTo?: ColorPickerAppendToType; @@ -86,7 +87,7 @@ export declare type ColorPickerEmits = { * Callback to invoke when input is cleared by the user. */ 'show': () => void; - /** + /** * Callback to invoke when input is cleared by the user. */ 'hide': () => void; diff --git a/src/components/contextmenu/ContextMenu.d.ts b/src/components/contextmenu/ContextMenu.d.ts index 176ad61bd..3cda7cfca 100755 --- a/src/components/contextmenu/ContextMenu.d.ts +++ b/src/components/contextmenu/ContextMenu.d.ts @@ -2,7 +2,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { MenuItem } from '../menuitem'; -type ContextMenuAppendTo = 'body' | 'self' | string | undefined; +type ContextMenuAppendTo = 'body' | 'self' | string | undefined | HTMLElement; export interface ContextMenuProps { /** diff --git a/src/components/dialog/Dialog.d.ts b/src/components/dialog/Dialog.d.ts index 537616b12..90ce69f66 100755 --- a/src/components/dialog/Dialog.d.ts +++ b/src/components/dialog/Dialog.d.ts @@ -3,7 +3,7 @@ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; type DialogPositionType = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright' | undefined; -type DialogAppendToType = 'body' | 'self' | string | undefined; +type DialogAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface DialogBreakpoints { /** diff --git a/src/components/dropdown/Dropdown.d.ts b/src/components/dropdown/Dropdown.d.ts index 04de6d6af..03ba11352 100755 --- a/src/components/dropdown/Dropdown.d.ts +++ b/src/components/dropdown/Dropdown.d.ts @@ -12,7 +12,7 @@ type DropdownOptionChildrenType = string | ((data: any) => any[]) | undefined; type DropdownFilterMatchModeType = 'contains' | 'startsWith' | 'endsWith' | undefined; -type DropdownAppendToType = 'body' | 'self' | string | undefined; +type DropdownAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface DropdownChangeEvent { /** @@ -244,7 +244,7 @@ export interface DropdownSlots { * Custom empty template. */ empty: () => VNode[]; - /** + /** * Custom content template. * @param {Object} scope - content slot's params. */ diff --git a/src/components/menu/Menu.d.ts b/src/components/menu/Menu.d.ts index eb948f6d4..829923f31 100755 --- a/src/components/menu/Menu.d.ts +++ b/src/components/menu/Menu.d.ts @@ -2,7 +2,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { MenuItem } from '../menuitem'; -type MenuAppendToType = 'body' | 'self' | string | undefined; +type MenuAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface MenuProps { /** diff --git a/src/components/multiselect/MultiSelect.d.ts b/src/components/multiselect/MultiSelect.d.ts index f6d77c35c..aeb0d8ed3 100755 --- a/src/components/multiselect/MultiSelect.d.ts +++ b/src/components/multiselect/MultiSelect.d.ts @@ -12,7 +12,7 @@ type MultiSelectOptionChildrenType = string | ((data: any) => any[]) | undefin type MultiSelectFilterMatchModeType = 'contains' | 'startsWith' | 'endsWith' | undefined; -type MultiSelectAppendToType = 'body' | 'self' | string | undefined; +type MultiSelectAppendToType = 'body' | 'self' | string | undefined | HTMLElement; type MultiSelectDisplayType = 'comma' | 'chip' | undefined; @@ -226,7 +226,7 @@ export interface MultiSelectSlots { */ options: any[]; }) => VNode[]; - /** + /** * Custom footer template. * @param {Object} scope - footer slot's params. */ @@ -244,7 +244,7 @@ export interface MultiSelectSlots { * Custom emptyfilter template. */ emptyfilter: () => VNode[]; - /** + /** * Custom empty template. */ empty: () => VNode[]; @@ -276,7 +276,7 @@ export interface MultiSelectSlots { */ index: number; }) => VNode[]; - /** + /** * Custom chip template. * @param {Object} scope - chip slot's params. */ diff --git a/src/components/overlaypanel/OverlayPanel.d.ts b/src/components/overlaypanel/OverlayPanel.d.ts index a3ca023fd..be7d83e4b 100755 --- a/src/components/overlaypanel/OverlayPanel.d.ts +++ b/src/components/overlaypanel/OverlayPanel.d.ts @@ -1,7 +1,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -type OverlayPanelAppendToType = 'body' | 'self' | string | undefined; +type OverlayPanelAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface OverlayPanelBreakpoints { /** diff --git a/src/components/password/Password.d.ts b/src/components/password/Password.d.ts index 5b0ecf340..3614b8e86 100755 --- a/src/components/password/Password.d.ts +++ b/src/components/password/Password.d.ts @@ -1,7 +1,7 @@ import { VNode, InputHTMLAttributes } from 'vue'; import { ClassComponent, GlobalComponentConstructor, Nullable } from '../ts-helpers'; -type PasswordAppendToType = 'body' | 'self' | string | undefined; +type PasswordAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface PasswordProps extends InputHTMLAttributes { /** diff --git a/src/components/portal/Portal.d.ts b/src/components/portal/Portal.d.ts index 767d53387..97474d380 100644 --- a/src/components/portal/Portal.d.ts +++ b/src/components/portal/Portal.d.ts @@ -1,7 +1,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -type PortalAppendToType = 'body' | 'self' | string | undefined; +type PortalAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface PortalProps { /** diff --git a/src/components/splitbutton/SplitButton.d.ts b/src/components/splitbutton/SplitButton.d.ts index a522dbf6f..467a47e8e 100755 --- a/src/components/splitbutton/SplitButton.d.ts +++ b/src/components/splitbutton/SplitButton.d.ts @@ -2,7 +2,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { MenuItem } from '../menuitem'; -type SplitButtonAppendToType = 'body' | 'self' | string | undefined; +type SplitButtonAppendToType = 'body' | 'self' | string | undefined | HTMLElement; export interface SplitButtonProps { /** diff --git a/src/components/tieredmenu/TieredMenu.d.ts b/src/components/tieredmenu/TieredMenu.d.ts index f9fd92e69..0212a236c 100755 --- a/src/components/tieredmenu/TieredMenu.d.ts +++ b/src/components/tieredmenu/TieredMenu.d.ts @@ -2,7 +2,7 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { MenuItem } from '../menuitem'; -type TieredMenuAppandToType = 'body' | 'self' | string | undefined; +type TieredMenuAppandToType = 'body' | 'self' | string | undefined | HTMLElement; export interface TieredMenuProps { /**