gridpackage.src.vaadin-grid-tree-toggle.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
/**
* @license
* Copyright (c) 2016 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import type { GridTreeToggleEventMap } from './vaadin-grid-tree-toggle-mixin.js';
import { GridTreeToggleMixin } from './vaadin-grid-tree-toggle-mixin.js';
export * from './vaadin-grid-tree-toggle-mixin.js';
/**
* `` is a helper element for the ``
* that provides toggle and level display functionality for the item tree.
*
* #### Example:
* ```html
*
* ```
* ```js
* const column = document.querySelector('#column');
* column.renderer = (root, column, model) => {
* let treeToggle = root.firstElementChild;
* if (!treeToggle) {
* treeToggle = document.createElement('vaadin-grid-tree-toggle');
* treeToggle.addEventListener('expanded-changed', () => { ... });
* root.appendChild(treeToggle);
* }
* treeToggle.leaf = !model.item.hasChildren;
* treeToggle.level = level;
* treeToggle.expanded = expanded;
* treeToggle.textContent = model.item.name;
* };
* ```
*
* ### Styling
*
* The following shadow DOM parts are available for styling:
*
* Part name | Description
* ---|---
* `toggle` | The tree toggle icon
*
* The following state attributes are available for styling:
*
* Attribute | Description | Part name
* ---|---|---
* `expanded` | When present, the toggle is expanded | :host
* `leaf` | When present, the toggle is not expandable, i. e., the current item is a leaf | :host
*
* The following custom CSS properties are available on
* the `` element:
*
* Custom CSS property | Description | Default
* ---|---|---
* `--vaadin-grid-tree-toggle-level-offset` | Visual offset step for each tree sublevel | `1em`
*
* @fires {CustomEvent} expanded-changed - Fired when the `expanded` property changes.
*/
declare class GridTreeToggle extends GridTreeToggleMixin(ThemableMixin(DirMixin(HTMLElement))) {
addEventListener(
type: K,
listener: (this: GridTreeToggle, ev: GridTreeToggleEventMap[K]) => void,
options?: AddEventListenerOptions | boolean,
): void;
removeEventListener(
type: K,
listener: (this: GridTreeToggle, ev: GridTreeToggleEventMap[K]) => void,
options?: EventListenerOptions | boolean,
): void;
}
declare global {
interface HTMLElementTagNameMap {
'vaadin-grid-tree-toggle': GridTreeToggle;
}
}
export { GridTreeToggle };