UNPKG

@progress/kendo-react-gantt

Version:

React Gantt enables the display of self-referencing tabular data with many features. KendoReact Gantt package

58 lines (57 loc) 2.17 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as e from "react"; import { useLocalization as k } from "@progress/kendo-react-intl"; import { Button as C, DropDownButton as f } from "@progress/kendo-react-buttons"; import { messages as g, addTask as v, addChild as p, addAbove as b, addBelow as E } from "../../messages/index.mjs"; import { IconWrap as w } from "@progress/kendo-react-common"; import { plusIcon as B } from "@progress/kendo-svg-icons"; const h = e.forwardRef( (o, M) => { const a = k(), n = (t) => a.toLanguageString(t, g[t]), l = n(v), c = n(p), d = n(b), s = n(E), r = e.useCallback( (t) => { t.syntheticEvent.preventDefault(); const u = t.item && t.item.direction ? t.item.direction : "none"; o.onClick && o.onClick({ nativeEvent: t.nativeEvent, syntheticEvent: t.syntheticEvent, direction: u }); }, [o.onClick] ), m = e.useCallback( (t) => { t.preventDefault(), o.onClick && o.onClick({ nativeEvent: t && t.nativeEvent, syntheticEvent: t, direction: "none" }); }, [o.onClick] ), i = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(w, { name: "plus", icon: B }), l); return o.selectedTask ? /* @__PURE__ */ e.createElement( f, { className: "k-views-dropdown", onItemClick: r, popupSettings: { popupClass: "k-gantt-toolbar" }, textField: "title", items: [ { title: c, direction: "child" }, { title: d, direction: "above" }, { title: s, direction: "below" } ], text: i } ) : /* @__PURE__ */ e.createElement(C, { onClick: m }, i); } ); h.displayName = "KendoReactGanttAddButton"; export { h as AddButton };