<!-- Vue 3 wrapper for Bryntum PagingToolbar -->

<template>
    <div ref="refElement">

    </div>
</template>

<script setup lang="ts">

import { getCurrentInstance, onBeforeUnmount, onMounted, provide, ref, watch, toRaw } from 'vue';

import type { AlignSpec, Base, ClickRepeaterConfig, Color, Container, ContainerItemConfig, ContainerLayoutConfig, DomConfig, KeyMapConfig, MaskConfig, Model, PagingToolbarListeners, ReactJSX, Rectangle, Scroller, ScrollerConfig, Store, TabConfig, ToolConfig, Toolbar, ToolbarItems, TooltipConfig, VueConfig, Widget } from '@bryntum/taskboard';
import { PagingToolbar } from '@bryntum/taskboard';

import { WrapperHelper } from '../helper/WrapperHelper';

defineProps<{
    // Configs
    /**
     * Element (or element id) to adopt as this Widget's encapsulating element. The widget's
     * content will be placed inside this element.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-adopt)
     */
    adopt ? : HTMLElement|string
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-align)
     */
    align ? : AlignSpec|string
    /**
     * When this widget is a child of a [Container](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container), it will by default be participating in a
     * flexbox layout. This config allows you to set this widget's
     * [align-self](https://developer.mozilla.org/en-US/docs/Web/CSS/align-self) style.
     */
    alignSelf ? : string
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating) and being shown through [showBy](#Core/widget/Widget#function-showBy).*
     * `true` to show a connector arrow pointing to the align target.
     */
    anchor ? : Boolean
    /**
     * Element (or the id of an element) to append this widget's element to. Can be configured, or set once at
     * runtime. To access the element of a rendered widget, see [element](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-element).
     * <div class="note">When creating nested trees of widgets, this should only be used on the outermost widget.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-appendTo)
     */
    appendTo ? : HTMLElement|string
    /**
     * A localizable string (May contain `'L{}'` tokens which resolve in the locale file) to inject
     * into an element which will be linked using the `aria-describedby` attribute.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-ariaDescription)
     */
    ariaDescription ? : string
    /**
     * A localizable string (May contain `'L{}'` tokens which resolve in the locale file) to inject as
     * the `aria-label` attribute.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-ariaLabel)
     */
    ariaLabel ? : string
    /**
     * Update assigned [record](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#config-record) automatically on field changes
     */
    autoUpdateRecord ? : Boolean
    /**
     * Set `true` to add a border to this container's element.
     */
    border ? : Boolean
    /**
     * An object where property names with a truthy value indicate which events should bubble up the ownership
     * hierarchy when triggered.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-bubbleEvents)
     */
    bubbleEvents ? : object
    /**
     * Set to `false` to not call onXXX method names (e.g. `onShow`, `onClick`), as an easy way to listen for events.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-callOnFunctions)
     */
    callOnFunctions ? : Boolean
    /**
     * By default, if an event handler throws an exception, the error propagates up the stack and the
     * application state is undefined. Code which follows the event handler will *not* be executed.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-catchEventHandlerExceptions)
     */
    catchEventHandlerExceptions ? : Boolean
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * Set to `true` to centre the Widget in browser viewport space.
     */
    centered ? : Boolean
    /**
     * Custom CSS classes to add to element.
     * May be specified as a space separated string, or as an object in which property names
     * with truthy values are used as the class names:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-cls)
     */
    cls ? : string|object
    /**
     * Applies the specified color to the widget, by setting the `--b-primary` CSS variable in the widgets
     * `style` block.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-color)
     */
    color ? : Color
    /**
     * Programmatic control over which column to start in when used in a grid layout.
     */
    column ? : number
    config ? : object
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating) or [positioned](#Core/widget/Widget#config-positioned).*
     * Element, Widget or Rectangle to which this Widget is constrained.
     */
    constrainTo ? : HTMLElement|Widget|Rectangle
    /**
     * The HTML content that coexists with sibling elements which may have been added to the
     * [contentElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-contentElement) by plugins and features.
     * When specifying html, this widget's element will also have the [htmlCls](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-htmlCls)
     * class added to its classList, to allow targeted styling.
     */
    content ? : string
    /**
     * Custom CSS classes to add to the [contentElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-contentElement).
     * May be specified as a space separated string, or as an object in which property names
     * with truthy values are used as the class names:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-contentElementCls)
     */
    contentElementCls ? : string|object
    /**
     * When this Widget configuration is used in the Grid's RowExpander feature's `widget` config, provide the
     * field on the expanded record to use for populating this widget's store (if applicable)
     */
    dataField ? : string
    /**
     * Object to apply to elements dataset (each key will be used as a data-attribute on the element)
     */
    dataset ? : Record<string, string>
    /**
     * The name of the property to set when a single value is to be applied to this Widget. Such as when used
     * in a grid WidgetColumn, this is the property to which the column's `field` is applied.
     */
    defaultBindProperty ? : string
    /**
     * A [query](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#function-query) selector function which can identify the descendant widget to which
     * focus should be directed by default.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-defaultFocus)
     * @param {Core.widget.Widget} widget Widget passed to method
     * @returns {boolean} truthy value if widget is the default one
     */
    defaultFocus ? : ((widget: Widget) => Boolean)|string
    /**
     * A config object containing default settings to apply to all child widgets.
     */
    defaults ? : ContainerItemConfig
    /**
     * Check for CSS compatibility and inclusion related issues and try to auto fix them. Performs the following
     * checks:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-detectCSSCompatibilityIssues)
     */
    detectCSSCompatibilityIssues ? : Boolean
    /**
     * Disable or enable the widget. It is similar to [readOnly](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-readOnly) except a disabled widget
     * cannot be focused, uses a different rendition (usually greyish) and does not allow selecting its value.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-disabled)
     */
    disabled ? : Boolean|'inert'
    /**
     * Controls the placement of this widget when it is added to a [panel's ](https://bryntum.com/products/taskboard/docs/api/Core/widget/Panel)
     * [strips collection](https://bryntum.com/products/taskboard/docs/api/Core/widget/Panel#config-strips). Typical values for this config are `'top'`,
     * `'bottom'`, `'left'`, or `'right'`, which cause the widget to be placed on that side of the panel's
     * body. Such widgets are called "edge strips".
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-dock)
     */
    dock ? : 'top'|'bottom'|'left'|'right'|'start'|'end'|'header'|'pre-header'|object
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * Set to `true` to be able to drag a widget freely on the page. Or set to an object with a ´handleSelector´
     * property which controls when a drag should start.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-draggable)
     * @property {string} handleSelector CSS selector used to determine if drag can be started from a mouse-downed element inside the widget
     */
    draggable ? : Boolean|object
    /**
     * An object specifying attributes to assign to the root element of this widget.
     * Set `null` value to attribute to remove it.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-elementAttributes)
     */
    elementAttributes ? : Record<string, string|null>
    /**
     * Set to `true` to allow users to reorder items in this toolbar using drag-drop
     */
    enableReordering ? : Boolean
    extraData ? : any
    /**
     * When this widget is a child of a [Container](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container), it will by default be participating in a
     * flexbox layout. This config allows you to set this widget's
     * [flex](https://developer.mozilla.org/en-US/docs/Web/CSS/flex) style.
     * This may be configured as a single number or a `&lt;flex-grow&gt; &lt;flex-shrink&gt; &lt;flex-basis&gt;` format string.
     * numeric-only values are interpreted as the `flex-grow` value.
     */
    flex ? : number|string
    /**
     * Set to `true` to move the widget out of the document flow and position it
     * absolutely in browser viewport space.
     */
    floating ? : Boolean
    /**
     * Widget's height, used to set element `style.height`. Either specify a valid height string or a number,
     * which will get 'px' appended. We recommend using CSS as the primary way to control height, but in some
     * cases this config is convenient.
     */
    height ? : string|number
    /**
     * Configure with true to make widget initially hidden.
     */
    hidden ? : Boolean
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-hideAnimation)
     */
    hideAnimation ? : Boolean|object
    /**
     * Specify `true` to make this container hide when it has no visible children (Either empty
     * or all children hidden).
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-hideWhenEmpty)
     */
    hideWhenEmpty ? : Boolean
    /**
     * The HTML to display initially or a function returning the markup (called at widget construction time).
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-html)
     * @param {Core.widget.Widget} widget The calling Widget
     */
    html ? : string|((widget: Widget) => void)|DomConfig|DomConfig[]|VueConfig|ReactJSX
    /**
     * The CSS class(es) to add when HTML content is being applied to this widget.
     */
    htmlCls ? : string|object
    /**
     * Widget id, if not specified one will be generated. Also used for lookups through Widget.getById
     */
    id ? : string
    /**
     * Determines if the toolbars read-only state should be controlled by its parent.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-ignoreParentReadOnly)
     */
    ignoreParentReadOnly ? : Boolean
    /**
     * Convenience setting to align input fields of child widgets. By default, the Field input element is
     * placed immediately following the `label`. If you prefer to have all input fields aligned to the
     * right, set this config to `'end'`.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-inputFieldAlign)
     */
    inputFieldAlign ? : 'start'|'end'
    /**
     * Element (or element id) to insert this widget before. If provided, [appendTo](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-appendTo) config is ignored.
     * <div class="note">When creating nested trees of widgets, this should only be used on the outermost widget.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-insertBefore)
     */
    insertBefore ? : HTMLElement|string
    /**
     * Element (or element id) to append this widget element to, as a first child. If provided, [appendTo](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-appendTo) config is ignored.
     * <div class="note">When creating nested trees of widgets, this should only be used on the outermost widget.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-insertFirst)
     */
    insertFirst ? : HTMLElement|string
    /**
     * An optional CSS class to add to child items of this container.
     */
    itemCls ? : string
    /**
     * An object containing typed child widget config objects or [Widgets](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget). Can also be
     * specified as an array.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-items)
     */
    items ? : Record<string, ToolbarItems|Boolean|null>|ToolbarItems[]|Widget[]
    /**
     * An object whose keys are the [key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) name
     * and optional modifier prefixes: `'Ctrl+'`, `'Alt+'`, `'Meta+'`, and `'Shift+'` (case-insensitive). The values
     * are the name of the instance method to call when the keystroke is received.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-keyMap)
     */
    keyMap ? : Record<string, KeyMapConfig>
    /**
     * Toolbars override the default `labelPosition` for containers, placing labels before the input fields
     * independent of which theme is used.
     */
    labelPosition ? : 'before'|'above'|'align-before'|'auto'|null
    /**
     * Sets `labelWidth´ for all children of this Container, that does not define their own `labelWidth`.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-labelWidth)
     */
    labelWidth ? : number|null
    /**
     * The short name of a helper class which manages rendering and styling of child items.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-layout)
     */
    layout ? : string|ContainerLayoutConfig
    /**
     * The CSS style properties to apply to the [contentElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-contentElement).
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-layoutStyle)
     */
    layoutStyle ? : object
    /**
     * An array of [child item](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#config-items) *config objects* which is to be converted into
     * instances only when this Container is rendered, rather than eagerly at construct time.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-lazyItems)
     */
    lazyItems ? : Record<string, ContainerItemConfig>|ContainerItemConfig[]|Widget[]
    /**
     * The listener set for this object.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-listeners)
     */
    listeners ? : PagingToolbarListeners
    /**
     * A class translations of which are used for translating this entity.
     * This is often used when translations of an item are defined on its container class.
     * For example:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-localeClass)
     */
    localeClass ? : typeof Base
    /**
     * Set to `false` to disable localization of this object.
     */
    localizable ? : Boolean
    /**
     * List of properties which values should be translated automatically upon a locale applying.
     * In case there is a need to localize not typical value (not a String value or a field with re-defined setter/getter),
     * you could use 'localeKey' meta configuration.
     * Example:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-localizableProperties)
     */
    localizableProperties ? : string[]
    /**
     * Widget's margin. This may be configured as a single number or a `TRBL` format string.
     * numeric-only values are interpreted as pixels.
     */
    margin ? : number|string
    /**
     * This config object contains the defaults for the [Mask](https://bryntum.com/products/taskboard/docs/api/Core/widget/Mask) created for the
     * [masked](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-masked) config. Any properties specified in the `masked` config will override these
     * values.
     */
    maskDefaults ? : MaskConfig
    /**
     * Set to `true` to apply the default mask to the widget. Alternatively, this can be the mask message or a
     * [Mask](https://bryntum.com/products/taskboard/docs/api/Core/widget/Mask) config object.
     */
    masked ? : Boolean|string|MaskConfig
    /**
     * The element's maxHeight. Can be either a String or a Number (which will have 'px' appended). Note that
     * like [height](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-height), *reading* the value will return the numeric value in pixels.
     */
    maxHeight ? : string|number
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-maximizeOnMobile)
     */
    maximizeOnMobile ? : number|string
    /**
     * The elements maxWidth. Can be either a String or a Number (which will have 'px' appended). Note that
     * like [width](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-width), *reading* the value will return the numeric value in pixels.
     */
    maxWidth ? : string|number
    /**
     * The element's minHeight. Can be either a String or a Number (which will have 'px' appended). Note that
     * like [height](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-height), *reading* the value will return the numeric value in pixels.
     */
    minHeight ? : string|number
    /**
     * The elements minWidth. Can be either a String or a Number (which will have 'px' appended). Note that
     * like [width](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-width), *reading* the value will return the numeric value in pixels.
     */
    minWidth ? : string|number
    /**
     * When this is configured as `true` a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)
     * is used to monitor this element for size changes caused by either style manipulation, or by CSS
     * layout.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-monitorResize)
     * @property {boolean} immediate Set to `true` to receive resize notifications immediately.
     */
    monitorResize ? : Boolean|object
    /**
     * An object containing default config objects which may be referenced by name in the [items](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#config-items)
     * config. For example, a specialized [Menu](https://bryntum.com/products/taskboard/docs/api/Core/widget/Menu) subclass may have a `namedItems` default
     * value defined like this:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-namedItems)
     */
    namedItems ? : Record<string, ContainerItemConfig>
    /**
     * How this Toolbar should deal with items that overflow its main axis.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-overflow)
     * @property {'scroll','menu'} overflow.type `'scroll'` or `'menu'`
     * @property {ClickRepeaterConfig} overflow.repeat A config object to reconfigure the [ClickRepeater](https://bryntum.com/products/taskboard/docs/api/Core/util/ClickRepeater) which controls auto repeat speed when holding down the scroll buttons when `type` is `'scroll'`
     * @property {Function} overflow.filter A filter function which may return a falsy value to prevent toolbar items from being cloned into the overflow menu.
     */
    overflow ? : string|{ type: 'scroll'|'menu', repeat: ClickRepeaterConfig, filter: () => void }|null
    /**
     * Set to `true` when a widget is rendered into another widget's [contentElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-contentElement), but must
     * not participate in the standard layout of that widget, and must be positioned relatively to that
     * widget's [contentElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-contentElement).
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-positioned)
     */
    positioned ? : Boolean
    /**
     * Prevent tooltip from being displayed on touch devices. Useful for example for buttons that display a
     * menu on click etc, since the tooltip would be displayed at the same time.
     */
    preventTooltipOnTouch ? : Boolean
    /**
     * Whether this widget is read-only.  This is only valid if the widget is an input
     * field, <strong>or contains input fields at any depth</strong>.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-readOnly)
     */
    readOnly ? : Boolean
    /**
     * [Record](https://bryntum.com/products/taskboard/docs/api/Core/data/Model) whose values will be used to populate fields in the container.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-record)
     */
    record ? : Model
    relayStoreEvents ? : Boolean
    /**
     * Either a default `rendition` to apply to all child widgets, or a map of renditions keyed by child widget
     * `type`.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-rendition)
     */
    rendition ? : string|Record<string, string>|null
    /**
     * Configure as `true` to have the component display a translucent ripple when its
     * [focusElement](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-focusElement), or [element](#Core/widget/Widget#property-element) is tapped <em>if the
     * current theme supports ripples</em>. Out of the box, only the Material theme supports ripples.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-ripple)
     * @property {string} [delegate] A CSS selector to filter which child elements trigger ripples. By default, the ripple is clipped to the triggering element.
     * @property {string} [color] A CSS color name or specification.
     * @property {number} [radius] The ending radius of the ripple. Note that it will be clipped by the target element by default.
     * @property {string} [clip] A string which describes how to clip the ripple if it is not to be clipped to the default element. Either the property of the widget to use as the clipping element, or a selector to allow clipping to the closest matching ancestor to the target element.
     */
    ripple ? : Boolean|object
    /**
     * The ARIA role to apply to this widget's element. By default, this is set to `'presentation'` to avoid
     * accidentally applying a role which may interfere with screen readers.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-role)
     */
    role ? : string
    /**
     * If you are rendering this widget to a shadow root inside a web component, set this config to the shadowRoot. If not inside a web component, set it to `document.body`
     */
    rootElement ? : ShadowRoot|HTMLElement
    /**
     * This may be configured as `true` to make the widget's element use the `direction:rtl` style.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-rtl)
     */
    rtl ? : Boolean
    /**
     * Specifies whether (and optionally in which axes) a Widget may scroll. `true` means this widget may scroll
     * in both axes. May be an object containing boolean `overflowX` and `overflowY` properties which are
     * applied to CSS style properties `overflowX` and `overflowY`. If they are boolean, they are translated to
     * CSS overflow properties thus:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-scrollable)
     */
    scrollable ? : Boolean|ScrollerConfig|Scroller
    /**
     * Defines what to do if document is scrolled while Widget is visible (only relevant when floating is set to `true`).
     * Valid values: ´null´: do nothing, ´hide´: hide the widget or ´realign´: realign to the target if possible.
     */
    scrollAction ? : 'hide'|'realign'|null
    /**
     * *Only valid if this Widget is [floating](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-floating).*
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-showAnimation)
     */
    showAnimation ? : Boolean|object
    /**
     * Set to `false` to not show the tooltip when this widget is [disabled](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-disabled)
     */
    showTooltipWhenDisabled ? : Boolean
    /**
     * Programmatic control over how many columns to span when used in a grid layout.
     */
    span ? : number
    /**
     * The [Store](https://bryntum.com/products/taskboard/docs/api/Core/data/Store) that this PagingToolbar is to control. If set to a string value, that string
     * value should represent the property name of the Store's reference on this toolbar's parent component.
     * By default, the toolbar will control the Store found at the parent components 'store' property.
     */
    store ? : Store|string
    /**
     * Specify `true` to match fields by their `name` property only when assigning a [record](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#config-record),
     * without falling back to `ref`.
     */
    strictRecordMapping ? : Boolean
    /**
     * A configuration for the [tab](https://bryntum.com/products/taskboard/docs/api/Core/widget/Tab) created for this widget when it is placed in a
     * [TabPanel](https://bryntum.com/products/taskboard/docs/api/Core/widget/TabPanel). For example, this config can be used to control the icon of the `tab` for
     * this widget:
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-tab)
     */
    tab ? : Boolean|TabConfig
    /**
     * When this container is used as a tab in a TabPanel, these items are added to the
     * [TabBar](https://bryntum.com/products/taskboard/docs/api/Core/widget/TabBar) when this container is the active tab.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-tabBarItems)
     */
    tabBarItems ? : ToolbarItems[]|Widget[]
    /**
     * The tag name of this Widget's root element
     */
    tag ? : string
    /**
     * Text alignment: 'left', 'center' or 'right'. Also accepts direction neutral 'start' and 'end'.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-textAlign)
     */
    textAlign ? : 'left'|'center'|'right'|'start'|'end'
    /**
     * Specify `true` for a container used to show text markup. It will apply the CSS class `b-text-content`
     * which specifies a default max-width that makes long text more readable.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-textContent)
     */
    textContent ? : Boolean
    /**
     * A title to display for the widget. Only in effect when inside a container that uses it (such as TabPanel)
     */
    title ? : string
    /**
     * The [tools](https://bryntum.com/products/taskboard/docs/api/Core/widget/Tool) to add either before or after the `title` in the Panel header. Each
     * property name is the reference by which an instantiated tool may be retrieved from the live
     * `[tools](https://bryntum.com/products/taskboard/docs/api/Core/widget/mixin/Toolable#property-tools)` property.
     */
    tools ? : Record<string, ToolConfig>
    /**
     * Tooltip for the widget, either as a string or as a Tooltip config object.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-tooltip)
     */
    tooltip ? : string|TooltipConfig|null
    type ? : 'pagingtoolbar'
    /**
     * Custom CSS class name suffixes to apply to the elements rendered by this widget. This may be specified
     * as a space separated string, an array of strings, or as an object in which property names with truthy
     * values are used as the class names.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-ui)
     */
    ui ? : string|object
    /**
     * A widgets weight determines its position among siblings when added to a [Container](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container).
     * Higher weights go further down.
     */
    weight ? : number
    /**
     * Custom CSS class to add to toolbar widgets
     */
    widgetCls ? : string
    /**
     * Widget's width, used to set element `style.width`. Either specify a valid width string or a number, which
     * will get 'px' appended. We recommend using CSS as the primary way to control width, but in some cases
     * this config is convenient.
     */
    width ? : string|number
    /**
     * The x position for the widget.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-x)
     */
    x ? : number
    /**
     * The y position for the widget.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#config-y)
     */
    y ? : number

}>();

