@progress/kendo-react-chart-wizard
Version:
React Chart Wizard lets you create a chart using data from a Grid, another data-bound component, or an external source
9 lines (8 loc) • 4.63 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),C=require("@progress/kendo-react-layout"),w=require("@progress/kendo-react-form"),R=require("@progress/kendo-react-labels"),r=require("../FormField.js"),m=require("@progress/kendo-react-dropdowns"),P=require("@progress/kendo-react-inputs"),T=require("@progress/kendo-react-intl"),t=require("../../messages.js"),e=require("../../utils.js"),q=require("@progress/kendo-react-animation"),A=s=>{var L,f,S,b,p,h,v;const i=T.useLocalization(),l=s.state,[c,F]=o.useState(!1),x=o.useCallback(n=>{F(!n.expanded)},[]),u=[{value:"top",text:i.toLanguageString(t.formatLegendPositionTop,t.messages.formatLegendPositionTop)},{value:"bottom",text:i.toLanguageString(t.formatLegendPositionBottom,t.messages.formatLegendPositionBottom)},{value:"left",text:i.toLanguageString(t.formatLegendPositionLeft,t.messages.formatLegendPositionLeft)},{value:"right",text:i.toLanguageString(t.formatLegendPositionRight,t.messages.formatLegendPositionRight)}],E=n=>{s.onStateChange(e.updateState(l,e.ActionTypes.legendVisible,n.value))},k=n=>{const a=n.target.value||e.nullItem;e.ensureValue(a)&&s.onStateChange(e.updateState(l,e.ActionTypes.legendFontSize,a.value))},y=n=>{const a=n.target.value||e.nullItem;s.onStateChange(e.updateState(l,e.ActionTypes.legendFontName,a.value))},I=n=>{s.onStateChange(e.updateState(l,e.ActionTypes.legendColor,n.value))},z=n=>{const a=n.target.value;s.onStateChange(e.updateState(l,e.ActionTypes.legendPosition,a.value))};return o.createElement(C.ExpansionPanel,{style:{maxWidth:"576px"},title:i.toLanguageString(t.formatLegend,t.messages.formatLegend),expanded:c,tabIndex:0,onAction:x},o.createElement(q.Reveal,null,c&&o.createElement(C.ExpansionPanelContent,null,o.createElement(w.FormElement,{onKeyDown:e.stopPropagation},o.createElement("div",{className:"k-form-layout k-d-grid k-grid-cols-2 k-gap-x-4"},o.createElement(R.Label,{editorId:"show-legend"},i.toLanguageString(t.formatLegendShowLegend,t.messages.formatLegendShowLegend)),o.createElement(P.Switch,{id:"show-legend",checked:(L=l.legend)==null?void 0:L.visible,onChange:E}),o.createElement(r.FormField,{className:"k-col-span-2",editorId:"legendLabelsFont",labelText:i.toLanguageString(t.formatLegendFont,t.messages.formatLegendFont)},o.createElement(m.ComboBox,{id:"legendLabelsFont",data:e.fontNames,textField:"text",dataItemKey:"value",placeholder:i.toLanguageString(t.formatLegendFontPlaceholder,t.messages.formatLegendFontPlaceholder),value:e.fontNames.find(n=>{var a,d,g;return n.value===((g=e.parseFont(((d=(a=l.legend)==null?void 0:a.labels)==null?void 0:d.font)||""))==null?void 0:g.name)})||e.nullItem,onChange:y,itemRender:e.itemRender,disabled:((f=l.legend)==null?void 0:f.visible)===!1,...e.dropdownlistCommonProps})),o.createElement(r.FormField,{editorId:"legendLabelsSize",labelText:i.toLanguageString(t.formatLegendSize,t.messages.formatLegendSize)},o.createElement(m.ComboBox,{id:"legendLabelsSize",data:e.fontSizes,textField:"text",dataItemKey:"value",placeholder:i.toLanguageString(t.formatLegendSizePlaceholder,t.messages.formatLegendSizePlaceholder),value:e.fontSizes.find(n=>{var a,d,g;return n.value===((g=e.parseFont(((d=(a=l.legend)==null?void 0:a.labels)==null?void 0:d.font)||""))==null?void 0:g.size)})||e.nullItem,onChange:k,disabled:((S=l.legend)==null?void 0:S.visible)===!1,allowCustom:!0,...e.dropdownlistCommonProps})),o.createElement(r.FormField,{editorId:"legendLabelsColor",labelText:i.toLanguageString(t.formatLegendColor,t.messages.formatLegendColor)},o.createElement(P.ColorPicker,{id:"legendLabelsColor",value:((p=(b=l.legend)==null?void 0:b.labels)==null?void 0:p.color)||"",onChange:I,disabled:((h=l.legend)==null?void 0:h.visible)===!1,view:"gradient",fillMode:"outline"})),o.createElement(r.FormField,{className:"k-col-span-2",editorId:"legendPosition",labelText:i.toLanguageString(t.formatLegendPosition,t.messages.formatLegendPosition)},o.createElement(m.DropDownList,{id:"legendPosition",data:u,textField:"text",dataItemKey:"value",value:u.find(n=>{var a;return n.value===((a=l.legend)==null?void 0:a.position)}),onChange:z,disabled:((v=l.legend)==null?void 0:v.visible)===!1,...e.dropdownlistCommonProps})))))))};exports.LegendPanel=A;