@devtable/dashboard 14.44.0 → 14.44.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/components/plugins/plugin-context.d.ts +50 -0
- package/dist/contexts/panel-context.d.ts +100 -0
- package/dist/dashboard-editor/model/panels/panel.d.ts +25 -0
- package/dist/dashboard-editor/model/queries/queries.d.ts +48 -0
- package/dist/dashboard-editor/model/queries/query.d.ts +2 -0
- package/dist/dashboard.es.js +6 -4
- package/dist/dashboard.umd.js +2 -2
- package/dist/model/meta-model/dashboard/content/query/merico-metric-query.d.ts +4 -0
- package/dist/model/meta-model/dashboard/content/query/query.d.ts +2 -0
- package/dist/model/render-model/dashboard/content/panels/panel.d.ts +17 -0
- package/dist/model/render-model/dashboard/content/queries/mute-query.d.ts +2 -0
- package/dist/model/render-model/dashboard/content/queries/queries.d.ts +36 -0
- package/dist/model/render-model/dashboard/content/queries/query.d.ts +2 -0
- package/dist/stats.html +1 -1
- package/dist/version.json +2 -2
- package/package.json +1 -1
package/dist/dashboard.umd.js
CHANGED
|
@@ -6,7 +6,7 @@ Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel vari
|
|
|
6
6
|
-- 在富文本中,要使用双重花括号来包裹代码。
|
|
7
7
|
项目ID:{{ context.project_id }}
|
|
8
8
|
搜索关键字:{{ filters.keyword }}
|
|
9
|
-
我的卡片变量: {{ 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:"其他"},unit:{title:"单位",text:{placeholder:"单位文案"},show_in_tooltip:"在提示框中显示单位",show_in_legend:"在图例中显示单位"},series_order:{label:"排序依据",name:"名称",value:"值",raw:"不排序,保持数据本身的顺序",asc:"升序",desc:"降序"},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轴数据字段",inverse:"反向坐标轴",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见",mirror:{label:"上下镜像"}},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:"无匹配项"}}};class Jt{constructor(t){P(this,"rootRef");this.rootRef=Q.observable({current:t})}async deleteItem(t){Q.runInAction(()=>{y.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?Q.toJS(this.rootRef.current):y.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(y.isObject(r))Q.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else Q.runInAction(()=>{y.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,a){return Q.reaction(()=>this.getValueFromRoot(t),(l,o)=>{r(l,o)},{requiresObservable:!0,fireImmediately:y.get(a,"fireImmediately",!1)})}}class Zd{constructor(){P(this,"channels",new Map);P(this,"globalChannel",new Xa)}getChannel(t){const r=this.channels.get(t);if(r)return r;const a=new Xa;return this.channels.set(t,a),a}}class Jd{constructor(t){P(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 r=this.instances.get(t.id);if(r)return r;const a={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new Zd,instanceData:new Jt(t.viz.conf)};return this.instances.set(t.id,a),a}}function _s(e,t,r,a){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Jt({}),colorPalette:{getColor(){return()=>""}},data:t,variables:a}}const Hd=e=>{const{panel:t,measure:r,vizManager:a,data:l,variables:o}=e,i=a.resolveComponent(t.viz.type),c=a.getOrCreateInstance(t),d={..._s(c,l,a,o),viewport:{width:r.w,height:r.h}},u=i.viewRender;return n.jsx(u,{context:d,instance:c,...y.omit(e,["panel","vizManager","data"])})},Rd=e=>{const{vizManager:t,panel:r,data:a,variables:l}=e,o=t.resolveComponent(r.viz.type),i=t.getOrCreateInstance(r),c={..._s(i,a,t,l)},d=o.configRender;return n.jsx(d,{context:c,instance:i,...y.omit(e,["panel","vizManager","data"])})},xs=(e,t)=>{const r=qe.bezier(e),a=qe.bezier(t);return function(l){return l<50?r(l*2/100).hex():a((l-50)*2/100).hex()}},Ht=e=>{const t=qe.bezier(e);return function(r){return t(r/100).hex()}},eu={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:xs(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},tu={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:xs(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},nu={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Ht(["#fff7f1","darkred"]),name:"red",category:"sequential"},ru={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Ht(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},au={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Ht(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},su={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Ht(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class lu{constructor(t){P(this,"symbol");this.symbol=Symbol(t)}}function Je(e){return new lu(e)}class qn{constructor(){P(this,"parent");P(this,"factoryRegistry",new Map);P(this,"instanceRegistry",new Map)}createScoped(){const t=new qn;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 r=this.factoryRegistry.get(t.symbol);if(r){const a=r(this);return this.instanceRegistry.set(t.symbol,a),a}if(this.parent)return this.parent.get(t)}provideFactory(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,r),this}provideValue(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>r),this}dispose(){this.instanceRegistry.forEach(t=>{const r=y.get(t,"dispose");y.isFunction(r)&&r.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}class ou{constructor(t){this.pluginManager=t}createPanelAddonNode(t){const a=this.pluginManager.installedPlugins.flatMap(l=>l.manifest.panelAddon).filter(l=>!!l).map(l=>h.createElement(l.addonRender,{...t,key:l.name}));return n.jsx(n.Fragment,{children:a})}}const ws=h.createContext({addonSlotId:null});function ms({children:e}){const t=`panel-addon-slot-${h.useId()}`;return n.jsxs(ws.Provider,{value:{addonSlotId:t},children:[n.jsx("div",{style:{position:"static",top:0,left:0},id:t}),e]})}function iu(){const{addonSlotId:e}=h.useContext(ws);return e?document.getElementById(e):null}const Cs="14.44.0",cu=Object.freeze(Object.defineProperty({__proto__:null,version:Cs},Symbol.toStringTag,{value:"Module"}));class du{constructor(t){P(this,"staticColors",new Map);P(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(a=>{this.register(a)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&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(r,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 uu{constructor(){P(this,"plugins",new Map);P(this,"vizComponents",new Map);P(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;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 r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class pu{constructor(){P(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,a){var i;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const l=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),o=y.orderBy(l,"version","asc");if(((i=y.last(o))==null?void 0:i.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((c,d)=>d.handler(c,a),r)}}class ee extends pu{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(a,l)=>({version:t,...r(a,l)}))}async migrate({configData:t,panelModel:r}){const a=await t.getItem(null),l=y.get(a,"version",0),o=this.run({from:l,to:this.VERSION},a,{panelModel:r});await t.setItem(null,o)}async needMigration({configData:t}){const r=await t.getItem(null);return y.get(r,"version",0)<this.VERSION}}const B=(e,t)=>{const[r,{setFalse:a}]=O.useBoolean(!0),[l,o]=h.useState();h.useEffect(()=>(e.getItem(t).then(c=>{o(c),a()}),e.watchItem(t,c=>{o(c)})));const i=h.useCallback(async c=>{await e.setItem(t,c),o(c)},[e,t]);return{loading:r,value:l,set:i}},ve={top:16,right:16,bottom:16,left:16},Ge=e=>Math.max(0,e-ve.left-ve.right),Fe=e=>Math.max(0,e-ve.top-ve.bottom),Ot=(e,t)=>({width:Ge(e),height:Fe(t)}),_e=({width:e,height:t,children:r})=>n.jsx(s.Box,{pt:ve.top,pr:ve.right,pb:ve.bottom,pl:ve.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:r});h.forwardRef(function({value:t,onChange:r,...a},l){return n.jsx(s.TextInput,{ref:l,value:t,onChange:r,...a})});class hu{constructor({valueRange:t,colorRange:r}){P(this,"mapper");this.mapper=ot.interpolate(t,r)}getColor(t){return this.mapper(t)}}function gu(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{const r=Number(t);if(Number.isNaN(r))throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}, parsed: ${r}`);return new hu(e).getColor(r)}catch(r){return console.error(r),"black"}return"black"}const fu=gu;function A(e){const[t,r]=e.split(".");return{queryID:t,columnKey:r}}function bu(e){return e.includes(".")?A(e):{queryID:"",columnKey:e}}function Ve(e,t){var l;const{queryID:r,columnKey:a}=A(t);return r?a?((l=e[r])==null?void 0:l.map(o=>o[a]))??[]:e[r]:[]}function Rt(e,t){const{queryID:r}=A(t);return r?e[r]:[]}function yu(e){return Object.values(e)[0]}function en(e,t){const{queryID:r,columnKey:a}=A(t);return e[a]}const je={CryptoJS:Ja,d3Array:vs,dayjs:M,lodash:y,numbro:Ye,mathjs:Ne,faker:nd.faker,popmotion:Wd},vu=[{name:"CryptoJS",url:"https://github.com/brix/crypto-js",version:"4.1.1"},{name:"d3Array",url:"https://github.com/d3/d3-array",version:"3.2.4"},{name:"dayjs",url:"https://day.js.org/",version:"1.11.6"},{name:"lodash",url:"https://lodash.com/docs/4.17.15",version:"4.17.21"},{name:"mathjs",url:"https://mathjs.org/",version:"11.12.0"},{name:"numbro",url:"https://numbrojs.com/",version:"2.3.6"},{name:"faker",url:"https://fakerjs.dev/",version:"7.6.0"},{name:"popmotion",url:"https://popmotion.io/",version:"11.0.3"}],_u=e=>`
|
|
9
|
+
我的卡片变量: {{ 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:"其他"},unit:{title:"单位",text:{placeholder:"单位文案"},show_in_tooltip:"在提示框中显示单位",show_in_legend:"在图例中显示单位"},series_order:{label:"排序依据",name:"名称",value:"值",raw:"不排序,保持数据本身的顺序",asc:"升序",desc:"降序"},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轴数据字段",inverse:"反向坐标轴",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见",mirror:{label:"上下镜像"}},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:"无匹配项"}}};class Jt{constructor(t){P(this,"rootRef");this.rootRef=Q.observable({current:t})}async deleteItem(t){Q.runInAction(()=>{y.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?Q.toJS(this.rootRef.current):y.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(y.isObject(r))Q.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else Q.runInAction(()=>{y.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,a){return Q.reaction(()=>this.getValueFromRoot(t),(l,o)=>{r(l,o)},{requiresObservable:!0,fireImmediately:y.get(a,"fireImmediately",!1)})}}class Zd{constructor(){P(this,"channels",new Map);P(this,"globalChannel",new Xa)}getChannel(t){const r=this.channels.get(t);if(r)return r;const a=new Xa;return this.channels.set(t,a),a}}class Jd{constructor(t){P(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 r=this.instances.get(t.id);if(r)return r;const a={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new Zd,instanceData:new Jt(t.viz.conf)};return this.instances.set(t.id,a),a}}function _s(e,t,r,a){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Jt({}),colorPalette:{getColor(){return()=>""}},data:t,variables:a}}const Hd=e=>{const{panel:t,measure:r,vizManager:a,data:l,variables:o}=e,i=a.resolveComponent(t.viz.type),c=a.getOrCreateInstance(t),d={..._s(c,l,a,o),viewport:{width:r.w,height:r.h}},u=i.viewRender;return n.jsx(u,{context:d,instance:c,...y.omit(e,["panel","vizManager","data"])})},Rd=e=>{const{vizManager:t,panel:r,data:a,variables:l}=e,o=t.resolveComponent(r.viz.type),i=t.getOrCreateInstance(r),c={..._s(i,a,t,l)},d=o.configRender;return n.jsx(d,{context:c,instance:i,...y.omit(e,["panel","vizManager","data"])})},xs=(e,t)=>{const r=qe.bezier(e),a=qe.bezier(t);return function(l){return l<50?r(l*2/100).hex():a((l-50)*2/100).hex()}},Ht=e=>{const t=qe.bezier(e);return function(r){return t(r/100).hex()}},eu={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:xs(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},tu={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:xs(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},nu={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Ht(["#fff7f1","darkred"]),name:"red",category:"sequential"},ru={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Ht(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},au={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Ht(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},su={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Ht(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class lu{constructor(t){P(this,"symbol");this.symbol=Symbol(t)}}function Je(e){return new lu(e)}class qn{constructor(){P(this,"parent");P(this,"factoryRegistry",new Map);P(this,"instanceRegistry",new Map)}createScoped(){const t=new qn;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 r=this.factoryRegistry.get(t.symbol);if(r){const a=r(this);return this.instanceRegistry.set(t.symbol,a),a}if(this.parent)return this.parent.get(t)}provideFactory(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,r),this}provideValue(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>r),this}dispose(){this.instanceRegistry.forEach(t=>{const r=y.get(t,"dispose");y.isFunction(r)&&r.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}class ou{constructor(t){this.pluginManager=t}createPanelAddonNode(t){const a=this.pluginManager.installedPlugins.flatMap(l=>l.manifest.panelAddon).filter(l=>!!l).map(l=>h.createElement(l.addonRender,{...t,key:l.name}));return n.jsx(n.Fragment,{children:a})}}const ws=h.createContext({addonSlotId:null});function ms({children:e}){const t=`panel-addon-slot-${h.useId()}`;return n.jsxs(ws.Provider,{value:{addonSlotId:t},children:[n.jsx("div",{style:{position:"static",top:0,left:0},id:t}),e]})}function iu(){const{addonSlotId:e}=h.useContext(ws);return e?document.getElementById(e):null}const Cs="14.44.1",cu=Object.freeze(Object.defineProperty({__proto__:null,version:Cs},Symbol.toStringTag,{value:"Module"}));class du{constructor(t){P(this,"staticColors",new Map);P(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(a=>{this.register(a)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&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(r,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 uu{constructor(){P(this,"plugins",new Map);P(this,"vizComponents",new Map);P(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;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 r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class pu{constructor(){P(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,a){var i;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const l=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),o=y.orderBy(l,"version","asc");if(((i=y.last(o))==null?void 0:i.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((c,d)=>d.handler(c,a),r)}}class ee extends pu{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(a,l)=>({version:t,...r(a,l)}))}async migrate({configData:t,panelModel:r}){const a=await t.getItem(null),l=y.get(a,"version",0),o=this.run({from:l,to:this.VERSION},a,{panelModel:r});await t.setItem(null,o)}async needMigration({configData:t}){const r=await t.getItem(null);return y.get(r,"version",0)<this.VERSION}}const B=(e,t)=>{const[r,{setFalse:a}]=O.useBoolean(!0),[l,o]=h.useState();h.useEffect(()=>(e.getItem(t).then(c=>{o(c),a()}),e.watchItem(t,c=>{o(c)})));const i=h.useCallback(async c=>{await e.setItem(t,c),o(c)},[e,t]);return{loading:r,value:l,set:i}},ve={top:16,right:16,bottom:16,left:16},Ge=e=>Math.max(0,e-ve.left-ve.right),Fe=e=>Math.max(0,e-ve.top-ve.bottom),Ot=(e,t)=>({width:Ge(e),height:Fe(t)}),_e=({width:e,height:t,children:r})=>n.jsx(s.Box,{pt:ve.top,pr:ve.right,pb:ve.bottom,pl:ve.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:r});h.forwardRef(function({value:t,onChange:r,...a},l){return n.jsx(s.TextInput,{ref:l,value:t,onChange:r,...a})});class hu{constructor({valueRange:t,colorRange:r}){P(this,"mapper");this.mapper=ot.interpolate(t,r)}getColor(t){return this.mapper(t)}}function gu(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{const r=Number(t);if(Number.isNaN(r))throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}, parsed: ${r}`);return new hu(e).getColor(r)}catch(r){return console.error(r),"black"}return"black"}const fu=gu;function A(e){const[t,r]=e.split(".");return{queryID:t,columnKey:r}}function bu(e){return e.includes(".")?A(e):{queryID:"",columnKey:e}}function Ve(e,t){var l;const{queryID:r,columnKey:a}=A(t);return r?a?((l=e[r])==null?void 0:l.map(o=>o[a]))??[]:e[r]:[]}function Rt(e,t){const{queryID:r}=A(t);return r?e[r]:[]}function yu(e){return Object.values(e)[0]}function en(e,t){const{queryID:r,columnKey:a}=A(t);return e[a]}const je={CryptoJS:Ja,d3Array:vs,dayjs:M,lodash:y,numbro:Ye,mathjs:Ne,faker:nd.faker,popmotion:Wd},vu=[{name:"CryptoJS",url:"https://github.com/brix/crypto-js",version:"4.1.1"},{name:"d3Array",url:"https://github.com/d3/d3-array",version:"3.2.4"},{name:"dayjs",url:"https://day.js.org/",version:"1.11.6"},{name:"lodash",url:"https://lodash.com/docs/4.17.15",version:"4.17.21"},{name:"mathjs",url:"https://mathjs.org/",version:"11.12.0"},{name:"numbro",url:"https://numbrojs.com/",version:"2.3.6"},{name:"faker",url:"https://fakerjs.dev/",version:"7.6.0"},{name:"popmotion",url:"https://popmotion.io/",version:"11.0.3"}],_u=e=>`
|
|
10
10
|
<tr>
|
|
11
11
|
<td><code>${e.name}</code></td>
|
|
12
12
|
<td>
|
|
@@ -527,7 +527,7 @@ Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel vari
|
|
|
527
527
|
</thead>
|
|
528
528
|
<tbody>${_.join("")}</tbody>
|
|
529
529
|
</table>
|
|
530
|
-
`}})}function PC(e,t,r){const{overflow:a,rotate:l}=e.x_axis.axisLabel,o=Be(a.on_axis);return X.getXAxis({id:"main-x-axis",type:"category",data:t,name:e.x_axis.name??"",align:"center",axisTick:{show:!0,alignWithLabel:!0},axisLabel:{rotate:l,...o,formatter:r},splitArea:{show:!1,areaStyle:{color:"#E7E7E9"}},splitLine:{show:!1},nameLocation:"center",nameGap:25,nameTextStyle:{fontWeight:"bold",align:"center"},z:3})}function VC(e,t){const{nameAlignment:r,data_key:a,...l}=e.y_axis,{overflow:o,rotate:i}=e.y_axis.axisLabel,c=Be(o.on_axis);return X.getYAxis({...l,type:"category",axisLabel:{rotate:i,...c,formatter:t},axisLine:{show:!0,lineStyle:{width:3}},axisTick:{show:!0,alignWithLabel:!0},splitArea:{show:!1,areaStyle:{color:"#E7E7E9"}},splitLine:{show:!1},nameTextStyle:{fontWeight:"bold",align:r},nameLocation:"end",nameGap:15,z:3})}function $C(e,t,r){if(!e.x_axis.data_key||!e.y_axis.data_key||!e.heat_block.data_key)return{};const a=r.reduce((m,k)=>{const z=Re(k,t);return m[k.name]=$e(k,z),m},{}),l=TC(e),o=kC(e),i=tn(e.visualMap,a),{min:c,max:d}=i,u=A(e.x_axis.data_key),p=A(e.y_axis.data_key),f=A(e.heat_block.data_key),v=y.uniq(t[u.queryID].map(m=>m[u.columnKey])),_=t[u.queryID].map(m=>{const k=y.get(m,u.columnKey),z=y.get(m,p.columnKey),D=y.get(m,f.columnKey),I={value:[k,z,D]},{followVisualMap:L,color:E}=Rn(D,c,d,e.visualMap);return L||(I.visualMap=!1,I.itemStyle={color:E}),I});return{xAxis:PC(e,v,l.x_axis),yAxis:VC(e,l.y_axis),series:DC(e,_),tooltip:AC(e,t,l,o),grid:zC(e),visualMap:i}}function EC({conf:e,data:t,width:r,height:a,interactionManager:l,variables:o,instance:i}){const c=h.useMemo(()=>{const w=A(e.x_axis.data_key),m=A(e.y_axis.data_key);return y.keyBy(t[w.queryID],k=>`${k[w.columnKey]}---${k[m.columnKey]}`)},[t,e.x_axis.data_key,e.y_axis.data_key]),d=Ie(l.triggerManager,mo.id),u=h.useCallback(w=>{const[m,k]=w.value,z=y.get(c,`${m}---${k}`,{error:"rowData is not found"});d.forEach(D=>{l.runInteraction(D.id,{...w,rowData:z})})},[c,d,l]),p=h.useRef(null),f=h.useCallback(()=>{var m;const w=(m=p.current)==null?void 0:m.getEchartsInstance();w&&de(i,w.getOption())},[i]),v=h.useMemo(()=>({click:u,finished:f}),[u,f]),_=h.useMemo(()=>$C(e,t,o),[e,t]);return n.jsx(he,{echarts:ce,option:_,ref:p,style:{width:r,height:a},onEvents:v,notMerge:!0,theme:"merico-light"})}function BC({context:e,instance:t}){const r=Me({vizManager:e.vizManager,instance:t}),{value:a}=B(e.instanceData,"config"),{variables:l}=e,o=h.useMemo(()=>y.defaults({},a,jr),[a]),i=e.data,{width:c,height:d}=e.viewport;return!c||!d?null:n.jsx(_e,{width:c,height:d,children:n.jsx(EC,{instance:t,variables:l,width:Ge(c),height:Fe(d),data:i,conf:o,interactionManager:r})})}const LC=[{lang:"en",resources:{merico_heatmap:{viz_name:"Merico Heatmap",click_heatmap:{heatblock:{label:"Click heat block"}}}}},{lang:"zh",resources:{merico_heatmap:{viz_name:"思码逸热力图",click_heatmap:{heatblock:{label:"点击热力块"}}}}}];function qC(e){const{visualMap:t=et(),heat_block:{min:r,max:a,...l},...o}=e;return{...o,heat_block:l,visualMap:{...et(),min:r,max:a}}}function OC(e){const t=e.tooltip.metrics;return{...e,tooltip:{...e.tooltip,metrics:t.map(r=>({...r,unit:r.unit??U()}))}}}function NC(e){const{heat_block:t}=e;return{...e,heat_block:{...t,unit:t.unit??U()}}}class GC extends ee{constructor(){super(...arguments);P(this,"VERSION",4)}configVersions(){this.version(1,r=>({version:1,config:r})),this.version(2,r=>({...r,version:2,config:qC(r.config)})),this.version(3,r=>({...r,version:3,config:OC(r.config)})),this.version(4,r=>({...r,version:4,config:NC(r.config)}))}}const FC={displayName:"viz.merico_heatmap.viz_name",displayGroup:"chart.groups.merico_suite",migrator:new GC,name:"merico-heatmap",viewRender:BC,configRender:mC,createConfig:()=>({version:4,config:jr}),triggers:[mo],translation:LC},Qr={item_badge:"_item_badge_l2t3l_1",label:"_label_l2t3l_8",value:"_value_l2t3l_20"},jC=({children:e})=>["string","number"].includes(typeof e)?n.jsx(s.Text,{size:"xs",ff:"monospace",children:e}):e,bt=h.forwardRef(({label:e,value:t,label_description:r,value_description:a},l)=>n.jsxs("div",{ref:l,className:Qr.item_badge,children:[n.jsx("div",{className:Qr.label,children:e}),n.jsxs(s.HoverCard,{shadow:"md",disabled:!a,children:[n.jsx(s.HoverCard.Target,{children:n.jsx("div",{className:Qr.value,"data-with-tooltip":!!a,children:t})}),n.jsx(s.HoverCard.Dropdown,{p:"xs",children:n.jsx(jC,{children:a})})]})]})),QC=({item:e})=>e.type!=="checkbox"?null:n.jsx(bt,{label:e.label,value:n.jsx(s.ThemeIcon,{variant:"white",radius:"xs",color:e.value?"teal":"red",w:12,h:12,miw:12,mih:12,children:e.value?n.jsx(S.IconCheck,{size:12,strokeWidth:3}):n.jsx(S.IconX,{strokeWidth:3})}),label_description:`filters.${e.key}`}),WC=({item:e})=>e.type!=="context"?null:n.jsx(bt,{label:e.key,value:e.value,label_description:`context.${e.key}`}),UC=T.observer(({item:e})=>{const{t}=x.useTranslation(),a=e.model.value,[l,o]=a.value,i=h.useMemo(()=>!o&&!l?Number.NaN:M(o).diff(M(l),"days")+1,[l,o]);if(Number.isNaN(i))return n.jsx("span",{style:{userSelect:"none",opacity:0,visibility:"hidden"},children:"."});const c=i===1?t("filter.widget.date_range.one_day"):t("filter.widget.date_range.x_days",{count:i});return n.jsx(bt,{label:e.label,value:e.value.join(" ~ "),label_description:`filters.${e.key}`,value_description:c})}),YC=({item:e})=>e.type!=="date-range"?null:n.jsx(UC,{item:e}),Co=({selection:e})=>(x.useTranslation(),e.length===0?null:n.jsx(s.Group,{justify:"flex-start",gap:"xs",maw:"80vw",children:e.map(t=>n.jsx(s.Pill,{size:"xs",ff:"monospace",children:t.label},t.value))})),KC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>r.optionsByValues(e.value),[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a.length,label_description:`filters.${e.key}`,value_description:n.jsx(Co,{selection:a})})}),XC=({item:e})=>e.type!=="multi-select"?null:n.jsx(KC,{item:e}),ZC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>{var l;return((l=r.options.find(o=>o.value===e.value))==null?void 0:l.label)??e.value},[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a,label_description:`filters.${e.key}`})}),JC=({item:e})=>e.type!=="select"?null:n.jsx(ZC,{item:e}),HC=({item:e})=>e.type!=="text-input"?null:n.jsx(bt,{label:e.label,value:n.jsx(s.Text,{maw:200,size:"xs",truncate:"end",ff:"monospace",children:e.value}),value_description:e.value}),RC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>r.optionsByValues(e.value),[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a.length,label_description:`filters.${e.key}`,value_description:n.jsx(Co,{selection:a})})}),eS=({item:e})=>e.type!=="tree-select"?null:n.jsx(RC,{item:e}),tS=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>{var l;return((l=r.options.find(o=>o.value===e.value))==null?void 0:l.label)??e.value},[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a,label_description:`filters.${e.key}`,value_description:e.value})}),nS=({item:e})=>e.type!=="tree-single-select"?null:n.jsx(tS,{item:e}),Wr=({item:e})=>{switch(e.type){case"date-range":return n.jsx(YC,{item:e});case"select":return n.jsx(JC,{item:e});case"tree-single-select":return n.jsx(nS,{item:e});case"multi-select":return n.jsx(XC,{item:e});case"tree-select":return n.jsx(eS,{item:e});case"text-input":return n.jsx(HC,{item:e});case"checkbox":return n.jsx(QC,{item:e});case"context":return n.jsx(WC,{item:e});default:return null}},rS=T.observer(({conf:e})=>{const r=J().dashboardState,{all:a,keys:l}=e;return a?n.jsxs(n.Fragment,{children:[Object.entries(r.context).map(([o,i])=>n.jsx(Wr,{item:i},o)),Object.entries(r.filters).map(([o,i])=>n.jsx(Wr,{item:i},o))]}):n.jsx(n.Fragment,{children:l.map(o=>{const i=y.get(r,o);return i?n.jsx(Wr,{item:i},o):null})})}),aS=T.observer(({context:e})=>{const{value:t}=B(e.instanceData,"config"),{width:r,height:a}=e.viewport;return t?n.jsx(s.Group,{justify:"flex-start",align:"flex-start",wrap:"wrap",px:0,py:0,gap:"xs",w:r,mah:a,style:{overflow:"auto"},"data-enable-scrollbar":!0,children:n.jsx(rS,{conf:t})}):null}),So={all:!0,keys:[]},sS={select:"filter.widget.names.select","multi-select":"filter.widget.names.multi_select","tree-select":"filter.widget.names.tree_select","tree-single-select":"filter.widget.names.tree_single_select","text-input":"filter.widget.names.text_input",checkbox:"filter.widget.names.checkbox","date-range":"filter.widget.names.date_range"},lS=({option:e,checked:t,...r})=>{const{t:a}=x.useTranslation(),l=e,o=l.type==="filter";return n.jsxs(s.Group,{gap:4,flex:1,children:[n.jsx(S.IconCheck,{size:14,opacity:t?1:0,color:"black"}),n.jsx(s.Stack,{gap:0,py:4,px:8,flex:1,styles:{root:{flexGrow:1,borderRadius:"4px"}},...r,children:n.jsxs(s.Group,{justify:"space-between",wrap:"nowrap",children:[n.jsx(s.Text,{size:"xs",children:e.label}),o&&n.jsx(s.Text,{size:"xs",c:t?"rgba(0,0,0,.8)":"dimmed",style:{flexShrink:0,flexGrow:0},children:a(sS[l.widget])})]})})]})},oS=T.observer(({value:e,onChange:t,disabled:r})=>{const{t:a}=x.useTranslation(),o=F().dashboardStateVariableOptions,i=h.useMemo(()=>{const{optionGroups:c,validValues:d}=o,u=c.map(f=>({group:a(f.group),items:f.items.map(v=>({...v,label:v.label,value:v.value,widget_label:v.label}))})),p=e.filter(f=>!d.has(f)).map(f=>({label:f,value:f,disabled:!0}));return p.length>0&&u.push({group:a("common.invalid"),items:p}),u},[o,a,e]);return n.jsx(s.MultiSelect,{size:"xs",label:a("viz.vizDashboardState.variable_selector.label"),placeholder:e.length===0?a("viz.vizDashboardState.variable_selector.placeholder"):void 0,data:i,renderOption:lS,maxDropdownHeight:600,value:e,onChange:t,disabled:r,clearable:!0})}),iS=({form:e})=>{const{t}=x.useTranslation(),r=e.watch("all");return n.jsxs(s.Stack,{gap:"xs",p:"xs",children:[n.jsx(b.Controller,{name:"all",control:e.control,render:({field:a})=>n.jsx(s.Checkbox,{size:"xs",label:t("viz.vizDashboardState.show_all"),checked:a.value,onChange:l=>a.onChange(l.currentTarget.checked)})}),n.jsx(b.Controller,{name:"keys",control:e.control,render:({field:a})=>n.jsx(oS,{disabled:r,...a})})]})};function cS({context:e}){const{value:t,set:r}=B(e.instanceData,"config"),a=h.useMemo(()=>y.defaultsDeep({},t,So),[t]),l=b.useForm({defaultValues:a}),{handleSubmit:o,formState:i,reset:c}=l;return h.useEffect(()=>{c(a)},[a]),n.jsxs("form",{onSubmit:o(r),children:[n.jsx(ae,{canSubmit:i.isDirty}),n.jsx(iS,{form:l})]})}const dS=[{lang:"en",resources:{vizDashboardState:{viz_name:"Dashboard State",show_all:"Show all filters and context entries",variable_selector:{label:"Select filters and context entries to show",placeholder:""}}}},{lang:"zh",resources:{vizDashboardState:{viz_name:"看板状态",show_all:"显示所有筛选器和上下文条目",variable_selector:{label:"选择要展示的筛选器和上下文",placeholder:""}}}}];class uS extends ee{constructor(){super(...arguments);P(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const pS={displayName:"viz.vizDashboardState.viz_name",displayGroup:"chart.groups.others",migrator:new uS,name:"vizDashboardState",viewRender:aS,configRender:cS,createConfig:()=>({version:1,config:So}),translation:dS},hS=[{value:"#25262B",name:"Dark"},{value:"#868E96",name:"Gray"},{value:"#FA5252",name:"Red"},{value:"#E64980",name:"Pink"},{value:"#BE4BDB",name:"Grape"},{value:"#7950F2",name:"Violet"},{value:"#4C6EF5",name:"Indigo"},{value:"#228BE6",name:"Blue"},{value:"#15AABF",name:"Cyan"},{value:"#12B886",name:"Teal"},{value:"#40C057",name:"Green"},{value:"#82C91E",name:"Lime"},{value:"#FAB005",name:"Yellow"},{value:"#FD7E14",name:"Orange"}].map(e=>({name:e.name,value:e.value,type:"single",category:"basic"})),gS=[eu,tu,au,ru,nu,su],Ur=[$r,Mw,Jm,ux,Hw,l_,C1,$p,Fg,Jb,Gy,L0,kv,Pb,uw,P_,lx,l0,rC,FC,fC,ef,pS],To=Ur.reduce((e,t)=>(e[t.name]={displayName:t.displayName,displayGroup:t.displayGroup},e),{}),ko=()=>({id:"dashboard",version:Cs,manifest:{viz:Ur,color:[...hS,...gS]}}),Ct=new uu,R={pluginManager:Je("pluginManager"),vizManager:Je("vizManager"),colorManager:Je("colorManager"),panelAddonManager:Je("panelAddonManager"),instanceScope:{panelModel:Je("panelModel"),vizInstance:Je("vizInstance"),interactionManager:Je("interactionManager"),migrator:Je("migrator"),operationManager:Je("operationManager"),triggerManager:Je("triggerManager")}},Yr=()=>{try{Ct.install(ko())}catch{}const e=new Jd(Ct),t=new du(Ct),r=new ou(Ct);return{pluginManager:Ct,vizManager:e,colorManager:t,panelAddonManager:r}},rt=h.createContext(Yr());try{Ct.install(ko())}catch{}const wn=Se.createInstance({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:Kd,zh:Xd}}).use(ed).use(x.initReactI18next);wn.init(),Ur.forEach(e=>{var t;(t=e.translation)==null||t.forEach(r=>{wn.addResourceBundle(r.lang,"translation",{viz:r.resources},!0,!0)})});function zo({lang:e,children:t}){return h.useEffect(()=>{wn.changeLanguage(e)},[e]),n.jsx(x.I18nextProvider,{i18n:wn,children:t})}M.extend(id),M.extend(cd),M.extend(dd),M.extend(ud),M.extend(pd),M.extend(hd),M.extend(gd),M.extend(fd),M.extend(bd),M.extend(yd),M.extend(xd),M.extend(wd),M.extend(md),M.extend(Cd),M.extend(Sd),M.extend(vd),M.extend(_d),M.extend(Td),M.extend(kd),M.extend(zd),M.extend(Dd),M.extend(Id),M.extend(Md),M.extend(Ad),M.extend(Pd),M.extend(Vd),M.extend($d),M.extend(Ed),M.extend(Bd),M.extend(Ld),M.extend(Od),M.extend(Nd),M.extend(qd),M.tz.setDefault("UTC"),M.updateLocale("en",{weekStart:1});function fS(e){e=e||{};const t=Object.keys(e).sort(),r=[];for(let a=0;a<t.length;a++){const l=t[a];if(l!="authentication"&&e[l])r.push(t[a]+"="+(typeof e[l]=="object"?JSON.stringify(e[l]):e[l]));else{const o=Object.keys(e[l]).sort();for(let i=0;i<o.length;i++){const c=o[i];c!="sign"&&e[l][c]&&r.push(o[i]+"="+(typeof e[l][c]=="object"?JSON.stringify(e[l][c]):e[l][c]))}}}return r.sort().join("&")}function bS(e,t){let r=fS(e);return r+="&key="+t,Ud.MD5(r).toString().toUpperCase()}class Do{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(t){if(!this.app_id||!this.app_secret)return;const r=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:r,sign:bS({app_id:this.app_id,nonce_str:r,...t},this.app_secret)}}getRequest(t,r){return(a,l,o,i)=>{const c=this.buildHeader(o),d=this.buildAxiosConfig(t,a,l,o,c,r);return ke(d).then(u=>i?u:u.data).catch(u=>{if(ke.isCancel(u))return Promise.reject(u);const p=u,f=y.get(p,"response.data.detail.message",p.message);return Promise.reject(new Error(f))})}}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}buildAxiosConfig(t,r,a,l,o,i){const c={baseURL:this.baseURL,method:t,url:r,params:t==="GET"?a:l.params,headers:o,signal:i};return["POST","PUT"].includes(t)&&(c.data=l.string?JSON.stringify(a):a,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(t){const r=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":t.string?"application/x-www-form-urlencoded":"application/json",authorization:r?`bearer ${r}`:"",...t.headers}}}class yS{constructor(t){this.implementation=t}getRequest(t,r){return this.implementation.getRequest(t,r)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}class Io extends Do{constructor(){super(...arguments);P(this,"makeQueryENV",null)}query(r){return async(a,l={})=>{var o;return a.env||(a.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.post(r)("/query",a,l)}}httpDataSourceQuery(r){return async(a,l={})=>{var o;return a.env||(a.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",r)("/query",a,l,!0)}}structure(r){return async(a,l={})=>this.post(r)("/query/structure",a,l)}mericoMetricInfo(r){return async(a,l={})=>this.post(r)("/query/merico_metric_info",a,l,!0)}mericoMetricQuery(r){return async(a,l={})=>this.post(r)("/query",a,l,!0)}}class Mo{constructor(t){this.implementation=t}query(t){return this.implementation.query(t)}httpDataSourceQuery(t){return this.implementation.httpDataSourceQuery(t)}structure(t){return this.implementation.structure(t)}mericoMetricInfo(t){return this.implementation.mericoMetricInfo(t)}mericoMetricQuery(t){return this.implementation.mericoMetricQuery(t)}getRequest(t,r){return this.implementation.getRequest(t,r)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}const Et=new Io;function Kr(e){Et.baseURL!==e.apiBaseURL&&(Et.baseURL=e.apiBaseURL),e.app_id&&(Et.app_id=e.app_id),e.app_secret&&(Et.app_secret=e.app_secret),e.makeQueryENV&&(Et.makeQueryENV=e.makeQueryENV)}const Ao=new Mo(Et),Ae=Ao,Xr=g.types.model("MockContextMeta",{current:g.types.optional(g.types.frozen(),{})}).views(e=>({get keys(){return Object.keys(e.current)},get keySet(){return new Set(this.keys)},get entries(){return Object.entries(e.current)}})).actions(e=>({replace(t){e.current=t},defaults(t){e.current={...t,...e.current}},get(t){return e.current[t]},set(t,r){e.current[t]=r}}));function Zr(e){return{current:e}}const vS=g.types.model("PanelStyleBorderMeta",{enabled:g.types.boolean}).views(e=>({get json(){const{enabled:t}=e;return{enabled:t}}})).actions(e=>({setEnabled(t){e.enabled=t}})),Po=g.types.model("PanelStyleMeta",{border:vS}).views(e=>({get json(){const{border:t}=e;return{border:t.json}}})).actions(e=>({})),Vo=g.types.model("PanelTitleMeta",{show:g.types.optional(g.types.boolean,!0)}).views(e=>({get json(){const{show:t}=e;return{show:t}}})).actions(e=>({setShow(t){e.show=t}})),$o=g.types.model("VariableMeta",{name:g.types.string,size:g.types.string,weight:g.types.string,color:g.types.union(g.types.model({type:g.types.literal("static"),staticColor:g.types.string}),g.types.model({type:g.types.literal("continuous"),valueRange:g.types.array(g.types.number),colorRange:g.types.array(g.types.string)}),g.types.model({type:g.types.literal("piecewise")})),formatter:g.types.model({output:g.types.enumeration("Output",["number","percent"]),average:g.types.optional(g.types.boolean,!1),mantissa:g.types.number,trimMantissa:g.types.optional(g.types.boolean,!1),absolute:g.types.optional(g.types.boolean,!1)}),data_field:g.types.string,aggregation:g.types.union(g.types.model({type:g.types.enumeration(["none","sum","mean","median","min","max","CV","std"]),config:g.types.frozen(),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("quantile"),config:g.types.model({p:g.types.number}),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("pick_record"),config:g.types.model({method:g.types.enumeration("Pick Record Method",["first","last"])}),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("custom"),config:g.types.model({func:g.types.string}),fallback:g.types.optional(g.types.string,"0")}))}).views(e=>({get json(){const{name:t,size:r,weight:a,color:l,formatter:o,data_field:i,aggregation:c}=e;return y.cloneDeep({name:t,size:r,color:l,weight:a,formatter:o,data_field:i,aggregation:c})}})),Eo=g.types.model("PanelVizMeta",{type:g.types.string,conf:g.types.frozen()}).views(e=>({get json(){return{conf:e.conf,type:e.type}}})).actions(e=>({setType(t){e.type=t},setConf(t){y.isEqual(e.conf,t)||(e.conf=t)}})),Bo=g.types.model({id:g.types.string,name:g.types.optional(g.types.string,""),title:Vo,description:g.types.string,queryIDs:g.types.array(g.types.string),viz:Eo,style:Po,variables:g.types.optional(g.types.array($o),[])}).views(e=>({get json(){const{id:t,name:r,title:a,description:l,queryIDs:o}=e;return{id:t,viz:e.viz.json,name:r,style:e.style.json,title:a.json,queryIDs:[...o],variables:e.variables.map(i=>i.json),description:l}},get queryIDSet(){return new Set(e.queryIDs)}})).actions(e=>({setID(t){e.id=t},setName(t){e.name=t},setDescription(t){e.description=t},addQueryID(t){e.queryIDSet.has(t)||e.queryIDs.push(t)},removeQueryID(t){if(!e.queryIDSet.has(t))return;const r=new Set(e.queryIDSet);r.delete(t),e.queryIDs=g.cast(Array.from(r))},setQueryIDs(t){e.queryIDs=g.cast(t)},addVariable(t){e.variables.push(t)},removeVariable(t){e.variables.remove(t)}}));var j=(e=>(e.Postgresql="postgresql",e.MySQL="mysql",e.HTTP="http",e.Transform="transform",e.MericoMetricSystem="merico_metric_system",e))(j||{});const Lo=g.types.model("DBQueryMeta",{_type:g.types.enumeration([j.MySQL,j.Postgresql]),sql:g.types.string}).views(e=>({get base(){return g.getParent(e)},get valid(){return!!e.sql},get json(){const{sql:t,_type:r}=e;return{sql:t,_type:r}}})).actions(e=>({setSQL(t){e.sql=t}})),_S=e=>Lo.create({_type:e,sql:""}),qo=g.types.model("HTTPQueryMeta",{_type:g.types.literal(j.HTTP),react_to:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){return!0},get json(){const{react_to:t,_type:r}=e;return tt({react_to:t,_type:r})}})).actions(e=>({setReactTo(t){e.react_to.length=0,e.react_to.push(...t)}})),xS=()=>qo.create({_type:j.HTTP,react_to:[]}),Oo=g.types.model("TransformQueryMeta",{_type:g.types.literal(j.Transform),dep_query_ids:g.types.optional(g.types.array(g.types.string),[]),react_to:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){return e.dep_query_ids.length>0},get json(){const{dep_query_ids:t,_type:r,react_to:a}=e;return tt({dep_query_ids:t,_type:r,react_to:a})}})).actions(e=>({setDependantQueryIDs(t){e.dep_query_ids.length=0,e.dep_query_ids.push(...t)},setReactTo(t){e.react_to.length=0,e.react_to.push(...t)}})),wS=()=>Oo.create({_type:j.Transform,dep_query_ids:[]}),No=g.types.model("MetricFilterColMeta",{dimension:g.types.optional(g.types.string,""),variable:g.types.optional(g.types.string,"")}).views(e=>({get allEmpty(){return!e.dimension&&!e.variable},get json(){const{dimension:t,variable:r}=e;return{dimension:t,variable:r}}})).actions(e=>({removeSelf(){g.getParent(e,2).removeFilter(e)},setDimension(t){e.dimension=t??"",e.allEmpty&&this.removeSelf()},setVariable(t){e.variable=t??"",e.allEmpty&&this.removeSelf()}})),Jr=g.types.model("MericoMetricQueryMeta",{_type:g.types.literal(j.MericoMetricSystem),id:g.types.optional(g.types.string,""),type:g.types.optional(g.types.enumeration("MetricType",["derived","combined"]),"derived"),filters:g.types.optional(g.types.array(No),[]),groupBys:g.types.optional(g.types.array(g.types.string),[]),timeQuery:g.types.model({enabled:g.types.optional(g.types.boolean,!1),range_variable:g.types.optional(g.types.string,""),unit_variable:g.types.optional(g.types.string,""),timezone:g.types.optional(g.types.string,"PRC"),stepKeyFormat:g.types.optional(g.types.string,"YYYY-MM-DD")}),useDefaultValues:g.types.optional(g.types.boolean,!1)}).views(e=>({get query(){return g.getParent(e)},get valid(){return!!e.id},get json(){const{id:t,type:r,filters:a,groupBys:l,timeQuery:o,_type:i}=e;return tt({id:t,type:r,filters:a.map(c=>c.json),groupBys:l,timeQuery:o,_type:i})},get usedFilterDimensionKeys(){const t=e.filters.map(r=>r.dimension).filter(r=>!!r);return new Set(t)},get usedFilterVariableSet(){const t=[...e.filters.map(r=>r.variable)].filter(r=>!!r);return new Set(t)},get usedTimeQueryVariableSet(){const t=[e.timeQuery.range_variable,e.timeQuery.unit_variable].filter(r=>!!r);return new Set(t)},get groupByValues(){const t=e.groupBys.map(r=>r.replace(/^(.+)\s->\s(.*)/,"$1"));return Array.from(new Set(t))}})).actions(e=>({reset(){e.filters.length=0,e.groupBys.length=0,e.timeQuery.enabled=!1,e.timeQuery.range_variable="",e.timeQuery.unit_variable="",e.useDefaultValues=!1,"data"in e.query&&(e.query.setData([]),e.query.setError(null))},setID(t){t!==e.id&&this.reset(),e.id=t},setType(t){t!=="derived"&&t!=="combined"||(e.type=t)},addFilter(t,r){t&&e.usedFilterDimensionKeys.has(t)||e.filters.push(No.create({dimension:t,variable:r}))},removeFilter(t){g.destroy(t)},setGroupBys(t){e.groupBys.length=0,e.groupBys.push(...t)},setRangeVariable(t){e.timeQuery.range_variable=t??""},setUnitVariable(t){e.timeQuery.unit_variable=t??""},setTimeQueryEnabled(t){e.timeQuery.enabled=t,t?e.groupBys.length>1&&(e.groupBys.length=0):(e.timeQuery.range_variable="",e.timeQuery.unit_variable="")},setUseDefaultValues(t){e.useDefaultValues=t}})),Go=()=>Jr.create({_type:j.MericoMetricSystem,id:"",type:"derived",filters:[],groupBys:[],timeQuery:{range_variable:"",unit_variable:"",timezone:"PRC",stepKeyFormat:"YYYY-MM-DD"},useDefaultValues:!1}),Fo=g.types.model("QueryMeta",{id:g.types.string,name:g.types.string,key:g.types.string,type:g.types.enumeration("DataSourceType",[j.Postgresql,j.MySQL,j.HTTP,j.Transform,j.MericoMetricSystem]),config:g.types.union(Lo,qo,Oo,Jr),pre_process:g.types.optional(g.types.string,""),post_process:g.types.optional(g.types.string,""),run_by:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){const{id:t,name:r,key:a,type:l,config:o}=e;return o.valid&&!!t&&!!r&&!!a&&!!l},get json(){const{id:t,name:r,key:a,type:l,config:o,pre_process:i,post_process:c,run_by:d}=e;return tt({id:t,name:r,key:a,type:l,config:o.json,pre_process:i,post_process:c,run_by:d})}})).actions(e=>({setName(t){e.name=t},setKey(t){e.key=t},setType(t){switch(e.type=t,t){case j.HTTP:e.config=xS();break;case j.MySQL:case j.Postgresql:e.config=_S(t);break;case j.Transform:e.config=wS();break;case j.MericoMetricSystem:e.config=Go();break;default:throw new Error(`Unexpected query type[${t}]`)}},setRunBy(t){e.run_by.length=0,e.run_by.push(...t)},setPreProcess(t){e.pre_process=t},setPostProcess(t){e.post_process=t}})),jo=g.types.model("LayoutItemMeta",{id:g.types.identifier,panelID:g.types.string,x:g.types.number,y:g.types.maybeNull(g.types.number),w:g.types.number,h:g.types.number,moved:g.types.optional(g.types.boolean,!1),static:g.types.optional(g.types.boolean,!1)}).views(e=>({get json(){const{id:t,panelID:r,x:a,y:l,w:o,h:i,moved:c}=e;return{h:i,w:o,x:a,y:l===null?0:l,id:t,moved:c,static:e.static,panelID:r}},get contentModel(){return g.getRoot(e).content},get panel(){const{panelID:t}=e;return this.contentModel.panels.findByID(t)},get layoutProperies(){const{id:t,x:r,y:a,w:l,h:o,moved:i}=e;return{id:t,i:t,x:r,y:a===null?1/0:a,w:l,h:o,moved:i,static:e.static}}})).actions(e=>({set(t){const{isDraggable:r,x:a,y:l,w:o,h:i,moved:c}=t;e.x=a,e.y=l,e.w=o,e.h=i,e.moved=!!c,e.static=!!t.static},setWidth(t){e.w=t},setHeight(t){e.h=t}})),Qo=g.types.model("LayoutSetMeta",{id:g.types.identifier,name:g.types.string,breakpoint:g.types.number,list:g.types.optional(g.types.array(jo),[])}).views(e=>({get contentModel(){return g.getRoot(e).content},get json(){const{id:t,name:r,breakpoint:a,list:l}=e;return{id:t,name:r,breakpoint:a,list:l.map(o=>tt(o.json))}},jsonByPanelIDSet(t){const{id:r,name:a,breakpoint:l,list:o}=e;return{id:r,name:a,breakpoint:l,list:o.filter(i=>t.has(i.panelID)).map(i=>tt(i.json))}},findByID(t){return e.list.find(r=>r.id===t)},findByPanelID(t){return e.list.find(r=>r.panelID===t)}})).actions(e=>({setName(t){e.name=t},setBreakpoint(t){e.breakpoint=t},addLayout(t){e.list.push(t)},addNewLayout(t){e.list.push({id:Ke.v4(),panelID:t,x:0,y:1/0,w:18,h:300,static:!1,moved:!1})},removeByPanelID(t){const r=e.list.findIndex(a=>a.panelID===t);r>=0&&e.list.splice(r,1)},removeByPanelIDs(t){for(;t.length>0;){const r=t.pop();r&&this.removeByPanelID(r)}},updateLayoutItem(t){const r=e.list.find(a=>a.id===t.i);if(!r){console.error("Trying to update a layout that doesn't exist"),console.log({strangeLayoutItem:t});return}r.set(t)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>{const t=e.list.length,r=e.contentModel.panels.list.length;return{match:t===r,layoutCount:t,panelCount:r}},({match:t,panelCount:r,layoutCount:a})=>{if(t)return;const l={id:"layout panel count mismatch",title:"Error detected, please don't save changes.",message:`${a} layout items against and ${r} panels.`,color:"red",autoClose:!1};Ze.showNotification(l),Ze.updateNotification(l)},{fireImmediately:!0,delay:0}))}})),Wo=g.types.model("SQLSnippetMeta",{key:g.types.string,value:g.types.string}).views(e=>({get json(){const{key:t,value:r}=e;return{key:t,value:r}}})).actions(e=>({setKey(t){e.key=t},setValue(t){e.value=t}}));var V=(e=>(e.Select="select",e.MultiSelect="multi-select",e.TreeSelect="tree-select",e.TreeSingleSelect="tree-single-select",e.TextInput="text-input",e.Checkbox="checkbox",e.DateRange="date-range",e))(V||{});const Hr=g.types.optional(g.types.enumeration(["intersect","reset"]),"intersect"),Rr=g.types.model("FilterCheckboxConfigMeta",{_name:g.types.literal("checkbox"),description:g.types.optional(g.types.string,""),default_value:g.types.boolean}).views(e=>({get json(){const{_name:t,description:r,default_value:a}=e;return{_name:t,description:r,default_value:a}},get isDescriptionEmpty(){const{description:t}=e;return t===""||t==="<p></p>"}})).actions(e=>({setDefaultValue(t){e.default_value=t},setDescription(t){e.description=t}})),Uo=()=>Rr.create({_name:"checkbox",description:"",default_value:!1}),Yo=()=>[{key:"d",value:"yesterday",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"yesterday"}}},{key:"w",value:"last week",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"week").startOf("week").toDate(),M(e).subtract(1,"week").endOf("week").toDate()],shortcut:"last week"}}},{key:"m",value:"last month",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last month"}}},{key:"m2",value:"last 2 months",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(2,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last 2 months"}}},{key:"m3",value:"last 3 months",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(3,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last 3 months"}}},{key:"y",value:"last year",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"year").startOf("year").toDate(),M(e).subtract(1,"year").endOf("year").toDate()],shortcut:"last year"}}},{key:"d7",value:"recent 7 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(7,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 7 days"}}},{key:"d30",value:"recent 30 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(30,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 30 days"}}},{key:"d60",value:"recent 60 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(60,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 60 days"}}},{key:"d90",value:"recent 90 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(90,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 90 days"}}},{key:"d180",value:"recent 180 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(180,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 180 days"}}},{key:"d365",value:"recent 365 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(365,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 365 days"}}},{key:"d",value:"today",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("day").toDate(),M(e).endOf("day").toDate()],shortcut:"today"}}},{key:"w",value:"this week",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("week").toDate(),M(e).endOf("week").toDate()],shortcut:"this week"}}},{key:"m",value:"this month",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("month").toDate(),M(e).endOf("month").toDate()],shortcut:"this month"}}},{key:"y",value:"this year",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("year").toDate(),M(e).endOf("year").toDate()],shortcut:"this year"}}},{key:"w",value:"this week so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("week").toDate(),M(e).toDate()],shortcut:"this week so far"}}},{key:"m",value:"this month so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("month").toDate(),M(e).toDate()],shortcut:"this month so far"}}},{key:"y",value:"this year so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("year").toDate(),M(e).toDate()],shortcut:"this year so far"}}}];function ea(e){if(!e)return null;const r=Yo().find(a=>a.value===e);return r?r.getRange():null}function Ko(){return y.groupBy(Yo(),"group")}function Xo(e){try{if(e.default_shortcut){const r=ea(e.default_shortcut);if(r)return{value:r.value.map(a=>M(a).toDate()),shortcut:e.default_shortcut}}return{value:e.default_value.map(r=>r===null?r:M.tz(r,"UTC").toDate()??r),shortcut:null}}catch(t){return console.error(t),{value:[null,null],shortcut:null}}}function Zo(e,t){return e.map(r=>{try{return r?M.tz(r,"UTC").toISOString():null}catch{return console.log(`[date-range] failed parsing ${r}`),null}})}const mS=g.types.model("FilterDateRangeConfigMeta",{_name:g.types.literal("date-range"),required:g.types.boolean,inputFormat:g.types.enumeration("DateRangeInputFormat",["YYYY","YYYYMM","YYYYMMDD","YYYY-MM","YYYY-MM-DD"]),default_value:g.types.optional(g.types.array(g.types.union(g.types.Date,g.types.null)),[null,null]),default_shortcut:g.types.optional(g.types.string,""),clearable:g.types.boolean,max_days:g.types.optional(g.types.number,0),allowSingleDateInRange:g.types.optional(g.types.boolean,!1)}).views(e=>({get json(){const{_name:t,max_days:r,required:a,clearable:l,inputFormat:o,default_value:i,default_shortcut:c,allowSingleDateInRange:d}=e;return{_name:t,max_days:r,required:a,clearable:l,inputFormat:o,default_value:Zo(i),default_shortcut:c,allowSingleDateInRange:d}},truthy(t){try{const{value:r}=t;return Array.isArray(r)&&r.length===2&&r.every(a=>!!a)}catch(r){return console.error(r),!1}},get filter(){return g.getParent(e)},get dateStringsValue(){try{const t=this.filter.value,[r,a]=t.value,l=r?M(r).format(e.inputFormat):"",o=a?M(a).format(e.inputFormat):"";return[l,o]}catch(t){return console.error(t),["",""]}}})).actions(e=>({setFilterValue(t){try{e.filter.setValue(t)}catch(r){console.error(r)}}})).actions(e=>({setRequired(t){e.required=t},setClearable(t){e.clearable=t},setInputFormat(t){t&&(e.inputFormat=t)},setDefaultValue(t){e.default_value.length=0,e.default_value.push(...t.value),e.setFilterValue(t)},setDefaultShortcut(t){if(e.default_shortcut=t??"",!t)return;const r=ea(e.default_shortcut);r&&e.setFilterValue(r)},setMaxDays(t){const r=Number(t);Number.isFinite(r)&&(e.max_days=r,r>0&&(e.clearable=!0))},setAllowSingleDateInRange(t){e.allowSingleDateInRange=t}})),ta=g.types.snapshotProcessor(mS,{preProcessor({default_value:e,...t}){return{...t,default_value:e.map(r=>r===null?null:M.tz(r,"UTC").toDate())}},postProcessor(e){const{default_value:t,...r}=e;return{...r,default_value:Zo(t,r.inputFormat)}}}),Jo=()=>ta.create({_name:"date-range",required:!1,inputFormat:"YYYY-MM-DD",clearable:!1,default_value:[null,null]}),Ho=g.types.model({label:g.types.string,value:g.types.string}).actions(e=>({setLabel(t){e.label=t},setValue(t){e.value=t}})),na=g.types.model("FilterConfigModel_BaseSelect",{static_options:g.types.optional(g.types.array(Ho),[]),options_query_id:g.types.optional(g.types.string,""),default_selection_count:g.types.optional(g.types.number,0),required:g.types.optional(g.types.boolean,!1)}).views(e=>({get contentModel(){return g.getRoot(e).content},get filter(){return g.getParent(e)},get usingQuery(){return!!e.options_query_id}})).views(e=>({get optionsLoading(){if(!e.usingQuery)return!1;const{state:t}=e.contentModel.getDataStuffByID(e.options_query_id);return t==="loading"},get options(){if(!e.usingQuery)return e.static_options;const{data:t,state:r}=e.contentModel.getDataStuffByID(e.options_query_id);return r==="error"?[]:Array.isArray(t)?t.filter(a=>"label"in a&&"value"in a):[]},get optionValuesSet(){return new Set(this.options.map(t=>t.value))}})).actions(e=>({setRequired(t){e.required=t},addStaticOption(t){e.static_options.push(t)},removeStaticOption(t){e.static_options.splice(t,1)},replaceStaticOptions(t){e.static_options.forEach(a=>g.detach(a));const r=t.map(a=>Ho.create(a));e.static_options.replace(r)},setDefaultSelectionCount(t){const r=Number(t);Number.isFinite(r)&&(e.default_selection_count=r)},setOptionsQueryID(t){e.options_query_id=t??""}})),ra=g.types.compose("FilterMultiSelectConfigMeta",g.types.model({_name:g.types.literal("multi-select"),min_width:g.types.optional(g.types.string,""),default_value:g.types.optional(g.types.array(g.types.string),[]),default_value_mode:Hr}),na).views(e=>({get json(){const{_name:t,default_value:r,default_value_mode:a,required:l,min_width:o,static_options:i,options_query_id:c,default_selection_count:d}=e;return tt({_name:t,required:!!l,min_width:o,default_value:r,static_options:i,options_query_id:c,default_value_mode:a,default_selection_count:d})},get defaultSelection(){const t=e.filter.formattedDefaultValue;return Array.isArray(t)&&t.length>0||!e.usingQuery?t:e.options.slice(0,e.default_selection_count).map(r=>r.value)},optionsByValues(t){if(!Array.isArray(t)||t.length===0)return[];const r=new Set(t);return e.options.filter(a=>r.has(a.value))},initialSelection(t){return t||this.defaultSelection},truthy(t){return Array.isArray(t)&&t.length>0}})).actions(e=>({setDefaultValue(t){e.default_value=g.cast(t)},setDefaultValueMode(t){t!=="intersect"&&t!=="reset"||(e.default_value_mode=t)},setMinWidth(t){e.min_width=t},applyDefaultSelection(){if(e.optionsLoading)return;if(e.default_value_mode==="reset"){e.filter.setValue(e.defaultSelection);return}const t=new Set(e.options.map(l=>l.value)),a=(e.filter.value??[]).filter(l=>t.has(l));a.length>0?e.filter.setValue(a):e.filter.setValue(e.defaultSelection)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>Q.toJS(e.defaultSelection),e.applyDefaultSelection,{fireImmediately:!1,delay:0}))}})),Ro=()=>ra.create({_name:"multi-select",default_value:[],static_options:[],options_query_id:"",default_selection_count:0}),aa=g.types.compose("FilterConfigModel_Select",g.types.model({_name:g.types.literal("select"),default_value:g.types.string,width:g.types.optional(g.types.string,""),clearable:g.types.optional(g.types.boolean,!1)}),na).views(e=>({get json(){const{_name:t,clearable:r,default_value:a,required:l,width:o,static_options:i,options_query_id:c,default_selection_count:d}=e;return tt({_name:t,width:o,required:l,clearable:r,default_value:a,static_options:i,options_query_id:c,default_selection_count:d})},truthy(t){return!!t},getSelectOption(t){return e.options.find(r=>r.value===t)},get default_selection(){return e.usingQuery?e.default_selection_count>0&&e.options.length>0?e.options[0].value:"":e.filter.formattedDefaultValue}})).actions(e=>({setDefaultValue(t){t!==null&&(e.default_value=t)},setWidth(t){e.width=t},setClearable(t){e.clearable=t},setDefaultSelection(){var a;const t=e.filter.value,r=(a=e.options.find(l=>l.value===t))==null?void 0:a.value;r?e.filter.setValue(r):e.filter.setValue(e.default_selection)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>Q.toJS(e.default_selection),e.setDefaultSelection,{fireImmediately:!1,delay:0}))}})),ei=()=>aa.create({_name:"select",required:!1,default_value:"",static_options:[],options_query_id:"",default_selection_count:0}),sa=g.types.model("FilterTextInputConfigMeta",{_name:g.types.literal("text-input"),required:g.types.boolean,default_value:g.types.string}).views(e=>({get json(){const{_name:t,required:r,default_value:a}=e;return{_name:t,required:r,default_value:a}},truthy(t){return typeof t!="string"?!1:!!t.trim()}})).actions(e=>({setRequired(t){e.required=t},setDefaultValue(t){e.default_value=t}})),la=()=>sa.create({_name:"text-input",required:!1,default_value:""}),CS=`
|
|
530
|
+
`}})}function PC(e,t,r){const{overflow:a,rotate:l}=e.x_axis.axisLabel,o=Be(a.on_axis);return X.getXAxis({id:"main-x-axis",type:"category",data:t,name:e.x_axis.name??"",align:"center",axisTick:{show:!0,alignWithLabel:!0},axisLabel:{rotate:l,...o,formatter:r},splitArea:{show:!1,areaStyle:{color:"#E7E7E9"}},splitLine:{show:!1},nameLocation:"center",nameGap:25,nameTextStyle:{fontWeight:"bold",align:"center"},z:3})}function VC(e,t){const{nameAlignment:r,data_key:a,...l}=e.y_axis,{overflow:o,rotate:i}=e.y_axis.axisLabel,c=Be(o.on_axis);return X.getYAxis({...l,type:"category",axisLabel:{rotate:i,...c,formatter:t},axisLine:{show:!0,lineStyle:{width:3}},axisTick:{show:!0,alignWithLabel:!0},splitArea:{show:!1,areaStyle:{color:"#E7E7E9"}},splitLine:{show:!1},nameTextStyle:{fontWeight:"bold",align:r},nameLocation:"end",nameGap:15,z:3})}function $C(e,t,r){if(!e.x_axis.data_key||!e.y_axis.data_key||!e.heat_block.data_key)return{};const a=r.reduce((m,k)=>{const z=Re(k,t);return m[k.name]=$e(k,z),m},{}),l=TC(e),o=kC(e),i=tn(e.visualMap,a),{min:c,max:d}=i,u=A(e.x_axis.data_key),p=A(e.y_axis.data_key),f=A(e.heat_block.data_key),v=y.uniq(t[u.queryID].map(m=>m[u.columnKey])),_=t[u.queryID].map(m=>{const k=y.get(m,u.columnKey),z=y.get(m,p.columnKey),D=y.get(m,f.columnKey),I={value:[k,z,D]},{followVisualMap:L,color:E}=Rn(D,c,d,e.visualMap);return L||(I.visualMap=!1,I.itemStyle={color:E}),I});return{xAxis:PC(e,v,l.x_axis),yAxis:VC(e,l.y_axis),series:DC(e,_),tooltip:AC(e,t,l,o),grid:zC(e),visualMap:i}}function EC({conf:e,data:t,width:r,height:a,interactionManager:l,variables:o,instance:i}){const c=h.useMemo(()=>{const w=A(e.x_axis.data_key),m=A(e.y_axis.data_key);return y.keyBy(t[w.queryID],k=>`${k[w.columnKey]}---${k[m.columnKey]}`)},[t,e.x_axis.data_key,e.y_axis.data_key]),d=Ie(l.triggerManager,mo.id),u=h.useCallback(w=>{const[m,k]=w.value,z=y.get(c,`${m}---${k}`,{error:"rowData is not found"});d.forEach(D=>{l.runInteraction(D.id,{...w,rowData:z})})},[c,d,l]),p=h.useRef(null),f=h.useCallback(()=>{var m;const w=(m=p.current)==null?void 0:m.getEchartsInstance();w&&de(i,w.getOption())},[i]),v=h.useMemo(()=>({click:u,finished:f}),[u,f]),_=h.useMemo(()=>$C(e,t,o),[e,t]);return n.jsx(he,{echarts:ce,option:_,ref:p,style:{width:r,height:a},onEvents:v,notMerge:!0,theme:"merico-light"})}function BC({context:e,instance:t}){const r=Me({vizManager:e.vizManager,instance:t}),{value:a}=B(e.instanceData,"config"),{variables:l}=e,o=h.useMemo(()=>y.defaults({},a,jr),[a]),i=e.data,{width:c,height:d}=e.viewport;return!c||!d?null:n.jsx(_e,{width:c,height:d,children:n.jsx(EC,{instance:t,variables:l,width:Ge(c),height:Fe(d),data:i,conf:o,interactionManager:r})})}const LC=[{lang:"en",resources:{merico_heatmap:{viz_name:"Merico Heatmap",click_heatmap:{heatblock:{label:"Click heat block"}}}}},{lang:"zh",resources:{merico_heatmap:{viz_name:"思码逸热力图",click_heatmap:{heatblock:{label:"点击热力块"}}}}}];function qC(e){const{visualMap:t=et(),heat_block:{min:r,max:a,...l},...o}=e;return{...o,heat_block:l,visualMap:{...et(),min:r,max:a}}}function OC(e){const t=e.tooltip.metrics;return{...e,tooltip:{...e.tooltip,metrics:t.map(r=>({...r,unit:r.unit??U()}))}}}function NC(e){const{heat_block:t}=e;return{...e,heat_block:{...t,unit:t.unit??U()}}}class GC extends ee{constructor(){super(...arguments);P(this,"VERSION",4)}configVersions(){this.version(1,r=>({version:1,config:r})),this.version(2,r=>({...r,version:2,config:qC(r.config)})),this.version(3,r=>({...r,version:3,config:OC(r.config)})),this.version(4,r=>({...r,version:4,config:NC(r.config)}))}}const FC={displayName:"viz.merico_heatmap.viz_name",displayGroup:"chart.groups.merico_suite",migrator:new GC,name:"merico-heatmap",viewRender:BC,configRender:mC,createConfig:()=>({version:4,config:jr}),triggers:[mo],translation:LC},Qr={item_badge:"_item_badge_l2t3l_1",label:"_label_l2t3l_8",value:"_value_l2t3l_20"},jC=({children:e})=>["string","number"].includes(typeof e)?n.jsx(s.Text,{size:"xs",ff:"monospace",children:e}):e,bt=h.forwardRef(({label:e,value:t,label_description:r,value_description:a},l)=>n.jsxs("div",{ref:l,className:Qr.item_badge,children:[n.jsx("div",{className:Qr.label,children:e}),n.jsxs(s.HoverCard,{shadow:"md",disabled:!a,children:[n.jsx(s.HoverCard.Target,{children:n.jsx("div",{className:Qr.value,"data-with-tooltip":!!a,children:t})}),n.jsx(s.HoverCard.Dropdown,{p:"xs",children:n.jsx(jC,{children:a})})]})]})),QC=({item:e})=>e.type!=="checkbox"?null:n.jsx(bt,{label:e.label,value:n.jsx(s.ThemeIcon,{variant:"white",radius:"xs",color:e.value?"teal":"red",w:12,h:12,miw:12,mih:12,children:e.value?n.jsx(S.IconCheck,{size:12,strokeWidth:3}):n.jsx(S.IconX,{strokeWidth:3})}),label_description:`filters.${e.key}`}),WC=({item:e})=>e.type!=="context"?null:n.jsx(bt,{label:e.key,value:e.value,label_description:`context.${e.key}`}),UC=T.observer(({item:e})=>{const{t}=x.useTranslation(),a=e.model.value,[l,o]=a.value,i=h.useMemo(()=>!o&&!l?Number.NaN:M(o).diff(M(l),"days")+1,[l,o]);if(Number.isNaN(i))return n.jsx("span",{style:{userSelect:"none",opacity:0,visibility:"hidden"},children:"."});const c=i===1?t("filter.widget.date_range.one_day"):t("filter.widget.date_range.x_days",{count:i});return n.jsx(bt,{label:e.label,value:e.value.join(" ~ "),label_description:`filters.${e.key}`,value_description:c})}),YC=({item:e})=>e.type!=="date-range"?null:n.jsx(UC,{item:e}),Co=({selection:e})=>(x.useTranslation(),e.length===0?null:n.jsx(s.Group,{justify:"flex-start",gap:"xs",maw:"80vw",children:e.map(t=>n.jsx(s.Pill,{size:"xs",ff:"monospace",children:t.label},t.value))})),KC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>r.optionsByValues(e.value),[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a.length,label_description:`filters.${e.key}`,value_description:n.jsx(Co,{selection:a})})}),XC=({item:e})=>e.type!=="multi-select"?null:n.jsx(KC,{item:e}),ZC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>{var l;return((l=r.options.find(o=>o.value===e.value))==null?void 0:l.label)??e.value},[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a,label_description:`filters.${e.key}`})}),JC=({item:e})=>e.type!=="select"?null:n.jsx(ZC,{item:e}),HC=({item:e})=>e.type!=="text-input"?null:n.jsx(bt,{label:e.label,value:n.jsx(s.Text,{maw:200,size:"xs",truncate:"end",ff:"monospace",children:e.value}),value_description:e.value}),RC=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>r.optionsByValues(e.value),[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a.length,label_description:`filters.${e.key}`,value_description:n.jsx(Co,{selection:a})})}),eS=({item:e})=>e.type!=="tree-select"?null:n.jsx(RC,{item:e}),tS=T.observer(({item:e})=>{x.useTranslation();const r=e.model.config,a=h.useMemo(()=>{var l;return((l=r.options.find(o=>o.value===e.value))==null?void 0:l.label)??e.value},[e.value,r.options]);return n.jsx(bt,{label:e.label,value:a,label_description:`filters.${e.key}`,value_description:e.value})}),nS=({item:e})=>e.type!=="tree-single-select"?null:n.jsx(tS,{item:e}),Wr=({item:e})=>{switch(e.type){case"date-range":return n.jsx(YC,{item:e});case"select":return n.jsx(JC,{item:e});case"tree-single-select":return n.jsx(nS,{item:e});case"multi-select":return n.jsx(XC,{item:e});case"tree-select":return n.jsx(eS,{item:e});case"text-input":return n.jsx(HC,{item:e});case"checkbox":return n.jsx(QC,{item:e});case"context":return n.jsx(WC,{item:e});default:return null}},rS=T.observer(({conf:e})=>{const r=J().dashboardState,{all:a,keys:l}=e;return a?n.jsxs(n.Fragment,{children:[Object.entries(r.context).map(([o,i])=>n.jsx(Wr,{item:i},o)),Object.entries(r.filters).map(([o,i])=>n.jsx(Wr,{item:i},o))]}):n.jsx(n.Fragment,{children:l.map(o=>{const i=y.get(r,o);return i?n.jsx(Wr,{item:i},o):null})})}),aS=T.observer(({context:e})=>{const{value:t}=B(e.instanceData,"config"),{width:r,height:a}=e.viewport;return t?n.jsx(s.Group,{justify:"flex-start",align:"flex-start",wrap:"wrap",px:0,py:0,gap:"xs",w:r,mah:a,style:{overflow:"auto"},"data-enable-scrollbar":!0,children:n.jsx(rS,{conf:t})}):null}),So={all:!0,keys:[]},sS={select:"filter.widget.names.select","multi-select":"filter.widget.names.multi_select","tree-select":"filter.widget.names.tree_select","tree-single-select":"filter.widget.names.tree_single_select","text-input":"filter.widget.names.text_input",checkbox:"filter.widget.names.checkbox","date-range":"filter.widget.names.date_range"},lS=({option:e,checked:t,...r})=>{const{t:a}=x.useTranslation(),l=e,o=l.type==="filter";return n.jsxs(s.Group,{gap:4,flex:1,children:[n.jsx(S.IconCheck,{size:14,opacity:t?1:0,color:"black"}),n.jsx(s.Stack,{gap:0,py:4,px:8,flex:1,styles:{root:{flexGrow:1,borderRadius:"4px"}},...r,children:n.jsxs(s.Group,{justify:"space-between",wrap:"nowrap",children:[n.jsx(s.Text,{size:"xs",children:e.label}),o&&n.jsx(s.Text,{size:"xs",c:t?"rgba(0,0,0,.8)":"dimmed",style:{flexShrink:0,flexGrow:0},children:a(sS[l.widget])})]})})]})},oS=T.observer(({value:e,onChange:t,disabled:r})=>{const{t:a}=x.useTranslation(),o=F().dashboardStateVariableOptions,i=h.useMemo(()=>{const{optionGroups:c,validValues:d}=o,u=c.map(f=>({group:a(f.group),items:f.items.map(v=>({...v,label:v.label,value:v.value,widget_label:v.label}))})),p=e.filter(f=>!d.has(f)).map(f=>({label:f,value:f,disabled:!0}));return p.length>0&&u.push({group:a("common.invalid"),items:p}),u},[o,a,e]);return n.jsx(s.MultiSelect,{size:"xs",label:a("viz.vizDashboardState.variable_selector.label"),placeholder:e.length===0?a("viz.vizDashboardState.variable_selector.placeholder"):void 0,data:i,renderOption:lS,maxDropdownHeight:600,value:e,onChange:t,disabled:r,clearable:!0})}),iS=({form:e})=>{const{t}=x.useTranslation(),r=e.watch("all");return n.jsxs(s.Stack,{gap:"xs",p:"xs",children:[n.jsx(b.Controller,{name:"all",control:e.control,render:({field:a})=>n.jsx(s.Checkbox,{size:"xs",label:t("viz.vizDashboardState.show_all"),checked:a.value,onChange:l=>a.onChange(l.currentTarget.checked)})}),n.jsx(b.Controller,{name:"keys",control:e.control,render:({field:a})=>n.jsx(oS,{disabled:r,...a})})]})};function cS({context:e}){const{value:t,set:r}=B(e.instanceData,"config"),a=h.useMemo(()=>y.defaultsDeep({},t,So),[t]),l=b.useForm({defaultValues:a}),{handleSubmit:o,formState:i,reset:c}=l;return h.useEffect(()=>{c(a)},[a]),n.jsxs("form",{onSubmit:o(r),children:[n.jsx(ae,{canSubmit:i.isDirty}),n.jsx(iS,{form:l})]})}const dS=[{lang:"en",resources:{vizDashboardState:{viz_name:"Dashboard State",show_all:"Show all filters and context entries",variable_selector:{label:"Select filters and context entries to show",placeholder:""}}}},{lang:"zh",resources:{vizDashboardState:{viz_name:"看板状态",show_all:"显示所有筛选器和上下文条目",variable_selector:{label:"选择要展示的筛选器和上下文",placeholder:""}}}}];class uS extends ee{constructor(){super(...arguments);P(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const pS={displayName:"viz.vizDashboardState.viz_name",displayGroup:"chart.groups.others",migrator:new uS,name:"vizDashboardState",viewRender:aS,configRender:cS,createConfig:()=>({version:1,config:So}),translation:dS},hS=[{value:"#25262B",name:"Dark"},{value:"#868E96",name:"Gray"},{value:"#FA5252",name:"Red"},{value:"#E64980",name:"Pink"},{value:"#BE4BDB",name:"Grape"},{value:"#7950F2",name:"Violet"},{value:"#4C6EF5",name:"Indigo"},{value:"#228BE6",name:"Blue"},{value:"#15AABF",name:"Cyan"},{value:"#12B886",name:"Teal"},{value:"#40C057",name:"Green"},{value:"#82C91E",name:"Lime"},{value:"#FAB005",name:"Yellow"},{value:"#FD7E14",name:"Orange"}].map(e=>({name:e.name,value:e.value,type:"single",category:"basic"})),gS=[eu,tu,au,ru,nu,su],Ur=[$r,Mw,Jm,ux,Hw,l_,C1,$p,Fg,Jb,Gy,L0,kv,Pb,uw,P_,lx,l0,rC,FC,fC,ef,pS],To=Ur.reduce((e,t)=>(e[t.name]={displayName:t.displayName,displayGroup:t.displayGroup},e),{}),ko=()=>({id:"dashboard",version:Cs,manifest:{viz:Ur,color:[...hS,...gS]}}),Ct=new uu,R={pluginManager:Je("pluginManager"),vizManager:Je("vizManager"),colorManager:Je("colorManager"),panelAddonManager:Je("panelAddonManager"),instanceScope:{panelModel:Je("panelModel"),vizInstance:Je("vizInstance"),interactionManager:Je("interactionManager"),migrator:Je("migrator"),operationManager:Je("operationManager"),triggerManager:Je("triggerManager")}},Yr=()=>{try{Ct.install(ko())}catch{}const e=new Jd(Ct),t=new du(Ct),r=new ou(Ct);return{pluginManager:Ct,vizManager:e,colorManager:t,panelAddonManager:r}},rt=h.createContext(Yr());try{Ct.install(ko())}catch{}const wn=Se.createInstance({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:Kd,zh:Xd}}).use(ed).use(x.initReactI18next);wn.init(),Ur.forEach(e=>{var t;(t=e.translation)==null||t.forEach(r=>{wn.addResourceBundle(r.lang,"translation",{viz:r.resources},!0,!0)})});function zo({lang:e,children:t}){return h.useEffect(()=>{wn.changeLanguage(e)},[e]),n.jsx(x.I18nextProvider,{i18n:wn,children:t})}M.extend(id),M.extend(cd),M.extend(dd),M.extend(ud),M.extend(pd),M.extend(hd),M.extend(gd),M.extend(fd),M.extend(bd),M.extend(yd),M.extend(xd),M.extend(wd),M.extend(md),M.extend(Cd),M.extend(Sd),M.extend(vd),M.extend(_d),M.extend(Td),M.extend(kd),M.extend(zd),M.extend(Dd),M.extend(Id),M.extend(Md),M.extend(Ad),M.extend(Pd),M.extend(Vd),M.extend($d),M.extend(Ed),M.extend(Bd),M.extend(Ld),M.extend(Od),M.extend(Nd),M.extend(qd),M.tz.setDefault("UTC"),M.updateLocale("en",{weekStart:1});function fS(e){e=e||{};const t=Object.keys(e).sort(),r=[];for(let a=0;a<t.length;a++){const l=t[a];if(l!="authentication"&&e[l])r.push(t[a]+"="+(typeof e[l]=="object"?JSON.stringify(e[l]):e[l]));else{const o=Object.keys(e[l]).sort();for(let i=0;i<o.length;i++){const c=o[i];c!="sign"&&e[l][c]&&r.push(o[i]+"="+(typeof e[l][c]=="object"?JSON.stringify(e[l][c]):e[l][c]))}}}return r.sort().join("&")}function bS(e,t){let r=fS(e);return r+="&key="+t,Ud.MD5(r).toString().toUpperCase()}class Do{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(t){if(!this.app_id||!this.app_secret)return;const r=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:r,sign:bS({app_id:this.app_id,nonce_str:r,...t},this.app_secret)}}getRequest(t,r){return(a,l,o,i)=>{const c=this.buildHeader(o),d=this.buildAxiosConfig(t,a,l,o,c,r);return ke(d).then(u=>i?u:u.data).catch(u=>{if(ke.isCancel(u))return Promise.reject(u);const p=u,f=y.get(p,"response.data.detail.message",p.message);return Promise.reject(new Error(f))})}}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}buildAxiosConfig(t,r,a,l,o,i){const c={baseURL:this.baseURL,method:t,url:r,params:t==="GET"?a:l.params,headers:o,signal:i};return["POST","PUT"].includes(t)&&(c.data=l.string?JSON.stringify(a):a,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(t){const r=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":t.string?"application/x-www-form-urlencoded":"application/json",authorization:r?`bearer ${r}`:"",...t.headers}}}class yS{constructor(t){this.implementation=t}getRequest(t,r){return this.implementation.getRequest(t,r)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}class Io extends Do{constructor(){super(...arguments);P(this,"makeQueryENV",null)}query(r){return async(a,l={})=>{var o;return a.env||(a.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.post(r)("/query",a,l)}}httpDataSourceQuery(r){return async(a,l={})=>{var o;return a.env||(a.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",r)("/query",a,l,!0)}}structure(r){return async(a,l={})=>this.post(r)("/query/structure",a,l)}mericoMetricInfo(r){return async(a,l={})=>this.post(r)("/query/merico_metric_info",a,l,!0)}mericoMetricQuery(r){return async(a,l={})=>this.post(r)("/query",a,l,!0)}}class Mo{constructor(t){this.implementation=t}query(t){return this.implementation.query(t)}httpDataSourceQuery(t){return this.implementation.httpDataSourceQuery(t)}structure(t){return this.implementation.structure(t)}mericoMetricInfo(t){return this.implementation.mericoMetricInfo(t)}mericoMetricQuery(t){return this.implementation.mericoMetricQuery(t)}getRequest(t,r){return this.implementation.getRequest(t,r)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}const Et=new Io;function Kr(e){Et.baseURL!==e.apiBaseURL&&(Et.baseURL=e.apiBaseURL),e.app_id&&(Et.app_id=e.app_id),e.app_secret&&(Et.app_secret=e.app_secret),e.makeQueryENV&&(Et.makeQueryENV=e.makeQueryENV)}const Ao=new Mo(Et),Ae=Ao,Xr=g.types.model("MockContextMeta",{current:g.types.optional(g.types.frozen(),{})}).views(e=>({get keys(){return Object.keys(e.current)},get keySet(){return new Set(this.keys)},get entries(){return Object.entries(e.current)}})).actions(e=>({replace(t){e.current=t},defaults(t){e.current={...t,...e.current}},get(t){return e.current[t]},set(t,r){e.current[t]=r}}));function Zr(e){return{current:e}}const vS=g.types.model("PanelStyleBorderMeta",{enabled:g.types.boolean}).views(e=>({get json(){const{enabled:t}=e;return{enabled:t}}})).actions(e=>({setEnabled(t){e.enabled=t}})),Po=g.types.model("PanelStyleMeta",{border:vS}).views(e=>({get json(){const{border:t}=e;return{border:t.json}}})).actions(e=>({})),Vo=g.types.model("PanelTitleMeta",{show:g.types.optional(g.types.boolean,!0)}).views(e=>({get json(){const{show:t}=e;return{show:t}}})).actions(e=>({setShow(t){e.show=t}})),$o=g.types.model("VariableMeta",{name:g.types.string,size:g.types.string,weight:g.types.string,color:g.types.union(g.types.model({type:g.types.literal("static"),staticColor:g.types.string}),g.types.model({type:g.types.literal("continuous"),valueRange:g.types.array(g.types.number),colorRange:g.types.array(g.types.string)}),g.types.model({type:g.types.literal("piecewise")})),formatter:g.types.model({output:g.types.enumeration("Output",["number","percent"]),average:g.types.optional(g.types.boolean,!1),mantissa:g.types.number,trimMantissa:g.types.optional(g.types.boolean,!1),absolute:g.types.optional(g.types.boolean,!1)}),data_field:g.types.string,aggregation:g.types.union(g.types.model({type:g.types.enumeration(["none","sum","mean","median","min","max","CV","std"]),config:g.types.frozen(),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("quantile"),config:g.types.model({p:g.types.number}),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("pick_record"),config:g.types.model({method:g.types.enumeration("Pick Record Method",["first","last"])}),fallback:g.types.optional(g.types.string,"0")}),g.types.model({type:g.types.literal("custom"),config:g.types.model({func:g.types.string}),fallback:g.types.optional(g.types.string,"0")}))}).views(e=>({get json(){const{name:t,size:r,weight:a,color:l,formatter:o,data_field:i,aggregation:c}=e;return y.cloneDeep({name:t,size:r,color:l,weight:a,formatter:o,data_field:i,aggregation:c})}})),Eo=g.types.model("PanelVizMeta",{type:g.types.string,conf:g.types.frozen()}).views(e=>({get json(){return{conf:e.conf,type:e.type}}})).actions(e=>({setType(t){e.type=t},setConf(t){y.isEqual(e.conf,t)||(e.conf=t)}})),Bo=g.types.model({id:g.types.string,name:g.types.optional(g.types.string,""),title:Vo,description:g.types.string,queryIDs:g.types.array(g.types.string),viz:Eo,style:Po,variables:g.types.optional(g.types.array($o),[])}).views(e=>({get json(){const{id:t,name:r,title:a,description:l,queryIDs:o}=e;return{id:t,viz:e.viz.json,name:r,style:e.style.json,title:a.json,queryIDs:[...o],variables:e.variables.map(i=>i.json),description:l}},get queryIDSet(){return new Set(e.queryIDs)}})).actions(e=>({setID(t){e.id=t},setName(t){e.name=t},setDescription(t){e.description=t},addQueryID(t){e.queryIDSet.has(t)||e.queryIDs.push(t)},removeQueryID(t){if(!e.queryIDSet.has(t))return;const r=new Set(e.queryIDSet);r.delete(t),e.queryIDs=g.cast(Array.from(r))},setQueryIDs(t){e.queryIDs=g.cast(t)},addVariable(t){e.variables.push(t)},removeVariable(t){e.variables.remove(t)}}));var j=(e=>(e.Postgresql="postgresql",e.MySQL="mysql",e.HTTP="http",e.Transform="transform",e.MericoMetricSystem="merico_metric_system",e))(j||{});const Lo=g.types.model("DBQueryMeta",{_type:g.types.enumeration([j.MySQL,j.Postgresql]),sql:g.types.string}).views(e=>({get base(){return g.getParent(e)},get valid(){return!!e.sql},get json(){const{sql:t,_type:r}=e;return{sql:t,_type:r}}})).actions(e=>({setSQL(t){e.sql=t}})),_S=e=>Lo.create({_type:e,sql:""}),qo=g.types.model("HTTPQueryMeta",{_type:g.types.literal(j.HTTP),react_to:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){return!0},get json(){const{react_to:t,_type:r}=e;return tt({react_to:t,_type:r})}})).actions(e=>({setReactTo(t){e.react_to.length=0,e.react_to.push(...t)}})),xS=()=>qo.create({_type:j.HTTP,react_to:[]}),Oo=g.types.model("TransformQueryMeta",{_type:g.types.literal(j.Transform),dep_query_ids:g.types.optional(g.types.array(g.types.string),[]),react_to:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){return e.dep_query_ids.length>0},get json(){const{dep_query_ids:t,_type:r,react_to:a}=e;return tt({dep_query_ids:t,_type:r,react_to:a})}})).actions(e=>({setDependantQueryIDs(t){e.dep_query_ids.length=0,e.dep_query_ids.push(...t)},setReactTo(t){e.react_to.length=0,e.react_to.push(...t)}})),wS=()=>Oo.create({_type:j.Transform,dep_query_ids:[]}),No=g.types.model("MetricFilterColMeta",{dimension:g.types.optional(g.types.string,""),variable:g.types.optional(g.types.string,"")}).views(e=>({get allEmpty(){return!e.dimension&&!e.variable},get json(){const{dimension:t,variable:r}=e;return{dimension:t,variable:r}}})).actions(e=>({removeSelf(){g.getParent(e,2).removeFilter(e)},setDimension(t){e.dimension=t??"",e.allEmpty&&this.removeSelf()},setVariable(t){e.variable=t??"",e.allEmpty&&this.removeSelf()}})),Jr=g.types.model("MericoMetricQueryMeta",{_type:g.types.literal(j.MericoMetricSystem),id:g.types.optional(g.types.string,""),type:g.types.optional(g.types.enumeration("MetricType",["derived","combined"]),"derived"),filters:g.types.optional(g.types.array(No),[]),groupBys:g.types.optional(g.types.array(g.types.string),[]),timeQuery:g.types.model({enabled:g.types.optional(g.types.boolean,!1),range_variable:g.types.optional(g.types.string,""),unit_variable:g.types.optional(g.types.string,""),timezone:g.types.optional(g.types.string,"PRC"),stepKeyFormat:g.types.optional(g.types.string,"YYYY-MM-DD")}),useDefaultValues:g.types.optional(g.types.boolean,!1)}).views(e=>({get query(){return g.getParent(e)},get valid(){return!!e.id},get json(){const{id:t,type:r,filters:a,groupBys:l,timeQuery:o,useDefaultValues:i,_type:c}=e;return tt({id:t,type:r,filters:a.map(d=>d.json),groupBys:l,timeQuery:o,useDefaultValues:i,_type:c})},get usedFilterDimensionKeys(){const t=e.filters.map(r=>r.dimension).filter(r=>!!r);return new Set(t)},get usedFilterVariableSet(){const t=[...e.filters.map(r=>r.variable)].filter(r=>!!r);return new Set(t)},get usedTimeQueryVariableSet(){const t=[e.timeQuery.range_variable,e.timeQuery.unit_variable].filter(r=>!!r);return new Set(t)},get groupByValues(){const t=e.groupBys.map(r=>r.replace(/^(.+)\s->\s(.*)/,"$1"));return Array.from(new Set(t))}})).actions(e=>({reset(){e.filters.length=0,e.groupBys.length=0,e.timeQuery.enabled=!1,e.timeQuery.range_variable="",e.timeQuery.unit_variable="",e.useDefaultValues=!1,"data"in e.query&&(e.query.setData([]),e.query.setError(null))},setID(t){t!==e.id&&this.reset(),e.id=t},setType(t){t!=="derived"&&t!=="combined"||(e.type=t)},addFilter(t,r){t&&e.usedFilterDimensionKeys.has(t)||e.filters.push(No.create({dimension:t,variable:r}))},removeFilter(t){g.destroy(t)},setGroupBys(t){e.groupBys.length=0,e.groupBys.push(...t)},setRangeVariable(t){e.timeQuery.range_variable=t??""},setUnitVariable(t){e.timeQuery.unit_variable=t??""},setTimeQueryEnabled(t){e.timeQuery.enabled=t,t?e.groupBys.length>1&&(e.groupBys.length=0):(e.timeQuery.range_variable="",e.timeQuery.unit_variable="")},setUseDefaultValues(t){e.useDefaultValues=t}})),Go=()=>Jr.create({_type:j.MericoMetricSystem,id:"",type:"derived",filters:[],groupBys:[],timeQuery:{range_variable:"",unit_variable:"",timezone:"PRC",stepKeyFormat:"YYYY-MM-DD"},useDefaultValues:!1}),Fo=g.types.model("QueryMeta",{id:g.types.string,name:g.types.string,key:g.types.string,type:g.types.enumeration("DataSourceType",[j.Postgresql,j.MySQL,j.HTTP,j.Transform,j.MericoMetricSystem]),config:g.types.union(Lo,qo,Oo,Jr),pre_process:g.types.optional(g.types.string,""),post_process:g.types.optional(g.types.string,""),run_by:g.types.optional(g.types.array(g.types.string),[])}).views(e=>({get valid(){const{id:t,name:r,key:a,type:l,config:o}=e;return o.valid&&!!t&&!!r&&!!a&&!!l},get json(){const{id:t,name:r,key:a,type:l,config:o,pre_process:i,post_process:c,run_by:d}=e;return tt({id:t,name:r,key:a,type:l,config:o.json,pre_process:i,post_process:c,run_by:d})}})).actions(e=>({setName(t){e.name=t},setKey(t){e.key=t},setType(t){switch(e.type=t,t){case j.HTTP:e.config=xS();break;case j.MySQL:case j.Postgresql:e.config=_S(t);break;case j.Transform:e.config=wS();break;case j.MericoMetricSystem:e.config=Go();break;default:throw new Error(`Unexpected query type[${t}]`)}},setRunBy(t){e.run_by.length=0,e.run_by.push(...t)},setPreProcess(t){e.pre_process=t},setPostProcess(t){e.post_process=t}})),jo=g.types.model("LayoutItemMeta",{id:g.types.identifier,panelID:g.types.string,x:g.types.number,y:g.types.maybeNull(g.types.number),w:g.types.number,h:g.types.number,moved:g.types.optional(g.types.boolean,!1),static:g.types.optional(g.types.boolean,!1)}).views(e=>({get json(){const{id:t,panelID:r,x:a,y:l,w:o,h:i,moved:c}=e;return{h:i,w:o,x:a,y:l===null?0:l,id:t,moved:c,static:e.static,panelID:r}},get contentModel(){return g.getRoot(e).content},get panel(){const{panelID:t}=e;return this.contentModel.panels.findByID(t)},get layoutProperies(){const{id:t,x:r,y:a,w:l,h:o,moved:i}=e;return{id:t,i:t,x:r,y:a===null?1/0:a,w:l,h:o,moved:i,static:e.static}}})).actions(e=>({set(t){const{isDraggable:r,x:a,y:l,w:o,h:i,moved:c}=t;e.x=a,e.y=l,e.w=o,e.h=i,e.moved=!!c,e.static=!!t.static},setWidth(t){e.w=t},setHeight(t){e.h=t}})),Qo=g.types.model("LayoutSetMeta",{id:g.types.identifier,name:g.types.string,breakpoint:g.types.number,list:g.types.optional(g.types.array(jo),[])}).views(e=>({get contentModel(){return g.getRoot(e).content},get json(){const{id:t,name:r,breakpoint:a,list:l}=e;return{id:t,name:r,breakpoint:a,list:l.map(o=>tt(o.json))}},jsonByPanelIDSet(t){const{id:r,name:a,breakpoint:l,list:o}=e;return{id:r,name:a,breakpoint:l,list:o.filter(i=>t.has(i.panelID)).map(i=>tt(i.json))}},findByID(t){return e.list.find(r=>r.id===t)},findByPanelID(t){return e.list.find(r=>r.panelID===t)}})).actions(e=>({setName(t){e.name=t},setBreakpoint(t){e.breakpoint=t},addLayout(t){e.list.push(t)},addNewLayout(t){e.list.push({id:Ke.v4(),panelID:t,x:0,y:1/0,w:18,h:300,static:!1,moved:!1})},removeByPanelID(t){const r=e.list.findIndex(a=>a.panelID===t);r>=0&&e.list.splice(r,1)},removeByPanelIDs(t){for(;t.length>0;){const r=t.pop();r&&this.removeByPanelID(r)}},updateLayoutItem(t){const r=e.list.find(a=>a.id===t.i);if(!r){console.error("Trying to update a layout that doesn't exist"),console.log({strangeLayoutItem:t});return}r.set(t)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>{const t=e.list.length,r=e.contentModel.panels.list.length;return{match:t===r,layoutCount:t,panelCount:r}},({match:t,panelCount:r,layoutCount:a})=>{if(t)return;const l={id:"layout panel count mismatch",title:"Error detected, please don't save changes.",message:`${a} layout items against and ${r} panels.`,color:"red",autoClose:!1};Ze.showNotification(l),Ze.updateNotification(l)},{fireImmediately:!0,delay:0}))}})),Wo=g.types.model("SQLSnippetMeta",{key:g.types.string,value:g.types.string}).views(e=>({get json(){const{key:t,value:r}=e;return{key:t,value:r}}})).actions(e=>({setKey(t){e.key=t},setValue(t){e.value=t}}));var V=(e=>(e.Select="select",e.MultiSelect="multi-select",e.TreeSelect="tree-select",e.TreeSingleSelect="tree-single-select",e.TextInput="text-input",e.Checkbox="checkbox",e.DateRange="date-range",e))(V||{});const Hr=g.types.optional(g.types.enumeration(["intersect","reset"]),"intersect"),Rr=g.types.model("FilterCheckboxConfigMeta",{_name:g.types.literal("checkbox"),description:g.types.optional(g.types.string,""),default_value:g.types.boolean}).views(e=>({get json(){const{_name:t,description:r,default_value:a}=e;return{_name:t,description:r,default_value:a}},get isDescriptionEmpty(){const{description:t}=e;return t===""||t==="<p></p>"}})).actions(e=>({setDefaultValue(t){e.default_value=t},setDescription(t){e.description=t}})),Uo=()=>Rr.create({_name:"checkbox",description:"",default_value:!1}),Yo=()=>[{key:"d",value:"yesterday",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"yesterday"}}},{key:"w",value:"last week",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"week").startOf("week").toDate(),M(e).subtract(1,"week").endOf("week").toDate()],shortcut:"last week"}}},{key:"m",value:"last month",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last month"}}},{key:"m2",value:"last 2 months",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(2,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last 2 months"}}},{key:"m3",value:"last 3 months",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(3,"month").startOf("month").toDate(),M(e).subtract(1,"month").endOf("month").toDate()],shortcut:"last 3 months"}}},{key:"y",value:"last year",group:"last",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(1,"year").startOf("year").toDate(),M(e).subtract(1,"year").endOf("year").toDate()],shortcut:"last year"}}},{key:"d7",value:"recent 7 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(7,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 7 days"}}},{key:"d30",value:"recent 30 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(30,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 30 days"}}},{key:"d60",value:"recent 60 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(60,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 60 days"}}},{key:"d90",value:"recent 90 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(90,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 90 days"}}},{key:"d180",value:"recent 180 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(180,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 180 days"}}},{key:"d365",value:"recent 365 days",group:"recent",getRange:()=>{const e=Date.now();return{value:[M(e).subtract(365,"day").startOf("day").toDate(),M(e).subtract(1,"day").endOf("day").toDate()],shortcut:"recent 365 days"}}},{key:"d",value:"today",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("day").toDate(),M(e).endOf("day").toDate()],shortcut:"today"}}},{key:"w",value:"this week",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("week").toDate(),M(e).endOf("week").toDate()],shortcut:"this week"}}},{key:"m",value:"this month",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("month").toDate(),M(e).endOf("month").toDate()],shortcut:"this month"}}},{key:"y",value:"this year",group:"this",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("year").toDate(),M(e).endOf("year").toDate()],shortcut:"this year"}}},{key:"w",value:"this week so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("week").toDate(),M(e).toDate()],shortcut:"this week so far"}}},{key:"m",value:"this month so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("month").toDate(),M(e).toDate()],shortcut:"this month so far"}}},{key:"y",value:"this year so far",group:"this_so_far",getRange:()=>{const e=Date.now();return{value:[M(e).startOf("year").toDate(),M(e).toDate()],shortcut:"this year so far"}}}];function ea(e){if(!e)return null;const r=Yo().find(a=>a.value===e);return r?r.getRange():null}function Ko(){return y.groupBy(Yo(),"group")}function Xo(e){try{if(e.default_shortcut){const r=ea(e.default_shortcut);if(r)return{value:r.value.map(a=>M(a).toDate()),shortcut:e.default_shortcut}}return{value:e.default_value.map(r=>r===null?r:M.tz(r,"UTC").toDate()??r),shortcut:null}}catch(t){return console.error(t),{value:[null,null],shortcut:null}}}function Zo(e,t){return e.map(r=>{try{return r?M.tz(r,"UTC").toISOString():null}catch{return console.log(`[date-range] failed parsing ${r}`),null}})}const mS=g.types.model("FilterDateRangeConfigMeta",{_name:g.types.literal("date-range"),required:g.types.boolean,inputFormat:g.types.enumeration("DateRangeInputFormat",["YYYY","YYYYMM","YYYYMMDD","YYYY-MM","YYYY-MM-DD"]),default_value:g.types.optional(g.types.array(g.types.union(g.types.Date,g.types.null)),[null,null]),default_shortcut:g.types.optional(g.types.string,""),clearable:g.types.boolean,max_days:g.types.optional(g.types.number,0),allowSingleDateInRange:g.types.optional(g.types.boolean,!1)}).views(e=>({get json(){const{_name:t,max_days:r,required:a,clearable:l,inputFormat:o,default_value:i,default_shortcut:c,allowSingleDateInRange:d}=e;return{_name:t,max_days:r,required:a,clearable:l,inputFormat:o,default_value:Zo(i),default_shortcut:c,allowSingleDateInRange:d}},truthy(t){try{const{value:r}=t;return Array.isArray(r)&&r.length===2&&r.every(a=>!!a)}catch(r){return console.error(r),!1}},get filter(){return g.getParent(e)},get dateStringsValue(){try{const t=this.filter.value,[r,a]=t.value,l=r?M(r).format(e.inputFormat):"",o=a?M(a).format(e.inputFormat):"";return[l,o]}catch(t){return console.error(t),["",""]}}})).actions(e=>({setFilterValue(t){try{e.filter.setValue(t)}catch(r){console.error(r)}}})).actions(e=>({setRequired(t){e.required=t},setClearable(t){e.clearable=t},setInputFormat(t){t&&(e.inputFormat=t)},setDefaultValue(t){e.default_value.length=0,e.default_value.push(...t.value),e.setFilterValue(t)},setDefaultShortcut(t){if(e.default_shortcut=t??"",!t)return;const r=ea(e.default_shortcut);r&&e.setFilterValue(r)},setMaxDays(t){const r=Number(t);Number.isFinite(r)&&(e.max_days=r,r>0&&(e.clearable=!0))},setAllowSingleDateInRange(t){e.allowSingleDateInRange=t}})),ta=g.types.snapshotProcessor(mS,{preProcessor({default_value:e,...t}){return{...t,default_value:e.map(r=>r===null?null:M.tz(r,"UTC").toDate())}},postProcessor(e){const{default_value:t,...r}=e;return{...r,default_value:Zo(t,r.inputFormat)}}}),Jo=()=>ta.create({_name:"date-range",required:!1,inputFormat:"YYYY-MM-DD",clearable:!1,default_value:[null,null]}),Ho=g.types.model({label:g.types.string,value:g.types.string}).actions(e=>({setLabel(t){e.label=t},setValue(t){e.value=t}})),na=g.types.model("FilterConfigModel_BaseSelect",{static_options:g.types.optional(g.types.array(Ho),[]),options_query_id:g.types.optional(g.types.string,""),default_selection_count:g.types.optional(g.types.number,0),required:g.types.optional(g.types.boolean,!1)}).views(e=>({get contentModel(){return g.getRoot(e).content},get filter(){return g.getParent(e)},get usingQuery(){return!!e.options_query_id}})).views(e=>({get optionsLoading(){if(!e.usingQuery)return!1;const{state:t}=e.contentModel.getDataStuffByID(e.options_query_id);return t==="loading"},get options(){if(!e.usingQuery)return e.static_options;const{data:t,state:r}=e.contentModel.getDataStuffByID(e.options_query_id);return r==="error"?[]:Array.isArray(t)?t.filter(a=>"label"in a&&"value"in a):[]},get optionValuesSet(){return new Set(this.options.map(t=>t.value))}})).actions(e=>({setRequired(t){e.required=t},addStaticOption(t){e.static_options.push(t)},removeStaticOption(t){e.static_options.splice(t,1)},replaceStaticOptions(t){e.static_options.forEach(a=>g.detach(a));const r=t.map(a=>Ho.create(a));e.static_options.replace(r)},setDefaultSelectionCount(t){const r=Number(t);Number.isFinite(r)&&(e.default_selection_count=r)},setOptionsQueryID(t){e.options_query_id=t??""}})),ra=g.types.compose("FilterMultiSelectConfigMeta",g.types.model({_name:g.types.literal("multi-select"),min_width:g.types.optional(g.types.string,""),default_value:g.types.optional(g.types.array(g.types.string),[]),default_value_mode:Hr}),na).views(e=>({get json(){const{_name:t,default_value:r,default_value_mode:a,required:l,min_width:o,static_options:i,options_query_id:c,default_selection_count:d}=e;return tt({_name:t,required:!!l,min_width:o,default_value:r,static_options:i,options_query_id:c,default_value_mode:a,default_selection_count:d})},get defaultSelection(){const t=e.filter.formattedDefaultValue;return Array.isArray(t)&&t.length>0||!e.usingQuery?t:e.options.slice(0,e.default_selection_count).map(r=>r.value)},optionsByValues(t){if(!Array.isArray(t)||t.length===0)return[];const r=new Set(t);return e.options.filter(a=>r.has(a.value))},initialSelection(t){return t||this.defaultSelection},truthy(t){return Array.isArray(t)&&t.length>0}})).actions(e=>({setDefaultValue(t){e.default_value=g.cast(t)},setDefaultValueMode(t){t!=="intersect"&&t!=="reset"||(e.default_value_mode=t)},setMinWidth(t){e.min_width=t},applyDefaultSelection(){if(e.optionsLoading)return;if(e.default_value_mode==="reset"){e.filter.setValue(e.defaultSelection);return}const t=new Set(e.options.map(l=>l.value)),a=(e.filter.value??[]).filter(l=>t.has(l));a.length>0?e.filter.setValue(a):e.filter.setValue(e.defaultSelection)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>Q.toJS(e.defaultSelection),e.applyDefaultSelection,{fireImmediately:!1,delay:0}))}})),Ro=()=>ra.create({_name:"multi-select",default_value:[],static_options:[],options_query_id:"",default_selection_count:0}),aa=g.types.compose("FilterConfigModel_Select",g.types.model({_name:g.types.literal("select"),default_value:g.types.string,width:g.types.optional(g.types.string,""),clearable:g.types.optional(g.types.boolean,!1)}),na).views(e=>({get json(){const{_name:t,clearable:r,default_value:a,required:l,width:o,static_options:i,options_query_id:c,default_selection_count:d}=e;return tt({_name:t,width:o,required:l,clearable:r,default_value:a,static_options:i,options_query_id:c,default_selection_count:d})},truthy(t){return!!t},getSelectOption(t){return e.options.find(r=>r.value===t)},get default_selection(){return e.usingQuery?e.default_selection_count>0&&e.options.length>0?e.options[0].value:"":e.filter.formattedDefaultValue}})).actions(e=>({setDefaultValue(t){t!==null&&(e.default_value=t)},setWidth(t){e.width=t},setClearable(t){e.clearable=t},setDefaultSelection(){var a;const t=e.filter.value,r=(a=e.options.find(l=>l.value===t))==null?void 0:a.value;r?e.filter.setValue(r):e.filter.setValue(e.default_selection)}})).actions(e=>({afterCreate(){g.addDisposer(e,Q.reaction(()=>Q.toJS(e.default_selection),e.setDefaultSelection,{fireImmediately:!1,delay:0}))}})),ei=()=>aa.create({_name:"select",required:!1,default_value:"",static_options:[],options_query_id:"",default_selection_count:0}),sa=g.types.model("FilterTextInputConfigMeta",{_name:g.types.literal("text-input"),required:g.types.boolean,default_value:g.types.string}).views(e=>({get json(){const{_name:t,required:r,default_value:a}=e;return{_name:t,required:r,default_value:a}},truthy(t){return typeof t!="string"?!1:!!t.trim()}})).actions(e=>({setRequired(t){e.required=t},setDefaultValue(t){e.default_value=t}})),la=()=>sa.create({_name:"text-input",required:!1,default_value:""}),CS=`
|
|
531
531
|
// row
|
|
532
532
|
{
|
|
533
533
|
label: string;
|
|
@@ -81,6 +81,7 @@ export declare const MericoMetricQueryMeta: import("mobx-state-tree").IModelType
|
|
|
81
81
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
82
82
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
83
83
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
84
|
+
useDefaultValues: boolean;
|
|
84
85
|
_type: DataSourceType.MericoMetricSystem;
|
|
85
86
|
};
|
|
86
87
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -132,6 +133,7 @@ export interface IMericoMetricQueryMeta {
|
|
|
132
133
|
timezone: string;
|
|
133
134
|
stepKeyFormat: string;
|
|
134
135
|
};
|
|
136
|
+
useDefaultValues: boolean;
|
|
135
137
|
_type: DataSourceType.MericoMetricSystem;
|
|
136
138
|
};
|
|
137
139
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -219,6 +221,7 @@ export declare const createMericoMetricQueryMetaConfig: () => {
|
|
|
219
221
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
220
222
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
221
223
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
224
|
+
useDefaultValues: boolean;
|
|
222
225
|
_type: DataSourceType.MericoMetricSystem;
|
|
223
226
|
};
|
|
224
227
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -287,6 +290,7 @@ export declare const createMericoMetricQueryMetaConfig: () => {
|
|
|
287
290
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
288
291
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
289
292
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
293
|
+
useDefaultValues: boolean;
|
|
290
294
|
_type: DataSourceType.MericoMetricSystem;
|
|
291
295
|
};
|
|
292
296
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -160,6 +160,7 @@ export declare const QueryMeta: import("mobx-state-tree").IModelType<{
|
|
|
160
160
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
161
161
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
162
162
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
163
|
+
useDefaultValues: boolean;
|
|
163
164
|
_type: DataSourceType.MericoMetricSystem;
|
|
164
165
|
};
|
|
165
166
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -254,6 +255,7 @@ export declare const QueryMeta: import("mobx-state-tree").IModelType<{
|
|
|
254
255
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
255
256
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
256
257
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
258
|
+
useDefaultValues: boolean;
|
|
257
259
|
_type: DataSourceType.MericoMetricSystem;
|
|
258
260
|
} | {
|
|
259
261
|
sql: string;
|
|
@@ -2593,6 +2593,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
2593
2593
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2594
2594
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2595
2595
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
2596
|
+
useDefaultValues: boolean;
|
|
2596
2597
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
2597
2598
|
};
|
|
2598
2599
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -2809,6 +2810,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
2809
2810
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2810
2811
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2811
2812
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
2813
|
+
useDefaultValues: boolean;
|
|
2812
2814
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
2813
2815
|
};
|
|
2814
2816
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -2934,6 +2936,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
2934
2936
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2935
2937
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2936
2938
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
2939
|
+
useDefaultValues: boolean;
|
|
2937
2940
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
2938
2941
|
};
|
|
2939
2942
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -3127,6 +3130,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
3127
3130
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3128
3131
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3129
3132
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
3133
|
+
useDefaultValues: boolean;
|
|
3130
3134
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
3131
3135
|
};
|
|
3132
3136
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -3344,6 +3348,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
3344
3348
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3345
3349
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3346
3350
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
3351
|
+
useDefaultValues: boolean;
|
|
3347
3352
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
3348
3353
|
};
|
|
3349
3354
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -3441,6 +3446,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
3441
3446
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3442
3447
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3443
3448
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
3449
|
+
useDefaultValues: boolean;
|
|
3444
3450
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
3445
3451
|
} | {
|
|
3446
3452
|
sql: string;
|
|
@@ -3688,6 +3694,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
3688
3694
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3689
3695
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3690
3696
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
3697
|
+
useDefaultValues: boolean;
|
|
3691
3698
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
3692
3699
|
};
|
|
3693
3700
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -3786,6 +3793,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
3786
3793
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3787
3794
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
3788
3795
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
3796
|
+
useDefaultValues: boolean;
|
|
3789
3797
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
3790
3798
|
} | {
|
|
3791
3799
|
sql: string;
|
|
@@ -4048,6 +4056,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4048
4056
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4049
4057
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4050
4058
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4059
|
+
useDefaultValues: boolean;
|
|
4051
4060
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4052
4061
|
};
|
|
4053
4062
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -4264,6 +4273,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4264
4273
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4265
4274
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4266
4275
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4276
|
+
useDefaultValues: boolean;
|
|
4267
4277
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4268
4278
|
};
|
|
4269
4279
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -4389,6 +4399,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4389
4399
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4390
4400
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4391
4401
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4402
|
+
useDefaultValues: boolean;
|
|
4392
4403
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4393
4404
|
};
|
|
4394
4405
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -4582,6 +4593,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4582
4593
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4583
4594
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4584
4595
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4596
|
+
useDefaultValues: boolean;
|
|
4585
4597
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4586
4598
|
};
|
|
4587
4599
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -4799,6 +4811,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4799
4811
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4800
4812
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4801
4813
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4814
|
+
useDefaultValues: boolean;
|
|
4802
4815
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4803
4816
|
};
|
|
4804
4817
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -4896,6 +4909,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
4896
4909
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4897
4910
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4898
4911
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
4912
|
+
useDefaultValues: boolean;
|
|
4899
4913
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
4900
4914
|
} | {
|
|
4901
4915
|
sql: string;
|
|
@@ -5143,6 +5157,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
5143
5157
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5144
5158
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5145
5159
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
5160
|
+
useDefaultValues: boolean;
|
|
5146
5161
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
5147
5162
|
};
|
|
5148
5163
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -5241,6 +5256,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
5241
5256
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5242
5257
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5243
5258
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
5259
|
+
useDefaultValues: boolean;
|
|
5244
5260
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
5245
5261
|
} | {
|
|
5246
5262
|
sql: string;
|
|
@@ -5803,6 +5819,7 @@ export declare const PanelRenderModel: import("mobx-state-tree").IModelType<{
|
|
|
5803
5819
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5804
5820
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5805
5821
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
5822
|
+
useDefaultValues: boolean;
|
|
5806
5823
|
_type: import('../../../../../model/meta-model').DataSourceType.MericoMetricSystem;
|
|
5807
5824
|
} | {
|
|
5808
5825
|
sql: string;
|
|
@@ -179,6 +179,7 @@ export declare const MuteQueryModel: import("mobx-state-tree").IModelType<{
|
|
|
179
179
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
180
180
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
181
181
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
182
|
+
useDefaultValues: boolean;
|
|
182
183
|
_type: DataSourceType.MericoMetricSystem;
|
|
183
184
|
};
|
|
184
185
|
readonly usedFilterDimensionKeys: Set<string>;
|
|
@@ -273,6 +274,7 @@ export declare const MuteQueryModel: import("mobx-state-tree").IModelType<{
|
|
|
273
274
|
timezone: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
274
275
|
stepKeyFormat: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
275
276
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
277
|
+
useDefaultValues: boolean;
|
|
276
278
|
_type: DataSourceType.MericoMetricSystem;
|
|
277
279
|
} | {
|
|
278
280
|
sql: string;
|