const emit = defineEmits<{
    /**
     * Fires before an object is destroyed.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.Base} params.event.source The Object that is being destroyed.
     */
    (e: 'beforeDestroy', params: ((event: { source: Base }) => void)|string): void
    /**
     * Triggered before a widget is hidden. Return `false` to prevent the action.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source The widget being hidden.
     */
    (e: 'beforeHide', params: ((event: { source: Widget }) => boolean|void)|string): boolean|void
    /**
     * This event is fired on the owning Toolbar prior to starting a drag gesture. The drag is canceled if
     * a listener returns `false`.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Toolbar} params.event.source The toolbar instance.
     * @param {Core.widget.Widget} params.event.item The dragged item.
     * @param {Event} params.event.domEvent The browser event.
     */
    (e: 'beforeItemDragStart', params: ((event: { source: Toolbar, item: Widget, domEvent: Event }) => boolean|void)|string): boolean|void
    /**
     * Fired before this container will load record values into its child fields. This is useful if you
     * want to modify the UI before data is loaded (e.g. set some input field to be readonly)
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Container} params.event.source The container
     * @param {Core.data.Model} params.event.record The record
     */
    (e: 'beforeSetRecord', params: ((event: { source: Container, record: Model }) => void)|string): void
    /**
     * Triggered before a widget is shown. Return `false` to prevent the action.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget,any} params.event.source The widget being shown
     */
    (e: 'beforeShow', params: ((event: { source: Widget|any }) => Promise<boolean>|boolean|void)|string): Promise<boolean>|boolean|void
    /**
     * Fires when any other event is fired from the object.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#event-catchAll)
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {{[key: string]: any, type: string}} params.event.event The Object that contains event details
     * @param {string} params.event.event.type The type of the event which is caught by the listener
     */
    (e: 'catchAll', params: ((event: {[key: string]: any, type: string}) => void)|string): void
    /**
     * Fires when an object is destroyed.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.Base} params.event.source The Object that is being destroyed.
     */
    (e: 'destroy', params: ((event: { source: Base }) => void)|string): void
    /**
     * Fires when a field is mutated and the state of the [hasChanges](https://bryntum.com/products/taskboard/docs/api/Core/widget/Container#property-hasChanges) property changes
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Container} params.event.source The container.
     * @param {boolean} params.event.dirty The dirty state of the Container - `true` if there are any fields which have been changed since initial load.
     */
    (e: 'dirtyStateChange', params: ((event: { source: Container, dirty: boolean }) => void)|string): void
    /**
     * Triggered when a widget's [element](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#property-element) is available.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {HTMLElement} params.event.element The Widget's element.
     */
    (e: 'elementCreated', params: ((event: { element: HTMLElement }) => void)|string): void
    /**
     * Fired when focus enters this Widget.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source This Widget
     * @param {HTMLElement} params.event.fromElement The element which lost focus.
     * @param {HTMLElement} params.event.toElement The element which gained focus.
     * @param {Core.widget.Widget} params.event.fromWidget The widget which lost focus.
     * @param {Core.widget.Widget} params.event.toWidget The widget which gained focus.
     * @param {boolean} params.event.backwards `true` if the `toElement` is before the `fromElement` in document order.
     */
    (e: 'focusIn', params: ((event: { source: Widget, fromElement: HTMLElement, toElement: HTMLElement, fromWidget: Widget, toWidget: Widget, backwards: boolean }) => void)|string): void
    /**
     * Fired when focus exits this Widget's ownership tree. This is different from a `blur` event.
     * focus moving from within this Widget's ownership tree, even if there are floating widgets
     * will not trigger this event. This is when focus exits this widget completely.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source This Widget
     * @param {HTMLElement} params.event.fromElement The element which lost focus.
     * @param {HTMLElement} params.event.toElement The element which gained focus.
     * @param {Core.widget.Widget} params.event.fromWidget The widget which lost focus.
     * @param {Core.widget.Widget} params.event.toWidget The widget which gained focus.
     * @param {boolean} params.event.backwards `true` if the `toElement` is before the `fromElement` in document order.
     */
    (e: 'focusOut', params: ((event: { source: Widget, fromElement: HTMLElement, toElement: HTMLElement, fromWidget: Widget, toWidget: Widget, backwards: boolean }) => void)|string): void
    /**
     * Triggered after a widget was hidden
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source The widget
     */
    (e: 'hide', params: ((event: { source: Widget }) => void)|string): void
    /**
     * This event is fired when a drag gesture has started.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Toolbar} params.event.source The toolbar instance.
     * @param {Core.widget.Widget} params.event.item The dragged item.
     * @param {Event} params.event.domEvent The browser event.
     */
    (e: 'itemDragStart', params: ((event: { source: Toolbar, item: Widget, domEvent: Event }) => void)|string): void
    /**
     * This event is fired when an item is dropped
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Toolbar} params.event.source The toolbar instance.
     * @param {Core.widget.Widget} params.event.item The dragged item.
     * @param {boolean} params.event.valid `true` if the drop was valid.
     * @param {Event} params.event.domEvent The browser event.
     */
    (e: 'itemDrop', params: ((event: { source: Toolbar, item: Widget, valid: boolean, domEvent: Event }) => void)|string): void
    /**
     * Triggered when a widget which had been in a non-visible state for any reason
     * achieves visibility.
     * [More...](https://bryntum.com/products/taskboard/docs/api/Core/widget/PagingToolbar#event-paint)
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source The widget being painted.
     * @param {boolean} params.event.firstPaint `true` if this is the first paint.
     */
    (e: 'paint', params: ((event: { source: Widget, firstPaint: boolean }) => void)|string): void
    /**
     * Fired when a Widget's read only state is toggled
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {boolean} params.event.readOnly Read only or not
     */
    (e: 'readOnly', params: ((event: { readOnly: boolean }) => void)|string): void
    /**
     * This event is fired after a widget's elements have been synchronized due to a direct or indirect call
     * to [recompose](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#function-recompose), if this results in some change to the widget's rendered DOM elements.
     */
    (e: 'recompose', params: (() => void)|string): void
    /**
     * Fired when the encapsulating element of a Widget resizes *only when [monitorResize](https://bryntum.com/products/taskboard/docs/api/Core/widget/Widget#config-monitorResize) is `true`*.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source This Widget
     * @param {number} params.event.width The new width
     * @param {number} params.event.height The new height
     * @param {number} params.event.oldWidth The old width
     * @param {number} params.event.oldHeight The old height
     */
    (e: 'resize', params: ((event: { source: Widget, width: number, height: number, oldWidth: number, oldHeight: number }) => void)|string): void
    /**
     * Triggered after a widget is shown.
     * @param {string} e Event name
     * @param {object} params Event parameters
     * @param {object} params.event Event object
     * @param {Core.widget.Widget} params.event.source The widget
     */
    (e: 'show', params: ((event: { source: Widget }) => void)|string): void
}>();

