@devtable/dashboard 13.42.0 → 13.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard.es.js +3 -2
- package/dist/dashboard.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/version.json +2 -2
- package/package.json +1 -1
package/dist/dashboard.es.js
CHANGED
|
@@ -9665,7 +9665,7 @@ class uc {
|
|
|
9665
9665
|
}), this.instanceRegistry.clear(), this.factoryRegistry.clear();
|
|
9666
9666
|
}
|
|
9667
9667
|
}
|
|
9668
|
-
const wf = "13.42.
|
|
9668
|
+
const wf = "13.42.1", b1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9669
9669
|
__proto__: null,
|
|
9670
9670
|
version: wf
|
|
9671
9671
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -36875,7 +36875,8 @@ const PF = D(({
|
|
|
36875
36875
|
padding: "0.25rem 0.2375rem",
|
|
36876
36876
|
borderRadius: "0.25rem"
|
|
36877
36877
|
}, children: e }), Ou = function() {
|
|
36878
|
-
|
|
36878
|
+
var t;
|
|
36879
|
+
return (((t = navigator.userAgentData) == null ? void 0 : t.platform) ?? navigator.platform).toLowerCase().includes("mac");
|
|
36879
36880
|
}(), qF = () => {
|
|
36880
36881
|
const {
|
|
36881
36882
|
t: e
|
package/dist/dashboard.umd.js
CHANGED
|
@@ -88,7 +88,7 @@ Check the top-level render call using <`+N+">.")}return A}}function em(k,A){{if(
|
|
|
88
88
|
${Object.entries(t).map(([s,i])=>`const ${s} = '${i}';`).join(`
|
|
89
89
|
`)}
|
|
90
90
|
return ${e};
|
|
91
|
-
`)(n)}catch(s){return console.error(s),console.log(e),e}}function Ys(e,t,n,s){const i=N_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=q_(c);return $_(d,i,n)})}function F_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function G_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,p=Mi(c,n),h=rx({sql:p,pre_process:u}),g=xc.encode(h);F_(h,g);let b=await Yt.query(i)({type:a,key:l,query:g,...s},{params:{name:t}});return b=sx(d,b,fo(n)),b}async function W_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Yt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function go(){try{return(await Yt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function Gp(){try{return(await Yt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Wp{constructor(t){q(this,"rootRef");this.rootRef=re.observable({current:t})}async deleteItem(t){re.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?re.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))re.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else re.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return re.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class R_{constructor(){q(this,"channels",new Map);q(this,"globalChannel",new bc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new bc;return this.channels.set(t,s),s}}class Q_{constructor(t){q(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new R_,instanceData:new Wp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Rp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Wp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const U_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Rp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},Y_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Rp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Qp=(e,t)=>{const n=Et.bezier(e),s=Et.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Ks=e=>{const t=Et.bezier(e);return function(n){return t(n/100).hex()}},K_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Qp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},X_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Qp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},J_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Ks(["#fff7f1","darkred"]),name:"red",category:"sequential"},Z_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Ks(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},H_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Ks(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ej={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Ks(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class tj{constructor(t){q(this,"symbol");this.symbol=Symbol(t)}}function pn(e){return new tj(e)}class mo{constructor(){q(this,"parent");q(this,"factoryRegistry",new Map);q(this,"instanceRegistry",new Map)}createScoped(){const t=new mo;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Up="13.42.0",nj=Object.freeze(Object.defineProperty({__proto__:null,version:Up},Symbol.toStringTag,{value:"Module"}));class rj{constructor(t){q(this,"staticColors",new Map);q(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(n,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class sj{constructor(){q(this,"plugins",new Map);q(this,"vizComponents",new Map);q(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class ij{constructor(){q(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Ie extends ij{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=Y.useBoolean(!0),[i,a]=f.useState();f.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=f.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Vt=e=>Math.max(0,e-ut.left-ut.right),Nt=e=>Math.max(0,e-ut.top-ut.bottom),Zr=(e,t)=>({width:Vt(e),height:Nt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),xo={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function aj({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=v.defaults({},t,xo),h=f.useMemo(()=>cs(n,a),[n,a]),{x:g,y:b,z:x}=f.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:T}=f.useMemo(()=>{const I=v.minBy(h,z=>z[x.columnKey]),M=v.maxBy(h,z=>z[x.columnKey]);return{min:v.get(I,x.columnKey),max:v.get(M,x.columnKey)}},[h,x]),C={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:T,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(I=>[I[g.columnKey],I[b.columnKey],I[x.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:C,style:Zr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(f.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:p}=Pe(),h=f.useMemo(()=>p.dataFieldOptions(s,l,a),[s,l,a]);if(h.length===0){const g=p.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:g.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:g.queryName?"black":"red",sx:{fontFamily:"monospace"},children:g.queryName??g.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:g.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:h,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function oj({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,xo),{control:i,handleSubmit:a,reset:l}=y.useForm({defaultValues:s});return f.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(S.IconDeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const lj=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function cj(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class uj extends Ie{constructor(){super(...arguments);q(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:cj(i,s)}})}}const dj={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new uj,name:"bar-3d",viewRender:aj,configRender:oj,createConfig(){return{version:2,config:v.cloneDeep(xo)}},translation:lj},pj=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function tt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
91
|
+
`)(n)}catch(s){return console.error(s),console.log(e),e}}function Ys(e,t,n,s){const i=N_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=q_(c);return $_(d,i,n)})}function F_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function G_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,p=Mi(c,n),h=rx({sql:p,pre_process:u}),g=xc.encode(h);F_(h,g);let b=await Yt.query(i)({type:a,key:l,query:g,...s},{params:{name:t}});return b=sx(d,b,fo(n)),b}async function W_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Yt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function go(){try{return(await Yt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function Gp(){try{return(await Yt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Wp{constructor(t){q(this,"rootRef");this.rootRef=re.observable({current:t})}async deleteItem(t){re.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?re.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))re.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else re.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return re.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class R_{constructor(){q(this,"channels",new Map);q(this,"globalChannel",new bc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new bc;return this.channels.set(t,s),s}}class Q_{constructor(t){q(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new R_,instanceData:new Wp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Rp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Wp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const U_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Rp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},Y_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Rp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Qp=(e,t)=>{const n=Et.bezier(e),s=Et.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Ks=e=>{const t=Et.bezier(e);return function(n){return t(n/100).hex()}},K_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Qp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},X_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Qp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},J_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Ks(["#fff7f1","darkred"]),name:"red",category:"sequential"},Z_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Ks(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},H_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Ks(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ej={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Ks(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class tj{constructor(t){q(this,"symbol");this.symbol=Symbol(t)}}function pn(e){return new tj(e)}class mo{constructor(){q(this,"parent");q(this,"factoryRegistry",new Map);q(this,"instanceRegistry",new Map)}createScoped(){const t=new mo;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Up="13.42.1",nj=Object.freeze(Object.defineProperty({__proto__:null,version:Up},Symbol.toStringTag,{value:"Module"}));class rj{constructor(t){q(this,"staticColors",new Map);q(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(n,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class sj{constructor(){q(this,"plugins",new Map);q(this,"vizComponents",new Map);q(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class ij{constructor(){q(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Ie extends ij{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=Y.useBoolean(!0),[i,a]=f.useState();f.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=f.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Vt=e=>Math.max(0,e-ut.left-ut.right),Nt=e=>Math.max(0,e-ut.top-ut.bottom),Zr=(e,t)=>({width:Vt(e),height:Nt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),xo={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function aj({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=v.defaults({},t,xo),h=f.useMemo(()=>cs(n,a),[n,a]),{x:g,y:b,z:x}=f.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:T}=f.useMemo(()=>{const I=v.minBy(h,z=>z[x.columnKey]),M=v.maxBy(h,z=>z[x.columnKey]);return{min:v.get(I,x.columnKey),max:v.get(M,x.columnKey)}},[h,x]),C={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:T,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(I=>[I[g.columnKey],I[b.columnKey],I[x.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:C,style:Zr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(f.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:p}=Pe(),h=f.useMemo(()=>p.dataFieldOptions(s,l,a),[s,l,a]);if(h.length===0){const g=p.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:g.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:g.queryName?"black":"red",sx:{fontFamily:"monospace"},children:g.queryName??g.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:g.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:h,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function oj({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,xo),{control:i,handleSubmit:a,reset:l}=y.useForm({defaultValues:s});return f.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(y.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(y.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(S.IconDeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const lj=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function cj(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class uj extends Ie{constructor(){super(...arguments);q(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:cj(i,s)}})}}const dj={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new uj,name:"bar-3d",viewRender:aj,configRender:oj,createConfig(){return{version:2,config:v.cloneDeep(xo)}},translation:lj},pj=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function tt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
92
92
|
`)}}const qt=f.forwardRef(({value:e,onChange:t,triggerButtonText:n},s)=>{const{t:i}=j.useTranslation(),[a,{setTrue:l,setFalse:c}]=Y.useBoolean(),[u,d]=f.useState(e);f.useEffect(()=>{d(e)},[e]);const p=T=>{d({...u,enabled:T})},h=()=>{c();const{enabled:T,func_content:C}=u,I={enabled:T,func_content:C};d(I),t(I)},g=()=>{c(),d(e)},b=T=>{d(C=>({...C,func_content:T}))},x=()=>{b(tt().func_content)},_=n??i("chart.axis.customize_label");return r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{variant:"filled",color:"grape",leftIcon:r.jsx(S.IconMathFunction,{size:16}),mt:24,onClick:l,sx:{flexGrow:0},children:_}),r.jsx(o.Modal,{size:800,title:_,opened:a,onClose:c,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:a&&r.jsxs(o.Stack,{children:[r.jsx(o.Checkbox,{mt:10,label:i("common.enabled"),checked:u.enabled,onChange:T=>p(T.currentTarget.checked)}),r.jsx(pj,{value:u.func_content,onChange:b,disabled:!u.enabled}),r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Button,{onClick:x,color:"red",leftIcon:r.jsx(S.IconRecycle,{size:20}),children:i("common.actions.reset_to_default")}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:g,variant:"subtle",children:i("common.actions.cancel")}),r.jsx(o.Button,{color:"green",leftIcon:r.jsx(S.IconDeviceFloppy,{size:16}),onClick:h,children:i("common.actions.save")})]})]})]})})]})}),Fn={x_axis_scroll:!1,y_axis_scroll:!1,x_axis_slider:!1,y_axis_slider:!1};function Yp(){return v.cloneDeep(Fn)}const hj=[{lang:"en",resources:{boxplot:{viz_name:"Boxplot Chart",box:"Box",outlier:"Outlier",scatter:"Scatter",click_series:{label:"Click box, scatter or outlier"}}}},{lang:"zh",resources:{boxplot:{viz_name:"箱线图",box:"箱体",outlier:"异常点",scatter:"散点",click_series:{label:"点击箱体、散点或异常点"}}}}],Kp={id:"builtin:echarts:click-echart:series",displayName:"viz.boxplot.click_series.label",nameRender:gj,configRender:fj,payload:[{name:"type",description:"Always 'click'",valueType:"string"},{name:"seriesType",description:"'boxplot'",valueType:"string"},{name:"name",description:"Name of the series clicked",valueType:"string"},{name:"color",description:"Color",valueType:"string"},{name:"value",description:"Record of 'name', 'min', 'q1', 'median', 'q3', 'max'",valueType:"object"},{name:"rowData",description:"Data of the row",valueType:"object"}]};function fj(e){return r.jsx(r.Fragment,{})}function gj(e){const{t}=j.useTranslation();return r.jsx(o.Text,{children:t("viz.boxplot.click_series.label")})}const Xs=f.forwardRef(({sectionTitle:e,value:t,onChange:n},s)=>{const{t:i,i18n:a}=j.useTranslation(),l=u=>d=>{const p=v.cloneDeep(t);v.set(p,u,d),n(p)},c=f.useMemo(()=>[{label:i("chart.axis.overflow.truncate"),value:"truncate"},{label:i("chart.axis.overflow.break_line"),value:"break"},{label:i("chart.axis.overflow.break_word"),value:"breakAll"}],[a.language]);return r.jsxs(o.Stack,{spacing:0,children:[e&&r.jsx(o.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",labelProps:{color:"dimmed"}}),r.jsxs(o.Group,{grow:!0,noWrap:!0,children:[r.jsx(o.NumberInput,{label:i("chart.axis.overflow.max_width"),hideControls:!0,value:t.width,onChange:l("width")}),r.jsx(o.Select,{label:i("chart.axis.overflow.label"),data:c,value:t.overflow,onChange:l("overflow")}),r.jsx(o.TextInput,{label:i("chart.axis.overflow.ellipsis"),value:t.ellipsis,disabled:!0})]})]})}),$t=f.forwardRef(({value:e,onChange:t},n)=>{const{t:s}=j.useTranslation(),i=l=>{t({...e,on_axis:l})},a=l=>{t({...e,in_tooltip:l})};return r.jsxs(o.Stack,{ref:n,spacing:0,children:[r.jsx(Xs,{sectionTitle:s("chart.axis.overflow.section_title.on_axis"),value:e.on_axis,onChange:i}),r.jsx(Xs,{sectionTitle:s("chart.axis.overflow.section_title.in_tooltip"),value:e.in_tooltip,onChange:a})]})});function ht(){return{on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}}}function It({overflow:e,width:t}){const n={truncate:"initial",break:"break-all",breakAll:"break-word"}[e],s=e==="truncate"?"nowrap":"initial",i={truncate:"ellipsis",break:"clip",breakAll:"clip"}[e];return`
|
|
93
93
|
max-width: ${t}px;
|
|
94
94
|
word-break: ${n};
|
|
@@ -487,7 +487,7 @@ Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel vari
|
|
|
487
487
|
-- 在富文本中,要使用双重花括号来包裹代码。
|
|
488
488
|
项目ID:{{ context.project_id }}
|
|
489
489
|
搜索关键字:{{ filters.keyword }}
|
|
490
|
-
我的卡片变量: {{ your_var }}`,tabs:{guide:"使用指南",vars:"看板信息与卡片的变量"}}}},style:{label:"样式",font_size:{label:"字号",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"字重"},size:{xs:"特小",sm:"小",md:"中",lg:"大",xl:"特大"},flex:{justify_content:{label:"内容分布",left:"从左起",center:"居中",right:"从右起",space_between:"均匀分布,首尾顶格",space_around:"均匀分布,首尾留空一半",space_evenly:"均匀分布,首尾留空"},align_items:{label:"对齐位置",start:"起点对齐",center:"居中对齐",end:"末端对齐",stretch:"拉伸对齐"}},color:{type:{label:"颜色类型",static:"单色",interpolation:"插值取色",none:"无"},interpolation:{setup:"设置取色方案",palette:{label:"色板",category:{sequential:"单色渐变",diverging:"双色渐变"},red_green:"红 / 绿",yellow_blue:"黄 / 蓝",red:"红",green:"绿",blue:"蓝",orange:"橙",mapping:{value_input_label:"映射一个值到此颜色"}}}}},query:{label:"查询",labels:"查询",add:"新增查询",delete:"删除这个查询",cant_delete:"此查询在使用中,不能删除。请查看“使用情况”标签页以了解详情",delete_unused:"删除未用到的查询",name:"名称",name_description:"唯一名称",manage:"管理查询",open:"打开此查询",configurations:"配置",basics:"基本信息",conditions:"条件",run_by_condition:{label:"以下条件为真时,才运行本查询",description:"为假的情况: 空数组 / NaN / false / 空字符串 / undefined / null",unset:"留空则在看板加载时便运行本查询"},re_run_condition:{label:"当以下条件改变时,重新运行此查询",unset:"留空则永不重新运行此查询"},dependency:{label:"依赖",has_none:"此查询无依赖"},edit_sql:"编辑SQL",preview_sql:"预览SQL",request:"请求",build_request:"构造请求",process_request:"加工请求",process_result:"加工结果",usage:{label:"使用情况",in_views:"所在视图",unused_description:"此查询未被任何筛选器或卡片用到"},transform:{label:"查询变形",full_label:"查询变形",data_source:"基于其他查询的数据,加工出新数据",guide:{pick_queries:"选择一至多个查询作为数据输入",write_function:"编写函数,返回新数据"}}},data:{label:"数据",preview_data:"预览数据",empty_data:"无数据",requires_data:"请先关联查询"},data_source:{label:"数据源",explore:"查看数据源",explorer:"数据源查看器",table_structure:"数据表结构",table_structure_short:"表结构",see_table_structure:"查看数据表结构"},visualization:{label:"可视化",component:"可视化组件",label_short:"可视化"},numbro:{format:{label:"格式",absolute:"绝对值",absolute_description:"非负",abbreviation:"缩写",abbreviation_description:"如1.23k、1.23m",mantissa:"小数",trim_mantissa:"抹零",trim_mantissa_description:"省略末尾的零",preview:{open:"展开预览",close:"收起预览",input:"输入",output:"输出"}}},import:{label:"导入...",title:"自描述文件导入看板内容",json_file:"描述文件(JSON格式)",this_dashboard:"此看板",this_file:"此文件"},function_utils:{trigger_text:"关于utils参数",modal_title:"关于utils参数",description:"参数 <code>utils</code> 是 <code>FunctionUtils</code>,包含以下内容:",document:"文档"},aggregation:{option:{none:"无",sum:"和",mean:"平均值",median:"中位数",min:"最小值",max:"最大值",cov:"变异系数",std:"标准差",quantile:{label:"分位",label_with_hint:"分位(99%, 95%, ...)"},custom:{label:"自定义",label_trigger:"编写函数",title:"自定义聚合方式"},pick_record:{label:"直接选择数据",method:{label:"数据记录",first:"第一条",last:"最后一条"}}}},rich_text:{label:"富文本",content:{label:"内容"},dynamic_color:{label:"动态颜色",edit:"编辑动态颜色",clear:"清除动态颜色"},color_mapping:{label:"颜色映射",edit:"编辑颜色映射",clear:"清除颜色映射",choose_value_var:"选择用于映射颜色的变量",min:{val:"固定最小值",var:"动态最小值(优先)"},max:{val:"固定最大值",var:"动态最大值(优先)"}}},chart:{chart_config:"图表设置",data_field:"数据字段",groups:{merico_suite:"思码逸套件",echarts_based_charts:"基于ECharts的图表",others:"其他"},label:{label:"文案",label_full:"标签文案",label_style:"标签文案样式",label_format:"标签文案格式"},label_position:{label:"文案位置",off:"不显示文案",top:"上",left:"左",right:"右",bottom:"下",inside:"内",inside_top:"内-上",inside_left:"内-左",inside_center:"内-中",inside_right:"内-右",inside_bottom:"内-下",inside_top_left:"内-上-左",inside_top_right:"内-上-右",inside_bottom_left:"内-下-左",inside_bottom_right:"内-下-右",outside:"外"},visual_map:{label:"视觉映射",continuous:{label:"连续型"},piecewise:{label:"分段型",mode:{pieces:"连续数据",categories:"离散数据"},add_a_piece:"加一个分段",interval:"值区间",piece_label:"文案"},bar_width:"长条的宽度",bar_height:"长条的高度",item_width:"小块的宽度",item_height:"小块的高度",calculable:"显示拖拽手柄",min_value:"最小值",max_value:"最大值",min_text:"最小值文案",max_text:"最大值文案",use_palette_x:'使用配色方案"{{x}}"',built_in_palettes:"内置配色方案",precision:"数据精度",skip_range:{lt_min:"小于最小值时的颜色",min:"最小值的颜色",max:"最大值的颜色",gt_max:"大于最大值时的颜色",follow_visual_map:"颜色跟随渐变规则"}},number_or_dynamic_value:{type:{static:"具体值",dynamic:"动态值"},dynamic:{setup:"设置",setup_title:"设置动态值",guide:"由函数确定动态值"}},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},symbol_size:{label:"标记点大小",static:"固定值",dynamic:"动态值",setup:{label:"设置",title:"设置动态值",description:"由函数确定动态值"}},series:{label:"系列",name:"名称",y_axis:"Y轴",data_field:"数据字段",add:"增加一个系列",delete:"删除这个系列",line:{label:"线",line_settings:"线段设置",line_style:"线条样式",type:{label:"类型",solid:"实线",dashed:"方虚线",dotted:"圆点虚线"},line_width:"线宽",step:{label:"阶梯状",off:"不启用",start:"在当前点拐弯",middle:"在当前点与下个点中间拐弯",end:"在下个点拐弯"},smooth_line:"平滑曲线",show_name_on_line:"显示标签文案",show_symbol_on_line:"显示标记点",area_style:{label:"区域填充样式",enabled:"启用区域填充",color:"填充颜色",use_series_color:"沿用系列本色",origin:{label:"图形区域的起始位置",auto:{label:"自动",description:"填充坐标轴线到数据间的区域(默认)"},start:{label:"自下而上",description:"填充坐标轴底部到数据间的区域"},end:{label:"自上而下",description:"填充坐标轴顶部到数据间的区域"}},shadow_blur:"图形阴影的模糊大小",shadow_color:"图形阴影的颜色",shadow_offset_x:"阴影水平方向上的偏移距离",shadow_offset_y:"阴影垂直方向上的偏移距离",opacity:"图形透明度"}},bar:{label:"柱",stack:"堆放",stack_hint:"此值相同的柱系列会堆叠在一起",bar_gap:{label:"柱间隔",no_gap:"柱子之间无间隔",overlap:"柱子可互相重叠"},bar_width:{min:"最小柱宽",exact:"柱宽",max:"最大柱宽"}},scatter:{label:"散点"},group_by:{label:"按此字段拆分为多个系列",label_line:"按此字段拆分为多条线"}},axis:{tick_label:"刻度文案",customize_label:"自定义文案",overflow:{label:"溢出",max_width:"最大宽度",truncate:"截断",break_line:"换行",break_word:"断词换行",ellipsis:"省略符",section_title:{on_axis:"轴刻度上文案的溢出",in_tooltip:"提示框中的文案溢出"}},section_title:{label_format:"文案格式"},type:{value:"数值轴",category:"类目轴",time:"时间轴",log:"对数轴",click_to_learn_more:"点击 <1>这里</1> 以进一步了解这些选项"}},name_text:{align:{label:"名称贴靠侧",left:"左",center:"中",right:"右"}},rotate:"旋转",degree:"度",padding:"内间距",content_template:{label:"内容模板",hint:"均值: ${avg}"},x_axis:{label:"X轴",labels:"X轴",label_format:"刻度文案格式",add:"增加一条X轴",delete:"删除这条X轴",x_axis_name:"X轴名称",x_axis_data_field:"X轴数据字段",x_axis_type:"X轴类型",layout:"布局",position:{label:"位置",top:"上",bottom:"下"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},y_axis:{label:"Y轴",labels:"Y轴",label_format:"刻度文案格式",add:"增加一条Y轴",delete:"删除这条Y轴",y_axis_name:"Y轴名称",y_axis_name_anchor:"名称贴靠侧",y_axis_data_field:"Y轴数据字段",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},stats:{label:"统计内容",template:{above_chart:"统计内容(图表上方)",under_chart:"统计内容(图表下方)"}},legend:{label:"图例",show_legend:"显示图例",show_in_legend:"显示在图例中",hide_in_legend:"不显示在图例中",orientation:{label:"布局朝向",horizontal:"横向",vertical:"纵向"}},tooltip:{label:"提示框",additional_metrics:{description:"在此设置更多指标,来展示在散点的提示框",add:"增加一个指标",delete:"删除这个指标"},trigger:{label:"触发者",scatter_point:"散点",x_axis:"X轴"}},style:{label:"样式"},color:{label:"颜色",background_color:"背景色",text_color:"文字颜色",click_to_add_a_color:"点击增加一个颜色",color_gradient:"颜色渐变",not_set:"未设置"},behavior:{label:"表现",invisible:"隐藏不可见"},heatmap:{heatblock:{label:"热力块",show_label:"展示值文案"}},reference_line:{label:"参考线",labels:"参考线",add:"增加一条参考线",name_placeholder:"均值参考线",delete:"删除这条参考线",orientation:{vertical_hint:"仅当X轴值为数字时可绘制"}},regression_line:{label:"回归线",labels:"回归线",add:"增加一条回归线",delete:"删除这条回归线",method:{label:"方法",linear:"线性回归",exponential:"指数回归",logistic:"指数回归",polynomial:"多项式回归",polynomial_order:"次"}},reference_area:{label:"参考区域",labels:"参考区域",add:"增加一面参考区域",delete:"删除这面参考区域",type:{label:"形状",rectangle:"矩形"},direction:{label:"方向",horizontal:"水平"},boundary:{upper:"上边界",lower:"下边界"},content:{label:"内容",content_text:"内容文字",text_position:"文字位置"},endpoint:{labels:"端点",left_bottom_point:"左下点",right_top_point:"右上点"}},zooming:{label:"缩放",scroll:{label:"滚轮缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用"},slider:{label:"滚动条缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用",y_axis_disabled:"暂不可用,会与Y轴刻度文字重叠"}}},viz:{viz_config_banner:"可视化参数配置"},validation:{number:{require_a_number:"请填写一个数字"}},spotlight:{trigger_text:"搜索",main_group:"主要项",placeholder:"打开…",not_found:"无匹配项"}}},bi=Um.createInstance({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:_P,zh:jP}}).use(Ym).use(j.initReactI18next);bi.init(),Zo.forEach(e=>{var t;(t=e.translation)==null||t.forEach(n=>{bi.addResourceBundle(n.lang,"translation",{viz:n.resources},!0,!0)})});function vg({lang:e,children:t}){return f.useEffect(()=>{bi.changeLanguage(e)},[e]),r.jsx(j.I18nextProvider,{i18n:bi,children:t})}function yi(e){console.groupCollapsed("Running operation ",e.type),console.log(e),console.groupEnd()}function _g(e,t){f.useEffect(()=>{const n=s=>{yi(s);const{viewID:i}=s.detail;if(!i){console.error(new Error("[Open View] Needs to pick a view first"));return}e.views.appendToVisibles(i),t&&e.views.setIDOfVIE(i)};return window.addEventListener("open-view",n),()=>{window.removeEventListener("open-view",n)}},[e,t]),f.useEffect(()=>{const n=s=>{yi(s);const{dictionary:i,payload:a}=s.detail;if(!a||Object.keys(a).length===0){console.error(new Error("[Set Filter Values] payload is empty"));return}const l={};Object.entries(i).forEach(([c,u])=>{const d=v.get(a,u);l[c]=d}),e.filters.applyValuesPatch(l)};return window.addEventListener("set-filter-values",n),()=>{window.removeEventListener("set-filter-values",n)}},[e]),f.useEffect(()=>{function n(i){return Array.isArray(i)?[]:typeof i=="object"?{}:typeof i=="boolean"?!1:typeof i=="string"?"":typeof i=="number"?0:i}const s=i=>{yi(i);const a={},{filter_keys:l}=i.detail;l.forEach(c=>{const u=v.get(e.filters.values,c),d=n(u);a[c]=d}),e.filters.applyValuesPatch(a)};return window.addEventListener("clear-filter-values",s),()=>{window.removeEventListener("clear-filter-values",s)}},[e]),f.useEffect(()=>{const n=s=>{yi(s);const{urlTemplate:i,openInNewTab:a,enableEncoding:l=!1,payload:c}=s.detail;if(!i){console.error(new Error("[Open Link] URL is empty"));return}function u(h){return v.cloneDeepWith(h,b=>{if(l&&typeof b=="string")return encodeURIComponent(b)})}const p=v.template(i||"")(u({...c,filters:e.payloadForSQL.filters,context:e.payloadForSQL.context}));window.open(p,a?"_blank":"_self","noopener")};return window.addEventListener("open-link",n),()=>{window.removeEventListener("open-link",n)}},[e])}function jg(e){return f.useCallback(t=>t.provideValue(Oe.pluginManager,e.pluginManager).provideValue(Oe.vizManager,e.vizManager).provideValue(Oe.colorManager,e.colorManager),[])}const lV="",wP=D.observer(({saveDashboardChanges:e})=>{const{t}=j.useTranslation(),n=jt.useModals(),s=se(),i=()=>{n.openConfirmModal({title:r.jsxs(o.Group,{position:"left",children:[r.jsx(S.IconAlertTriangle,{size:18,color:"red"}),r.jsx(o.Text,{children:"You are reverting changes"})]}),labels:{confirm:t("common.actions.confirm"),cancel:t("common.actions.cancel")},confirmProps:{color:"red"},onCancel:()=>console.log("Cancel"),onConfirm:()=>s.reset(),zIndex:320,withCloseButton:!1})},a=s.changed;return r.jsxs(o.Group,{spacing:0,children:[r.jsx(o.Button,{color:"green",variant:"filled",size:"xs",leftIcon:r.jsx(S.IconDeviceFloppy,{size:18}),onClick:e,disabled:!a,sx:{borderTopRightRadius:0,borderBottomRightRadius:0},children:t("common.actions.save_changes")}),r.jsxs(o.Menu,{width:200,trigger:"hover",openDelay:100,closeDelay:400,withinPortal:!0,zIndex:320,disabled:!a,children:[r.jsx(o.Menu.Target,{children:r.jsx(o.ActionIcon,{variant:"default",disabled:!a,sx:{height:"30px",borderTopLeftRadius:0,borderBottomLeftRadius:0,svg:{fill:"rgb(173, 181, 189)",stroke:"none"}},children:r.jsx(S.IconCaretDown,{size:18})})}),r.jsx(o.Menu.Dropdown,{children:r.jsx(o.Menu.Item,{icon:r.jsx(S.IconRecycle,{size:14,color:"red"}),disabled:!a,onClick:i,children:t("common.actions.revert_changes")})})]})]})}),CP=D.observer(({saveDashboardChanges:e,onExit:t,headerSlot:n=null})=>{j.useTranslation();const s=ce(),i=s.content.changed,a=()=>{t({hasChanges:i,dashboardId:s.id})};return r.jsx(o.Header,{height:60,px:"md",py:0,sx:{zIndex:299},children:r.jsxs(o.Group,{position:"apart",sx:{height:60,minWidth:"1000px",position:"relative"},children:[r.jsxs(o.Group,{children:[r.jsx(o.Button,{size:"xs",color:i?"red":"green",leftIcon:r.jsx(S.IconArrowLeft,{size:20}),onClick:a,children:r.jsx(o.Group,{spacing:4,children:r.jsxs(j.Trans,{i18nKey:"common.actions.end_editing",values:{name:s.name},children:["End Editing ",r.jsx(o.Text,{td:"underline",children:s.name})]})})}),r.jsx(wP,{saveDashboardChanges:e})]}),r.jsx(o.Group,{position:"right",sx:{flexGrow:1},children:n})]})})}),wg={height:"30px",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},SP=D.observer(()=>{var i;const{t:e}=j.useTranslation(),t=se(),n=((i=t.views.VIE)==null?void 0:i.type)===G.Tabs,s=()=>t.addANewPanel(t.views.idOfVIE);return n?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconPlaylistAdd,{size:20}),sx:{...wg,transform:"none !important"},children:e("panel.add")})}):r.jsx(o.Button,{variant:"outline",color:"blue",radius:0,size:"xs",onClick:s,leftIcon:r.jsx(S.IconPlaylistAdd,{size:20}),sx:{...wg,background:"rgb(231, 245, 255)"},children:e("panel.add")})}),kP=D.observer(({done:e})=>{var E,R;const{t}=j.useTranslation(),s=se().layouts,i=f.useMemo(()=>({list:s.breakpointsInfo}),[s.breakpointsInfo]),{control:a,handleSubmit:l,watch:c,getValues:u,reset:d,formState:p}=y.useForm({defaultValues:i}),{fields:h,append:g,remove:b}=y.useFieldArray({control:a,name:"list",rules:{validate:Z=>{if(console.log({values:Z}),v.uniqBy(Z,"breakpoint").length!==Z.length)return"Screen sizes should be unique by min width"}}}),x=c("list"),_=h.map((Z,oe)=>({...Z,...x[oe]})),T=()=>{g({id:sn.v4(),name:"",breakpoint:""})},C=({list:Z})=>{const oe=Z.filter(ve=>Number.isFinite(ve.breakpoint));s.updateLayoutSetsInfo(oe),e()},I=u(),M=f.useMemo(()=>{const Z={list:I.list.filter(oe=>!!oe.name&&Number.isFinite(oe.breakpoint))};return!v.isEqual(Z,i)},[I,i]),z=(R=(E=p.errors.list)==null?void 0:E.root)==null?void 0:R.message;return r.jsx(r.Fragment,{children:r.jsxs("form",{onSubmit:l(C),children:[r.jsxs(o.Table,{fontSize:"sm",highlightOnHover:!0,withBorder:!0,sx:{tableLayout:"fixed"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"340px"},children:t("common.name")}),r.jsx("th",{style:{width:"160px"},children:t("breakpoint.breakpoint")}),r.jsx("th",{})]})}),r.jsxs("tbody",{children:[_.map((Z,oe)=>r.jsxs("tr",{children:[r.jsx("th",{children:Z.id==="basis"?Z.name:r.jsx(y.Controller,{name:`list.${oe}.name`,control:a,render:({field:ve})=>r.jsx(o.TextInput,{size:"xs",label:"",required:!0,sx:{flex:1},...ve})})}),r.jsx("td",{children:Z.id==="basis"?r.jsxs(o.Text,{ff:"monospace",children:[Z.breakpoint,"px"]}):r.jsx(y.Controller,{name:`list.${oe}.breakpoint`,control:a,render:({field:ve})=>r.jsx(o.NumberInput,{size:"xs",label:"",required:!0,max:1e4,hideControls:!0,rightSection:r.jsx(o.Text,{color:"dimmed",children:"px"}),rightSectionProps:{style:{width:"30px"}},sx:{flex:1,fontFamily:"monospace"},styles:{input:{paddingRight:"30px"}},...ve})})}),r.jsx("td",{children:Z.id!=="basis"&&r.jsx(o.ActionIcon,{mx:"auto",size:"xs",variant:"subtle",color:"red",onClick:()=>b(oe),children:r.jsx(S.IconTrash,{})})})]},Z.id)),r.jsx("tr",{style:{backgroundColor:"transparent"},children:r.jsx("td",{colSpan:3,style:{padding:"0"},children:r.jsx(o.Tooltip,{label:t("breakpoint.add"),children:r.jsx(o.ActionIcon,{variant:"subtle",size:"md",color:"blue",onClick:T,sx:{width:"100%"},children:r.jsx(S.IconPlus,{size:18})})})})})]})]}),r.jsx(o.Text,{mt:6,ta:"right",size:"xs",color:"red",children:z??" "}),r.jsxs(o.Group,{mt:6,position:"apart",children:[r.jsx(o.Button,{color:"orange",size:"xs",onClick:()=>d(),leftIcon:r.jsx(S.IconRecycle,{size:18}),disabled:!M,children:t("common.actions.revert")}),r.jsx(o.Button,{color:"green",size:"xs",type:"submit",leftIcon:r.jsx(S.IconDeviceFloppy,{size:18}),disabled:!M,children:t("common.actions.save_changes")})]})]})})}),TP=D.observer(()=>{const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Me.useDisclosure(!1),i=se(),a=i.layouts.currentBreakpoint,l=i.layouts.currentLayoutRange,c=()=>{setTimeout(()=>{window.dispatchEvent(new Event("resize"))},32)},u=()=>{s(),c()};return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{children:[r.jsxs(o.Menu,{withArrow:!0,withinPortal:!0,zIndex:320,trigger:"hover",children:[r.jsx(o.Menu.Target,{children:r.jsx(o.Button,{size:"xs",variant:"subtle",leftIcon:r.jsx(S.IconDevices,{size:16}),sx:{borderRadius:0},children:r.jsxs(o.Group,{spacing:6,children:[r.jsx(o.Text,{size:"xs",fw:"normal",children:l.name}),r.jsx(o.Text,{size:"xs",color:"#777",children:i.layouts.currentRangeText})]})})}),r.jsxs(o.Menu.Dropdown,{children:[i.layouts.breakpointRanges.map(d=>r.jsx(o.Menu.Item,{onClick:()=>i.layouts.setCurrentBreakpoint(d.id),disabled:a===d.id,children:r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Text,{size:"sm",children:d.name}),r.jsx(o.Text,{size:"xs",color:"dimmed",children:d.text})]})},d.id)),r.jsx(o.Menu.Divider,{}),r.jsx(o.Menu.Item,{color:"blue",icon:r.jsx(S.IconSettings,{size:14}),onClick:n,children:r.jsx(o.Text,{size:"sm",children:e("breakpoint.manage")})})]})]}),i.layouts.divisionPreviewScale<1&&r.jsx(o.Text,{size:"xs",color:"dimmed",children:is(i.layouts.divisionPreviewScale).format({output:"percent",mantissa:0})})]}),r.jsx(o.Modal,{opened:t,onClose:u,title:e("breakpoint.label",{count:2}),withinPortal:!0,zIndex:320,size:600,closeOnClickOutside:!1,children:r.jsx(kP,{done:u})})]})}),Cg={height:"30px",borderRight:"none",borderTop:"none",borderLeft:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},IP=D.observer(()=>{var i;const{t:e}=j.useTranslation(),t=se(),n=((i=t.views.VIE)==null?void 0:i.type)===G.Tabs,s=()=>{var a;return(a=t.views.VIE)==null?void 0:a.downloadSchema()};return n?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconCode,{size:16}),sx:{...Cg,transform:"none !important"},children:e("view.download_schema")})}):r.jsx(o.Button,{variant:"outline",color:"blue",radius:0,size:"xs",onClick:s,leftIcon:r.jsx(S.IconCode,{size:16}),sx:{...Cg},children:e("view.download_schema")})}),vi=({headers:e,rows:t})=>r.jsxs(o.Table,{fontSize:"xs",highlightOnHover:!0,sx:{tableLayout:"fixed",fontFamily:"monospace"},children:[r.jsx("thead",{children:e}),r.jsx("tbody",{children:t})]}),DP=({content:e})=>{const{t}=j.useTranslation(),n=e.views;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("view.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{children:t("common.type")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.name}),r.jsx("td",{children:t(`view.component.${s.type}.label`)})]},s.id))})]})},MP=({content:e})=>{const{t}=j.useTranslation(),n=e.filters;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("filter.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.key")}),r.jsx("th",{children:t("common.label")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.key}),r.jsx("td",{children:s.label})]},s.id))})]})},zP=({content:e})=>{const{t}=j.useTranslation(),n=e.panels;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("panel.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{children:t("visualization.component")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.name}),r.jsx("td",{children:s.viz.type})]},s.id))})]})},EP=({content:e})=>{var s;const{t}=j.useTranslation(),n=(s=e.definition)==null?void 0:s.queries;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("query.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{style:{width:"140px"},children:t("common.type")}),r.jsx("th",{style:{width:"260px"},children:t("data_source.label")})]}),rows:n.map(i=>r.jsxs("tr",{children:[r.jsx("td",{children:i.id}),r.jsx("td",{children:i.name}),r.jsx("td",{children:i.type}),r.jsx("td",{children:i.key})]},i.id))})]})},AP=({content:e})=>{var s;const{t}=j.useTranslation(),n=(s=e.definition)==null?void 0:s.sqlSnippets;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("sql_snippet.labels")}),r.jsx(o.List,{size:"sm",pl:10,ff:"monospace",icon:r.jsx(S.IconPointFilled,{size:10}),children:n.map(i=>r.jsx(o.List.Item,{children:i.key},i.key))})]})},PP=({content:e})=>{var s;const{t}=j.useTranslation(),n=Object.keys(((s=e.definition)==null?void 0:s.mock_context)??{});return n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("mock_context.label")}),r.jsx(o.List,{size:"sm",pl:10,ff:"monospace",icon:r.jsx(S.IconPointFilled,{size:10}),children:n.map(i=>r.jsx(o.List.Item,{children:i},i))})]})},OP=({content:e})=>e?r.jsxs(o.Box,{children:[r.jsx(o.Divider,{mt:20,mb:10,variant:"dashed"}),r.jsx(o.Text,{ta:"left",c:"dimmed",children:"Preview"}),r.jsxs(o.Stack,{children:[r.jsx(DP,{content:e}),r.jsx(MP,{content:e}),r.jsx(zP,{content:e}),r.jsx(EP,{content:e}),r.jsx(AP,{content:e}),r.jsx(PP,{content:e})]})]}):null;function LP(e){if(e.target===null)throw new Error("FileReader failed with null result");if(typeof e.target.result!="string")throw new Error(`Unparsable file content of type: ${typeof e.target.result}`);let t=JSON.parse(e.target.result);if("content"in t&&(t=t.content),t.version!==gn)throw new Error("Schema version mismatch");return t}const BP=D.observer(({onSuccess:e,stretchModal:t,shrinkModal:n})=>{var C,I;const{t:s}=j.useTranslation(),i=se(),{handleSubmit:a,formState:{errors:l},setValue:c,watch:u,setError:d,clearErrors:p}=y.useForm({defaultValues:{content:null}}),h=({content:M})=>{try{if(!M)throw new Error("please use a valid json file");i.applyJSONSchema(M),Ut.showNotification({title:"Successful",message:"",color:"green"}),e()}catch(z){console.error(z),Ut.showNotification({title:"Failed",message:z.message,color:"red"})}},[g,b]=f.useState(null);f.useEffect(()=>{if(!g)return;const M=new FileReader;M.readAsText(g,"UTF-8"),M.onload=z=>{try{const E=LP(z);c("content",E),p("content")}catch(E){console.error(E),d("content",{type:"custom",message:E.message})}},M.onabort=()=>console.log("🟨 abort"),M.onerror=()=>{M.error&&(console.error(M.error),d("content",{type:"custom",message:M.error.message}))}},[g]);const[x]=u(["content"]),_=!x,T=(C=l==null?void 0:l.content)==null?void 0:C.message;return f.useEffect(()=>{!x||T?n():t()},[x,T]),r.jsx(o.Box,{mx:"auto",sx:{position:"relative"},children:r.jsxs("form",{onSubmit:a(h),children:[r.jsx(o.FileInput,{label:s("import.json_file"),required:!0,value:g,onChange:b,error:(I=l==null?void 0:l.content)==null?void 0:I.message,sx:{maxWidth:500}}),T?r.jsx(o.Table,{fontSize:12,mt:10,children:r.jsxs("tbody",{children:[r.jsxs("tr",{children:[r.jsx("th",{children:s("import.this_dashboard")}),r.jsx("td",{children:gn})]}),r.jsxs("tr",{children:[r.jsx("th",{children:s("import.this_file")}),r.jsx("td",{style:{color:"red"},children:x==null?void 0:x.version})]})]})}):r.jsxs(r.Fragment,{children:[r.jsx(OP,{content:x}),r.jsx(o.Group,{position:"right",my:"md",children:r.jsx(o.Button,{type:"submit",color:"green",disabled:_,children:s("common.actions.confirm")})})]})]})})}),Sg={height:"30px",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},VP=D.observer(()=>{var d;const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Me.useDisclosure(!1),[i,{setTrue:a,setFalse:l}]=Y.useBoolean(!1),u=((d=ce().content.views.VIE)==null?void 0:d.type)===G.Tabs;return u?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconFileImport,{size:16}),sx:{...Sg,transform:"none !important"},children:e("import.label")})}):r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{variant:"subtle",color:"blue",radius:0,size:"xs",disabled:u||t,onClick:n,leftIcon:r.jsx(S.IconFileImport,{size:16}),sx:{...Sg},children:e("import.label")}),r.jsx(o.Modal,{opened:t,onClose:s,title:e("import.title"),trapFocus:!0,onDragStart:p=>{p.stopPropagation()},withinPortal:!0,zIndex:320,size:i?"90vw":500,children:r.jsx(BP,{onSuccess:s,stretchModal:a,shrinkModal:l})})]})}),NP=({iconKey:e,...t})=>{switch(e){case"query_variables":return r.jsx(S.IconVariable,{...t});case"mock_context":return r.jsx(S.IconCodeDots,{...t});case"filter":return r.jsx(S.IconFilter,{...t});case"sql_snippet":return r.jsx(S.IconCopy,{...t});case"query":return r.jsx(S.IconDatabase,{...t});case"view":return r.jsx(S.IconBoxMultiple,{...t});case"panel":return r.jsx(S.IconAppWindow,{...t});default:return null}},qP=({action:e})=>{const{t}=j.useTranslation();return e.description?r.jsx(o.Text,{color:"dimmed",size:"xs",children:t(e.description)}):e.viz?r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Text,{color:"dimmed",size:"xs",children:t(e.viz.displayName)}),r.jsx(o.Text,{color:"dimmed",opacity:0,size:"xs",className:"spotlight-action-viz-group",children:t(e.viz.displayGroup)})]}):null},$P=o.createStyles((e,t)=>({action:{position:"relative",display:"block",width:"100%",padding:`${o.rem(10)} ${o.rem(12)}`,borderRadius:e.radius.sm,...e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1],".spotlight-action-viz-group":{opacity:1}}),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1],".spotlight-action-viz-group":{opacity:1}}}})),FP=D.observer(({action:e,styles:t,classNames:n,hovered:s,onTrigger:i,highlightQuery:a,query:l,...c})=>{const{t:u}=j.useTranslation(),{classes:d}=$P(null,{styles:t,classNames:n,name:"Spotlight"});return r.jsx(o.UnstyledButton,{className:d.action,"data-hovered":s||void 0,tabIndex:-1,onMouseDown:p=>p.preventDefault(),onClick:i,...c,children:r.jsxs(o.Group,{noWrap:!0,children:[r.jsx(NP,{iconKey:e.iconKey,size:14}),r.jsxs("div",{style:{flex:1},children:[r.jsx(o.Highlight,{highlight:l,size:"sm",children:u(e.title)}),r.jsx(qP,{action:e})]})]})})}),GP=D.observer(({children:e})=>{const{t,i18n:n}=j.useTranslation(),s=ce(),i=f.useMemo(()=>s.editor.spotlightActions.map(u=>{const d=u.group;return{...u,group:d?t(d):void 0,keywords:[u.title,t(u.title)]}}),[s.editor.spotlightActions,n.language]),[a,{set:l}]=Y.useBoolean(!1),c=f.useCallback(u=>{l(!!u)},[]);return r.jsx(jc.SpotlightProvider,{actions:i,actionComponent:FP,shortcut:["mod + P","mod + K"],searchIcon:r.jsx(S.IconSearch,{size:"1.2rem"}),searchPlaceholder:t("spotlight.placeholder"),nothingFoundMessage:t("spotlight.not_found"),limit:a?20:5,onQueryChange:c,children:e})}),kg=({children:e})=>r.jsx(o.Text,{style:{fontSize:"0.6875rem",lineHeight:1,padding:"0.25rem 0.2375rem",borderRadius:"0.25rem"},children:e}),Tg=function(){return(navigator.userAgentData.platform??navigator.platform).toLowerCase().includes("mac")}(),WP=()=>{const{t:e}=j.useTranslation();return r.jsx(o.Tooltip,{label:r.jsxs(r.Fragment,{children:[Tg&&r.jsx(kg,{children:"⌘ + K"}),!Tg&&r.jsx(kg,{children:"Ctrl + K"})]}),children:r.jsx(o.UnstyledButton,{onClick:()=>jc.spotlight.open(),style:{height:"1.875rem",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef",paddingLeft:"calc(0.875rem / 1.5)",paddingRight:"1rem"},sx:{color:"#228be6",background:"transparent","&:hover":{background:"rgb(231, 245, 255)"}},children:r.jsxs(o.Group,{spacing:"0.625rem",children:[r.jsx(S.IconSearch,{size:"1rem",color:"#228be6"}),r.jsx(o.Text,{style:{flexGrow:1,fontWeight:500,fontSize:"0.75rem",lineHeight:1},children:e("spotlight.trigger_text")})]})})})},RP={position:"fixed",top:60,left:0,right:0,height:30,zIndex:299,borderBottom:"1px solid #e9ecef",background:"rgba(233,236,239, 0.15)"},QP=D.observer(()=>r.jsx(o.Box,{sx:RP,pl:{base:200,xs:200,sm:200,md:220,lg:240,xl:260},children:r.jsxs(o.Group,{position:"apart",align:"center",sx:{height:"30px"},children:[r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(SP,{}),r.jsx(VP,{}),r.jsx(WP,{})]}),r.jsx(TP,{}),r.jsx(o.Group,{position:"right",spacing:0,children:r.jsx(IP,{})})]})})),UP=D.observer(e=>r.jsxs(r.Fragment,{children:[r.jsx(CP,{...e}),r.jsx(QP,{})]})),cV="";function YP(e,t,n){const s=[];return e.filter(i=>"__INTERACTIONS"in i.viz.conf).forEach((i,a)=>{const l=t[i.id];l.data.interactions=v.get(l,"data.interactions",[]);const{__INTERACTIONS:c,__OPERATIONS:u,__TRIGGERS:d}=i.viz.conf;Object.entries(u).forEach(([p,h])=>{const{schemaRef:g,data:b}=h,{config:x}=b;switch(g){case"builtin:op:open-link":let _=x.urlTemplate.substring(0,100);x.urlTemplate.length>=20&&(_+="..."),l.type="interaction",l.data.interactions.push({schemaRef:g,urlTemplate:x.urlTemplate,shortURLTemplate:_});return;case"builtin:op:open_view":s.push({id:`OPERATION--${p}`,source:i.id,target:x.viewID,label:"Open View",style:{stroke:"rgba(0,0,0,0.8)"},type:"default"});return;case"builtin:op:set_filter_values":l.type="interaction",l.data.interactions.push({schemaRef:g,filters:Object.keys(x.dictionary).map(T=>({key:T,label:n[T]}))});return;case"builtin:op:clear_filter_values":l.type="interaction",l.data.interactions.push({schemaRef:g,filters:x.filter_keys.map(T=>({key:T,label:n[T]}))});return;default:return}})}),s}function KP(e,t){const n=e.filters.keyLabelMap;return{edges:YP(e.panels.list,t,n),edgeNodes:[]}}function Ig(e,t,n){return e*t+e*n}function XP(e,t,n){return e*t+(e-1)*n}const _i=25,Vl=40,Dg=25,Nl=350,JP=150,ZP=150,Mg=150,zg=300,ji=40,Eg=25,HP=300;function e2(e,t){const n=v.keyBy(t,i=>i.id),s=[];return e.current.forEach((i,a)=>{i.panelIDs.forEach((l,c)=>{const u=Ig(c,ji,Eg)+Vl,d=n[l];if(!d){s.push({id:l,_node_type:"panel",parentNode:i.id,data:{label:`!: ${l}`},position:{x:_i,y:u},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,style:{width:zg,height:ji}});return}const p=d.name;s.push({id:d.id,_node_type:"panel",parentNode:i.id,data:{label:p},position:{x:_i,y:u},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,style:{width:zg,height:ji}})})}),s}const t2={[G.Division]:"Div",[G.Modal]:"Modal",[G.Tabs]:"Tabs"},n2=cg;function r2(e){return e.current.map((n,s)=>{const i=XP(n.panelIDs.length,ji,Eg)+Vl+Dg;let a=[];return n.type===G.Tabs&&(a=n.config.tabsInOrder.map(c=>c.view_id)),{id:n.id,_node_type:"view-root",_view_type:n.type,_view_level:0,_sub_view_ids:[],_tab_view_ids:a,data:{label:`${t2[n.type]}:${n.name}`},position:{x:0,y:0},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,className:"light",style:{backgroundColor:n2[n.type],width:Nl,height:i}}})}function s2(e){const t=v.keyBy(e,n=>n.id);e.forEach(n=>{n._node_type!=="view-root"||n._view_type!==G.Tabs||n._tab_view_ids.forEach(s=>{t[s].parentNode=n.id})})}function i2(e){const t=r2(e.views);s2(t);const n=e2(e.views,e.panels.list);return[...t,...n]}function a2({nodeMap:e,nodes:t,edges:n}){t.forEach(s=>{s._node_type!=="view-root"||s._view_type!==G.Tabs||(s.sourcePosition=Ue.Position.Bottom,s.style.width=Nl+_i*2,s.style.height=Dg+s._tab_view_ids.reduce((i,a)=>{const l=e[a];l.position.y=i,l.position.x=_i;const c=l.style.height;return i+c+20},Vl))})}function o2({nodeMap:e,nodes:t,edges:n}){n.filter(s=>s.label==="Open View").forEach(s=>{const i=e[s.source],a=e[s.target];if(!i||!a||!i.parentNode)return;const l=e[i.parentNode];l._node_type!=="view-root"||a._node_type!=="view-root"||(a._view_level+=1+l._view_level,l._sub_view_ids.push(a.id))}),t.sort((s,i)=>s._node_type==="view-root"&&i._node_type==="view-root"?s._view_level-i._view_level:s._node_type!=="view-root"&&i._node_type!=="view-root"?0:s._node_type==="view-root"?-1:1)}function l2({nodeMap:e,nodes:t,edges:n}){const s={};n.forEach(i=>{if(i.label!=="Open View")return;const a=e[i.source],l=e[i.target];if(a&&l&&a.parentNode){const c=e[a.parentNode],u=c.position.x,d=Number(v.get(l,"style.height",0)),p=Number(c.style.width);l.position.x=u+p+HP,c._view_level===0&&l._sub_view_ids.length===0&&(a.sourcePosition=Ue.Position.Left,l.targetPosition=Ue.Position.Right,l.position.x*=-1);const g=l.position.x,b=v.get(s,g,0);l.position.y=b,s[g]=b+d+Mg}})}function c2({nodeMap:e,nodes:t,edges:n}){const s=new Set,i=new Set;n.forEach(l=>{s.add(l.source),i.add(l.target)}),t.filter(l=>l._node_type!=="view-root"||l.id==="Main"||l.parentNode?!1:!s.has(l.id)&&!i.has(l.id)).forEach((l,c)=>{l.position.x=Ig(c,Nl,ZP),l.position.y=0-JP-Mg})}function u2({nodeMap:e,nodes:t,edges:n}){const s={nodeMap:e,nodes:t,edges:n};return c2(s),o2(s),a2(s),l2(s),{nodes:t,edges:n}}function d2(e){const t=i2(e),n=v.keyBy(t,u=>u.id),{edges:s,edgeNodes:i}=KP(e,n),a=[...t,...i],l=v.keyBy(a,u=>u.id),c={edges:v.uniqBy(s,u=>u.id),nodes:a,nodeMap:l};return u2(c)}const uV="",ql={"builtin:op:open-link":r.jsx(o.ThemeIcon,{color:"blue",size:20,radius:"xl",children:r.jsx(S.IconCircleDashed,{size:14})}),"builtin:op:set_filter_values":r.jsx(o.ThemeIcon,{color:"orange",size:20,radius:"xl",children:r.jsx(S.IconCircleDot,{size:14})}),"builtin:op:clear_filter_values":r.jsx(o.ThemeIcon,{color:"orange",size:20,radius:"xl",children:r.jsx(S.IconCircleOff,{size:14})})};function p2(e){const t=[];return e.forEach(n=>{switch(n.schemaRef){case"builtin:op:open-link":t.push({key:n.urlTemplate,icon:ql[n.schemaRef],text:r.jsxs(o.Group,{spacing:4,children:[r.jsx(o.Text,{children:"Open: "}),r.jsx(o.Text,{color:"dimmed",children:n.shortURLTemplate})]})});return;case"builtin:op:set_filter_values":n.filters.forEach(({key:s,label:i})=>{t.push({key:n.schemaRef+s,icon:ql[n.schemaRef],text:r.jsx(o.Group,{spacing:4,children:r.jsxs(o.Text,{children:["Set Filter: ",i]})})})});return;case"builtin:op:clear_filter_values":n.filters.forEach(({key:s,label:i})=>{t.push({key:n.schemaRef+s,icon:ql[n.schemaRef],text:r.jsx(o.Group,{spacing:4,children:r.jsxs(o.Text,{children:["Clear Filter: ",i]})})})});return}}),t}const h2=f.memo(({data:e,isConnectable:t,sourcePosition:n=Ue.Position.Right,targetPosition:s=Ue.Position.Left,...i})=>{const a=f.useMemo(()=>p2(e.interactions),[e.interactions]);return r.jsxs(r.Fragment,{children:[r.jsx(Ue.Handle,{type:"target",position:s,isConnectable:t}),r.jsx(o.Box,{sx:{position:"absolute",top:0,right:0},children:r.jsx(S.IconChevronsUpRight,{size:12})}),r.jsxs(o.HoverCard,{shadow:"xl",withinPortal:!0,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Text,{children:e.label})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsx(o.List,{spacing:"xs",size:"sm",center:!0,children:a.map(l=>r.jsx(o.List.Item,{icon:l.icon,children:l.text},l.key))})})]}),r.jsx(Ue.Handle,{type:"source",position:n,isConnectable:t})]})}),dV="",f2={interaction:h2},g2=D.observer(()=>{const e=Te(),{edges:t,nodes:n}=d2(e);return r.jsxs(Ue,{nodes:n,edges:t,onNodesChange:v.noop,onEdgesChange:v.noop,onConnect:v.noop,className:"interactions-viewer",fitView:!0,nodeTypes:f2,children:[r.jsx(Ue.MiniMap,{}),r.jsx(Ue.Controls,{}),r.jsx(Ue.Background,{})]})}),m2=D.observer(({opened:e,close:t})=>{const{t:n}=j.useTranslation();return r.jsx(o.Modal,{size:"96vw",opened:e,onClose:t,title:n("interactions.interactions_viewer"),trapFocus:!0,onDragStart:s=>{s.stopPropagation()},styles:{body:{height:"calc(90vh - 54px)"},content:{transform:"none !important"}},zIndex:300,children:r.jsx(g2,{})})}),x2={"> button":{"&:first-of-type":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:.5},":not(:first-of-type):not(:last-of-type)":{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:.5,borderRightWidth:.5},"&:last-of-type":{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:.5}}};function b2({onClick:e,name:t,active:n,openSettings:s}){return r.jsxs(o.Box,{sx:{position:"relative"},children:[r.jsx(o.UnstyledButton,{sx:i=>({display:"block",width:"100%",padding:i.spacing.xs,borderRadius:0,position:"relative",color:i.black,"&:hover":{backgroundColor:i.colors.gray[0]},backgroundColor:n?i.colors.gray[2]:"transparent"}),children:r.jsx(o.Group,{sx:{width:"calc(100% - 28px)"},onClick:e,children:r.jsx(o.Text,{size:"sm",children:t})})}),n&&r.jsx(o.Tooltip,{label:"Edit",position:"right",withinPortal:!0,children:r.jsx(o.ActionIcon,{onClick:s,variant:"light",color:"blue",sx:{position:"absolute",top:0,bottom:0,height:"100%",right:0,zIndex:0,borderRadius:0},children:r.jsx(S.IconAdjustments,{size:16})})})]})}const y2=D.observer(()=>{const{t:e}=j.useTranslation(),t=ce(),n=se(),s=f.useCallback(a=>()=>n.views.setIDOfVIE(a),[n]),i=a=>{t.editor.open(["_VIEWS_",a])};return r.jsxs(o.Box,{sx:{position:"relative"},children:[n.views.options.map(a=>r.jsx(b2,{active:n.views.idOfVIE===a.value,name:a.label,onClick:s(a.value),openSettings:()=>i(a.value)},a.value)),r.jsx(o.Divider,{variant:"dashed"}),r.jsx(o.Button,{variant:"subtle",rightIcon:r.jsx(S.IconPlus,{size:14}),size:"sm",px:"xs",color:"blue",onClick:n.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"space-between"}},children:e("view.add")})]})}),v2=D.observer(()=>{const{t:e}=j.useTranslation(),t=ce(),n=se(),s=()=>{if(!n.queries.firstID){t.editor.open(["_QUERIES_",""]);return}t.editor.open(["_QUERIES_",n.queries.firstID])},i=()=>{if(!n.filters.firstID){t.editor.open(["_FILTERS_",""]);return}t.editor.open(["_FILTERS_",n.filters.firstID])},[a,l]=f.useState(!1),c=()=>l(!0),u=()=>l(!1);return r.jsxs(o.Navbar,{p:0,width:{base:200,xs:200,sm:200,md:220,lg:240,xl:260},zIndex:299,children:[r.jsxs(o.Navbar.Section,{children:[r.jsxs(o.Group,{grow:!0,spacing:0,sx:{...x2,button:{borderWidth:0,borderBottomWidth:1,borderColor:"#e9ecef"}},children:[r.jsx(o.Tooltip,{label:e("filter.labels"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:i,children:r.jsx(S.IconFilter,{size:18})})}),r.jsx(o.Tooltip,{label:e("query.labels"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:s,children:r.jsx(S.IconDatabase,{size:18})})}),r.jsx(o.Tooltip,{label:e("interactions.interactions_viewer"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:c,children:r.jsx(S.IconRoute,{size:18})})})]}),r.jsx(m2,{opened:a,close:u})]}),r.jsx(o.Navbar.Section,{py:5,sx:{borderBottom:"1px solid #eee"},children:r.jsx(o.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:e("view.labels")})}),r.jsx(o.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:r.jsx(y2,{})}),r.jsx(o.Navbar.Section,{children:r.jsx(o.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:r.jsx(o.Button,{size:"xs",leftIcon:r.jsx(S.IconSettings,{size:20}),onClick:()=>t.editor.open([]),children:e("common.titles.settings")})})})]})}),_2=D.observer(({filter:e})=>{const{panel:t}=Pe(),{t:n}=j.useTranslation(),s=e.config;return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Checkbox,{checked:s.default_value,onChange:i=>s.setDefaultValue(i.currentTarget.checked),label:n("filter.widget.checkbox.default_checked")}),r.jsx(Wn,{filter:e})]}),r.jsx(Mn,{label:n("filter.widget.checkbox.description"),value:s.description,onChange:s.setDescription,styles:{root:{flexGrow:1,minHeight:"400px"}}},t.id)]})}),j2=[{label:"2022",value:"YYYY"},{label:"202201",value:"YYYYMM"},{label:"20220101",value:"YYYYMMDD"},{label:"2022-01",value:"YYYY-MM"},{label:"2022-01-01",value:"YYYY-MM-DD"}],w2=D.observer(function({filter:t}){const{t:n}=j.useTranslation(),s=t.config,i=f.useMemo(()=>sl().map(({key:l,value:c,group:u})=>({label:n(`filter.widget.date_range.shortcut.${u}.full.${l}`),value:c,group:n(`filter.widget.date_range.shortcut.${u}.label`)})),[]),a=[...s.default_value];return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{children:[r.jsx(o.Checkbox,{checked:s.required,onChange:l=>s.setRequired(l.currentTarget.checked),label:n("filter.widget.date_range.required")}),r.jsx(o.Checkbox,{checked:s.allowSingleDateInRange,onChange:l=>s.setAllowSingleDateInRange(l.currentTarget.checked),label:n("filter.widget.date_range.allow_single_date")})]}),r.jsxs(o.Group,{grow:!0,children:[r.jsx(o.Select,{data:j2,label:n("filter.widget.date_range.display_format"),value:s.inputFormat,onChange:s.setInputFormat}),r.jsx(o.NumberInput,{label:n("filter.widget.date_range.max_days"),min:0,value:s.max_days,onChange:s.setMaxDays,hideControls:!0})]}),r.jsxs(o.Group,{children:[r.jsx(Qf,{label:n("filter.widget.date_range.default_value"),config:s,value:{value:a,shortcut:null},onChange:s.setDefaultValue,disabled:!!s.default_shortcut}),r.jsx(o.Select,{data:i,label:n("filter.widget.date_range.default_by_shortcut"),value:s.default_shortcut,onChange:s.setDefaultShortcut,placeholder:n("filter.widget.date_range.default_by_shortcut_placeholder"),clearable:!0,sx:{flexGrow:1},maxDropdownHeight:500})]}),r.jsx(Wn,{filter:t})]})}),C2=`
|
|
490
|
+
我的卡片变量: {{ your_var }}`,tabs:{guide:"使用指南",vars:"看板信息与卡片的变量"}}}},style:{label:"样式",font_size:{label:"字号",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"字重"},size:{xs:"特小",sm:"小",md:"中",lg:"大",xl:"特大"},flex:{justify_content:{label:"内容分布",left:"从左起",center:"居中",right:"从右起",space_between:"均匀分布,首尾顶格",space_around:"均匀分布,首尾留空一半",space_evenly:"均匀分布,首尾留空"},align_items:{label:"对齐位置",start:"起点对齐",center:"居中对齐",end:"末端对齐",stretch:"拉伸对齐"}},color:{type:{label:"颜色类型",static:"单色",interpolation:"插值取色",none:"无"},interpolation:{setup:"设置取色方案",palette:{label:"色板",category:{sequential:"单色渐变",diverging:"双色渐变"},red_green:"红 / 绿",yellow_blue:"黄 / 蓝",red:"红",green:"绿",blue:"蓝",orange:"橙",mapping:{value_input_label:"映射一个值到此颜色"}}}}},query:{label:"查询",labels:"查询",add:"新增查询",delete:"删除这个查询",cant_delete:"此查询在使用中,不能删除。请查看“使用情况”标签页以了解详情",delete_unused:"删除未用到的查询",name:"名称",name_description:"唯一名称",manage:"管理查询",open:"打开此查询",configurations:"配置",basics:"基本信息",conditions:"条件",run_by_condition:{label:"以下条件为真时,才运行本查询",description:"为假的情况: 空数组 / NaN / false / 空字符串 / undefined / null",unset:"留空则在看板加载时便运行本查询"},re_run_condition:{label:"当以下条件改变时,重新运行此查询",unset:"留空则永不重新运行此查询"},dependency:{label:"依赖",has_none:"此查询无依赖"},edit_sql:"编辑SQL",preview_sql:"预览SQL",request:"请求",build_request:"构造请求",process_request:"加工请求",process_result:"加工结果",usage:{label:"使用情况",in_views:"所在视图",unused_description:"此查询未被任何筛选器或卡片用到"},transform:{label:"查询变形",full_label:"查询变形",data_source:"基于其他查询的数据,加工出新数据",guide:{pick_queries:"选择一至多个查询作为数据输入",write_function:"编写函数,返回新数据"}}},data:{label:"数据",preview_data:"预览数据",empty_data:"无数据",requires_data:"请先关联查询"},data_source:{label:"数据源",explore:"查看数据源",explorer:"数据源查看器",table_structure:"数据表结构",table_structure_short:"表结构",see_table_structure:"查看数据表结构"},visualization:{label:"可视化",component:"可视化组件",label_short:"可视化"},numbro:{format:{label:"格式",absolute:"绝对值",absolute_description:"非负",abbreviation:"缩写",abbreviation_description:"如1.23k、1.23m",mantissa:"小数",trim_mantissa:"抹零",trim_mantissa_description:"省略末尾的零",preview:{open:"展开预览",close:"收起预览",input:"输入",output:"输出"}}},import:{label:"导入...",title:"自描述文件导入看板内容",json_file:"描述文件(JSON格式)",this_dashboard:"此看板",this_file:"此文件"},function_utils:{trigger_text:"关于utils参数",modal_title:"关于utils参数",description:"参数 <code>utils</code> 是 <code>FunctionUtils</code>,包含以下内容:",document:"文档"},aggregation:{option:{none:"无",sum:"和",mean:"平均值",median:"中位数",min:"最小值",max:"最大值",cov:"变异系数",std:"标准差",quantile:{label:"分位",label_with_hint:"分位(99%, 95%, ...)"},custom:{label:"自定义",label_trigger:"编写函数",title:"自定义聚合方式"},pick_record:{label:"直接选择数据",method:{label:"数据记录",first:"第一条",last:"最后一条"}}}},rich_text:{label:"富文本",content:{label:"内容"},dynamic_color:{label:"动态颜色",edit:"编辑动态颜色",clear:"清除动态颜色"},color_mapping:{label:"颜色映射",edit:"编辑颜色映射",clear:"清除颜色映射",choose_value_var:"选择用于映射颜色的变量",min:{val:"固定最小值",var:"动态最小值(优先)"},max:{val:"固定最大值",var:"动态最大值(优先)"}}},chart:{chart_config:"图表设置",data_field:"数据字段",groups:{merico_suite:"思码逸套件",echarts_based_charts:"基于ECharts的图表",others:"其他"},label:{label:"文案",label_full:"标签文案",label_style:"标签文案样式",label_format:"标签文案格式"},label_position:{label:"文案位置",off:"不显示文案",top:"上",left:"左",right:"右",bottom:"下",inside:"内",inside_top:"内-上",inside_left:"内-左",inside_center:"内-中",inside_right:"内-右",inside_bottom:"内-下",inside_top_left:"内-上-左",inside_top_right:"内-上-右",inside_bottom_left:"内-下-左",inside_bottom_right:"内-下-右",outside:"外"},visual_map:{label:"视觉映射",continuous:{label:"连续型"},piecewise:{label:"分段型",mode:{pieces:"连续数据",categories:"离散数据"},add_a_piece:"加一个分段",interval:"值区间",piece_label:"文案"},bar_width:"长条的宽度",bar_height:"长条的高度",item_width:"小块的宽度",item_height:"小块的高度",calculable:"显示拖拽手柄",min_value:"最小值",max_value:"最大值",min_text:"最小值文案",max_text:"最大值文案",use_palette_x:'使用配色方案"{{x}}"',built_in_palettes:"内置配色方案",precision:"数据精度",skip_range:{lt_min:"小于最小值时的颜色",min:"最小值的颜色",max:"最大值的颜色",gt_max:"大于最大值时的颜色",follow_visual_map:"颜色跟随渐变规则"}},number_or_dynamic_value:{type:{static:"具体值",dynamic:"动态值"},dynamic:{setup:"设置",setup_title:"设置动态值",guide:"由函数确定动态值"}},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},symbol_size:{label:"标记点大小",static:"固定值",dynamic:"动态值",setup:{label:"设置",title:"设置动态值",description:"由函数确定动态值"}},series:{label:"系列",name:"名称",y_axis:"Y轴",data_field:"数据字段",add:"增加一个系列",delete:"删除这个系列",line:{label:"线",line_settings:"线段设置",line_style:"线条样式",type:{label:"类型",solid:"实线",dashed:"方虚线",dotted:"圆点虚线"},line_width:"线宽",step:{label:"阶梯状",off:"不启用",start:"在当前点拐弯",middle:"在当前点与下个点中间拐弯",end:"在下个点拐弯"},smooth_line:"平滑曲线",show_name_on_line:"显示标签文案",show_symbol_on_line:"显示标记点",area_style:{label:"区域填充样式",enabled:"启用区域填充",color:"填充颜色",use_series_color:"沿用系列本色",origin:{label:"图形区域的起始位置",auto:{label:"自动",description:"填充坐标轴线到数据间的区域(默认)"},start:{label:"自下而上",description:"填充坐标轴底部到数据间的区域"},end:{label:"自上而下",description:"填充坐标轴顶部到数据间的区域"}},shadow_blur:"图形阴影的模糊大小",shadow_color:"图形阴影的颜色",shadow_offset_x:"阴影水平方向上的偏移距离",shadow_offset_y:"阴影垂直方向上的偏移距离",opacity:"图形透明度"}},bar:{label:"柱",stack:"堆放",stack_hint:"此值相同的柱系列会堆叠在一起",bar_gap:{label:"柱间隔",no_gap:"柱子之间无间隔",overlap:"柱子可互相重叠"},bar_width:{min:"最小柱宽",exact:"柱宽",max:"最大柱宽"}},scatter:{label:"散点"},group_by:{label:"按此字段拆分为多个系列",label_line:"按此字段拆分为多条线"}},axis:{tick_label:"刻度文案",customize_label:"自定义文案",overflow:{label:"溢出",max_width:"最大宽度",truncate:"截断",break_line:"换行",break_word:"断词换行",ellipsis:"省略符",section_title:{on_axis:"轴刻度上文案的溢出",in_tooltip:"提示框中的文案溢出"}},section_title:{label_format:"文案格式"},type:{value:"数值轴",category:"类目轴",time:"时间轴",log:"对数轴",click_to_learn_more:"点击 <1>这里</1> 以进一步了解这些选项"}},name_text:{align:{label:"名称贴靠侧",left:"左",center:"中",right:"右"}},rotate:"旋转",degree:"度",padding:"内间距",content_template:{label:"内容模板",hint:"均值: ${avg}"},x_axis:{label:"X轴",labels:"X轴",label_format:"刻度文案格式",add:"增加一条X轴",delete:"删除这条X轴",x_axis_name:"X轴名称",x_axis_data_field:"X轴数据字段",x_axis_type:"X轴类型",layout:"布局",position:{label:"位置",top:"上",bottom:"下"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},y_axis:{label:"Y轴",labels:"Y轴",label_format:"刻度文案格式",add:"增加一条Y轴",delete:"删除这条Y轴",y_axis_name:"Y轴名称",y_axis_name_anchor:"名称贴靠侧",y_axis_data_field:"Y轴数据字段",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},stats:{label:"统计内容",template:{above_chart:"统计内容(图表上方)",under_chart:"统计内容(图表下方)"}},legend:{label:"图例",show_legend:"显示图例",show_in_legend:"显示在图例中",hide_in_legend:"不显示在图例中",orientation:{label:"布局朝向",horizontal:"横向",vertical:"纵向"}},tooltip:{label:"提示框",additional_metrics:{description:"在此设置更多指标,来展示在散点的提示框",add:"增加一个指标",delete:"删除这个指标"},trigger:{label:"触发者",scatter_point:"散点",x_axis:"X轴"}},style:{label:"样式"},color:{label:"颜色",background_color:"背景色",text_color:"文字颜色",click_to_add_a_color:"点击增加一个颜色",color_gradient:"颜色渐变",not_set:"未设置"},behavior:{label:"表现",invisible:"隐藏不可见"},heatmap:{heatblock:{label:"热力块",show_label:"展示值文案"}},reference_line:{label:"参考线",labels:"参考线",add:"增加一条参考线",name_placeholder:"均值参考线",delete:"删除这条参考线",orientation:{vertical_hint:"仅当X轴值为数字时可绘制"}},regression_line:{label:"回归线",labels:"回归线",add:"增加一条回归线",delete:"删除这条回归线",method:{label:"方法",linear:"线性回归",exponential:"指数回归",logistic:"指数回归",polynomial:"多项式回归",polynomial_order:"次"}},reference_area:{label:"参考区域",labels:"参考区域",add:"增加一面参考区域",delete:"删除这面参考区域",type:{label:"形状",rectangle:"矩形"},direction:{label:"方向",horizontal:"水平"},boundary:{upper:"上边界",lower:"下边界"},content:{label:"内容",content_text:"内容文字",text_position:"文字位置"},endpoint:{labels:"端点",left_bottom_point:"左下点",right_top_point:"右上点"}},zooming:{label:"缩放",scroll:{label:"滚轮缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用"},slider:{label:"滚动条缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用",y_axis_disabled:"暂不可用,会与Y轴刻度文字重叠"}}},viz:{viz_config_banner:"可视化参数配置"},validation:{number:{require_a_number:"请填写一个数字"}},spotlight:{trigger_text:"搜索",main_group:"主要项",placeholder:"打开…",not_found:"无匹配项"}}},bi=Um.createInstance({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:_P,zh:jP}}).use(Ym).use(j.initReactI18next);bi.init(),Zo.forEach(e=>{var t;(t=e.translation)==null||t.forEach(n=>{bi.addResourceBundle(n.lang,"translation",{viz:n.resources},!0,!0)})});function vg({lang:e,children:t}){return f.useEffect(()=>{bi.changeLanguage(e)},[e]),r.jsx(j.I18nextProvider,{i18n:bi,children:t})}function yi(e){console.groupCollapsed("Running operation ",e.type),console.log(e),console.groupEnd()}function _g(e,t){f.useEffect(()=>{const n=s=>{yi(s);const{viewID:i}=s.detail;if(!i){console.error(new Error("[Open View] Needs to pick a view first"));return}e.views.appendToVisibles(i),t&&e.views.setIDOfVIE(i)};return window.addEventListener("open-view",n),()=>{window.removeEventListener("open-view",n)}},[e,t]),f.useEffect(()=>{const n=s=>{yi(s);const{dictionary:i,payload:a}=s.detail;if(!a||Object.keys(a).length===0){console.error(new Error("[Set Filter Values] payload is empty"));return}const l={};Object.entries(i).forEach(([c,u])=>{const d=v.get(a,u);l[c]=d}),e.filters.applyValuesPatch(l)};return window.addEventListener("set-filter-values",n),()=>{window.removeEventListener("set-filter-values",n)}},[e]),f.useEffect(()=>{function n(i){return Array.isArray(i)?[]:typeof i=="object"?{}:typeof i=="boolean"?!1:typeof i=="string"?"":typeof i=="number"?0:i}const s=i=>{yi(i);const a={},{filter_keys:l}=i.detail;l.forEach(c=>{const u=v.get(e.filters.values,c),d=n(u);a[c]=d}),e.filters.applyValuesPatch(a)};return window.addEventListener("clear-filter-values",s),()=>{window.removeEventListener("clear-filter-values",s)}},[e]),f.useEffect(()=>{const n=s=>{yi(s);const{urlTemplate:i,openInNewTab:a,enableEncoding:l=!1,payload:c}=s.detail;if(!i){console.error(new Error("[Open Link] URL is empty"));return}function u(h){return v.cloneDeepWith(h,b=>{if(l&&typeof b=="string")return encodeURIComponent(b)})}const p=v.template(i||"")(u({...c,filters:e.payloadForSQL.filters,context:e.payloadForSQL.context}));window.open(p,a?"_blank":"_self","noopener")};return window.addEventListener("open-link",n),()=>{window.removeEventListener("open-link",n)}},[e])}function jg(e){return f.useCallback(t=>t.provideValue(Oe.pluginManager,e.pluginManager).provideValue(Oe.vizManager,e.vizManager).provideValue(Oe.colorManager,e.colorManager),[])}const lV="",wP=D.observer(({saveDashboardChanges:e})=>{const{t}=j.useTranslation(),n=jt.useModals(),s=se(),i=()=>{n.openConfirmModal({title:r.jsxs(o.Group,{position:"left",children:[r.jsx(S.IconAlertTriangle,{size:18,color:"red"}),r.jsx(o.Text,{children:"You are reverting changes"})]}),labels:{confirm:t("common.actions.confirm"),cancel:t("common.actions.cancel")},confirmProps:{color:"red"},onCancel:()=>console.log("Cancel"),onConfirm:()=>s.reset(),zIndex:320,withCloseButton:!1})},a=s.changed;return r.jsxs(o.Group,{spacing:0,children:[r.jsx(o.Button,{color:"green",variant:"filled",size:"xs",leftIcon:r.jsx(S.IconDeviceFloppy,{size:18}),onClick:e,disabled:!a,sx:{borderTopRightRadius:0,borderBottomRightRadius:0},children:t("common.actions.save_changes")}),r.jsxs(o.Menu,{width:200,trigger:"hover",openDelay:100,closeDelay:400,withinPortal:!0,zIndex:320,disabled:!a,children:[r.jsx(o.Menu.Target,{children:r.jsx(o.ActionIcon,{variant:"default",disabled:!a,sx:{height:"30px",borderTopLeftRadius:0,borderBottomLeftRadius:0,svg:{fill:"rgb(173, 181, 189)",stroke:"none"}},children:r.jsx(S.IconCaretDown,{size:18})})}),r.jsx(o.Menu.Dropdown,{children:r.jsx(o.Menu.Item,{icon:r.jsx(S.IconRecycle,{size:14,color:"red"}),disabled:!a,onClick:i,children:t("common.actions.revert_changes")})})]})]})}),CP=D.observer(({saveDashboardChanges:e,onExit:t,headerSlot:n=null})=>{j.useTranslation();const s=ce(),i=s.content.changed,a=()=>{t({hasChanges:i,dashboardId:s.id})};return r.jsx(o.Header,{height:60,px:"md",py:0,sx:{zIndex:299},children:r.jsxs(o.Group,{position:"apart",sx:{height:60,minWidth:"1000px",position:"relative"},children:[r.jsxs(o.Group,{children:[r.jsx(o.Button,{size:"xs",color:i?"red":"green",leftIcon:r.jsx(S.IconArrowLeft,{size:20}),onClick:a,children:r.jsx(o.Group,{spacing:4,children:r.jsxs(j.Trans,{i18nKey:"common.actions.end_editing",values:{name:s.name},children:["End Editing ",r.jsx(o.Text,{td:"underline",children:s.name})]})})}),r.jsx(wP,{saveDashboardChanges:e})]}),r.jsx(o.Group,{position:"right",sx:{flexGrow:1},children:n})]})})}),wg={height:"30px",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},SP=D.observer(()=>{var i;const{t:e}=j.useTranslation(),t=se(),n=((i=t.views.VIE)==null?void 0:i.type)===G.Tabs,s=()=>t.addANewPanel(t.views.idOfVIE);return n?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconPlaylistAdd,{size:20}),sx:{...wg,transform:"none !important"},children:e("panel.add")})}):r.jsx(o.Button,{variant:"outline",color:"blue",radius:0,size:"xs",onClick:s,leftIcon:r.jsx(S.IconPlaylistAdd,{size:20}),sx:{...wg,background:"rgb(231, 245, 255)"},children:e("panel.add")})}),kP=D.observer(({done:e})=>{var E,R;const{t}=j.useTranslation(),s=se().layouts,i=f.useMemo(()=>({list:s.breakpointsInfo}),[s.breakpointsInfo]),{control:a,handleSubmit:l,watch:c,getValues:u,reset:d,formState:p}=y.useForm({defaultValues:i}),{fields:h,append:g,remove:b}=y.useFieldArray({control:a,name:"list",rules:{validate:Z=>{if(console.log({values:Z}),v.uniqBy(Z,"breakpoint").length!==Z.length)return"Screen sizes should be unique by min width"}}}),x=c("list"),_=h.map((Z,oe)=>({...Z,...x[oe]})),T=()=>{g({id:sn.v4(),name:"",breakpoint:""})},C=({list:Z})=>{const oe=Z.filter(ve=>Number.isFinite(ve.breakpoint));s.updateLayoutSetsInfo(oe),e()},I=u(),M=f.useMemo(()=>{const Z={list:I.list.filter(oe=>!!oe.name&&Number.isFinite(oe.breakpoint))};return!v.isEqual(Z,i)},[I,i]),z=(R=(E=p.errors.list)==null?void 0:E.root)==null?void 0:R.message;return r.jsx(r.Fragment,{children:r.jsxs("form",{onSubmit:l(C),children:[r.jsxs(o.Table,{fontSize:"sm",highlightOnHover:!0,withBorder:!0,sx:{tableLayout:"fixed"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"340px"},children:t("common.name")}),r.jsx("th",{style:{width:"160px"},children:t("breakpoint.breakpoint")}),r.jsx("th",{})]})}),r.jsxs("tbody",{children:[_.map((Z,oe)=>r.jsxs("tr",{children:[r.jsx("th",{children:Z.id==="basis"?Z.name:r.jsx(y.Controller,{name:`list.${oe}.name`,control:a,render:({field:ve})=>r.jsx(o.TextInput,{size:"xs",label:"",required:!0,sx:{flex:1},...ve})})}),r.jsx("td",{children:Z.id==="basis"?r.jsxs(o.Text,{ff:"monospace",children:[Z.breakpoint,"px"]}):r.jsx(y.Controller,{name:`list.${oe}.breakpoint`,control:a,render:({field:ve})=>r.jsx(o.NumberInput,{size:"xs",label:"",required:!0,max:1e4,hideControls:!0,rightSection:r.jsx(o.Text,{color:"dimmed",children:"px"}),rightSectionProps:{style:{width:"30px"}},sx:{flex:1,fontFamily:"monospace"},styles:{input:{paddingRight:"30px"}},...ve})})}),r.jsx("td",{children:Z.id!=="basis"&&r.jsx(o.ActionIcon,{mx:"auto",size:"xs",variant:"subtle",color:"red",onClick:()=>b(oe),children:r.jsx(S.IconTrash,{})})})]},Z.id)),r.jsx("tr",{style:{backgroundColor:"transparent"},children:r.jsx("td",{colSpan:3,style:{padding:"0"},children:r.jsx(o.Tooltip,{label:t("breakpoint.add"),children:r.jsx(o.ActionIcon,{variant:"subtle",size:"md",color:"blue",onClick:T,sx:{width:"100%"},children:r.jsx(S.IconPlus,{size:18})})})})})]})]}),r.jsx(o.Text,{mt:6,ta:"right",size:"xs",color:"red",children:z??" "}),r.jsxs(o.Group,{mt:6,position:"apart",children:[r.jsx(o.Button,{color:"orange",size:"xs",onClick:()=>d(),leftIcon:r.jsx(S.IconRecycle,{size:18}),disabled:!M,children:t("common.actions.revert")}),r.jsx(o.Button,{color:"green",size:"xs",type:"submit",leftIcon:r.jsx(S.IconDeviceFloppy,{size:18}),disabled:!M,children:t("common.actions.save_changes")})]})]})})}),TP=D.observer(()=>{const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Me.useDisclosure(!1),i=se(),a=i.layouts.currentBreakpoint,l=i.layouts.currentLayoutRange,c=()=>{setTimeout(()=>{window.dispatchEvent(new Event("resize"))},32)},u=()=>{s(),c()};return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{children:[r.jsxs(o.Menu,{withArrow:!0,withinPortal:!0,zIndex:320,trigger:"hover",children:[r.jsx(o.Menu.Target,{children:r.jsx(o.Button,{size:"xs",variant:"subtle",leftIcon:r.jsx(S.IconDevices,{size:16}),sx:{borderRadius:0},children:r.jsxs(o.Group,{spacing:6,children:[r.jsx(o.Text,{size:"xs",fw:"normal",children:l.name}),r.jsx(o.Text,{size:"xs",color:"#777",children:i.layouts.currentRangeText})]})})}),r.jsxs(o.Menu.Dropdown,{children:[i.layouts.breakpointRanges.map(d=>r.jsx(o.Menu.Item,{onClick:()=>i.layouts.setCurrentBreakpoint(d.id),disabled:a===d.id,children:r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Text,{size:"sm",children:d.name}),r.jsx(o.Text,{size:"xs",color:"dimmed",children:d.text})]})},d.id)),r.jsx(o.Menu.Divider,{}),r.jsx(o.Menu.Item,{color:"blue",icon:r.jsx(S.IconSettings,{size:14}),onClick:n,children:r.jsx(o.Text,{size:"sm",children:e("breakpoint.manage")})})]})]}),i.layouts.divisionPreviewScale<1&&r.jsx(o.Text,{size:"xs",color:"dimmed",children:is(i.layouts.divisionPreviewScale).format({output:"percent",mantissa:0})})]}),r.jsx(o.Modal,{opened:t,onClose:u,title:e("breakpoint.label",{count:2}),withinPortal:!0,zIndex:320,size:600,closeOnClickOutside:!1,children:r.jsx(kP,{done:u})})]})}),Cg={height:"30px",borderRight:"none",borderTop:"none",borderLeft:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},IP=D.observer(()=>{var i;const{t:e}=j.useTranslation(),t=se(),n=((i=t.views.VIE)==null?void 0:i.type)===G.Tabs,s=()=>{var a;return(a=t.views.VIE)==null?void 0:a.downloadSchema()};return n?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconCode,{size:16}),sx:{...Cg,transform:"none !important"},children:e("view.download_schema")})}):r.jsx(o.Button,{variant:"outline",color:"blue",radius:0,size:"xs",onClick:s,leftIcon:r.jsx(S.IconCode,{size:16}),sx:{...Cg},children:e("view.download_schema")})}),vi=({headers:e,rows:t})=>r.jsxs(o.Table,{fontSize:"xs",highlightOnHover:!0,sx:{tableLayout:"fixed",fontFamily:"monospace"},children:[r.jsx("thead",{children:e}),r.jsx("tbody",{children:t})]}),DP=({content:e})=>{const{t}=j.useTranslation(),n=e.views;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("view.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{children:t("common.type")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.name}),r.jsx("td",{children:t(`view.component.${s.type}.label`)})]},s.id))})]})},MP=({content:e})=>{const{t}=j.useTranslation(),n=e.filters;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("filter.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.key")}),r.jsx("th",{children:t("common.label")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.key}),r.jsx("td",{children:s.label})]},s.id))})]})},zP=({content:e})=>{const{t}=j.useTranslation(),n=e.panels;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("panel.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{children:t("visualization.component")})]}),rows:n.map(s=>r.jsxs("tr",{children:[r.jsx("td",{children:s.id}),r.jsx("td",{children:s.name}),r.jsx("td",{children:s.viz.type})]},s.id))})]})},EP=({content:e})=>{var s;const{t}=j.useTranslation(),n=(s=e.definition)==null?void 0:s.queries;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("query.labels")}),r.jsx(vi,{headers:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"160px"},children:t("common.id")}),r.jsx("th",{children:t("common.name")}),r.jsx("th",{style:{width:"140px"},children:t("common.type")}),r.jsx("th",{style:{width:"260px"},children:t("data_source.label")})]}),rows:n.map(i=>r.jsxs("tr",{children:[r.jsx("td",{children:i.id}),r.jsx("td",{children:i.name}),r.jsx("td",{children:i.type}),r.jsx("td",{children:i.key})]},i.id))})]})},AP=({content:e})=>{var s;const{t}=j.useTranslation(),n=(s=e.definition)==null?void 0:s.sqlSnippets;return!Array.isArray(n)||n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("sql_snippet.labels")}),r.jsx(o.List,{size:"sm",pl:10,ff:"monospace",icon:r.jsx(S.IconPointFilled,{size:10}),children:n.map(i=>r.jsx(o.List.Item,{children:i.key},i.key))})]})},PP=({content:e})=>{var s;const{t}=j.useTranslation(),n=Object.keys(((s=e.definition)==null?void 0:s.mock_context)??{});return n.length===0?null:r.jsxs(o.Box,{children:[r.jsx(o.Text,{pl:10,size:"sm",fw:500,c:"dimmed",ta:"center",children:t("mock_context.label")}),r.jsx(o.List,{size:"sm",pl:10,ff:"monospace",icon:r.jsx(S.IconPointFilled,{size:10}),children:n.map(i=>r.jsx(o.List.Item,{children:i},i))})]})},OP=({content:e})=>e?r.jsxs(o.Box,{children:[r.jsx(o.Divider,{mt:20,mb:10,variant:"dashed"}),r.jsx(o.Text,{ta:"left",c:"dimmed",children:"Preview"}),r.jsxs(o.Stack,{children:[r.jsx(DP,{content:e}),r.jsx(MP,{content:e}),r.jsx(zP,{content:e}),r.jsx(EP,{content:e}),r.jsx(AP,{content:e}),r.jsx(PP,{content:e})]})]}):null;function LP(e){if(e.target===null)throw new Error("FileReader failed with null result");if(typeof e.target.result!="string")throw new Error(`Unparsable file content of type: ${typeof e.target.result}`);let t=JSON.parse(e.target.result);if("content"in t&&(t=t.content),t.version!==gn)throw new Error("Schema version mismatch");return t}const BP=D.observer(({onSuccess:e,stretchModal:t,shrinkModal:n})=>{var C,I;const{t:s}=j.useTranslation(),i=se(),{handleSubmit:a,formState:{errors:l},setValue:c,watch:u,setError:d,clearErrors:p}=y.useForm({defaultValues:{content:null}}),h=({content:M})=>{try{if(!M)throw new Error("please use a valid json file");i.applyJSONSchema(M),Ut.showNotification({title:"Successful",message:"",color:"green"}),e()}catch(z){console.error(z),Ut.showNotification({title:"Failed",message:z.message,color:"red"})}},[g,b]=f.useState(null);f.useEffect(()=>{if(!g)return;const M=new FileReader;M.readAsText(g,"UTF-8"),M.onload=z=>{try{const E=LP(z);c("content",E),p("content")}catch(E){console.error(E),d("content",{type:"custom",message:E.message})}},M.onabort=()=>console.log("🟨 abort"),M.onerror=()=>{M.error&&(console.error(M.error),d("content",{type:"custom",message:M.error.message}))}},[g]);const[x]=u(["content"]),_=!x,T=(C=l==null?void 0:l.content)==null?void 0:C.message;return f.useEffect(()=>{!x||T?n():t()},[x,T]),r.jsx(o.Box,{mx:"auto",sx:{position:"relative"},children:r.jsxs("form",{onSubmit:a(h),children:[r.jsx(o.FileInput,{label:s("import.json_file"),required:!0,value:g,onChange:b,error:(I=l==null?void 0:l.content)==null?void 0:I.message,sx:{maxWidth:500}}),T?r.jsx(o.Table,{fontSize:12,mt:10,children:r.jsxs("tbody",{children:[r.jsxs("tr",{children:[r.jsx("th",{children:s("import.this_dashboard")}),r.jsx("td",{children:gn})]}),r.jsxs("tr",{children:[r.jsx("th",{children:s("import.this_file")}),r.jsx("td",{style:{color:"red"},children:x==null?void 0:x.version})]})]})}):r.jsxs(r.Fragment,{children:[r.jsx(OP,{content:x}),r.jsx(o.Group,{position:"right",my:"md",children:r.jsx(o.Button,{type:"submit",color:"green",disabled:_,children:s("common.actions.confirm")})})]})]})})}),Sg={height:"30px",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef"},VP=D.observer(()=>{var d;const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Me.useDisclosure(!1),[i,{setTrue:a,setFalse:l}]=Y.useBoolean(!1),u=((d=ce().content.views.VIE)==null?void 0:d.type)===G.Tabs;return u?r.jsx(o.Tooltip,{label:e("common.choose_a_tab_first"),children:r.jsx(o.Button,{variant:"outline",color:"gray",radius:0,size:"xs",leftIcon:r.jsx(S.IconFileImport,{size:16}),sx:{...Sg,transform:"none !important"},children:e("import.label")})}):r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{variant:"subtle",color:"blue",radius:0,size:"xs",disabled:u||t,onClick:n,leftIcon:r.jsx(S.IconFileImport,{size:16}),sx:{...Sg},children:e("import.label")}),r.jsx(o.Modal,{opened:t,onClose:s,title:e("import.title"),trapFocus:!0,onDragStart:p=>{p.stopPropagation()},withinPortal:!0,zIndex:320,size:i?"90vw":500,children:r.jsx(BP,{onSuccess:s,stretchModal:a,shrinkModal:l})})]})}),NP=({iconKey:e,...t})=>{switch(e){case"query_variables":return r.jsx(S.IconVariable,{...t});case"mock_context":return r.jsx(S.IconCodeDots,{...t});case"filter":return r.jsx(S.IconFilter,{...t});case"sql_snippet":return r.jsx(S.IconCopy,{...t});case"query":return r.jsx(S.IconDatabase,{...t});case"view":return r.jsx(S.IconBoxMultiple,{...t});case"panel":return r.jsx(S.IconAppWindow,{...t});default:return null}},qP=({action:e})=>{const{t}=j.useTranslation();return e.description?r.jsx(o.Text,{color:"dimmed",size:"xs",children:t(e.description)}):e.viz?r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Text,{color:"dimmed",size:"xs",children:t(e.viz.displayName)}),r.jsx(o.Text,{color:"dimmed",opacity:0,size:"xs",className:"spotlight-action-viz-group",children:t(e.viz.displayGroup)})]}):null},$P=o.createStyles((e,t)=>({action:{position:"relative",display:"block",width:"100%",padding:`${o.rem(10)} ${o.rem(12)}`,borderRadius:e.radius.sm,...e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1],".spotlight-action-viz-group":{opacity:1}}),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1],".spotlight-action-viz-group":{opacity:1}}}})),FP=D.observer(({action:e,styles:t,classNames:n,hovered:s,onTrigger:i,highlightQuery:a,query:l,...c})=>{const{t:u}=j.useTranslation(),{classes:d}=$P(null,{styles:t,classNames:n,name:"Spotlight"});return r.jsx(o.UnstyledButton,{className:d.action,"data-hovered":s||void 0,tabIndex:-1,onMouseDown:p=>p.preventDefault(),onClick:i,...c,children:r.jsxs(o.Group,{noWrap:!0,children:[r.jsx(NP,{iconKey:e.iconKey,size:14}),r.jsxs("div",{style:{flex:1},children:[r.jsx(o.Highlight,{highlight:l,size:"sm",children:u(e.title)}),r.jsx(qP,{action:e})]})]})})}),GP=D.observer(({children:e})=>{const{t,i18n:n}=j.useTranslation(),s=ce(),i=f.useMemo(()=>s.editor.spotlightActions.map(u=>{const d=u.group;return{...u,group:d?t(d):void 0,keywords:[u.title,t(u.title)]}}),[s.editor.spotlightActions,n.language]),[a,{set:l}]=Y.useBoolean(!1),c=f.useCallback(u=>{l(!!u)},[]);return r.jsx(jc.SpotlightProvider,{actions:i,actionComponent:FP,shortcut:["mod + P","mod + K"],searchIcon:r.jsx(S.IconSearch,{size:"1.2rem"}),searchPlaceholder:t("spotlight.placeholder"),nothingFoundMessage:t("spotlight.not_found"),limit:a?20:5,onQueryChange:c,children:e})}),kg=({children:e})=>r.jsx(o.Text,{style:{fontSize:"0.6875rem",lineHeight:1,padding:"0.25rem 0.2375rem",borderRadius:"0.25rem"},children:e}),Tg=function(){var t;return(((t=navigator.userAgentData)==null?void 0:t.platform)??navigator.platform).toLowerCase().includes("mac")}(),WP=()=>{const{t:e}=j.useTranslation();return r.jsx(o.Tooltip,{label:r.jsxs(r.Fragment,{children:[Tg&&r.jsx(kg,{children:"⌘ + K"}),!Tg&&r.jsx(kg,{children:"Ctrl + K"})]}),children:r.jsx(o.UnstyledButton,{onClick:()=>jc.spotlight.open(),style:{height:"1.875rem",borderLeft:"none",borderTop:"none",borderRight:"1px solid #e9ecef",borderBottom:"1px solid #e9ecef",paddingLeft:"calc(0.875rem / 1.5)",paddingRight:"1rem"},sx:{color:"#228be6",background:"transparent","&:hover":{background:"rgb(231, 245, 255)"}},children:r.jsxs(o.Group,{spacing:"0.625rem",children:[r.jsx(S.IconSearch,{size:"1rem",color:"#228be6"}),r.jsx(o.Text,{style:{flexGrow:1,fontWeight:500,fontSize:"0.75rem",lineHeight:1},children:e("spotlight.trigger_text")})]})})})},RP={position:"fixed",top:60,left:0,right:0,height:30,zIndex:299,borderBottom:"1px solid #e9ecef",background:"rgba(233,236,239, 0.15)"},QP=D.observer(()=>r.jsx(o.Box,{sx:RP,pl:{base:200,xs:200,sm:200,md:220,lg:240,xl:260},children:r.jsxs(o.Group,{position:"apart",align:"center",sx:{height:"30px"},children:[r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(SP,{}),r.jsx(VP,{}),r.jsx(WP,{})]}),r.jsx(TP,{}),r.jsx(o.Group,{position:"right",spacing:0,children:r.jsx(IP,{})})]})})),UP=D.observer(e=>r.jsxs(r.Fragment,{children:[r.jsx(CP,{...e}),r.jsx(QP,{})]})),cV="";function YP(e,t,n){const s=[];return e.filter(i=>"__INTERACTIONS"in i.viz.conf).forEach((i,a)=>{const l=t[i.id];l.data.interactions=v.get(l,"data.interactions",[]);const{__INTERACTIONS:c,__OPERATIONS:u,__TRIGGERS:d}=i.viz.conf;Object.entries(u).forEach(([p,h])=>{const{schemaRef:g,data:b}=h,{config:x}=b;switch(g){case"builtin:op:open-link":let _=x.urlTemplate.substring(0,100);x.urlTemplate.length>=20&&(_+="..."),l.type="interaction",l.data.interactions.push({schemaRef:g,urlTemplate:x.urlTemplate,shortURLTemplate:_});return;case"builtin:op:open_view":s.push({id:`OPERATION--${p}`,source:i.id,target:x.viewID,label:"Open View",style:{stroke:"rgba(0,0,0,0.8)"},type:"default"});return;case"builtin:op:set_filter_values":l.type="interaction",l.data.interactions.push({schemaRef:g,filters:Object.keys(x.dictionary).map(T=>({key:T,label:n[T]}))});return;case"builtin:op:clear_filter_values":l.type="interaction",l.data.interactions.push({schemaRef:g,filters:x.filter_keys.map(T=>({key:T,label:n[T]}))});return;default:return}})}),s}function KP(e,t){const n=e.filters.keyLabelMap;return{edges:YP(e.panels.list,t,n),edgeNodes:[]}}function Ig(e,t,n){return e*t+e*n}function XP(e,t,n){return e*t+(e-1)*n}const _i=25,Vl=40,Dg=25,Nl=350,JP=150,ZP=150,Mg=150,zg=300,ji=40,Eg=25,HP=300;function e2(e,t){const n=v.keyBy(t,i=>i.id),s=[];return e.current.forEach((i,a)=>{i.panelIDs.forEach((l,c)=>{const u=Ig(c,ji,Eg)+Vl,d=n[l];if(!d){s.push({id:l,_node_type:"panel",parentNode:i.id,data:{label:`!: ${l}`},position:{x:_i,y:u},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,style:{width:zg,height:ji}});return}const p=d.name;s.push({id:d.id,_node_type:"panel",parentNode:i.id,data:{label:p},position:{x:_i,y:u},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,style:{width:zg,height:ji}})})}),s}const t2={[G.Division]:"Div",[G.Modal]:"Modal",[G.Tabs]:"Tabs"},n2=cg;function r2(e){return e.current.map((n,s)=>{const i=XP(n.panelIDs.length,ji,Eg)+Vl+Dg;let a=[];return n.type===G.Tabs&&(a=n.config.tabsInOrder.map(c=>c.view_id)),{id:n.id,_node_type:"view-root",_view_type:n.type,_view_level:0,_sub_view_ids:[],_tab_view_ids:a,data:{label:`${t2[n.type]}:${n.name}`},position:{x:0,y:0},sourcePosition:Ue.Position.Right,targetPosition:Ue.Position.Left,className:"light",style:{backgroundColor:n2[n.type],width:Nl,height:i}}})}function s2(e){const t=v.keyBy(e,n=>n.id);e.forEach(n=>{n._node_type!=="view-root"||n._view_type!==G.Tabs||n._tab_view_ids.forEach(s=>{t[s].parentNode=n.id})})}function i2(e){const t=r2(e.views);s2(t);const n=e2(e.views,e.panels.list);return[...t,...n]}function a2({nodeMap:e,nodes:t,edges:n}){t.forEach(s=>{s._node_type!=="view-root"||s._view_type!==G.Tabs||(s.sourcePosition=Ue.Position.Bottom,s.style.width=Nl+_i*2,s.style.height=Dg+s._tab_view_ids.reduce((i,a)=>{const l=e[a];l.position.y=i,l.position.x=_i;const c=l.style.height;return i+c+20},Vl))})}function o2({nodeMap:e,nodes:t,edges:n}){n.filter(s=>s.label==="Open View").forEach(s=>{const i=e[s.source],a=e[s.target];if(!i||!a||!i.parentNode)return;const l=e[i.parentNode];l._node_type!=="view-root"||a._node_type!=="view-root"||(a._view_level+=1+l._view_level,l._sub_view_ids.push(a.id))}),t.sort((s,i)=>s._node_type==="view-root"&&i._node_type==="view-root"?s._view_level-i._view_level:s._node_type!=="view-root"&&i._node_type!=="view-root"?0:s._node_type==="view-root"?-1:1)}function l2({nodeMap:e,nodes:t,edges:n}){const s={};n.forEach(i=>{if(i.label!=="Open View")return;const a=e[i.source],l=e[i.target];if(a&&l&&a.parentNode){const c=e[a.parentNode],u=c.position.x,d=Number(v.get(l,"style.height",0)),p=Number(c.style.width);l.position.x=u+p+HP,c._view_level===0&&l._sub_view_ids.length===0&&(a.sourcePosition=Ue.Position.Left,l.targetPosition=Ue.Position.Right,l.position.x*=-1);const g=l.position.x,b=v.get(s,g,0);l.position.y=b,s[g]=b+d+Mg}})}function c2({nodeMap:e,nodes:t,edges:n}){const s=new Set,i=new Set;n.forEach(l=>{s.add(l.source),i.add(l.target)}),t.filter(l=>l._node_type!=="view-root"||l.id==="Main"||l.parentNode?!1:!s.has(l.id)&&!i.has(l.id)).forEach((l,c)=>{l.position.x=Ig(c,Nl,ZP),l.position.y=0-JP-Mg})}function u2({nodeMap:e,nodes:t,edges:n}){const s={nodeMap:e,nodes:t,edges:n};return c2(s),o2(s),a2(s),l2(s),{nodes:t,edges:n}}function d2(e){const t=i2(e),n=v.keyBy(t,u=>u.id),{edges:s,edgeNodes:i}=KP(e,n),a=[...t,...i],l=v.keyBy(a,u=>u.id),c={edges:v.uniqBy(s,u=>u.id),nodes:a,nodeMap:l};return u2(c)}const uV="",ql={"builtin:op:open-link":r.jsx(o.ThemeIcon,{color:"blue",size:20,radius:"xl",children:r.jsx(S.IconCircleDashed,{size:14})}),"builtin:op:set_filter_values":r.jsx(o.ThemeIcon,{color:"orange",size:20,radius:"xl",children:r.jsx(S.IconCircleDot,{size:14})}),"builtin:op:clear_filter_values":r.jsx(o.ThemeIcon,{color:"orange",size:20,radius:"xl",children:r.jsx(S.IconCircleOff,{size:14})})};function p2(e){const t=[];return e.forEach(n=>{switch(n.schemaRef){case"builtin:op:open-link":t.push({key:n.urlTemplate,icon:ql[n.schemaRef],text:r.jsxs(o.Group,{spacing:4,children:[r.jsx(o.Text,{children:"Open: "}),r.jsx(o.Text,{color:"dimmed",children:n.shortURLTemplate})]})});return;case"builtin:op:set_filter_values":n.filters.forEach(({key:s,label:i})=>{t.push({key:n.schemaRef+s,icon:ql[n.schemaRef],text:r.jsx(o.Group,{spacing:4,children:r.jsxs(o.Text,{children:["Set Filter: ",i]})})})});return;case"builtin:op:clear_filter_values":n.filters.forEach(({key:s,label:i})=>{t.push({key:n.schemaRef+s,icon:ql[n.schemaRef],text:r.jsx(o.Group,{spacing:4,children:r.jsxs(o.Text,{children:["Clear Filter: ",i]})})})});return}}),t}const h2=f.memo(({data:e,isConnectable:t,sourcePosition:n=Ue.Position.Right,targetPosition:s=Ue.Position.Left,...i})=>{const a=f.useMemo(()=>p2(e.interactions),[e.interactions]);return r.jsxs(r.Fragment,{children:[r.jsx(Ue.Handle,{type:"target",position:s,isConnectable:t}),r.jsx(o.Box,{sx:{position:"absolute",top:0,right:0},children:r.jsx(S.IconChevronsUpRight,{size:12})}),r.jsxs(o.HoverCard,{shadow:"xl",withinPortal:!0,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Text,{children:e.label})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsx(o.List,{spacing:"xs",size:"sm",center:!0,children:a.map(l=>r.jsx(o.List.Item,{icon:l.icon,children:l.text},l.key))})})]}),r.jsx(Ue.Handle,{type:"source",position:n,isConnectable:t})]})}),dV="",f2={interaction:h2},g2=D.observer(()=>{const e=Te(),{edges:t,nodes:n}=d2(e);return r.jsxs(Ue,{nodes:n,edges:t,onNodesChange:v.noop,onEdgesChange:v.noop,onConnect:v.noop,className:"interactions-viewer",fitView:!0,nodeTypes:f2,children:[r.jsx(Ue.MiniMap,{}),r.jsx(Ue.Controls,{}),r.jsx(Ue.Background,{})]})}),m2=D.observer(({opened:e,close:t})=>{const{t:n}=j.useTranslation();return r.jsx(o.Modal,{size:"96vw",opened:e,onClose:t,title:n("interactions.interactions_viewer"),trapFocus:!0,onDragStart:s=>{s.stopPropagation()},styles:{body:{height:"calc(90vh - 54px)"},content:{transform:"none !important"}},zIndex:300,children:r.jsx(g2,{})})}),x2={"> button":{"&:first-of-type":{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:.5},":not(:first-of-type):not(:last-of-type)":{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:.5,borderRightWidth:.5},"&:last-of-type":{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:.5}}};function b2({onClick:e,name:t,active:n,openSettings:s}){return r.jsxs(o.Box,{sx:{position:"relative"},children:[r.jsx(o.UnstyledButton,{sx:i=>({display:"block",width:"100%",padding:i.spacing.xs,borderRadius:0,position:"relative",color:i.black,"&:hover":{backgroundColor:i.colors.gray[0]},backgroundColor:n?i.colors.gray[2]:"transparent"}),children:r.jsx(o.Group,{sx:{width:"calc(100% - 28px)"},onClick:e,children:r.jsx(o.Text,{size:"sm",children:t})})}),n&&r.jsx(o.Tooltip,{label:"Edit",position:"right",withinPortal:!0,children:r.jsx(o.ActionIcon,{onClick:s,variant:"light",color:"blue",sx:{position:"absolute",top:0,bottom:0,height:"100%",right:0,zIndex:0,borderRadius:0},children:r.jsx(S.IconAdjustments,{size:16})})})]})}const y2=D.observer(()=>{const{t:e}=j.useTranslation(),t=ce(),n=se(),s=f.useCallback(a=>()=>n.views.setIDOfVIE(a),[n]),i=a=>{t.editor.open(["_VIEWS_",a])};return r.jsxs(o.Box,{sx:{position:"relative"},children:[n.views.options.map(a=>r.jsx(b2,{active:n.views.idOfVIE===a.value,name:a.label,onClick:s(a.value),openSettings:()=>i(a.value)},a.value)),r.jsx(o.Divider,{variant:"dashed"}),r.jsx(o.Button,{variant:"subtle",rightIcon:r.jsx(S.IconPlus,{size:14}),size:"sm",px:"xs",color:"blue",onClick:n.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"space-between"}},children:e("view.add")})]})}),v2=D.observer(()=>{const{t:e}=j.useTranslation(),t=ce(),n=se(),s=()=>{if(!n.queries.firstID){t.editor.open(["_QUERIES_",""]);return}t.editor.open(["_QUERIES_",n.queries.firstID])},i=()=>{if(!n.filters.firstID){t.editor.open(["_FILTERS_",""]);return}t.editor.open(["_FILTERS_",n.filters.firstID])},[a,l]=f.useState(!1),c=()=>l(!0),u=()=>l(!1);return r.jsxs(o.Navbar,{p:0,width:{base:200,xs:200,sm:200,md:220,lg:240,xl:260},zIndex:299,children:[r.jsxs(o.Navbar.Section,{children:[r.jsxs(o.Group,{grow:!0,spacing:0,sx:{...x2,button:{borderWidth:0,borderBottomWidth:1,borderColor:"#e9ecef"}},children:[r.jsx(o.Tooltip,{label:e("filter.labels"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:i,children:r.jsx(S.IconFilter,{size:18})})}),r.jsx(o.Tooltip,{label:e("query.labels"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:s,children:r.jsx(S.IconDatabase,{size:18})})}),r.jsx(o.Tooltip,{label:e("interactions.interactions_viewer"),withinPortal:!0,children:r.jsx(o.ActionIcon,{variant:"default",radius:0,size:"md",sx:{height:"30px"},onClick:c,children:r.jsx(S.IconRoute,{size:18})})})]}),r.jsx(m2,{opened:a,close:u})]}),r.jsx(o.Navbar.Section,{py:5,sx:{borderBottom:"1px solid #eee"},children:r.jsx(o.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:e("view.labels")})}),r.jsx(o.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:r.jsx(y2,{})}),r.jsx(o.Navbar.Section,{children:r.jsx(o.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:r.jsx(o.Button,{size:"xs",leftIcon:r.jsx(S.IconSettings,{size:20}),onClick:()=>t.editor.open([]),children:e("common.titles.settings")})})})]})}),_2=D.observer(({filter:e})=>{const{panel:t}=Pe(),{t:n}=j.useTranslation(),s=e.config;return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Checkbox,{checked:s.default_value,onChange:i=>s.setDefaultValue(i.currentTarget.checked),label:n("filter.widget.checkbox.default_checked")}),r.jsx(Wn,{filter:e})]}),r.jsx(Mn,{label:n("filter.widget.checkbox.description"),value:s.description,onChange:s.setDescription,styles:{root:{flexGrow:1,minHeight:"400px"}}},t.id)]})}),j2=[{label:"2022",value:"YYYY"},{label:"202201",value:"YYYYMM"},{label:"20220101",value:"YYYYMMDD"},{label:"2022-01",value:"YYYY-MM"},{label:"2022-01-01",value:"YYYY-MM-DD"}],w2=D.observer(function({filter:t}){const{t:n}=j.useTranslation(),s=t.config,i=f.useMemo(()=>sl().map(({key:l,value:c,group:u})=>({label:n(`filter.widget.date_range.shortcut.${u}.full.${l}`),value:c,group:n(`filter.widget.date_range.shortcut.${u}.label`)})),[]),a=[...s.default_value];return r.jsxs(r.Fragment,{children:[r.jsxs(o.Group,{children:[r.jsx(o.Checkbox,{checked:s.required,onChange:l=>s.setRequired(l.currentTarget.checked),label:n("filter.widget.date_range.required")}),r.jsx(o.Checkbox,{checked:s.allowSingleDateInRange,onChange:l=>s.setAllowSingleDateInRange(l.currentTarget.checked),label:n("filter.widget.date_range.allow_single_date")})]}),r.jsxs(o.Group,{grow:!0,children:[r.jsx(o.Select,{data:j2,label:n("filter.widget.date_range.display_format"),value:s.inputFormat,onChange:s.setInputFormat}),r.jsx(o.NumberInput,{label:n("filter.widget.date_range.max_days"),min:0,value:s.max_days,onChange:s.setMaxDays,hideControls:!0})]}),r.jsxs(o.Group,{children:[r.jsx(Qf,{label:n("filter.widget.date_range.default_value"),config:s,value:{value:a,shortcut:null},onChange:s.setDefaultValue,disabled:!!s.default_shortcut}),r.jsx(o.Select,{data:i,label:n("filter.widget.date_range.default_by_shortcut"),value:s.default_shortcut,onChange:s.setDefaultShortcut,placeholder:n("filter.widget.date_range.default_by_shortcut_placeholder"),clearable:!0,sx:{flexGrow:1},maxDropdownHeight:500})]}),r.jsx(Wn,{filter:t})]})}),C2=`
|
|
491
491
|
// row
|
|
492
492
|
{
|
|
493
493
|
label: string;
|