devextreme-react
Version:
DevExtreme React UI and Visualization Components
435 lines (433 loc) • 14.6 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 dxFunnel from "devextreme/viz/funnel";
import { Component as BaseComponent } from "./core/component";
import NestedOption from "./core/nested-option";
const Funnel = 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", "onItemClick", "onLegendClick"]), []);
const defaults = useMemo(() => ({
defaultLoadingIndicator: "loadingIndicator",
}), []);
const expectedChildren = useMemo(() => ({
adaptiveLayout: { optionName: "adaptiveLayout", isCollectionItem: false },
export: { optionName: "export", isCollectionItem: false },
funnelTitle: { optionName: "title", isCollectionItem: false },
item: { optionName: "item", isCollectionItem: false },
label: { optionName: "label", isCollectionItem: false },
legend: { optionName: "legend", isCollectionItem: false },
loadingIndicator: { optionName: "loadingIndicator", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
size: { optionName: "size", isCollectionItem: false },
title: { optionName: "title", isCollectionItem: false },
tooltip: { optionName: "tooltip", isCollectionItem: false }
}), []);
return (React.createElement((BaseComponent), {
WidgetClass: dxFunnel,
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 _componentConnector = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "connector",
},
});
};
const Connector = Object.assign(_componentConnector, {
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 _componentFunnelTitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false },
funnelTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
subtitle: { optionName: "subtitle", isCollectionItem: false }
},
},
});
};
const FunnelTitle = Object.assign(_componentFunnelTitle, {
componentType: "option",
});
const _componentFunnelTitleSubtitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
const FunnelTitleSubtitle = Object.assign(_componentFunnelTitleSubtitle, {
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 },
itemBorder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const HoverStyle = Object.assign(_componentHoverStyle, {
componentType: "option",
});
const _componentItem = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "item",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
hoverStyle: { optionName: "hoverStyle", isCollectionItem: false },
itemBorder: { optionName: "border", isCollectionItem: false },
selectionStyle: { optionName: "selectionStyle", isCollectionItem: false }
},
},
});
};
const Item = Object.assign(_componentItem, {
componentType: "option",
});
const _componentItemBorder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const ItemBorder = Object.assign(_componentItemBorder, {
componentType: "option",
});
const _componentLabel = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "label",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
connector: { optionName: "connector", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
format: { optionName: "format", isCollectionItem: false },
labelBorder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const Label = Object.assign(_componentLabel, {
componentType: "option",
});
const _componentLabelBorder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const LabelBorder = Object.assign(_componentLabelBorder, {
componentType: "option",
});
const _componentLegend = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "legend",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
legendBorder: { optionName: "border", isCollectionItem: false },
legendTitle: { optionName: "title", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
title: { optionName: "title", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "markerTemplate",
render: "markerRender",
component: "markerComponent"
}],
},
});
};
const Legend = Object.assign(_componentLegend, {
componentType: "option",
});
const _componentLegendBorder = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "border",
},
});
};
const LegendBorder = Object.assign(_componentLegendBorder, {
componentType: "option",
});
const _componentLegendTitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
subtitle: { optionName: "subtitle", isCollectionItem: false }
},
},
});
};
const LegendTitle = Object.assign(_componentLegendTitle, {
componentType: "option",
});
const _componentLegendTitleSubtitle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
const LegendTitleSubtitle = Object.assign(_componentLegendTitleSubtitle, {
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 _componentSelectionStyle = (props) => {
return React.createElement((NestedOption), {
...props,
elementDescriptor: {
OptionName: "selectionStyle",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
hatching: { optionName: "hatching", isCollectionItem: false },
itemBorder: { optionName: "border", isCollectionItem: false }
},
},
});
};
const SelectionStyle = Object.assign(_componentSelectionStyle, {
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 },
funnelTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", 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: "contentTemplate",
render: "contentRender",
component: "contentComponent"
}],
},
});
};
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 Funnel;
export { Funnel, AdaptiveLayout, Border, Connector, Export, Font, Format, FunnelTitle, FunnelTitleSubtitle, Hatching, HoverStyle, Item, ItemBorder, Label, LabelBorder, Legend, LegendBorder, LegendTitle, LegendTitleSubtitle, LoadingIndicator, Margin, SelectionStyle, Shadow, Size, Subtitle, Title, Tooltip, TooltipBorder };