Files

1 line
4.6 KiB
JavaScript

import{K as e,Q as t,Z as n,mr as r,pr as i,xt as a}from"./common.js";import{n as o,t as s}from"./EchartsBaseConfig.js";import{Fragment as c,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createTextVNode as m,createVNode as h,defineComponent as g,normalizeClass as _,openBlock as v,ref as y,renderList as b,renderSlot as x,resolveComponent as S,unref as C,watch as w,withCtx as T}from"vue";import{Checkbox as E}from"ant-design-vue";import{useDesign as D}from"@mfish/core/hooks";import{Icon as O}from"@mfish/core/components/Icon";import{cloneDeep as k}from"lodash-es";var A=r(g({__name:`MfColorIntervalConfig`,props:{themeColors:{type:Array,default:()=>[]}},setup(e){let n=e,r=a(),{prefixCls:o}=D(`color-interval-config`),s=y(!1),g=l(()=>r.getCurComponent.chart.options.visualMap?.inRange?.color||[]);w(()=>n.themeColors,e=>{e?.length>0&&(r.getCurComponent.chart.options.visualMap.inRange.color=k(e))}),w(()=>r.getCurConfigComponent,e=>{e&&x()},{immediate:!0});function x(){r.getCurConfigComponent.chart.options.visualMap?.show!==void 0&&(s.value=r.getCurConfigComponent.chart.options.visualMap?.show||!1)}function A(e,t){e?r.getCurComponent.chart.options.visualMap.inRange.color[t]=e:r.getCurComponent.chart.options.visualMap.inRange.color[t]=``}function j(e){r.getCurComponent.chart.options.visualMap.inRange.color.splice(e,1)}function M(){let e=r.getCurComponent.chart.options.visualMap.inRange.color.length;n.themeColors.length>e?r.getCurComponent.chart.options.visualMap.inRange.color.push(n.themeColors[e]):r.getCurComponent.chart.options.visualMap.inRange.color.push(`#FF0000`)}function N(){r.getCurComponent.chart.options.visualMap.show=s.value}return(e,n)=>{let r=S(`AButton`);return v(),f(`div`,{class:_(C(o))},[h(t,{title:`颜色区间配置`,"default-expand":!0},{action:T(()=>[h(C(E),{checked:s.value,"onUpdate:checked":n[0]||=e=>s.value=e,onChange:N},{default:T(()=>[...n[1]||=[m(` 显示颜色条 `,-1)]]),_:1},8,[`checked`])]),default:T(()=>[(v(!0),f(c,null,b(g.value,(e,t)=>(v(),f(`div`,{class:`title`,key:t},[n[2]||=m(` 区间颜色 `,-1),p(`div`,null,[h(C(i),{type:1,placeholder:`设置区间颜色,格式#FFFFFF`,value:e,"hide-cancel":!0,"hide-confirm":!0,onInputChange:e=>A(e,t)},null,8,[`value`,`onInputChange`])]),t>0?(v(),u(C(O),{key:0,class:`color-delete`,icon:`ant-design:delete-outlined`,onClick:e=>j(t)},null,8,[`onClick`])):d(``,!0)]))),128)),h(r,{onClick:M},{icon:T(()=>[h(C(O),{icon:`ant-design:plus-outlined`})]),default:T(()=>[n[3]||=m(` 添加区间颜色 `,-1)]),_:1})]),_:1})],2)}}}),[[`__scopeId`,`data-v-3f7afd24`]]),j=r(g({__name:`MfMapConfig`,emits:[`changeBorderColor`],setup(t,{emit:r}){let c=r,l=a(),{prefixCls:d}=D(`map-chart-config`),f=y(!0),g=y(k(e[0].color)),b=y(),S=y();w(()=>l.getCurConfigComponent,e=>{e&&O()},{immediate:!0});function O(){l.getCurConfigComponent.chart.options?.mapColor!==void 0&&(b.value=l.getCurConfigComponent.chart.options.mapColor),l.getCurConfigComponent.chart.options?.geo?.itemStyle?.borderColor!==void 0&&(S.value=l.getCurConfigComponent.chart.options.geo.itemStyle.borderColor),l.getCurConfigComponent.chart.options.geo3D?.itemStyle?.borderColor!==void 0&&(S.value=l.getCurConfigComponent.chart.options.geo3D.itemStyle.borderColor),l.getCurConfigComponent.chart.options.tooltip?.show!==void 0&&(f.value=l.getCurConfigComponent.chart.options.tooltip?.show||!1)}function j(){l.getCurConfigComponent.chart.options.tooltip={...l.getCurConfigComponent.chart.options.tooltip,show:f.value}}function M(e){g.value=k(e.color)}function N(e,t){P(e,t),b.value=t}function P(e,t){l.getCurConfigComponent.chart.options.mapColor=t}function F(e,t){I(e,t),S.value=t}function I(e,t){l.getCurConfigComponent.chart.options.geo3D?l.getCurConfigComponent.chart.options.geo3D.itemStyle.borderColor=t:l.getCurConfigComponent.chart.options.geo.itemStyle.borderColor=t,c(`changeBorderColor`,t)}return(e,t)=>(v(),u(n,{class:_(C(d))},{default:T(()=>[h(s,{onThemeChange:M,title:`标识颜色`}),t[2]||=p(`div`,{class:`title`},` 地图颜色 `,-1),h(C(i),{placeholder:`设置地图颜色,格式#FFFFFF`,type:1,value:b.value,onConfirmChange:N,onInputChange:P},null,8,[`value`]),t[3]||=p(`div`,{class:`title`},` 边线颜色 `,-1),h(C(i),{placeholder:`设置地图边线颜色,格式#FFFFFF`,type:1,value:S.value,onConfirmChange:F,onInputChange:I},null,8,[`value`]),h(o),h(C(E),{checked:f.value,"onUpdate:checked":t[0]||=e=>f.value=e,onChange:j},{default:T(()=>[...t[1]||=[m(` 提示框`,-1)]]),_:1},8,[`checked`]),x(e.$slots,`default`,{},void 0,!0),h(A,{"theme-colors":g.value},null,8,[`theme-colors`])]),_:3},8,[`class`]))}}),[[`__scopeId`,`data-v-5c260592`]]);export{j as t};