UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

68 lines (67 loc) 2.24 kB
/** * DevExtreme (esm/__internal/grids/new/grid_core/toolbar/toolbar.js) * Version: 25.1.3 * Build date: Wed Jun 25 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { createFragment, createComponentVNode } from "inferno"; import { off, on } from "../../../../../common/core/events"; import { withKeyDownHandler } from "../../../../grids/new/grid_core/keyboard_navigation/index"; import { Component, createRef } from "inferno"; import { Toolbar } from "../inferno_wrappers/toolbar"; const ToolbarComponent = withKeyDownHandler(Toolbar); export class ToolbarView extends Component { constructor() { super(...arguments); this.containerRef = createRef(); this.onContextMenu = event => { var _this$props$showConte, _this$props; null === (_this$props$showConte = (_this$props = this.props).showContextMenu) || void 0 === _this$props$showConte || _this$props$showConte.call(_this$props, event) } } componentDidMount() { on(this.containerRef.current, "dxcontextmenu", this.onContextMenu) } componentWillUnmount() { off(this.containerRef.current, "dxcontextmenu", this.onContextMenu) } render() { const { visible: visible, items: items, disabled: disabled, multiline: multiline } = this.props; if (!visible) { return createFragment() } return createComponentVNode(2, ToolbarComponent, { elementRef: this.containerRef, visible: visible, items: items, disabled: disabled, multiline: multiline, keyDownConfig: { "F10+shift": event => { var _this$props$showConte2, _this$props2; null === (_this$props$showConte2 = (_this$props2 = this.props).showContextMenu) || void 0 === _this$props$showConte2 || _this$props$showConte2.call(_this$props2, event) } } }) } }