UNPKG

devextreme-react

Version:

DevExtreme React UI and Visualization Components

649 lines (647 loc) • 24 kB
/*! * 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"; "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TooltipBorder = exports.Tooltip = exports.Title = exports.Subtitle = exports.SmallValuesGrouping = exports.Size = exports.Shadow = exports.SeriesTemplate = exports.SeriesBorder = exports.Series = exports.SelectionStyle = exports.PieChartTitleSubtitle = exports.PieChartTitle = exports.Margin = exports.LoadingIndicator = exports.LegendTitleSubtitle = exports.LegendTitle = exports.Legend = exports.Label = exports.Image = exports.HoverStyle = exports.Hatching = exports.Format = exports.Font = exports.Export = exports.Connector = exports.CommonSeriesSettings = exports.CommonAnnotationSettings = exports.Color = exports.Border = exports.ArgumentFormat = exports.AnnotationBorder = exports.Annotation = exports.Animation = exports.AdaptiveLayout = exports.PieChart = void 0; const React = __importStar(require("react")); const react_1 = require("react"); const pie_chart_1 = __importDefault(require("devextreme/viz/pie_chart")); const component_1 = require("./core/component"); const nested_option_1 = __importDefault(require("./core/nested-option")); const PieChart = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => { const baseRef = (0, react_1.useRef)(null); (0, react_1.useImperativeHandle)(ref, () => ({ instance() { return baseRef.current?.getInstance(); } }), [baseRef.current]); const subscribableOptions = (0, react_1.useMemo)(() => (["loadingIndicator", "loadingIndicator.show"]), []); const independentEvents = (0, react_1.useMemo)(() => (["onDisposing", "onDone", "onDrawn", "onExported", "onExporting", "onFileSaving", "onIncidentOccurred", "onInitialized", "onLegendClick", "onPointClick", "onTooltipHidden", "onTooltipShown"]), []); const defaults = (0, react_1.useMemo)(() => ({ defaultLoadingIndicator: "loadingIndicator", }), []); const expectedChildren = (0, react_1.useMemo)(() => ({ adaptiveLayout: { optionName: "adaptiveLayout", isCollectionItem: false }, animation: { optionName: "animation", isCollectionItem: false }, annotation: { optionName: "annotations", isCollectionItem: true }, commonAnnotationSettings: { optionName: "commonAnnotationSettings", isCollectionItem: false }, commonSeriesSettings: { optionName: "commonSeriesSettings", isCollectionItem: false }, export: { optionName: "export", isCollectionItem: false }, legend: { optionName: "legend", isCollectionItem: false }, loadingIndicator: { optionName: "loadingIndicator", isCollectionItem: false }, margin: { optionName: "margin", isCollectionItem: false }, pieChartTitle: { optionName: "title", isCollectionItem: false }, series: { optionName: "series", isCollectionItem: true }, seriesTemplate: { optionName: "seriesTemplate", isCollectionItem: false }, size: { optionName: "size", isCollectionItem: false }, title: { optionName: "title", isCollectionItem: false }, tooltip: { optionName: "tooltip", isCollectionItem: false } }), []); const templateProps = (0, react_1.useMemo)(() => ([ { tmplOption: "centerTemplate", render: "centerRender", component: "centerComponent" }, ]), []); return (React.createElement((component_1.Component), { WidgetClass: pie_chart_1.default, ref: baseRef, subscribableOptions, independentEvents, defaults, expectedChildren, templateProps, ...props, })); })); exports.PieChart = PieChart; const _componentAdaptiveLayout = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "adaptiveLayout", }, }); }; const AdaptiveLayout = Object.assign(_componentAdaptiveLayout, { componentType: "option", }); exports.AdaptiveLayout = AdaptiveLayout; const _componentAnimation = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "animation", }, }); }; const Animation = Object.assign(_componentAnimation, { componentType: "option", }); exports.Animation = Animation; const _componentAnnotation = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "annotations", IsCollectionItem: true, ExpectedChildren: { annotationBorder: { optionName: "border", isCollectionItem: false }, border: { optionName: "border", isCollectionItem: false }, font: { optionName: "font", isCollectionItem: false }, image: { optionName: "image", isCollectionItem: false }, shadow: { optionName: "shadow", isCollectionItem: false } }, TemplateProps: [{ tmplOption: "template", render: "render", component: "component" }, { tmplOption: "tooltipTemplate", render: "tooltipRender", component: "tooltipComponent" }], }, }); }; const Annotation = Object.assign(_componentAnnotation, { componentType: "option", }); exports.Annotation = Annotation; const _componentAnnotationBorder = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "border", }, }); }; const AnnotationBorder = Object.assign(_componentAnnotationBorder, { componentType: "option", }); exports.AnnotationBorder = AnnotationBorder; const _componentArgumentFormat = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "argumentFormat", }, }); }; const ArgumentFormat = Object.assign(_componentArgumentFormat, { componentType: "option", }); exports.ArgumentFormat = ArgumentFormat; const _componentBorder = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "border", }, }); }; const Border = Object.assign(_componentBorder, { componentType: "option", }); exports.Border = Border; const _componentColor = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "color", }, }); }; const Color = Object.assign(_componentColor, { componentType: "option", }); exports.Color = Color; const _componentCommonAnnotationSettings = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "commonAnnotationSettings", ExpectedChildren: { annotationBorder: { optionName: "border", isCollectionItem: false }, border: { optionName: "border", isCollectionItem: false }, font: { optionName: "font", isCollectionItem: false }, image: { optionName: "image", isCollectionItem: false }, shadow: { optionName: "shadow", isCollectionItem: false } }, TemplateProps: [{ tmplOption: "template", render: "render", component: "component" }, { tmplOption: "tooltipTemplate", render: "tooltipRender", component: "tooltipComponent" }], }, }); }; const CommonAnnotationSettings = Object.assign(_componentCommonAnnotationSettings, { componentType: "option", }); exports.CommonAnnotationSettings = CommonAnnotationSettings; const _componentCommonSeriesSettings = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "commonSeriesSettings", ExpectedChildren: { border: { optionName: "border", isCollectionItem: false }, color: { optionName: "color", isCollectionItem: false }, hoverStyle: { optionName: "hoverStyle", isCollectionItem: false }, label: { optionName: "label", isCollectionItem: false }, selectionStyle: { optionName: "selectionStyle", isCollectionItem: false }, seriesBorder: { optionName: "border", isCollectionItem: false }, smallValuesGrouping: { optionName: "smallValuesGrouping", isCollectionItem: false } }, }, }); }; const CommonSeriesSettings = Object.assign(_componentCommonSeriesSettings, { componentType: "option", }); exports.CommonSeriesSettings = CommonSeriesSettings; const _componentConnector = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "connector", }, }); }; const Connector = Object.assign(_componentConnector, { componentType: "option", }); exports.Connector = Connector; const _componentExport = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "export", }, }); }; const Export = Object.assign(_componentExport, { componentType: "option", }); exports.Export = Export; const _componentFont = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "font", }, }); }; const Font = Object.assign(_componentFont, { componentType: "option", }); exports.Font = Font; const _componentFormat = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "format", }, }); }; const Format = Object.assign(_componentFormat, { componentType: "option", }); exports.Format = Format; const _componentHatching = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "hatching", }, }); }; const Hatching = Object.assign(_componentHatching, { componentType: "option", }); exports.Hatching = Hatching; const _componentHoverStyle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "hoverStyle", ExpectedChildren: { border: { optionName: "border", isCollectionItem: false }, color: { optionName: "color", isCollectionItem: false }, hatching: { optionName: "hatching", isCollectionItem: false }, seriesBorder: { optionName: "border", isCollectionItem: false } }, }, }); }; const HoverStyle = Object.assign(_componentHoverStyle, { componentType: "option", }); exports.HoverStyle = HoverStyle; const _componentImage = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "image", }, }); }; const Image = Object.assign(_componentImage, { componentType: "option", }); exports.Image = Image; const _componentLabel = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "label", ExpectedChildren: { argumentFormat: { optionName: "argumentFormat", isCollectionItem: false }, border: { optionName: "border", isCollectionItem: false }, connector: { optionName: "connector", isCollectionItem: false }, font: { optionName: "font", isCollectionItem: false }, format: { optionName: "format", isCollectionItem: false }, seriesBorder: { optionName: "border", isCollectionItem: false } }, }, }); }; const Label = Object.assign(_componentLabel, { componentType: "option", }); exports.Label = Label; const _componentLegend = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "legend", ExpectedChildren: { annotationBorder: { optionName: "border", isCollectionItem: false }, border: { optionName: "border", isCollectionItem: false }, font: { optionName: "font", 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", }); exports.Legend = Legend; const _componentLegendTitle = (props) => { return React.createElement((nested_option_1.default), { ...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", }); exports.LegendTitle = LegendTitle; const _componentLegendTitleSubtitle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "subtitle", ExpectedChildren: { font: { optionName: "font", isCollectionItem: false } }, }, }); }; const LegendTitleSubtitle = Object.assign(_componentLegendTitleSubtitle, { componentType: "option", }); exports.LegendTitleSubtitle = LegendTitleSubtitle; const _componentLoadingIndicator = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "loadingIndicator", DefaultsProps: { defaultShow: "show" }, ExpectedChildren: { font: { optionName: "font", isCollectionItem: false } }, }, }); }; const LoadingIndicator = Object.assign(_componentLoadingIndicator, { componentType: "option", }); exports.LoadingIndicator = LoadingIndicator; const _componentMargin = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "margin", }, }); }; const Margin = Object.assign(_componentMargin, { componentType: "option", }); exports.Margin = Margin; const _componentPieChartTitle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "title", ExpectedChildren: { font: { optionName: "font", isCollectionItem: false }, margin: { optionName: "margin", isCollectionItem: false }, pieChartTitleSubtitle: { optionName: "subtitle", isCollectionItem: false }, subtitle: { optionName: "subtitle", isCollectionItem: false } }, }, }); }; const PieChartTitle = Object.assign(_componentPieChartTitle, { componentType: "option", }); exports.PieChartTitle = PieChartTitle; const _componentPieChartTitleSubtitle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "subtitle", ExpectedChildren: { font: { optionName: "font", isCollectionItem: false } }, }, }); }; const PieChartTitleSubtitle = Object.assign(_componentPieChartTitleSubtitle, { componentType: "option", }); exports.PieChartTitleSubtitle = PieChartTitleSubtitle; const _componentSelectionStyle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "selectionStyle", ExpectedChildren: { border: { optionName: "border", isCollectionItem: false }, color: { optionName: "color", isCollectionItem: false }, hatching: { optionName: "hatching", isCollectionItem: false }, seriesBorder: { optionName: "border", isCollectionItem: false } }, }, }); }; const SelectionStyle = Object.assign(_componentSelectionStyle, { componentType: "option", }); exports.SelectionStyle = SelectionStyle; const _componentSeries = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "series", IsCollectionItem: true, ExpectedChildren: { border: { optionName: "border", isCollectionItem: false }, color: { optionName: "color", isCollectionItem: false }, hoverStyle: { optionName: "hoverStyle", isCollectionItem: false }, label: { optionName: "label", isCollectionItem: false }, selectionStyle: { optionName: "selectionStyle", isCollectionItem: false }, seriesBorder: { optionName: "border", isCollectionItem: false }, smallValuesGrouping: { optionName: "smallValuesGrouping", isCollectionItem: false } }, }, }); }; const Series = Object.assign(_componentSeries, { componentType: "option", }); exports.Series = Series; const _componentSeriesBorder = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "border", }, }); }; const SeriesBorder = Object.assign(_componentSeriesBorder, { componentType: "option", }); exports.SeriesBorder = SeriesBorder; const _componentSeriesTemplate = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "seriesTemplate", }, }); }; const SeriesTemplate = Object.assign(_componentSeriesTemplate, { componentType: "option", }); exports.SeriesTemplate = SeriesTemplate; const _componentShadow = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "shadow", }, }); }; const Shadow = Object.assign(_componentShadow, { componentType: "option", }); exports.Shadow = Shadow; const _componentSize = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "size", }, }); }; const Size = Object.assign(_componentSize, { componentType: "option", }); exports.Size = Size; const _componentSmallValuesGrouping = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "smallValuesGrouping", }, }); }; const SmallValuesGrouping = Object.assign(_componentSmallValuesGrouping, { componentType: "option", }); exports.SmallValuesGrouping = SmallValuesGrouping; const _componentSubtitle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "subtitle", ExpectedChildren: { font: { optionName: "font", isCollectionItem: false } }, }, }); }; const Subtitle = Object.assign(_componentSubtitle, { componentType: "option", }); exports.Subtitle = Subtitle; const _componentTitle = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "title", ExpectedChildren: { font: { optionName: "font", isCollectionItem: false }, legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false }, margin: { optionName: "margin", isCollectionItem: false }, pieChartTitleSubtitle: { optionName: "subtitle", isCollectionItem: false } }, }, }); }; const Title = Object.assign(_componentTitle, { componentType: "option", }); exports.Title = Title; const _componentTooltip = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "tooltip", ExpectedChildren: { argumentFormat: { optionName: "argumentFormat", isCollectionItem: false }, 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", }); exports.Tooltip = Tooltip; const _componentTooltipBorder = (props) => { return React.createElement((nested_option_1.default), { ...props, elementDescriptor: { OptionName: "border", }, }); }; const TooltipBorder = Object.assign(_componentTooltipBorder, { componentType: "option", }); exports.TooltipBorder = TooltipBorder; exports.default = PieChart;