const widgetData = {
    instanceClass : PagingToolbar,
    instanceName  : 'PagingToolbar',

    configNames   : [
        'adopt',
        'align',
        'anchor',
        'ariaDescription',
        'ariaLabel',
        'autoUpdateRecord',
        'border',
        'bubbleEvents',
        'centered',
        'color',
        'config',
        'constrainTo',
        'contentElementCls',
        'dataField',
        'defaultBindProperty',
        'defaultFocus',
        'defaults',
        'detectCSSCompatibilityIssues',
        'dock',
        'draggable',
        'elementAttributes',
        'floating',
        'hideAnimation',
        'hideWhenEmpty',
        'htmlCls',
        'ignoreParentReadOnly',
        'itemCls',
        'lazyItems',
        'listeners',
        'localeClass',
        'localizable',
        'localizableProperties',
        'maskDefaults',
        'masked',
        'monitorResize',
        'namedItems',
        'overflow',
        'positioned',
        'preventTooltipOnTouch',
        'relayStoreEvents',
        'ripple',
        'role',
        'rootElement',
        'scrollAction',
        'showAnimation',
        'showTooltipWhenDisabled',
        'store',
        'tab',
        'tabBarItems',
        'tag',
        'textAlign',
        'textContent',
        'title',
        'type',
        'ui',
        'weight',
        'widgetCls'
    ],
    propertyConfigNames : [
        'alignSelf',
        'appendTo',
        'callOnFunctions',
        'catchEventHandlerExceptions',
        'cls',
        'column',
        'content',
        'dataset',
        'disabled',
        'enableReordering',
        'extraData',
        'flex',
        'height',
        'hidden',
        'html',
        'id',
        'inputFieldAlign',
        'insertBefore',
        'insertFirst',
        'items',
        'keyMap',
        'labelPosition',
        'labelWidth',
        'layout',
        'layoutStyle',
        'margin',
        'maxHeight',
        'maximizeOnMobile',
        'maxWidth',
        'minHeight',
        'minWidth',
        'onBeforeDestroy',
        'onBeforeHide',
        'onBeforeItemDragStart',
        'onBeforeSetRecord',
        'onBeforeShow',
        'onCatchAll',
        'onDestroy',
        'onDirtyStateChange',
        'onElementCreated',
        'onFocusIn',
        'onFocusOut',
        'onHide',
        'onItemDragStart',
        'onItemDrop',
        'onPaint',
        'onReadOnly',
        'onRecompose',
        'onResize',
        'onShow',
        'readOnly',
        'record',
        'rendition',
        'rtl',
        'scrollable',
        'span',
        'strictRecordMapping',
        'tools',
        'tooltip',
        'width',
        'x',
        'y'
    ],
    propertyNames : [
        'parent',
        'values'
    ],
    eventNames : [
        'beforeDestroy',
        'beforeHide',
        'beforeItemDragStart',
        'beforeSetRecord',
        'beforeShow',
        'catchAll',
        'destroy',
        'dirtyStateChange',
        'elementCreated',
        'focusIn',
        'focusOut',
        'hide',
        'itemDragStart',
        'itemDrop',
        'paint',
        'readOnly',
        'recompose',
        'resize',
        'show'
    ]
};

const instance: {
    value?: PagingToolbar
} = {};

const refElement = ref<HTMLDivElement>()!;
// Storage for teleports (in-cell Vue component instances) automatically renderer by template
const teleports = ref(new Map());

// Provide teleports for processCellContent
provide('teleports', teleports);

onMounted(() => {

    const me = getCurrentInstance()!;

    instance.value = WrapperHelper.createWidget<typeof PagingToolbar>({
        me,
        widgetData,
        emit,
        element : refElement.value!,
        toRaw
    });

    const watcher = (prop: string, callback: any) => watch(() => me.props[prop], callback);
    WrapperHelper.watchProps(instance.value, widgetData, watcher);
});

onBeforeUnmount(() => {
    // @ts-ignore
    instance.value?.destroy?.();
});

defineExpose({
    instance,
    refElement,
    teleports
});

</script>
