devextreme-react
Version:
DevExtreme React UI and Visualization Components
316 lines (314 loc) • 10.4 kB
JavaScript
/*!
* devextreme-react
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-react
*/
"use client";
import * as React from "react";
import { memo, forwardRef, useImperativeHandle, useRef, useMemo } from "react";
import dxSankey from "devextreme/viz/sankey";
import { Component as BaseComponent } from "./core/component";
import NestedOption from "./core/nested-option";
const Sankey = memo(forwardRef((props, ref) => {
const baseRef = useRef(null);
useImperativeHandle(ref, () => ({
instance() {
return baseRef.current?.getInstance();
}
}), [baseRef.current]);
const subscribableOptions = useMemo(() => (["loadingIndicator", "loadingIndicator.show"]), []);
const independentEvents = useMemo(() => (["onDisposing", "onDrawn", "onExported", "onExporting", "onFileSaving", "onIncidentOccurred", "onInitialized", "onLinkClick", "onNodeClick"]), []);
const defaults = useMemo(() => ({
defaultLoadingIndicator: "loadingIndicator",
}), []);
const expectedChildren = useMemo(() => ({
adaptiveLayout: { optionName: "adaptiveLayout", isCollectionItem: false },
export: { optionName: "export", isCollectionItem: false },
label: { optionName: "label", isCollectionItem: false },
link: { optionName: "link", isCollectionItem: false },
loadingIndicator: { optionName: "loadingIndicator", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
node: { optionName: "node", isCollectionItem: false },
size: { optionName: "size", isCollectionItem: false },
title: { optionName: "title", isCollectionItem: false },
tooltip: { optionName: "tooltip", isCollectionItem: false }
}), []);
return (React.createElement((BaseComponent), {
WidgetClass: dxSankey,
ref: baseRef,
subscribableOptions,
independentEvents,
defaults,
expectedChildren,
...props,
}));
}));
const _componentAdaptiveLayout = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "adaptiveLayout",
},
});
};
const AdaptiveLayout = Object.assign(_componentAdaptiveLayout, {
componentType: "option",
});
const _componentBorder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const Border = Object.assign(_componentBorder, {
componentType: "option",
});
const _componentExport = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "export",
},
});
};
const Export = Object.assign(_componentExport, {
componentType: "option",
});
const _componentFont = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "font",
},
});
};
const Font = Object.assign(_componentFont, {
componentType: "option",
});
const _componentFormat = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "format",
},
});
};
const Format = Object.assign(_componentFormat, {
componentType: "option",
});
const _componentHatching = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "hatching",
},
});
};
const Hatching = Object.assign(_componentHatching, {
componentType: "option",
});
const _componentHoverStyle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "hoverStyle",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
hatching: { optionName: "hatching", isCollectionItem: false },
sankeyborder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const HoverStyle = Object.assign(_componentHoverStyle, {
componentType: "option",
});
const _componentLabel = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "label",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
sankeyborder: { optionName: "border", isCollectionItem: false },
shadow: { optionName: "shadow", isCollectionItem: false }
},
},
});
};
const Label = Object.assign(_componentLabel, {
componentType: "option",
});
const _componentLink = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "link",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
hoverStyle: { optionName: "hoverStyle", isCollectionItem: false },
sankeyborder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const Link = Object.assign(_componentLink, {
componentType: "option",
});
const _componentLoadingIndicator = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "loadingIndicator",
DefaultsProps: {
defaultShow: "show"
},
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
const LoadingIndicator = Object.assign(_componentLoadingIndicator, {
componentType: "option",
});
const _componentMargin = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "margin",
},
});
};
const Margin = Object.assign(_componentMargin, {
componentType: "option",
});
const _componentNode = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "node",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
hoverStyle: { optionName: "hoverStyle", isCollectionItem: false },
sankeyborder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const Node = Object.assign(_componentNode, {
componentType: "option",
});
const _componentSankeyborder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const Sankeyborder = Object.assign(_componentSankeyborder, {
componentType: "option",
});
const _componentShadow = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "shadow",
},
});
};
const Shadow = Object.assign(_componentShadow, {
componentType: "option",
});
const _componentSize = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "size",
},
});
};
const Size = Object.assign(_componentSize, {
componentType: "option",
});
const _componentSubtitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
const Subtitle = Object.assign(_componentSubtitle, {
componentType: "option",
});
const _componentTitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
subtitle: { optionName: "subtitle", isCollectionItem: false }
},
},
});
};
const Title = Object.assign(_componentTitle, {
componentType: "option",
});
const _componentTooltip = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "tooltip",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
format: { optionName: "format", isCollectionItem: false },
shadow: { optionName: "shadow", isCollectionItem: false },
tooltipBorder: { optionName: "border", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "linkTooltipTemplate",
render: "linkTooltipRender",
component: "linkTooltipComponent"
}, {
tmplOption: "nodeTooltipTemplate",
render: "nodeTooltipRender",
component: "nodeTooltipComponent"
}],
},
});
};
const Tooltip = Object.assign(_componentTooltip, {
componentType: "option",
});
const _componentTooltipBorder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const TooltipBorder = Object.assign(_componentTooltipBorder, {
componentType: "option",
});
export default Sankey;
export { Sankey, AdaptiveLayout, Border, Export, Font, Format, Hatching, HoverStyle, Label, Link, LoadingIndicator, Margin, Node, Sankeyborder, Shadow, Size, Subtitle, Title, Tooltip, TooltipBorder };