UNPKG

pxt-core

Version:

Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors

44 lines (43 loc) 1.98 kB
import * as Blockly from "blockly"; import { FieldDropdown } from "./field_dropdown"; import { PointerCoords, UserInputAction } from "./field_utils"; export declare abstract class FieldDropdownGrid extends FieldDropdown { isFieldCustom_: boolean; protected width_: number; protected columns_: number; protected maxRows_: number; protected backgroundColour_: string; protected borderColour_: string; protected activeDescendantIndex: number | undefined; protected gridItems: HTMLDivElement[]; protected openingPointerCoords: PointerCoords | undefined; protected lastUserInputAction: UserInputAction | undefined; protected keyDownBinding: Blockly.browserEvents.Data | null; protected pointerMoveBinding: Blockly.browserEvents.Data | null; /** * Callback for when a grid item is clicked inside the dropdown or widget div. * Should be bound to the FieldIconMenu. * @param {string | null} value the value to set for the field * @protected */ protected abstract buttonClickAndClose_(value: string | null): void; /** * Callback for when a grid item is highlighted using keyboard navigation. * Use this method to classNames for grid items and scroll to the highlighted item if required. * @param {HTMLElement} gridItemContainer the HTMLElement containing the grid items * @protected */ protected abstract setFocusedItem_(gridItemContainer: HTMLElement): void; private setFocusedItem; /** * Set openingPointerCoords if the Event is a PointerEvent. * @param {Event} e the event that triggered showEditor_ * @protected */ protected setOpeningPointerCoords(e: Event): void; protected addKeyDownHandler(gridItemContainer: HTMLElement): void; protected addPointerListener(parentDiv: HTMLElement): void; protected pointerMoveTriggeredByUser(): boolean; protected pointerOutTriggeredByUser(): boolean; protected disposeGrid(): void; }