@devtable/dashboard 14.58.2 → 14.58.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard.es.js +25 -10
- package/dist/dashboard.umd.js +4 -4
- package/dist/i18n/en.d.ts +8 -0
- package/dist/i18n/zh.d.ts +8 -0
- package/dist/stats.html +1 -1
- package/dist/version.json +2 -2
- package/package.json +6 -6
package/dist/dashboard.es.js
CHANGED
|
@@ -779,6 +779,14 @@ Variable: {{ your_var }}`,
|
|
|
779
779
|
val: "Fallback value",
|
|
780
780
|
var: "Max value variable"
|
|
781
781
|
}
|
|
782
|
+
},
|
|
783
|
+
interaction_block: {
|
|
784
|
+
modal_title: "Configure Interaction Block",
|
|
785
|
+
block_id_label: "Block ID",
|
|
786
|
+
block_id_description: "Unique identifier for this interaction block",
|
|
787
|
+
block_id_placeholder: "Enter block ID",
|
|
788
|
+
toggle_tooltip: "Toggle interaction block settings",
|
|
789
|
+
clear_tooltip: "Clear interaction block"
|
|
782
790
|
}
|
|
783
791
|
},
|
|
784
792
|
chart: {
|
|
@@ -1854,6 +1862,14 @@ Variable: {{ your_var }}`,
|
|
|
1854
1862
|
val: "固定最大值",
|
|
1855
1863
|
var: "动态最大值(优先)"
|
|
1856
1864
|
}
|
|
1865
|
+
},
|
|
1866
|
+
interaction_block: {
|
|
1867
|
+
modal_title: "配置交互块",
|
|
1868
|
+
block_id_label: "块ID",
|
|
1869
|
+
block_id_description: "此交互块的唯一标识符",
|
|
1870
|
+
block_id_placeholder: "输入块ID",
|
|
1871
|
+
toggle_tooltip: "切换交互块设置",
|
|
1872
|
+
clear_tooltip: "清除交互块"
|
|
1857
1873
|
}
|
|
1858
1874
|
},
|
|
1859
1875
|
chart: {
|
|
@@ -2520,7 +2536,7 @@ class hi {
|
|
|
2520
2536
|
}), this.instanceRegistry.clear(), this.factoryRegistry.clear();
|
|
2521
2537
|
}
|
|
2522
2538
|
}
|
|
2523
|
-
const Ks = "14.58.
|
|
2539
|
+
const Ks = "14.58.3", qg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2524
2540
|
__proto__: null,
|
|
2525
2541
|
version: Ks
|
|
2526
2542
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -3027,17 +3043,16 @@ const fi = {
|
|
|
3027
3043
|
color: "#3D3E45",
|
|
3028
3044
|
margin: "0 0 14px"
|
|
3029
3045
|
},
|
|
3030
|
-
"
|
|
3046
|
+
"[data-interaction-block-id]": {
|
|
3031
3047
|
position: "relative",
|
|
3032
3048
|
padding: "4px 8px",
|
|
3033
3049
|
borderRadius: "4px",
|
|
3034
|
-
transition: "all 0.2s ease"
|
|
3035
|
-
width: "fit-content"
|
|
3050
|
+
transition: "all 0.2s ease"
|
|
3036
3051
|
},
|
|
3037
|
-
"
|
|
3052
|
+
"[data-interaction-block-id]:hover": {
|
|
3038
3053
|
backgroundColor: "rgba(59, 130, 246, 0.08)"
|
|
3039
3054
|
},
|
|
3040
|
-
"[contenteditable=false]
|
|
3055
|
+
"[contenteditable=false] [data-interaction-block-id]:hover": {
|
|
3041
3056
|
cursor: "pointer"
|
|
3042
3057
|
}
|
|
3043
3058
|
}, bi = "grad_color_", uf = new RegExp(`^(?!${bi})(.+)$`);
|
|
@@ -4361,8 +4376,8 @@ function Uf({
|
|
|
4361
4376
|
const d = l();
|
|
4362
4377
|
o(d);
|
|
4363
4378
|
}
|
|
4364
|
-
}, [e]), /* @__PURE__ */ r(xe, { opened: e, zIndex: 1200, onClose: c, title: a("
|
|
4365
|
-
/* @__PURE__ */ r(L, { label: a("
|
|
4379
|
+
}, [e]), /* @__PURE__ */ r(xe, { opened: e, zIndex: 1200, onClose: c, title: a("rich_text.interaction_block.modal_title"), children: /* @__PURE__ */ u(D, { gap: "md", children: [
|
|
4380
|
+
/* @__PURE__ */ r(L, { label: a("rich_text.interaction_block.block_id_label"), description: a("rich_text.interaction_block.block_id_description"), placeholder: a("rich_text.interaction_block.block_id_placeholder"), value: i, onChange: (d) => o(d.currentTarget.value), onKeyDown: (d) => {
|
|
4366
4381
|
d.key === "Enter" && s();
|
|
4367
4382
|
} }),
|
|
4368
4383
|
/* @__PURE__ */ u(v, { justify: "flex-end", gap: "sm", children: [
|
|
@@ -4384,7 +4399,7 @@ function Kf() {
|
|
|
4384
4399
|
return null;
|
|
4385
4400
|
const o = t.isActive("interactionBlock");
|
|
4386
4401
|
return /* @__PURE__ */ u(F, { children: [
|
|
4387
|
-
/* @__PURE__ */ r(oe.Control, { onClick: i, active: o, "aria-label": e("
|
|
4402
|
+
/* @__PURE__ */ r(oe.Control, { onClick: i, active: o, "aria-label": e("rich_text.interaction_block.toggle_tooltip"), title: e("rich_text.interaction_block.toggle_tooltip"), children: /* @__PURE__ */ r(wp, { stroke: 1.5, size: 16 }) }),
|
|
4388
4403
|
/* @__PURE__ */ r(Uf, { opened: n, onClose: () => a(!1), editor: t })
|
|
4389
4404
|
] });
|
|
4390
4405
|
}
|
|
@@ -4400,7 +4415,7 @@ function Yf() {
|
|
|
4400
4415
|
if (!t)
|
|
4401
4416
|
return null;
|
|
4402
4417
|
const a = t.isActive("interactionBlock");
|
|
4403
|
-
return /* @__PURE__ */ r(oe.Control, { onClick: n, disabled: !a, "aria-label": e("
|
|
4418
|
+
return /* @__PURE__ */ r(oe.Control, { onClick: n, disabled: !a, "aria-label": e("rich_text.interaction_block.clear_tooltip"), title: e("rich_text.interaction_block.clear_tooltip"), children: /* @__PURE__ */ r(Sp, { stroke: 1.5, size: 16 }) });
|
|
4404
4419
|
}
|
|
4405
4420
|
const Xf = {
|
|
4406
4421
|
"dynamic-color": {
|
package/dist/dashboard.umd.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
-- use double curly brackets to wrap code in rich-text content.
|
|
3
3
|
Project ID: {{ context.project_id }}
|
|
4
4
|
Keyword: {{ filters.keyword }}
|
|
5
|
-
Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel variables"}}}},style:{label:"Style",font_size:{label:"Font Size",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"Font Weight"},size:{xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},flex:{justify_content:{label:"Justify Content",left:"Left",center:"Center",right:"Right",space_between:"Space Between",space_around:"Space Around",space_evenly:"Space Evenly"},align_items:{label:"Align Items",start:"Start",center:"Center",end:"End",stretch:"Stretch"}},color:{type:{label:"Color Type",static:"Static",interpolation:"Interpolation",none:"None"},interpolation:{setup:"Setup color interpolation",palette:{label:"Palette",category:{sequential:"Sequential",diverging:"Diverging"},red_green:"Red / Green",yellow_blue:"Yellow / Blue",red:"Red",green:"Green",blue:"Blue",orange:"Orange",mapping:{value_input_label:"Map a value to this color"}}}}},query:{label:"Query",labels:"Queries",add:"Add a Query",delete:"Delete this Query",cant_delete:"Can't delete this query for it's being used, check out Usage tab for details",delete_unused:"Delete unused queries",name:"Name",name_description:"A unique name",manage:"Manage Queries",open:"Open this query",configurations:"Configurations",basics:"Basics",conditions:"Conditions",run_by_condition:{label:"Run query when these are truthy",description:"Falsy: empty array / NaN / false / empty string / undefined / null",unset:"Leave it empty to always run this query on load"},re_run_condition:{label:"Re-run query when these changed",unset:"Leave it empty to never re-run this query"},dependency:{label:"Dependency",has_none:"This query has no dependency"},edit_sql:"Edit SQL",preview_sql:"Preview SQL",request:"Request",build_request:"Build Request",process_request:"Process Request",process_result:"Process Result",usage:{label:"Usage",in_views:"In View(s)",unused_description:"This query is not used by any filter or panel"},transform:{label:"Transform",full_label:"Transform Query",data_source:"Use other queries' data",guide:{pick_queries:"Pick queries for data input",write_function:"Write a function for making new data"}}},data:{label:"Data",preview_data:"Preview Data",empty_data:"Empty Data",requires_data:"Requires data",data_field:{selector:{options:{unset:"Unset",default:"Default"}}}},data_source:{label:"Data Source",explore:"Explore Data Source",explorer:"Data Source Explorer",table_structure:"Table Structure",table_structure_short:"Structure",see_table_structure:"See Table Structure"},visualization:{label:"Visualization",component:"Visualization",label_short:"Viz"},numbro:{format:{label:"Format",absolute:"Absolute",absolute_description:"Non-negative",abbreviation:"Abbreviation",abbreviation_description:"like 1.23k, 1.23m",mantissa:"Mantissa",trim_mantissa:"Trim mantissa",trim_mantissa_description:"hide trailing zero(s)",preview:{open:"Open Preview",close:"Close Preview",input:"In",output:"Out"}}},import:{label:"Import...",title:"Import content with schema json",json_file:"JSON File",this_dashboard:"This dashboard",this_file:"This file"},function_utils:{trigger_text:"About parameter 'utils'",modal_title:"About FunctionUtils",description:"Parameter <code>utils</code> is <code>FunctionUtils</code>, which contains:",document:"Document"},aggregation:{option:{none:"None",sum:"Sum",mean:"Mean",median:"Median",min:"Min",max:"Max",cov:"Coefficient of Variation",std:"Standard Variation",quantile:{label:"Quantile",label_with_hint:"Quantile(99%, 95%, ...)"},custom:{label:"Custom",label_trigger:"Edit Function",title:"Custom Aggregation"},pick_record:{label:"Pick Record",method:{label:"Record",first:"First Record",last:"Last Record"}}}},rich_text:{label:"Rich Text",content:{label:"Content"},dynamic_color:{label:"Dynamic Color",edit:"Edit dynamic color",clear:"Clear dynamic color"},color_mapping:{label:"Color Mapping",edit:"Edit color mapping",clear:"Clear color mapping",choose_value_var:"Choose a variable for color mapping",min:{val:"Fallback value",var:"Min value variable"},max:{val:"Fallback value",var:"Max value variable"}}},chart:{chart_config:"Chart Config",data_field:"Data Field",groups:{merico_suite:"Merico suite",echarts_based_charts:"ECharts-based charts",others:"Others"},unit:{title:"Unit",text:{placeholder:"Unit text"},show_in_tooltip:"Show unit text in tooltip",show_in_legend:"Show unit text in legend"},series_order:{label:"Order series by...",name:"Name",value:"Value",raw:"Record order",asc:"Ascending",desc:"Descending"},label:{label:"Label",label_full:"Label",label_style:"Label Style",label_format:"Label Format"},label_position:{label:"Label Position",off:"Off",top:"Top",left:"Left",right:"Right",bottom:"Bottom",inside:"Inside",inside_top:"Inside Top",inside_left:"Inside Left",inside_center:"Inside Center",inside_right:"Inside Right",inside_bottom:"Inside Bottom",inside_top_left:"Inside Top Left",inside_top_right:"Inside Top Right",inside_bottom_left:"Inside Bottom Left",inside_bottom_right:"Inside Bottom Right",outside:"Outside"},visual_map:{label:"Visual Map",continuous:{label:"Continuous"},piecewise:{label:"Piecewise",mode:{pieces:"Pieces",categories:"Categories"},add_a_piece:"Add a piece",interval:"Interval",piece_label:"Label"},bar_width:"Bar Width",bar_height:"Bar Height",item_width:"Item Width",item_height:"Item Height",calculable:"Show drag handle",min_value:"Min Value",max_value:"Max Value",min_text:"Min Text",max_text:"Max Text",use_palette_x:'Use palette "{{x}}"',built_in_palettes:"Built-in Palettes",precision:"Data Precision",skip_range:{lt_min:"Color for smaller values than min value",min:"Color for min value",max:"Color for max value",gt_max:"Color for greater values than max value",follow_visual_map:"follow gradient rule"}},number_or_dynamic_value:{type:{static:"Static",dynamic:"Dynamic"},dynamic:{setup:"Setup",setup_title:"Setup dynamic value",guide:"Dyanmic by a custom function"}},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},symbol_size:{label:"Symbol Size",static:"Static",dynamic:"Dynamic",setup:{label:"Setup",title:"Setup dynamic size",description:"Dynamic by a custom function"}},series:{label:"Series",name:"Name",y_axis:"Y Axis",data_field:"Data Field",add:"Add a series",delete:"Delete this series",line:{label:"Line",line_settings:"Line Settings",line_style:"Line Style",type:{label:"Line Type",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},line_width:"Line Width",step:{label:"Step",off:"Off",start:"Start",middle:"Middle",end:"End"},smooth_line:"Smooth Line",show_name_on_line:"Display Name on Line",show_symbol_on_line:"Show Symbol on Line",area_style:{label:"Area style",enabled:"Enable area style",color:"Area color",use_series_color:"Use series' color",origin:{label:"Origin position of the area",auto:{label:"Auto",description:"Fill between axis line and data (Default)"},start:{label:"Start",description:"Fill between min axis value and data"},end:{label:"End",description:"Fill between max axis value and data"}},shadow_blur:"Shadow Blur",shadow_color:"Shadow Color",shadow_offset_x:"Shadow Offset X",shadow_offset_y:"Shadow Offset Y",opacity:"Opacity"}},bar:{label:"Bar",stack:"Stack",stack_hint:"Stack bars by this ID",bar_gap:{label:"Bar Gap",no_gap:"No gap between bars",overlap:"Bars overlapping on each other"},bar_width:{min:"Bar Width(min)",exact:"Bar Width",max:"Bar Width(max)"}},scatter:{label:"Scatter"},group_by:{label:"Split into multiple seires by this field...",label_line:"Split into multiple lines by this field..."}},axis:{tick_label:"Tick Label",customize_label:"Customize Label",overflow:{label:"Overflow",max_width:"Max Width",truncate:"Truncate",break_line:"Break Line",break_word:"Break Word",ellipsis:"Ellipsis",section_title:{on_axis:"Overflow on Axis",in_tooltip:"Overflow in Tooltip"}},section_title:{label_format:"Label Format"},type:{value:"Value",category:"Category",time:"Time",log:"Log",click_to_learn_more:"Click <1>here</1> to learn more about these options"}},name_text:{align:{label:"Name Anchor",left:"Left",center:"Center",right:"Right"}},rotate:"Rotate",degree:"degree",padding:"Padding",content_template:{label:"Content Template",hint:"Average: ${avg}"},x_axis:{label:"X Axis",labels:"X Axes",label_format:"Label Format",add:"Add an X Axis",delete:"Delete this X Axis",x_axis_name:"X Axis Name",x_axis_data_field:"X Axis Data Field",x_axis_type:"X Axis Type",layout:"Layout",position:{label:"Position",top:"Top",bottom:"Bottom"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},y_axis:{label:"Y Axis",labels:"Y Axes",label_format:"Label Format",add:"Add a Y Axis",delete:"Delete this Y Axis",y_axis_name:"Y Axis Name",y_axis_name_anchor:"Name Anchor",y_axis_data_field:"Y Axis Data Field",inverse:"Inverse",layout:"Layout",position:{label:"Position",left:"Left",right:"Right"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible",mirror:{label:"Mirror"}},stats:{label:"Stats",template:{above_chart:"Stats above the chart",under_chart:"Stats under the chart"}},legend:{label:"Legend",show_legend:"Show Legend",show_in_legend:"Show in legend",hide_in_legend:"Hide in legend",orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"}},tooltip:{label:"Tooltip",additional_metrics:{description:"Set additional metrics to show in scatter's tooltip",add:"Add a metic",delete:"Delete this Metric"},trigger:{label:"Trigger",scatter_point:"Scatter Point",x_axis:"X Axis"}},style:{label:"Style"},color:{label:"Color",background_color:"Background Color",text_color:"Text Color",click_to_add_a_color:"Click to add a color",color_gradient:"Color Gradient",not_set:"Not set"},behavior:{label:"Behavior",invisible:"Invisible"},heatmap:{heatblock:{label:"Heat Block",show_label:"Show Label"}},reference_line:{label:"Reference Line",labels:"Reference Lines",add:"Add a reference line",name_placeholder:"Average Reference Line",delete:"Remove this Reference Line",orientation:{vertical_hint:"Works only when xAxis values are numbers"}},regression_line:{label:"Regression Line",labels:"Regression Lines",add:"Add a line",delete:"Delete this line",method:{label:"Method",linear:"Linear",exponential:"Exponential",logistic:"Logistic",polynomial:"Polynomial",polynomial_order:"Order"}},reference_area:{label:"Reference Area",labels:"Reference Areas",add:"Add a reference area",delete:"Remove this reference area",type:{label:"Type",rectangle:"Rectangle"},direction:{label:"Direction",horizontal:"Horizontal"},boundary:{upper:"Upper Boundary",lower:"Lower Boundary"},content:{label:"Content",content_text:"Content Text",text_position:"Text Position"},endpoint:{labels:"Endpoints",left_bottom_point:"Left-Bottom Point",right_top_point:"Right-Top Point"}},zooming:{label:"Zooming",scroll:{label:"Scroll to zoom",x_axis:"Enable on X Axis",y_axis:"Enable on Y Axis"},slider:{label:"Slider for zooming",x_axis:"Slider for X Axis",y_axis:"Slider for Y Axis",y_axis_disabled:"Not available for now, will overlap y-axis's label"}}},viz:{viz_config_banner:"Visualization Settings"},validation:{number:{require_a_number:"A number is required"}},spotlight:{trigger_text:"Search",main_group:"Main",placeholder:"Search to open...",not_found:"Nothing found..."}}},Fu={translation:{filter:{label:"筛选器",labels:"筛选器",add:"新增筛选器",manage:"管理筛选器",delete:"删除这个筛选器",show_filters:"展开筛选器",hide_filters:"收起筛选器",usage:{label:"使用情况",unused_description:"此筛选器未被任何查询、SQL片段或视图使用"},field:{widget:"控件",visible_in:"在...视图中可见",key_placeholder:"用于引用此筛选器,需保持唯一",label_placeholder:"用于展示的标签文案",auto_submit:"自动提交",order:"排列次序",custom_default_value:{trigger:"自定义默认值",title:"自定义默认值",tips:"提示",tip_1:"在指定筛选器默认值这事上,自定义函数具备最高优先级",tip_2:"清空下方编辑器来禁用本功能"}},widget:{names:{select:"单选",multi_select:"多选",tree_select:"树形选择器",tree_single_select:"树形单选器",text_input:"文本框",checkbox:"勾选框",date_range:"日期范围",merico_date_range:"思码逸专用日期范围"},common:{use_query_data_as_options:"使用所查数据为选项",fetch_options_from_datasource:"从数据源查选项",or_fetch_options_from_datasource:"或从数据源查选项",selector_option_empty:"无选项可用",see_data_structure:"点击查看期望的数据格式",using_query:"在用查询获取选项",default_selection_count:"默认选中前N项",min_width:"控件最小宽度",x_selected:"已选数:{{count}}",default_value_mode:{label:"当选项变更时",intersect:"保持已选值的有效部分",reset:"忽略已选值,使用新选项"}},text_input:{default_value:"默认值",required:"必填"},select:{width:"控件宽度",required:"必选",clearable:"可取消选择",configure_options:"配置选项",default_selection:"默认选项",no_default_selection:"无",select_first_option_by_default:"默认选中第一个选项",preset_options:{apply:"使用预设选项列表",date_unit:"日期步长"}},multi_select:{width_description:"至少160px"},tree_select:{strictly:"枝叶节点不相关,各选各的"},tree_single_select:{select_first_option_by_default:"默认选中第一个选项"},checkbox:{description:"描述信息",default_checked:"默认勾选"},date_range:{required:"必选",allow_single_date:"允许选一天作为范围",display_format:"展示格式",max_days:"最大选择天数",one_day:"1天",x_days:"{{count}}天",x_max_days:"最多可选{{max_days}}天",default_value:"默认日期范围(具体)",default_by_shortcut:"默认日期范围(快捷方式)",default_by_shortcut_placeholder:"优先于左侧",start_date:"开始日期",end_date:"结束日期",step:{label:"步长",day:"天",week:"周",bi_week:"双周",month:"月",quarter:"季度",year:"年"},shortcut:{last:{label:"过往整周期",d:"昨天",w:"周",m:"月",m2:"两个月",m3:"三个月",m6:"六个月",y:"年",full:{d:"昨天",w:"上周",m:"上个月",m2:"上两月",m3:"上三月",m6:"上六个月",y:"去年"}},recent:{label:"最近",d7:"7天",d30:"30天",d60:"60天",d90:"90天",d180:"180天",d365:"365天",full:{d7:"近7天",d30:"近30天",d60:"近60天",d90:"近90天",d180:"近180天",d365:"近365天"}},this:{label:"当前整周期",d:"今天",w:"周",m:"月",y:"年",full:{d:"今天",w:"本周",m:"本月",y:"今年"}},this_so_far:{label:"至今",w:"周",m:"月",y:"年",full:{w:"本周至今",m:"本月至今",y:"本年至今"}}}}}},view:{label:"视图",labels:"视图",add:"新增视图",delete:"删除此视图",download_schema:"下载此视图描述文件",layout:{drag_to_move:"拖动可重排图表位置"},component:{div:{label:"内容"},tabs:{label:"标签页",tabs_settings:"标签页设置",tab:{name:"名称",view:"内容视图",order:"排列次序",color:"颜色",delete:"删除这个标签页",switch_to_view:"打开视图: {{name}}"}},modal:{label:"弹窗",modal_settings:"弹窗设置",title:"弹窗标题",custom_title:"自定义弹窗标题",width:"宽度",height:"高度"}}},interactions:{label:"交互",add:"新增交互",interactions_viewer:"纵览交互",unavailable:"不可用",unavailable_reason:"此可视化组件没有交互功能",trigger:{setup:"设置触发动作",label:"触发动作",payload:"触发时的参数"},operation:{setup:"操作设置",label:"操作",settings:"设置",variables:"变量",console_log:{label:"console.log | 调试用",log_content:"打印内容"},open_link:{label:"打开链接",url:"URL",open_in_new_tab:"在新标签页中打开"},open_view:{label:"唤出视图",view:"视图"},switch_tab:{label:"切换标签页",view:"视图",tab:"标签页"},scroll_to_panel:{label:"滚动到卡片",panel:"卡片"},set_filter_values:{label:"设置筛选器值",set_filter:"将筛选器的值",with:"设为"},clear_filter_values:{label:"清除筛选器值",select_filter:"选择筛选器以清除其值"}}},query_variable:{label:"查询变量",labels:"查询变量",add:"新增变量",guide:{tabs:{guide:"使用指南",variables_in_this_dashboard:"本看板中的查询变量",global_sql_snippets:"全局SQL片段"}},open:"查看查询变量"},sql_snippet:{label:"SQL片段",labels:"SQL片段",add:"新增SQL片段",delete:"删除这个SQL片段",delete_unused:"删除未用到的SQL片段",manage:"管理SQL片段",key:"键",key_occupied:"此键已被其他SQL片段占用",edit_snippet:"编辑SQL片段",preview_snippet:"预览SQL片段",usage:{label:"使用情况"}},global_sql_snippet:{label:"全局SQL片段",labels:"全局SQL片段",description:"管理员负责在系统设置中维护全局SQL片段"},common:{titles:{settings:"设置",edit:"编辑",config:"配置"},pagination:{label:"分页",page_size:"页容量",total:"共",total_rows:"共 {{total}} 行",to_previous_page:"上一页",to_next_page:"下一页",showing_rows:"第 {{start_row}} - {{end_row}} 行,共 {{total}} 行"},align:{horizontal:{label:"水平对齐",left:"居左",center:"居中",right:"居右"},vertical:{label:"垂直对齐",top:"居上",center:"居中",bottom:"居下"}},id:"ID",name:"名称",key:"键",label:"标签",value:"值",type:"类型",info:"信息",min:"最小值",max:"最大值",invalid:"无效的",data_field:"数据字段",id_field:"ID 字段",name_data_field:"名称字段",value_data_field:"值字段",color_data_field:"颜色字段",enabled:"启用",copied:"已复制到剪切板",action:"操作",actions:{search:"查询",reload:"刷新",actions:"操作",open:"打开",close:"关闭",save:"保存",save_changes:"保存改动",revert:"还原",revert_changes:"还原改动",reset_to_default:"重置为初始值",init_with_default:"初始化",select_all:"全选",clear:"清除",clear_selection:"撤销选择",refresh:"刷新",download_data:"下载数据",download_schema:"下载描述文件",download_screenshot:"下载截图",enter_fullscreen:"全屏",duplicate:"复制",delete:"删除",cancel:"取消",confirm:"确认",apply:"应用",add_an_option:"新增选项",edit:"编辑",end_editing:"结束编辑 <0>{{name}}</0>",edit_rich_text:"编辑富文本内容"},tabs:{variant:{label:"风格",default:"默认",outline:"轮廓",pills:"胶囊"},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},grow_tabs:"拉伸标签卡宽度"},choose_a_tab_first:"请先选择一个标签页"},breakpoint:{label_one:"屏幕尺寸",label_other:"屏幕尺寸",add:"新增屏幕尺寸",manage:"管理屏幕尺寸",breakpoint:"最小宽度"},context:{label:"上下文"},mock_context:{label:"模拟上下文",hint:"内容格式为JSON"},panel:{label:"卡片",labels:"卡片",add:"新增卡片",delete:"删除这个卡片",panel_name:"卡片名",panel_description:"卡片描述",panel_description_click:"点击查看卡片描述",show_title:"展示卡片标题",use_name_as_title:"使用卡片名作为标题",settings:{change_view:"移至另一个视图下",change_view_title:"移动此卡片至另一个视图下",choose_queries:"关联查询",need_to_choose_queries:"请关联至少一个查询以使用其数据"},style:{label:"样式",width:"宽",width_postfix:"之 36 栏",height:"高",height_postfix:"px",border:"边框"},variable:{label:"变量",labels:"变量",add:"新增变量",delete:"删除此变量",aggregation:{label:"聚合",fallback_value:"兜底值",fallback_value_description:"当数据为空或聚合结果非数字时,使用此兜底值"},guide:{text:`-- 可以在富文本和自定义函数中,使用看板信息以及卡片的变量。
|
|
5
|
+
Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel variables"}}}},style:{label:"Style",font_size:{label:"Font Size",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"Font Weight"},size:{xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},flex:{justify_content:{label:"Justify Content",left:"Left",center:"Center",right:"Right",space_between:"Space Between",space_around:"Space Around",space_evenly:"Space Evenly"},align_items:{label:"Align Items",start:"Start",center:"Center",end:"End",stretch:"Stretch"}},color:{type:{label:"Color Type",static:"Static",interpolation:"Interpolation",none:"None"},interpolation:{setup:"Setup color interpolation",palette:{label:"Palette",category:{sequential:"Sequential",diverging:"Diverging"},red_green:"Red / Green",yellow_blue:"Yellow / Blue",red:"Red",green:"Green",blue:"Blue",orange:"Orange",mapping:{value_input_label:"Map a value to this color"}}}}},query:{label:"Query",labels:"Queries",add:"Add a Query",delete:"Delete this Query",cant_delete:"Can't delete this query for it's being used, check out Usage tab for details",delete_unused:"Delete unused queries",name:"Name",name_description:"A unique name",manage:"Manage Queries",open:"Open this query",configurations:"Configurations",basics:"Basics",conditions:"Conditions",run_by_condition:{label:"Run query when these are truthy",description:"Falsy: empty array / NaN / false / empty string / undefined / null",unset:"Leave it empty to always run this query on load"},re_run_condition:{label:"Re-run query when these changed",unset:"Leave it empty to never re-run this query"},dependency:{label:"Dependency",has_none:"This query has no dependency"},edit_sql:"Edit SQL",preview_sql:"Preview SQL",request:"Request",build_request:"Build Request",process_request:"Process Request",process_result:"Process Result",usage:{label:"Usage",in_views:"In View(s)",unused_description:"This query is not used by any filter or panel"},transform:{label:"Transform",full_label:"Transform Query",data_source:"Use other queries' data",guide:{pick_queries:"Pick queries for data input",write_function:"Write a function for making new data"}}},data:{label:"Data",preview_data:"Preview Data",empty_data:"Empty Data",requires_data:"Requires data",data_field:{selector:{options:{unset:"Unset",default:"Default"}}}},data_source:{label:"Data Source",explore:"Explore Data Source",explorer:"Data Source Explorer",table_structure:"Table Structure",table_structure_short:"Structure",see_table_structure:"See Table Structure"},visualization:{label:"Visualization",component:"Visualization",label_short:"Viz"},numbro:{format:{label:"Format",absolute:"Absolute",absolute_description:"Non-negative",abbreviation:"Abbreviation",abbreviation_description:"like 1.23k, 1.23m",mantissa:"Mantissa",trim_mantissa:"Trim mantissa",trim_mantissa_description:"hide trailing zero(s)",preview:{open:"Open Preview",close:"Close Preview",input:"In",output:"Out"}}},import:{label:"Import...",title:"Import content with schema json",json_file:"JSON File",this_dashboard:"This dashboard",this_file:"This file"},function_utils:{trigger_text:"About parameter 'utils'",modal_title:"About FunctionUtils",description:"Parameter <code>utils</code> is <code>FunctionUtils</code>, which contains:",document:"Document"},aggregation:{option:{none:"None",sum:"Sum",mean:"Mean",median:"Median",min:"Min",max:"Max",cov:"Coefficient of Variation",std:"Standard Variation",quantile:{label:"Quantile",label_with_hint:"Quantile(99%, 95%, ...)"},custom:{label:"Custom",label_trigger:"Edit Function",title:"Custom Aggregation"},pick_record:{label:"Pick Record",method:{label:"Record",first:"First Record",last:"Last Record"}}}},rich_text:{label:"Rich Text",content:{label:"Content"},dynamic_color:{label:"Dynamic Color",edit:"Edit dynamic color",clear:"Clear dynamic color"},color_mapping:{label:"Color Mapping",edit:"Edit color mapping",clear:"Clear color mapping",choose_value_var:"Choose a variable for color mapping",min:{val:"Fallback value",var:"Min value variable"},max:{val:"Fallback value",var:"Max value variable"}},interaction_block:{modal_title:"Configure Interaction Block",block_id_label:"Block ID",block_id_description:"Unique identifier for this interaction block",block_id_placeholder:"Enter block ID",toggle_tooltip:"Toggle interaction block settings",clear_tooltip:"Clear interaction block"}},chart:{chart_config:"Chart Config",data_field:"Data Field",groups:{merico_suite:"Merico suite",echarts_based_charts:"ECharts-based charts",others:"Others"},unit:{title:"Unit",text:{placeholder:"Unit text"},show_in_tooltip:"Show unit text in tooltip",show_in_legend:"Show unit text in legend"},series_order:{label:"Order series by...",name:"Name",value:"Value",raw:"Record order",asc:"Ascending",desc:"Descending"},label:{label:"Label",label_full:"Label",label_style:"Label Style",label_format:"Label Format"},label_position:{label:"Label Position",off:"Off",top:"Top",left:"Left",right:"Right",bottom:"Bottom",inside:"Inside",inside_top:"Inside Top",inside_left:"Inside Left",inside_center:"Inside Center",inside_right:"Inside Right",inside_bottom:"Inside Bottom",inside_top_left:"Inside Top Left",inside_top_right:"Inside Top Right",inside_bottom_left:"Inside Bottom Left",inside_bottom_right:"Inside Bottom Right",outside:"Outside"},visual_map:{label:"Visual Map",continuous:{label:"Continuous"},piecewise:{label:"Piecewise",mode:{pieces:"Pieces",categories:"Categories"},add_a_piece:"Add a piece",interval:"Interval",piece_label:"Label"},bar_width:"Bar Width",bar_height:"Bar Height",item_width:"Item Width",item_height:"Item Height",calculable:"Show drag handle",min_value:"Min Value",max_value:"Max Value",min_text:"Min Text",max_text:"Max Text",use_palette_x:'Use palette "{{x}}"',built_in_palettes:"Built-in Palettes",precision:"Data Precision",skip_range:{lt_min:"Color for smaller values than min value",min:"Color for min value",max:"Color for max value",gt_max:"Color for greater values than max value",follow_visual_map:"follow gradient rule"}},number_or_dynamic_value:{type:{static:"Static",dynamic:"Dynamic"},dynamic:{setup:"Setup",setup_title:"Setup dynamic value",guide:"Dyanmic by a custom function"}},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},symbol_size:{label:"Symbol Size",static:"Static",dynamic:"Dynamic",setup:{label:"Setup",title:"Setup dynamic size",description:"Dynamic by a custom function"}},series:{label:"Series",name:"Name",y_axis:"Y Axis",data_field:"Data Field",add:"Add a series",delete:"Delete this series",line:{label:"Line",line_settings:"Line Settings",line_style:"Line Style",type:{label:"Line Type",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},line_width:"Line Width",step:{label:"Step",off:"Off",start:"Start",middle:"Middle",end:"End"},smooth_line:"Smooth Line",show_name_on_line:"Display Name on Line",show_symbol_on_line:"Show Symbol on Line",area_style:{label:"Area style",enabled:"Enable area style",color:"Area color",use_series_color:"Use series' color",origin:{label:"Origin position of the area",auto:{label:"Auto",description:"Fill between axis line and data (Default)"},start:{label:"Start",description:"Fill between min axis value and data"},end:{label:"End",description:"Fill between max axis value and data"}},shadow_blur:"Shadow Blur",shadow_color:"Shadow Color",shadow_offset_x:"Shadow Offset X",shadow_offset_y:"Shadow Offset Y",opacity:"Opacity"}},bar:{label:"Bar",stack:"Stack",stack_hint:"Stack bars by this ID",bar_gap:{label:"Bar Gap",no_gap:"No gap between bars",overlap:"Bars overlapping on each other"},bar_width:{min:"Bar Width(min)",exact:"Bar Width",max:"Bar Width(max)"}},scatter:{label:"Scatter"},group_by:{label:"Split into multiple seires by this field...",label_line:"Split into multiple lines by this field..."}},axis:{tick_label:"Tick Label",customize_label:"Customize Label",overflow:{label:"Overflow",max_width:"Max Width",truncate:"Truncate",break_line:"Break Line",break_word:"Break Word",ellipsis:"Ellipsis",section_title:{on_axis:"Overflow on Axis",in_tooltip:"Overflow in Tooltip"}},section_title:{label_format:"Label Format"},type:{value:"Value",category:"Category",time:"Time",log:"Log",click_to_learn_more:"Click <1>here</1> to learn more about these options"}},name_text:{align:{label:"Name Anchor",left:"Left",center:"Center",right:"Right"}},rotate:"Rotate",degree:"degree",padding:"Padding",content_template:{label:"Content Template",hint:"Average: ${avg}"},x_axis:{label:"X Axis",labels:"X Axes",label_format:"Label Format",add:"Add an X Axis",delete:"Delete this X Axis",x_axis_name:"X Axis Name",x_axis_data_field:"X Axis Data Field",x_axis_type:"X Axis Type",layout:"Layout",position:{label:"Position",top:"Top",bottom:"Bottom"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},y_axis:{label:"Y Axis",labels:"Y Axes",label_format:"Label Format",add:"Add a Y Axis",delete:"Delete this Y Axis",y_axis_name:"Y Axis Name",y_axis_name_anchor:"Name Anchor",y_axis_data_field:"Y Axis Data Field",inverse:"Inverse",layout:"Layout",position:{label:"Position",left:"Left",right:"Right"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible",mirror:{label:"Mirror"}},stats:{label:"Stats",template:{above_chart:"Stats above the chart",under_chart:"Stats under the chart"}},legend:{label:"Legend",show_legend:"Show Legend",show_in_legend:"Show in legend",hide_in_legend:"Hide in legend",orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"}},tooltip:{label:"Tooltip",additional_metrics:{description:"Set additional metrics to show in scatter's tooltip",add:"Add a metic",delete:"Delete this Metric"},trigger:{label:"Trigger",scatter_point:"Scatter Point",x_axis:"X Axis"}},style:{label:"Style"},color:{label:"Color",background_color:"Background Color",text_color:"Text Color",click_to_add_a_color:"Click to add a color",color_gradient:"Color Gradient",not_set:"Not set"},behavior:{label:"Behavior",invisible:"Invisible"},heatmap:{heatblock:{label:"Heat Block",show_label:"Show Label"}},reference_line:{label:"Reference Line",labels:"Reference Lines",add:"Add a reference line",name_placeholder:"Average Reference Line",delete:"Remove this Reference Line",orientation:{vertical_hint:"Works only when xAxis values are numbers"}},regression_line:{label:"Regression Line",labels:"Regression Lines",add:"Add a line",delete:"Delete this line",method:{label:"Method",linear:"Linear",exponential:"Exponential",logistic:"Logistic",polynomial:"Polynomial",polynomial_order:"Order"}},reference_area:{label:"Reference Area",labels:"Reference Areas",add:"Add a reference area",delete:"Remove this reference area",type:{label:"Type",rectangle:"Rectangle"},direction:{label:"Direction",horizontal:"Horizontal"},boundary:{upper:"Upper Boundary",lower:"Lower Boundary"},content:{label:"Content",content_text:"Content Text",text_position:"Text Position"},endpoint:{labels:"Endpoints",left_bottom_point:"Left-Bottom Point",right_top_point:"Right-Top Point"}},zooming:{label:"Zooming",scroll:{label:"Scroll to zoom",x_axis:"Enable on X Axis",y_axis:"Enable on Y Axis"},slider:{label:"Slider for zooming",x_axis:"Slider for X Axis",y_axis:"Slider for Y Axis",y_axis_disabled:"Not available for now, will overlap y-axis's label"}}},viz:{viz_config_banner:"Visualization Settings"},validation:{number:{require_a_number:"A number is required"}},spotlight:{trigger_text:"Search",main_group:"Main",placeholder:"Search to open...",not_found:"Nothing found..."}}},Fu={translation:{filter:{label:"筛选器",labels:"筛选器",add:"新增筛选器",manage:"管理筛选器",delete:"删除这个筛选器",show_filters:"展开筛选器",hide_filters:"收起筛选器",usage:{label:"使用情况",unused_description:"此筛选器未被任何查询、SQL片段或视图使用"},field:{widget:"控件",visible_in:"在...视图中可见",key_placeholder:"用于引用此筛选器,需保持唯一",label_placeholder:"用于展示的标签文案",auto_submit:"自动提交",order:"排列次序",custom_default_value:{trigger:"自定义默认值",title:"自定义默认值",tips:"提示",tip_1:"在指定筛选器默认值这事上,自定义函数具备最高优先级",tip_2:"清空下方编辑器来禁用本功能"}},widget:{names:{select:"单选",multi_select:"多选",tree_select:"树形选择器",tree_single_select:"树形单选器",text_input:"文本框",checkbox:"勾选框",date_range:"日期范围",merico_date_range:"思码逸专用日期范围"},common:{use_query_data_as_options:"使用所查数据为选项",fetch_options_from_datasource:"从数据源查选项",or_fetch_options_from_datasource:"或从数据源查选项",selector_option_empty:"无选项可用",see_data_structure:"点击查看期望的数据格式",using_query:"在用查询获取选项",default_selection_count:"默认选中前N项",min_width:"控件最小宽度",x_selected:"已选数:{{count}}",default_value_mode:{label:"当选项变更时",intersect:"保持已选值的有效部分",reset:"忽略已选值,使用新选项"}},text_input:{default_value:"默认值",required:"必填"},select:{width:"控件宽度",required:"必选",clearable:"可取消选择",configure_options:"配置选项",default_selection:"默认选项",no_default_selection:"无",select_first_option_by_default:"默认选中第一个选项",preset_options:{apply:"使用预设选项列表",date_unit:"日期步长"}},multi_select:{width_description:"至少160px"},tree_select:{strictly:"枝叶节点不相关,各选各的"},tree_single_select:{select_first_option_by_default:"默认选中第一个选项"},checkbox:{description:"描述信息",default_checked:"默认勾选"},date_range:{required:"必选",allow_single_date:"允许选一天作为范围",display_format:"展示格式",max_days:"最大选择天数",one_day:"1天",x_days:"{{count}}天",x_max_days:"最多可选{{max_days}}天",default_value:"默认日期范围(具体)",default_by_shortcut:"默认日期范围(快捷方式)",default_by_shortcut_placeholder:"优先于左侧",start_date:"开始日期",end_date:"结束日期",step:{label:"步长",day:"天",week:"周",bi_week:"双周",month:"月",quarter:"季度",year:"年"},shortcut:{last:{label:"过往整周期",d:"昨天",w:"周",m:"月",m2:"两个月",m3:"三个月",m6:"六个月",y:"年",full:{d:"昨天",w:"上周",m:"上个月",m2:"上两月",m3:"上三月",m6:"上六个月",y:"去年"}},recent:{label:"最近",d7:"7天",d30:"30天",d60:"60天",d90:"90天",d180:"180天",d365:"365天",full:{d7:"近7天",d30:"近30天",d60:"近60天",d90:"近90天",d180:"近180天",d365:"近365天"}},this:{label:"当前整周期",d:"今天",w:"周",m:"月",y:"年",full:{d:"今天",w:"本周",m:"本月",y:"今年"}},this_so_far:{label:"至今",w:"周",m:"月",y:"年",full:{w:"本周至今",m:"本月至今",y:"本年至今"}}}}}},view:{label:"视图",labels:"视图",add:"新增视图",delete:"删除此视图",download_schema:"下载此视图描述文件",layout:{drag_to_move:"拖动可重排图表位置"},component:{div:{label:"内容"},tabs:{label:"标签页",tabs_settings:"标签页设置",tab:{name:"名称",view:"内容视图",order:"排列次序",color:"颜色",delete:"删除这个标签页",switch_to_view:"打开视图: {{name}}"}},modal:{label:"弹窗",modal_settings:"弹窗设置",title:"弹窗标题",custom_title:"自定义弹窗标题",width:"宽度",height:"高度"}}},interactions:{label:"交互",add:"新增交互",interactions_viewer:"纵览交互",unavailable:"不可用",unavailable_reason:"此可视化组件没有交互功能",trigger:{setup:"设置触发动作",label:"触发动作",payload:"触发时的参数"},operation:{setup:"操作设置",label:"操作",settings:"设置",variables:"变量",console_log:{label:"console.log | 调试用",log_content:"打印内容"},open_link:{label:"打开链接",url:"URL",open_in_new_tab:"在新标签页中打开"},open_view:{label:"唤出视图",view:"视图"},switch_tab:{label:"切换标签页",view:"视图",tab:"标签页"},scroll_to_panel:{label:"滚动到卡片",panel:"卡片"},set_filter_values:{label:"设置筛选器值",set_filter:"将筛选器的值",with:"设为"},clear_filter_values:{label:"清除筛选器值",select_filter:"选择筛选器以清除其值"}}},query_variable:{label:"查询变量",labels:"查询变量",add:"新增变量",guide:{tabs:{guide:"使用指南",variables_in_this_dashboard:"本看板中的查询变量",global_sql_snippets:"全局SQL片段"}},open:"查看查询变量"},sql_snippet:{label:"SQL片段",labels:"SQL片段",add:"新增SQL片段",delete:"删除这个SQL片段",delete_unused:"删除未用到的SQL片段",manage:"管理SQL片段",key:"键",key_occupied:"此键已被其他SQL片段占用",edit_snippet:"编辑SQL片段",preview_snippet:"预览SQL片段",usage:{label:"使用情况"}},global_sql_snippet:{label:"全局SQL片段",labels:"全局SQL片段",description:"管理员负责在系统设置中维护全局SQL片段"},common:{titles:{settings:"设置",edit:"编辑",config:"配置"},pagination:{label:"分页",page_size:"页容量",total:"共",total_rows:"共 {{total}} 行",to_previous_page:"上一页",to_next_page:"下一页",showing_rows:"第 {{start_row}} - {{end_row}} 行,共 {{total}} 行"},align:{horizontal:{label:"水平对齐",left:"居左",center:"居中",right:"居右"},vertical:{label:"垂直对齐",top:"居上",center:"居中",bottom:"居下"}},id:"ID",name:"名称",key:"键",label:"标签",value:"值",type:"类型",info:"信息",min:"最小值",max:"最大值",invalid:"无效的",data_field:"数据字段",id_field:"ID 字段",name_data_field:"名称字段",value_data_field:"值字段",color_data_field:"颜色字段",enabled:"启用",copied:"已复制到剪切板",action:"操作",actions:{search:"查询",reload:"刷新",actions:"操作",open:"打开",close:"关闭",save:"保存",save_changes:"保存改动",revert:"还原",revert_changes:"还原改动",reset_to_default:"重置为初始值",init_with_default:"初始化",select_all:"全选",clear:"清除",clear_selection:"撤销选择",refresh:"刷新",download_data:"下载数据",download_schema:"下载描述文件",download_screenshot:"下载截图",enter_fullscreen:"全屏",duplicate:"复制",delete:"删除",cancel:"取消",confirm:"确认",apply:"应用",add_an_option:"新增选项",edit:"编辑",end_editing:"结束编辑 <0>{{name}}</0>",edit_rich_text:"编辑富文本内容"},tabs:{variant:{label:"风格",default:"默认",outline:"轮廓",pills:"胶囊"},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},grow_tabs:"拉伸标签卡宽度"},choose_a_tab_first:"请先选择一个标签页"},breakpoint:{label_one:"屏幕尺寸",label_other:"屏幕尺寸",add:"新增屏幕尺寸",manage:"管理屏幕尺寸",breakpoint:"最小宽度"},context:{label:"上下文"},mock_context:{label:"模拟上下文",hint:"内容格式为JSON"},panel:{label:"卡片",labels:"卡片",add:"新增卡片",delete:"删除这个卡片",panel_name:"卡片名",panel_description:"卡片描述",panel_description_click:"点击查看卡片描述",show_title:"展示卡片标题",use_name_as_title:"使用卡片名作为标题",settings:{change_view:"移至另一个视图下",change_view_title:"移动此卡片至另一个视图下",choose_queries:"关联查询",need_to_choose_queries:"请关联至少一个查询以使用其数据"},style:{label:"样式",width:"宽",width_postfix:"之 36 栏",height:"高",height_postfix:"px",border:"边框"},variable:{label:"变量",labels:"变量",add:"新增变量",delete:"删除此变量",aggregation:{label:"聚合",fallback_value:"兜底值",fallback_value_description:"当数据为空或聚合结果非数字时,使用此兜底值"},guide:{text:`-- 可以在富文本和自定义函数中,使用看板信息以及卡片的变量。
|
|
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_field:{selector:{options:{unset:"未设置",default:"默认"}}}},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 sn{constructor(t){V(this,"rootRef");this.rootRef=F.observable({current:t})}async deleteItem(t){F.runInAction(()=>{y.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?F.toJS(this.rootRef.current):y.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(y.isObject(r))F.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else F.runInAction(()=>{y.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,a){return F.reaction(()=>this.getValueFromRoot(t),(o,l)=>{r(o,l)},{requiresObservable:!0,fireImmediately:y.get(a,"fireImmediately",!1)})}}class Qu{constructor(){V(this,"channels",new Map);V(this,"globalChannel",new hs)}getChannel(t){const r=this.channels.get(t);if(r)return r;const a=new hs;return this.channels.set(t,a),a}}class ju{constructor(t){V(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 Qu,instanceData:new sn(t.viz.conf)};return this.instances.set(t.id,a),a}}function Es(e,t,r,a){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new sn({}),colorPalette:{getColor(){return()=>""}},data:t,variables:a}}const Wu=e=>{const{panel:t,measure:r,vizManager:a,data:o,variables:l}=e,i=a.resolveComponent(t.viz.type),c=a.getOrCreateInstance(t),d={...Es(c,o,a,l),viewport:{width:r.w,height:r.h}},u=i.viewRender;return n.jsx(u,{context:d,instance:c,...y.omit(e,["panel","vizManager","data"])})},Uu=e=>{const{vizManager:t,panel:r,data:a,variables:o}=e,l=t.resolveComponent(r.viz.type),i=t.getOrCreateInstance(r),c={...Es(i,a,t,o)},d=l.configRender;return n.jsx(d,{context:c,instance:i,...y.omit(e,["panel","vizManager","data"])})},Bs=(e,t)=>{const r=Oe.bezier(e),a=Oe.bezier(t);return function(o){return o<50?r(o*2/100).hex():a((o-50)*2/100).hex()}},on=e=>{const t=Oe.bezier(e);return function(r){return t(r/100).hex()}},Ku={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Bs(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Yu={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Bs(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Xu={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:on(["#fff7f1","darkred"]),name:"red",category:"sequential"},Zu={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:on(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},Ju={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:on(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},Hu={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:on(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class Ru{constructor(t){this.pluginManager=t}createPanelAddonNode(t){const a=this.pluginManager.installedPlugins.flatMap(o=>o.manifest.panelAddon).filter(o=>!!o).map(o=>h.createElement(o.addonRender,{...t,key:o.name}));return n.jsx(n.Fragment,{children:a})}}const qs=h.createContext({addonSlotId:null});function Ls({children:e,addonSlotId:t}){const r=h.useId(),a=t||`panel-addon-slot-${r}`;return n.jsx(qs.Provider,{value:{addonSlotId:a},children:e})}function ep(){const{addonSlotId:e}=h.useContext(qs);return e?document.getElementById(e):null}class tp{constructor(t){V(this,"symbol");this.symbol=Symbol(t)}}function Xe(e){return new tp(e)}class Un{constructor(){V(this,"parent");V(this,"factoryRegistry",new Map);V(this,"instanceRegistry",new Map)}createScoped(){const t=new Un;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()}}const Os="14.58.2",np=Object.freeze(Object.defineProperty({__proto__:null,version:Os},Symbol.toStringTag,{value:"Module"}));class rp{constructor(t){V(this,"staticColors",new Map);V(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 ap{constructor(){V(this,"plugins",new Map);V(this,"vizComponents",new Map);V(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 sp{constructor(){V(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 o=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),l=y.orderBy(o,"version","asc");if(((i=y.last(l))==null?void 0:i.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return l.reduce((c,d)=>d.handler(c,a),r)}}class R extends sp{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(a,o)=>({version:t,...r(a,o)}))}async migrate({configData:t,panelModel:r}){const a=await t.getItem(null),o=y.get(a,"version",0),l=this.run({from:o,to:this.VERSION},a,{panelModel:r});await t.setItem(null,l)}async needMigration({configData:t}){const r=await t.getItem(null);return y.get(r,"version",0)<this.VERSION}}const A=(e,t)=>{const[r,{setFalse:a}]=O.useBoolean(!0),[o,l]=h.useState();h.useEffect(()=>(e.getItem(t).then(c=>{l(c),a()}),e.watchItem(t,c=>{l(c)})));const i=h.useCallback(async c=>{await e.setItem(t,c),l(c)},[e,t]);return{loading:r,value:o,set:i}},Ns=h.createContext(null),Kn=Ns.Provider;function Qt(){const e=h.useContext(Ns);if(!e)throw new Error("Please use DashboardModelContextProvider");return e}const j=()=>Qt(),Gs=()=>Qt(),Fs=h.createContext({}),Yn=Fs.Provider;function Qs(){return h.useContext(Fs)}const Xn=h.createContext(null),Zn=Xn.Provider;function Jn(){const e=h.useContext(Xn);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const Q=()=>Jn(),op={inEditMode:!1},wt=h.createContext(op);function js(){const e=h.useContext(wt);if(!e)throw new Error("Please use LayoutStateContext.Provider");return e}const Ws=h.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{},getEchartsOptions:()=>null,setEchartsOptions:()=>{}}),Hn=Ws.Provider;function Rn(){const e=h.useContext(Ws);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const se=()=>Rn(),oe=()=>Rn();function Us(){try{return Rn(),!0}catch{return!1}}const Ks=()=>Us(),Ys=()=>Us(),lp={fullScreenPanelID:"",setFullScreenPanelID:y.noop},er=h.createContext(lp);function Xs(){const e=h.useContext(er);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}const ip={en:"en",zh:"zh-cn"};function tr({children:e}){const{i18n:t}=m.useTranslation(),r=h.useMemo(()=>{const a=t.language;return ip[a]??"en"},[t.language]);return n.jsx(vt.DatesProvider,{settings:{locale:r,firstDayOfWeek:1},children:e})}const ee=()=>Jn(),cp={items:[]},nr=h.createContext(cp),rr=nr.Provider;function ar(){return h.useContext(nr)}h.forwardRef(function({value:t,onChange:r,...a},o){return n.jsx(s.TextInput,{ref:o,value:t,onChange:r,...a})});class dp{constructor({valueRange:t,colorRange:r}){V(this,"mapper");this.mapper=ot.interpolate(t,r)}getColor(t){return this.mapper(t)}}function up(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 dp(e).getColor(r)}catch(r){return console.error(r),"black"}return"black"}const pp=up;function $(e){const[t,r]=e.split(".");return{queryID:t,columnKey:r}}function Zs(e){return!!e&&!!e.columnKey&&!!e.queryID}function Js(e){return e.includes(".")?$(e):{queryID:"",columnKey:e}}function xe(e,t){var o;const{queryID:r,columnKey:a}=$(t);return r?a?((o=e[r])==null?void 0:o.map(l=>l[a]))??[]:e[r]:[]}function ln(e,t){const{queryID:r}=$(t);return r?e[r]:[]}function hp(e){return Object.values(e)[0]}function cn(e,t){const{queryID:r,columnKey:a}=$(t);return e[a]}const Qe={CryptoJS:fs,d3Array:As,dayjs:M,lodash:y,numbro:$e,mathjs:Fe,faker:Xd.faker,popmotion:Lu},gp=[{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"}],fp=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_field:{selector:{options:{unset:"未设置",default:"默认"}}}},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:"动态最大值(优先)"}},interaction_block:{modal_title:"配置交互块",block_id_label:"块ID",block_id_description:"此交互块的唯一标识符",block_id_placeholder:"输入块ID",toggle_tooltip:"切换交互块设置",clear_tooltip:"清除交互块"}},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 sn{constructor(t){V(this,"rootRef");this.rootRef=F.observable({current:t})}async deleteItem(t){F.runInAction(()=>{y.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?F.toJS(this.rootRef.current):y.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(y.isObject(r))F.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else F.runInAction(()=>{y.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,a){return F.reaction(()=>this.getValueFromRoot(t),(o,l)=>{r(o,l)},{requiresObservable:!0,fireImmediately:y.get(a,"fireImmediately",!1)})}}class Qu{constructor(){V(this,"channels",new Map);V(this,"globalChannel",new hs)}getChannel(t){const r=this.channels.get(t);if(r)return r;const a=new hs;return this.channels.set(t,a),a}}class ju{constructor(t){V(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 Qu,instanceData:new sn(t.viz.conf)};return this.instances.set(t.id,a),a}}function Es(e,t,r,a){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new sn({}),colorPalette:{getColor(){return()=>""}},data:t,variables:a}}const Wu=e=>{const{panel:t,measure:r,vizManager:a,data:o,variables:l}=e,i=a.resolveComponent(t.viz.type),c=a.getOrCreateInstance(t),d={...Es(c,o,a,l),viewport:{width:r.w,height:r.h}},u=i.viewRender;return n.jsx(u,{context:d,instance:c,...y.omit(e,["panel","vizManager","data"])})},Uu=e=>{const{vizManager:t,panel:r,data:a,variables:o}=e,l=t.resolveComponent(r.viz.type),i=t.getOrCreateInstance(r),c={...Es(i,a,t,o)},d=l.configRender;return n.jsx(d,{context:c,instance:i,...y.omit(e,["panel","vizManager","data"])})},Bs=(e,t)=>{const r=Oe.bezier(e),a=Oe.bezier(t);return function(o){return o<50?r(o*2/100).hex():a((o-50)*2/100).hex()}},on=e=>{const t=Oe.bezier(e);return function(r){return t(r/100).hex()}},Ku={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Bs(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Yu={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Bs(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Xu={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:on(["#fff7f1","darkred"]),name:"red",category:"sequential"},Zu={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:on(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},Ju={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:on(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},Hu={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:on(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class Ru{constructor(t){this.pluginManager=t}createPanelAddonNode(t){const a=this.pluginManager.installedPlugins.flatMap(o=>o.manifest.panelAddon).filter(o=>!!o).map(o=>h.createElement(o.addonRender,{...t,key:o.name}));return n.jsx(n.Fragment,{children:a})}}const qs=h.createContext({addonSlotId:null});function Ls({children:e,addonSlotId:t}){const r=h.useId(),a=t||`panel-addon-slot-${r}`;return n.jsx(qs.Provider,{value:{addonSlotId:a},children:e})}function ep(){const{addonSlotId:e}=h.useContext(qs);return e?document.getElementById(e):null}class tp{constructor(t){V(this,"symbol");this.symbol=Symbol(t)}}function Xe(e){return new tp(e)}class Un{constructor(){V(this,"parent");V(this,"factoryRegistry",new Map);V(this,"instanceRegistry",new Map)}createScoped(){const t=new Un;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()}}const Os="14.58.3",np=Object.freeze(Object.defineProperty({__proto__:null,version:Os},Symbol.toStringTag,{value:"Module"}));class rp{constructor(t){V(this,"staticColors",new Map);V(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 ap{constructor(){V(this,"plugins",new Map);V(this,"vizComponents",new Map);V(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 sp{constructor(){V(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 o=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),l=y.orderBy(o,"version","asc");if(((i=y.last(l))==null?void 0:i.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return l.reduce((c,d)=>d.handler(c,a),r)}}class R extends sp{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(a,o)=>({version:t,...r(a,o)}))}async migrate({configData:t,panelModel:r}){const a=await t.getItem(null),o=y.get(a,"version",0),l=this.run({from:o,to:this.VERSION},a,{panelModel:r});await t.setItem(null,l)}async needMigration({configData:t}){const r=await t.getItem(null);return y.get(r,"version",0)<this.VERSION}}const A=(e,t)=>{const[r,{setFalse:a}]=O.useBoolean(!0),[o,l]=h.useState();h.useEffect(()=>(e.getItem(t).then(c=>{l(c),a()}),e.watchItem(t,c=>{l(c)})));const i=h.useCallback(async c=>{await e.setItem(t,c),l(c)},[e,t]);return{loading:r,value:o,set:i}},Ns=h.createContext(null),Kn=Ns.Provider;function Qt(){const e=h.useContext(Ns);if(!e)throw new Error("Please use DashboardModelContextProvider");return e}const j=()=>Qt(),Gs=()=>Qt(),Fs=h.createContext({}),Yn=Fs.Provider;function Qs(){return h.useContext(Fs)}const Xn=h.createContext(null),Zn=Xn.Provider;function Jn(){const e=h.useContext(Xn);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const Q=()=>Jn(),op={inEditMode:!1},wt=h.createContext(op);function js(){const e=h.useContext(wt);if(!e)throw new Error("Please use LayoutStateContext.Provider");return e}const Ws=h.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{},getEchartsOptions:()=>null,setEchartsOptions:()=>{}}),Hn=Ws.Provider;function Rn(){const e=h.useContext(Ws);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const se=()=>Rn(),oe=()=>Rn();function Us(){try{return Rn(),!0}catch{return!1}}const Ks=()=>Us(),Ys=()=>Us(),lp={fullScreenPanelID:"",setFullScreenPanelID:y.noop},er=h.createContext(lp);function Xs(){const e=h.useContext(er);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}const ip={en:"en",zh:"zh-cn"};function tr({children:e}){const{i18n:t}=m.useTranslation(),r=h.useMemo(()=>{const a=t.language;return ip[a]??"en"},[t.language]);return n.jsx(vt.DatesProvider,{settings:{locale:r,firstDayOfWeek:1},children:e})}const ee=()=>Jn(),cp={items:[]},nr=h.createContext(cp),rr=nr.Provider;function ar(){return h.useContext(nr)}h.forwardRef(function({value:t,onChange:r,...a},o){return n.jsx(s.TextInput,{ref:o,value:t,onChange:r,...a})});class dp{constructor({valueRange:t,colorRange:r}){V(this,"mapper");this.mapper=ot.interpolate(t,r)}getColor(t){return this.mapper(t)}}function up(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 dp(e).getColor(r)}catch(r){return console.error(r),"black"}return"black"}const pp=up;function $(e){const[t,r]=e.split(".");return{queryID:t,columnKey:r}}function Zs(e){return!!e&&!!e.columnKey&&!!e.queryID}function Js(e){return e.includes(".")?$(e):{queryID:"",columnKey:e}}function xe(e,t){var o;const{queryID:r,columnKey:a}=$(t);return r?a?((o=e[r])==null?void 0:o.map(l=>l[a]))??[]:e[r]:[]}function ln(e,t){const{queryID:r}=$(t);return r?e[r]:[]}function hp(e){return Object.values(e)[0]}function cn(e,t){const{queryID:r,columnKey:a}=$(t);return e[a]}const Qe={CryptoJS:fs,d3Array:As,dayjs:M,lodash:y,numbro:$e,mathjs:Fe,faker:Xd.faker,popmotion:Lu},gp=[{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"}],fp=e=>`
|
|
10
10
|
<tr>
|
|
11
11
|
<td><code>${e.name}</code></td>
|
|
12
12
|
<td>
|
|
@@ -34,7 +34,7 @@ Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel vari
|
|
|
34
34
|
</tbody>
|
|
35
35
|
</table>
|
|
36
36
|
`,Hs=["function aggregation({ queryData }, utils) {",' return "Aggregation Result";',"}"].join(`
|
|
37
|
-
`),zt={type:"none",config:{},fallback:"0"};function yp(e){const t=Array.from(e).sort((a,o)=>a-o),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}function vp(e,t){switch(t.type){case"sum":return y.sum(e);case"mean":return y.mean(e);case"median":return yp(e);case"max":return y.max(e);case"min":return y.min(e);case"quantile":return Gt.quantile(e,t.config.p);case"CV":if(e.length===0)return Number.NaN;const r=Fe.std(...e),a=Fe.mean(...e);return a?r/a:Number.NaN;case"std":return e.length===0?Number.NaN:Fe.std(...e);default:return e}}function sr(e,t){const r=e.map(Number),a=vp(r,t);return typeof a=="number"?Number.isFinite(a)?a:t.fallback:a??t.fallback}function _p(e,t,r){try{const a=ln(e,t);return new Function(`return ${r.config.func}`)()({queryData:a},Qe)}catch(a){return console.error(a),a.message}}function mp(e,t,r){try{const a=xe(e,t),{method:o}=r.config;return y[o](a)}catch(a){return console.error(a),r.fallback}}function or(e,t,r){try{return r.type==="custom"?_p(e,t,r):r.type==="pick_record"?mp(e,t,r):sr(xe(e,t),r)}catch(a){return console.error(a),null}}const lr={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:"0 !important"},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"},blockquote:{fontSize:"14px",lineHeight:"32px",color:"#3D3E45",margin:"0 0 14px"},"
|
|
37
|
+
`),zt={type:"none",config:{},fallback:"0"};function yp(e){const t=Array.from(e).sort((a,o)=>a-o),r=Math.floor(t.length/2);return t.length%2===0?(t[r-1]+t[r])/2:t[r]}function vp(e,t){switch(t.type){case"sum":return y.sum(e);case"mean":return y.mean(e);case"median":return yp(e);case"max":return y.max(e);case"min":return y.min(e);case"quantile":return Gt.quantile(e,t.config.p);case"CV":if(e.length===0)return Number.NaN;const r=Fe.std(...e),a=Fe.mean(...e);return a?r/a:Number.NaN;case"std":return e.length===0?Number.NaN:Fe.std(...e);default:return e}}function sr(e,t){const r=e.map(Number),a=vp(r,t);return typeof a=="number"?Number.isFinite(a)?a:t.fallback:a??t.fallback}function _p(e,t,r){try{const a=ln(e,t);return new Function(`return ${r.config.func}`)()({queryData:a},Qe)}catch(a){return console.error(a),a.message}}function mp(e,t,r){try{const a=xe(e,t),{method:o}=r.config;return y[o](a)}catch(a){return console.error(a),r.fallback}}function or(e,t,r){try{return r.type==="custom"?_p(e,t,r):r.type==="pick_record"?mp(e,t,r):sr(xe(e,t),r)}catch(a){return console.error(a),null}}const lr={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:"0 !important"},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"},blockquote:{fontSize:"14px",lineHeight:"32px",color:"#3D3E45",margin:"0 0 14px"},"[data-interaction-block-id]":{position:"relative",padding:"4px 8px",borderRadius:"4px",transition:"all 0.2s ease"},"[data-interaction-block-id]:hover":{backgroundColor:"rgba(59, 130, 246, 0.08)"},"[contenteditable=false] [data-interaction-block-id]:hover":{cursor:"pointer"}},ir="grad_color_",wp=new RegExp(`^(?!${ir})(.+)$`);function Rs(e){return e&&e.replace(wp,`${ir}$1`)}const xp=e=>{const r="abcdefghijklmnopqrstuvwxyz",o=`1234567890${r}${r.toUpperCase()}`.split(""),l=new Uint8Array(e);crypto.getRandomValues(l);const i=l.reduce((c,d)=>`${c}${o[d&61]}`,"");return`${ir}${i}`};function Cp(e,t,r){try{if(!Number.isFinite(t)||!Number.isFinite(r))throw new Error(`[getColorMappingFunc] invalid interval with min[${t}] max[${r}]`);if(e.length<2)throw new Error("[getColorMappingFunc] expected at least 2 colors");const a=(r-t)/(e.length-1),o=As.range(t,r+a,a);return Nu.scaleLinear(o,e)}catch(a){return console.error(a),()=>"inherit"}}function eo(e,t,r,a){const o=Number(e.getAttribute(r)),l=e.getAttribute(a);if(!l)return o;const i=Number(t[l]);return Number.isFinite(i)?i:o}function Sp(e,t){const r={};return e.querySelectorAll("color-mapping").forEach(o=>{const l=o.getAttribute(Me.color),i=eo(o,t,Me.min_val,Me.min_var),c=eo(o,t,Me.max_val,Me.max_var),d=o.getAttribute(Me.variable);if(!l||!Number.isFinite(i)||!Number.isFinite(c)||!d)return;const u=Number(t[d]);if(!Number.isFinite(u))return;const p=l.split(","),g=Cp(p,i,c);r[`#${Rs(o.id)}`]={color:g(u)}}),r}function Tp(e){const t=y.get(e,Me.color,[]),r=y.get(e,Me.min_val,""),a=y.get(e,Me.min_var,""),o=y.get(e,Me.max_val,""),l=y.get(e,Me.max_var,""),i=y.get(e,Me.variable,""),c=t.length===0&&[r,a,o,l,i].every(d=>d==="");return{colors:t,min_val:r,min_var:a,max_val:o,max_var:l,variable:i,empty:c}}const ce={color:"data-colors",min_val:"data-min-val",min_var:"data-min-var",max_val:"data-max-val",max_var:"data-max-var",variable:"data-var"},Me=ce,to="colorMapping",no=Ft.Mark.create({name:to,addAttributes(){return{id:{default:xp(6),parseHTML:e=>{const t=e.getAttribute("id");return Rs(t)}},[ce.color]:{default:[],parseHTML:e=>{const t=e.getAttribute(ce.color);return t?t.split(","):[]}},[ce.min_val]:{default:0,parseHTML:e=>e.getAttribute(ce.min_val)},[ce.min_var]:{default:"",parseHTML:e=>e.getAttribute(ce.min_var)},[ce.max_val]:{default:100,parseHTML:e=>e.getAttribute(ce.max_val)},[ce.max_var]:{default:"",parseHTML:e=>e.getAttribute(ce.max_var)},[ce.variable]:{default:"",parseHTML:e=>e.getAttribute(ce.variable)}}},parseHTML(){return[{tag:"color-mapping",getAttrs:e=>typeof e=="string"?(console.debug(e),!1):Object.values(Me).map(t=>e.getAttribute(t))}]},renderHTML({HTMLAttributes:e}){return["color-mapping",e,0]},addCommands(){return{setColorMapping:e=>({commands:t})=>{const{colors:r,min_val:a,min_var:o,max_val:l,max_var:i,variable:c}=e;return t.setMark(this.name,{[ce.color]:r,[ce.min_val]:a,[ce.min_var]:o,[ce.max_val]:l,[ce.max_var]:i,[ce.variable]:c})},unsetColorMapping:()=>({commands:e})=>e.unsetMark(this.name)}}}),je={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function kp(){ue.registerTheme("merico-light",{color:Object.values(je.graphics.multiple),visualMap:{color:Object.values(je.graphics.depth).reverse()},axes:[{type:"all",name:"通用坐标轴",axisLineColor:"#97999D",axisTickColor:"#97999D",axisLabelShow:!0,axisLabelColor:"#818388",splitLineShow:!0,splitLineColor:["#E0E6F1"]}]})}function ro(){kp()}function Dp(e){return({option:r,...a})=>{const{aggValue:o,formattedValue:l,label:i}=r,{hovered:c,ref:d}=re.useHover(),u=e==="aggregated"?o:l,p=e==="aggregated"?l:o;return n.jsx(s.Box,{ref:d,...a,children:n.jsxs(s.Group,{wrap:"nowrap",justify:"space-between",children:[n.jsx(s.Text,{size:"sm",sx:{flexGrow:1},children:i}),n.jsx(s.Text,{size:"xs",opacity:c?1:.65,sx:{flexShrink:0},children:c?p:u})]})})}}const H=e=>(t,r)=>{t!==null&&e(t,r)},cr=k.observer(h.forwardRef((e,t)=>{const{label:r,value:a,onChange:o,description:l,required:i,clearable:c=!0,sx:d,preview:u="formatted",zIndex:p=340}=e;m.useTranslation();const{panel:g}=oe(),b=h.useMemo(()=>g.variableOptions(a,c),[a,c]);return b.length===0?n.jsx(s.TextInput,{ref:t,label:r,placeholder:a,readOnly:!0,disabled:!0}):n.jsx(s.Select,{ref:t,label:r,description:l,renderOption:Dp(u),data:b,value:a,required:i,sx:d,maxDropdownHeight:500,comboboxProps:{withinPortal:!0,zIndex:p},onChange:H(o)})})),ao={static:{type:"static",value:10},dynamic:{type:"dynamic",value:["function getValue({ variables }, { lodash, interpolate }) {"," // your code goes here"," return 100;","}"].join(`
|
|
38
38
|
`)}},zp=({value:e,onChange:t})=>{const r=a=>{a&&t(a)};return n.jsx(s.Box,{children:n.jsx(Te,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1}}})})},Mp=({value:e,onChange:t})=>{const{t:r}=m.useTranslation(),[a,{setTrue:o,setFalse:l}]=O.useBoolean(),[i,c]=h.useState(e),d=()=>{l();const{type:b,value:_}=i,w={type:b,value:_};c(w),t(w)},u=()=>{l(),c(e)},p=b=>{c(_=>({..._,value:b}))},g=()=>{p(ao.dynamic.value)};return n.jsxs(n.Fragment,{children:[n.jsx(s.Box,{sx:{width:"50%"},children:n.jsx(s.Button,{color:"grape",variant:"filled",leftSection:n.jsx(T.IconMathFunction,{size:16}),mt:24,onClick:o,sx:{flexGrow:0},children:r("chart.number_or_dynamic_value.dynamic.setup")})}),n.jsx(s.Modal,{size:800,title:r("chart.number_or_dynamic_value.dynamic.setup_title"),opened:a,onClose:l,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:a&&n.jsxs(s.Stack,{children:[n.jsx(s.Divider,{mt:10,mb:-10,label:r("chart.number_or_dynamic_value.dynamic.guide"),labelPosition:"center",variant:"dashed"}),n.jsx(zp,{value:i.value,onChange:p}),n.jsxs(s.Group,{justify:"space-between",children:[n.jsx(s.Button,{onClick:g,color:"red",leftSection:n.jsx(T.IconRecycle,{size:20}),children:r("common.actions.reset_to_default")}),n.jsxs(s.Group,{justify:"right",children:[n.jsx(s.Button,{onClick:u,variant:"subtle",children:r("common.actions.cancel")}),n.jsx(s.Button,{color:"green",leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),onClick:d,children:r("common.actions.save")})]})]})]})})]})},Ip=({value:e,onChange:t})=>e.type!=="dynamic"?null:n.jsx(Mp,{value:e,onChange:t}),Vp=({value:e,onChange:t})=>{if(e.type!=="static")return null;const r=a=>{t({...e,value:typeof a=="string"?"":a})};return n.jsx(s.NumberInput,{defaultValue:18,label:" ",hideControls:!0,value:e.value,onChange:r})},so=h.forwardRef(({label:e="Value",value:t,onChange:r},a)=>{const{t:o,i18n:l}=m.useTranslation(),i=d=>{d!=="static"&&d!=="dynamic"||r({...ao[d]})},c=h.useMemo(()=>[{label:o("chart.number_or_dynamic_value.type.static"),value:"static"},{label:o("chart.number_or_dynamic_value.type.dynamic"),value:"dynamic"}],[l.language]);return n.jsxs(s.SimpleGrid,{cols:2,children:[n.jsx(s.Select,{ref:a,label:e,data:c,value:t.type,onChange:i,sx:{flexGrow:1}}),n.jsx(Vp,{value:t,onChange:r}),n.jsx(Ip,{value:t,onChange:r})]})});function oo(e,t,r){if(!e.type)return r;if(e.type==="static"){const{value:o}=e;return Number(o)}const{value:a}=e;try{const o=new Function(`return ${a}`)()({variables:t},{lodash:y,interpolate:ot.interpolate});return Number(o)}catch(o){return console.error(`[getNumberOrDynamicValue] failed parsing custom function, error: ${o.message}`),10}}function lo(e){return{type:"continuous",id:"continuous-example",min:{type:"static",value:0},max:{type:"static",value:100},orient:"horizontal",left:"center",top:"top",text:["",""],calculable:!0,itemWidth:15,itemHeight:140,show:!0,inRange:{color:e??Object.values(je.graphics.depth)},skipRange:{lt_min:"",min:"",max:"",gt_max:""}}}function Pp(){return{type:"piecewise",piecewise_mode:"pieces",id:"piecewise-visualmap",min:{type:"static",value:0},max:{type:"static",value:100},align:"auto",orient:"horizontal",left:"center",top:"top",itemWidth:15,itemHeight:15,show:!0,precision:0,pieces:[io()],categories:[]}}function tt(){return lo()}function $p(){return{compared:Object.values(je.graphics.compared),level:Object.values(je.graphics.level),depth:Object.values(je.graphics.depth),yellow_blue:["#8f531d","#ffd347","#e3efe3","#eefaee","#4ecbbf","#003f94"],blue:["#f9fcff","#48b3e9","#003f94"],darkgreen_pink:["#0c525a","#f21f99"],spectrum:["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"]}}function dn(e,t){const{min:r,max:a}=e,o=oo(r,t),l=oo(a,t);if(e.type==="continuous"){const{skipRange:g,text:b,..._}=e;return{..._,min:o,max:l,text:[...b]}}const{piecewise_mode:i,pieces:c,categories:d,...u}=e,p={...u};return delete p.min,delete p.max,i==="pieces"?p.pieces=c.map(g=>{const b={};g.label&&(b.label=g.label),g.color&&(b.color=g.color);const _=Number(g.lower.value);g.lower.value===""?b[g.lower.symbol]=o:Number.isFinite(_)&&(b[g.lower.symbol]=_);const w=Number(g.upper.value);return g.upper.value===""?b[g.upper.symbol]=l:Number.isFinite(w)&&(b[g.upper.symbol]=w),b}):i==="categories"&&(p.categories=d),p}const Mt=e=>({followVisualMap:!e,color:e});function dr(e,t,r,a){if(a.type!=="continuous")return Mt("");const{skipRange:o}=a;return e===t?Mt(o.min):e===r?Mt(o.max):e<t?Mt(o.lt_min):e>r?Mt(o.gt_max):Mt("")}function io(){return{lower:{value:"0",symbol:"gt"},upper:{value:"",symbol:"lt"},label:"",color:""}}const Ap=$p(),Ep=({colors:e,applyPalette:t,zIndex:r=340})=>{const{t:a}=m.useTranslation(),o=`linear-gradient(to right, ${e.join(", ")})`;return n.jsxs(s.Menu,{shadow:"md",width:300,withinPortal:!0,zIndex:r,children:[n.jsx(s.Menu.Target,{children:n.jsxs(s.UnstyledButton,{children:[n.jsx(s.Text,{style:{display:"inline-block",fontSize:"0.875rem",fontWeight:500,color:"#212529",wordBreak:"break-word",cursor:"default"},children:a("chart.color.color_gradient")}),n.jsxs(s.Group,{style:{padding:"0.4375rem 0.625rem",border:"0.0625rem solid #ced4da",borderRadius:"0.25rem",columnGap:10},children:[n.jsx(s.Box,{style:{height:"20px",flexGrow:1,backgroundImage:o,borderRadius:4}}),n.jsx(T.IconSelector,{size:14,color:"rgb(134, 142, 150)"})]})]})}),n.jsxs(s.Menu.Dropdown,{children:[n.jsx(s.Menu.Label,{children:a("chart.visual_map.built_in_palettes")}),n.jsx(s.Menu.Divider,{}),Object.entries(Ap).map(([l,i])=>n.jsx(s.Tooltip,{label:a("chart.visual_map.use_palette_x",{x:l}),children:n.jsx(s.Menu.Item,{children:n.jsx(s.Box,{style:{height:"20px",width:"100%",backgroundImage:`linear-gradient(to right, ${i.join(", ")})`,borderRadius:4,boxShadow:"0 0 3px 0 #eee",cursor:"pointer"},onClick:()=>{t(i)},title:l})})},l))]})]})},Bp=({color:e,index:t,handleChange:r,handleRemove:a})=>{const[o,{setTrue:l,setFalse:i}]=O.useBoolean(!1),{ref:c,handleRef:d}=nn.useSortable({id:e.id,index:t});return n.jsxs(s.Flex,{ref:c,gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",onMouseEnter:l,onMouseLeave:i,children:[n.jsx(s.Center,{style:{minWidth:"30px",maxWidth:"30px",flex:0},children:o?n.jsx(s.ActionIcon,{size:"xs",ref:d,variant:"subtle",children:n.jsx(T.IconGripVertical,{})}):n.jsx(s.Badge,{size:"sm",variant:"light",children:t+1})}),n.jsx("div",{style:{flex:1},children:n.jsx(s.ColorInput,{styles:{root:{flexGrow:1}},popoverProps:{withinPortal:!0,zIndex:340},size:"xs",value:e.value,onChange:r})}),n.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0},children:n.jsx(s.CloseButton,{onClick:a,size:"sm"})})]})},co=h.forwardRef(({value:e,onChange:t,zIndex:r=340},a)=>{const{t:o}=m.useTranslation(),l=h.useMemo(()=>e.map(w=>({id:ke.v4(),value:w})),[e]),i=w=>{t([...e,w])},c=w=>{const x=[...e];x.splice(w,1),t(x)},d=w=>{t([...w])},u=w=>x=>{const S=[...e];S[w]=x,t(S)},[p,g]=h.useState(""),b=()=>{p&&(i(p),g(""))},_=w=>{const{source:x,target:S}=w.operation,D=jn.move(l,x,S);t(D.map(z=>z.value))};return n.jsxs(s.Stack,{ref:a,children:[n.jsx(Ep,{colors:e,applyPalette:d,zIndex:r}),n.jsx(tn.DragDropProvider,{onDragEnd:_,children:l.map((w,x)=>n.jsx(Bp,{color:w,handleChange:u(x),handleRemove:()=>c(x),index:x},w.id))}),n.jsxs(s.Flex,{gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",children:[n.jsx("div",{style:{minWidth:"30px",maxWidth:"30px",flex:0}}),n.jsx("div",{style:{flex:1},children:n.jsx(s.ColorInput,{popoverProps:{withinPortal:!0,zIndex:r},placeholder:o("chart.color.click_to_add_a_color"),value:p,onChange:g,onBlur:b,size:"xs"})}),n.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0}})]})]})}),qp=({defaultValues:e,onSubmit:t,unset:r})=>{const{t:a}=m.useTranslation(),o=v.useForm({defaultValues:e}),{control:l,handleSubmit:i,reset:c}=o;h.useEffect(()=>{c(e)},[e]);const d=h.useCallback(()=>c(e),[c,e]);return n.jsxs(s.Box,{children:[n.jsx(s.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),n.jsxs(s.Box,{px:"1rem",children:[n.jsx(v.Controller,{control:l,name:"variable",render:({field:u})=>n.jsx(cr,{label:a("rich_text.color_mapping.choose_value_var"),clearable:!1,preview:"aggregated",zIndex:340,...u})}),n.jsxs(s.Group,{grow:!0,justify:"space-between",children:[n.jsx(v.Controller,{name:"min_var",control:l,render:({field:u})=>n.jsx(cr,{label:a("rich_text.color_mapping.min.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...u})}),n.jsx(v.Controller,{name:"min_val",control:l,render:({field:u})=>n.jsx(s.TextInput,{label:a("rich_text.color_mapping.min.val"),...u,sx:{maxWidth:"120px",flexGrow:0}})})]}),n.jsxs(s.Group,{grow:!0,justify:"space-between",children:[n.jsx(v.Controller,{name:"max_var",control:l,render:({field:u})=>n.jsx(cr,{label:a("rich_text.color_mapping.max.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...u})}),n.jsx(v.Controller,{name:"max_val",control:l,render:({field:u})=>n.jsx(s.TextInput,{label:a("rich_text.color_mapping.max.val"),...u,sx:{maxWidth:"120px",flexGrow:0}})})]}),n.jsx(v.Controller,{control:l,name:"colors",render:({field:u})=>n.jsx(co,{...u})})]}),n.jsx(s.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),n.jsxs(s.Group,{justify:"space-between",px:"1rem",pb:"0.75rem",children:[n.jsxs(s.Group,{justify:"flex-start",children:[n.jsx(s.Button,{color:"red",size:"xs",onClick:r,leftSection:n.jsx(T.IconTrash,{size:18}),children:a("common.actions.clear")}),n.jsx(s.Button,{color:"orange",size:"xs",onClick:d,leftSection:n.jsx(T.IconArrowBackUp,{size:18}),children:a("common.actions.revert")})]}),n.jsx(s.Button,{color:"green",size:"xs",onClick:i(t),leftSection:n.jsx(T.IconDeviceFloppy,{size:18}),children:a("common.actions.save_changes")})]})]})};function Lp(e){if(e.length===0)return"";const t=r=>`${r/(e.length-1)*100}%`;return e.map((r,a)=>`${r} ${t(a)}`).join(", ")}function uo(e,...t){return`linear-gradient(${e}deg, ${Lp(t)})`}const Op=()=>n.jsx("div",{style:{width:"20px",height:"13px",borderRadius:"2px",background:uo(90,...Object.values(je.graphics.depth))}}),Np=({disabled:e})=>n.jsx(s.Box,{sx:{width:"16px",height:"10px",borderRadius:"2px",background:uo(90,...Object.values(je.graphics.depth)),opacity:e?"0.5":1,position:"relative","&:after":{position:"absolute",content:"''",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"15px",height:"15px",background:`
|
|
39
39
|
linear-gradient(to top right,
|
|
40
40
|
rgba(0,0,0,0) 0%,
|
|
@@ -48,7 +48,7 @@ Variable: {{ your_var }}`,tabs:{guide:"Guide",vars:"Dashboard state & Panel vari
|
|
|
48
48
|
rgba(0,0,0,0) 100%)`}}}),Gp=({editor:e})=>{const{t}=m.useTranslation(),[r,{set:a,setTrue:o,setFalse:l,toggle:i}]=O.useBoolean(),c=e.getAttributes(to),{empty:d,...u}=h.useMemo(()=>Tp(c),[c]),p=h.useCallback(b=>{e.chain().focus().setColorMapping(b).run(),l()},[e]),g=h.useCallback(()=>{e.chain().focus().unsetColorMapping().run()},[e]);return n.jsxs(n.Fragment,{children:[n.jsx(s.Modal,{size:500,opened:r,onClose:l,shadow:"md",withinPortal:!0,zIndex:330,closeOnClickOutside:!1,closeOnEscape:!1,title:t("rich_text.color_mapping.edit"),styles:{header:{paddingBottom:0,minHeight:"unset"},body:{padding:0}},children:n.jsx(qp,{defaultValues:u,unset:g,onSubmit:p})}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(s.Tooltip,{label:t("rich_text.color_mapping.label"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},onClick:o,children:n.jsx(Op,{})})}),n.jsx(s.Tooltip,{label:t("rich_text.color_mapping.clear"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"},disabled:d,onClick:g,children:n.jsx(Np,{disabled:d})})})]})]})},un="function color({ variables }, { filters, context }, utils) {",po="}",Fp=[un,' return "red";',po].join(`
|
|
49
49
|
`);function Qp(e){if(!e)return[];const t=e.split(`
|
|
50
50
|
`),r=t.length+1;let a=1;const o=t[t.length-1];return o&&(a=o.length+1),[{range:[2,1,r,a],label:"body",allowMultiline:!0}]}const jp=e=>e&&e.replace(un,"").replace(/(.*)\}$/,"$1"),ho=e=>!e||e.startsWith(un)?e:[un,e,po].join(`
|
|
51
|
-
`),ur="dyn_color_",Wp=new RegExp(`^(?!${ur})(.+)$`);function go(e){return e&&e.replace(Wp,`${ur}$1`)}const fo=e=>{const r="abcdefghijklmnopqrstuvwxyz",o=`1234567890${r}${r.toUpperCase()}`.split(""),l=new Uint8Array(e);crypto.getRandomValues(l);const i=l.reduce((c,d)=>`${c}${o[d&61]}`,"");return`${ur}${i}`};function Up(e,t,r){const a={},o=i=>new Function(`return ${ho(i)}`)()({variables:r},t,Qe);return e.querySelectorAll("dynamic-color").forEach(i=>{const c=i.getAttribute("data-value");c&&(a[`#${go(i.id)}`]={color:o(c)})}),a}const jt="data-value",Kp=jt,bo="dynamicColor",yo=Ft.Mark.create({name:bo,addAttributes(){return{id:{default:fo(6),parseHTML:e=>{const t=e.getAttribute("id");return go(t)}},[jt]:{default:null,parseHTML:e=>e.getAttribute(jt)}}},parseHTML(){return[{tag:"dynamic-color",getAttrs:e=>typeof e=="string"?(console.debug(e),!1):[e.getAttribute(jt)]}]},renderHTML({HTMLAttributes:e}){return["dynamic-color",e,0]},addCommands(){return{setDynamicColor:e=>({commands:t})=>{const r=jp(e);return t.setMark(this.name,{[jt]:r})},unsetDynamicColor:()=>({commands:e})=>e.unsetMark(this.name)}}}),Yp=({value:e,onChange:t,onMount:r})=>{const a=h.useRef(null),o=h.useRef(null),l=c=>{if(!c){t("");return}t(c)};h.useEffect(()=>{var d;const c=(d=a.current)==null?void 0:d.getModel();c&&(c.getValue()||c.setValue(e))},[e]);const i=(c,d)=>{a.current=c,o.current=d,r==null||r(c,d)};return n.jsx(Te,{className:"function-editor",height:"100%",defaultLanguage:"javascript",defaultValue:e,onChange:l,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1}},onMount:i})},xt=h.forwardRef(({value:e,onChange:t,label:r,defaultValue:a,restrictions:o=[]},l)=>{const{t:i}=m.useTranslation(),[c,d]=h.useState(e),u=()=>{t(c)},p=()=>{d(e)},g=()=>{d(a)};h.useEffect(()=>{d(e)},[e]);const b=h.useCallback((x,S)=>{if(o.length===0)return;const D=Hd.constrainedEditor(S),z=x.getModel();if(D.initializeIn(x),D.addRestrictionsTo(z,o),!!z&&!z._hasHighlight){D.toggleDevMode(),z.toggleHighlightOfEditableAreas();const I=z.getCurrentEditableRanges(),E=z.getValueInEditableRanges();console.debug({model:z,currentRanges:I,currentValue:E})}},[o]),_=c!==e,w=typeof c=="string"&&c.length===0;return n.jsxs(s.Stack,{gap:4,sx:{height:"100%",".editableArea--multi-line":{backgroundColor:"rgba(255,183,78, 0.1)"},".editableArea--single-line":{backgroundColor:"rgba(255,183,78, 0.1)"}},children:[n.jsxs(s.Group,{mb:6,justify:"space-between",sx:{flexShrink:0,flexGrow:0},children:[n.jsx(s.Group,{justify:"flex-start",children:n.jsx(mo,{})}),n.jsxs(s.Group,{justify:"flex-end",children:[n.jsx(s.Button,{onClick:g,size:"xs",variant:"default",leftSection:n.jsx(T.IconPlayerSkipBack,{size:16}),children:i("common.actions.reset_to_default")}),n.jsx(s.Button,{onClick:p,color:"red",size:"xs",disabled:!_,leftSection:n.jsx(T.IconRecycle,{size:16}),children:i("common.actions.revert_changes")}),n.jsx(s.Button,{color:"green",size:"xs",onClick:u,disabled:!_,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]})]}),n.jsx(s.Text,{size:"14px",children:r}),n.jsxs(s.Box,{sx:{position:"relative",flexGrow:1},children:[w&&n.jsx(s.Overlay,{center:!0,color:"#fff",backgroundOpacity:.5,children:n.jsx(s.Button,{color:"blue",radius:"xl",onClick:g,children:i("common.actions.init_with_default")})}),n.jsx(Yp,{value:c,onChange:d,onMount:b})]})]})}),pr=h.forwardRef(({title:e,value:t,onChange:r,label:a,description:o=null,triggerLabel:l="Edit",triggerButtonProps:i={},renderTriggerButton:c,defaultValue:d,zIndex:u=320,restrictions:p},g)=>{const[b,{open:_,close:w}]=re.useDisclosure(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(s.Modal,{opened:b,onClose:w,title:e,withinPortal:!0,zIndex:u,size:"900px",children:[o,n.jsx(s.Box,{h:600,children:n.jsx(xt,{value:t,onChange:r,defaultValue:d,label:a,restrictions:p})})]}),c==null?void 0:c({onClick:_}),!c&&n.jsx(s.Button,{onClick:_,...i,children:l})]})}),Xp=({onClick:e})=>{const{t}=m.useTranslation();return n.jsx(s.Tooltip,{label:t("rich_text.dynamic_color.label"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"rgb(190, 75, 219)"},onClick:e,children:n.jsx(T.IconMathFunction,{stroke:2,size:16})})})},Zp=({editor:e})=>{const{t}=m.useTranslation(),r=e.getAttributes(bo)[Kp]??"",a=ho(r),o=Qp(r);return n.jsxs(n.Fragment,{children:[n.jsx(pr,{title:t("rich_text.dynamic_color.edit"),label:"",triggerLabel:"",value:a,onChange:l=>{l?e.chain().focus().setDynamicColor(l).run():e.chain().focus().unsetDynamicColor().run()},defaultValue:Fp,renderTriggerButton:Xp,restrictions:o,zIndex:340}),n.jsx(s.Tooltip,{label:t("rich_text.dynamic_color.clear"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},disabled:!r,onClick:()=>e.chain().focus().unsetDynamicColor().run(),children:n.jsx(T.IconMathFunctionOff,{stroke:1.5,size:16})})})]})},vo=Ft.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replace(/['"]+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}; line-height: 1.2; overflow: auto`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Jp=["8","10","12","14","16","18","20","24","30","36","48","60","72"].map(e=>`${e}px`),Hp=[{label:"auto",value:""}].concat(Jp.map(e=>({label:e,value:e}))),Rp={input:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"}},eh=({editor:e})=>{const t=e.getAttributes("textStyle").fontSize;return n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(s.NativeSelect,{size:"xs",leftSection:n.jsx(T.IconTextSize,{stroke:1.5,size:16}),data:Hp,styles:Rp,value:t||"",onChange:r=>{const a=r.currentTarget.value;a?e.chain().focus().setFontSize(a).run():e.chain().focus().unsetFontSize().run()}})})},_o=Ft.Node.create({name:"interactionBlock",group:"block",content:"block+",defining:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{blockId:{default:null,parseHTML:e=>e.getAttribute("data-interaction-block-id"),renderHTML:e=>e.blockId?{"data-interaction-block-id":e.blockId}:{}}}},parseHTML(){return[{tag:"div[data-interaction-block-id]"}]},renderHTML({HTMLAttributes:e}){return["div",Ft.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setInteractionBlock:e=>({commands:t})=>t.wrapIn(this.name,{blockId:e}),toggleInteractionBlock:e=>({commands:t})=>t.toggleWrap(this.name,{blockId:e}),unsetInteractionBlock:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-i":()=>this.editor.commands.toggleInteractionBlock("")}}}),It=h.forwardRef(({value:e,styles:t={},sx:r={},dashboardStateValues:a=fr(),variableAggValueMap:o={}},l)=>{const i=Ks(),c=h.useMemo(()=>{const _=[Ms,Ds,G.Link,ms,_s,ys,ws.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),Ss,Cs,xs,Ts.configure({types:["heading","paragraph"]}),vs.configure({placeholder:"This is placeholder"}),ks,bs.Color,vo,yo,_o];return i&&_.push(no),_},[i]),d=zs.useEditor({extensions:c,content:e,editable:!1});h.useEffect(()=>{d==null||d.commands.setContent(e)},[e,d]);const u=h.useMemo(()=>new DOMParser().parseFromString(e,"text/html"),[e]),p=h.useMemo(()=>Up(u,a,o),[u,a,o]),g=h.useMemo(()=>Sp(u,o),[u,o]),b=h.useMemo(()=>y.defaultsDeep({},{content:{...lr,...p,...g}},t),[t,p,g]);return n.jsx(G.RichTextEditor,{editor:d,styles:b,sx:r,children:n.jsx(G.RichTextEditor.Content,{ref:l})})});function mo(){const{t:e}=m.useTranslation(),[t,{open:r,close:a}]=re.useDisclosure(!1);return n.jsxs(n.Fragment,{children:[n.jsx(s.Modal,{opened:t,onClose:a,title:e("function_utils.modal_title"),zIndex:330,withinPortal:!0,children:n.jsx(It,{value:bp(e),styles:{root:{border:"none"},content:{padding:0,table:{marginBottom:0}}}})}),n.jsx(s.Button,{variant:"light",color:"violet",size:"xs",onClick:r,leftSection:n.jsx(T.IconInfoCircle,{size:16}),children:e("function_utils.trigger_text")})]})}const hr=({option:e,checked:t,...r})=>{const{label:a,description:o}=e;return n.jsx("div",{...r,style:{flexGrow:1},children:n.jsxs(s.Group,{justify:"space-between",wrap:"nowrap",children:[n.jsxs(s.Group,{justify:"flex-start",gap:"0.5em",children:[t&&n.jsx(T.IconCheck,{size:16,color:"green"}),n.jsx(s.Text,{size:"sm",sx:{flexGrow:1},children:a})]}),n.jsx(s.Text,{size:"xs",c:"dimmed",children:o})]})})},gr=({value:e,onChange:t,height:r="200px",defaultLanguage:a="sql",theme:o="vs-dark"})=>{const l=c=>{t==null||t(c??"")},i=!t;return n.jsx(Te,{className:"minimal-monaco-editor",height:r,defaultLanguage:a,value:e,onChange:i?void 0:l,theme:o,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:i||!t,"semanticHighlighting.enabled":!0}})},th=({color:e})=>h.forwardRef(({onClick:t},r)=>n.jsx(G.RichTextEditor.Control,{ref:r,onClick:t,children:n.jsx(s.ColorSwatch,{color:e,size:14})})),nh=({editor:e})=>{const t=s.useMantineTheme(),r=e.getAttributes("textStyle").color||t.black,a=h.useMemo(()=>Co(r),[r]),o=h.useCallback(i=>{e.chain().setColor(i).run()},[e]),l=h.useCallback(()=>{e.chain().focus().unsetColor().run()},[e]);return n.jsx(To,{value:a,onChange:o,clear:l,Trigger:th({color:a})})};function rh({opened:e,onClose:t,editor:r}){const{t:a}=m.useTranslation(),[o,l]=h.useState(""),i=()=>{const{state:u}=r,{$from:p}=u.selection;for(let g=p.depth;g>0;g--){const b=p.node(g);if(b.type.name==="interactionBlock")return b.attrs.blockId||""}return""},c=()=>{o.trim()&&(r.chain().focus().toggleInteractionBlock(o.trim()).run(),l(""),t())},d=()=>{l(""),t()};return h.useEffect(()=>{if(e){const u=i();l(u)}},[e]),n.jsx(s.Modal,{opened:e,zIndex:1200,onClose:d,title:a("rich_text_editor.interaction_block.modal_title"),children:n.jsxs(s.Stack,{gap:"md",children:[n.jsx(s.TextInput,{label:a("rich_text_editor.interaction_block.block_id_label"),description:a("rich_text_editor.interaction_block.block_id_description"),placeholder:a("rich_text_editor.interaction_block.block_id_placeholder"),value:o,onChange:u=>l(u.currentTarget.value),onKeyDown:u=>{u.key==="Enter"&&c()}}),n.jsxs(s.Group,{justify:"flex-end",gap:"sm",children:[n.jsx(s.Button,{variant:"default",size:"xs",onClick:d,children:a("common.actions.cancel")}),n.jsx(s.Button,{variant:"filled",color:"blue",size:"xs",onClick:c,disabled:!o.trim(),children:a("common.actions.apply")})]})]})})}function ah(){const{t:e}=m.useTranslation(),{editor:t}=G.useRichTextEditorContext(),[r,a]=h.useState(!1);function o(){a(!0)}if(!t)return null;const l=t.isActive("interactionBlock");return n.jsxs(n.Fragment,{children:[n.jsx(G.RichTextEditor.Control,{onClick:o,active:l,"aria-label":e("rich_text_editor.interaction_block.toggle_tooltip"),title:e("rich_text_editor.interaction_block.toggle_tooltip"),children:n.jsx(T.IconHandClick,{stroke:1.5,size:16})}),n.jsx(rh,{opened:r,onClose:()=>a(!1),editor:t})]})}function sh(){const{t:e}=m.useTranslation(),{editor:t}=G.useRichTextEditorContext();function r(){t==null||t.commands.unsetInteractionBlock()}if(!t)return null;const a=t.isActive("interactionBlock");return n.jsx(G.RichTextEditor.Control,{onClick:r,disabled:!a,"aria-label":e("rich_text_editor.interaction_block.clear_tooltip"),title:e("rich_text_editor.interaction_block.clear_tooltip"),children:n.jsx(T.IconHandOff,{stroke:1.5,size:16})})}const oh={"dynamic-color":{position:"relative"},"dynamic-color:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"1px",border:"double 1px purple"},"color-mapping":{position:"relative"},"color-mapping:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"4px",opacity:.8,background:"linear-gradient(90deg, rgb(255, 225, 225) 0%, rgb(253, 188, 188) 40%, rgb(243, 148, 148) 60%, rgb(250, 66, 66) 80%, rgb(226, 18, 18) 100%)"}};function lh(){const{editor:e}=G.useRichTextEditorContext();return n.jsx(G.RichTextEditor.Control,{onClick:()=>e==null?void 0:e.commands.insertTable({rows:3,cols:3,withHeaderRow:!0}),"aria-label":"Insert table",title:"Insert table",children:n.jsx(T.IconBorderAll,{stroke:1.5,size:16})})}const pn=h.forwardRef(({value:e,onChange:t,styles:r={},label:a,onSubmit:o,onCancel:l})=>{const{t:i}=m.useTranslation(),c=Ys(),d=h.useMemo(()=>{const D=[Ms,Ds,G.Link,ms,_s,ys,ws.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),Ss,Cs,xs,Ts.configure({types:["heading","paragraph"]}),vs.configure({placeholder:"This is placeholder"}),ks,bs.Color,vo,yo,_o];return c&&D.push(no),D},[c]),[u,p]=h.useState(e),g=()=>{t(u),o==null||o()},b=({editor:D})=>{const z=D.getHTML();p(z)},_=zs.useEditor({extensions:d,content:e,onUpdate:b,onCreate:({editor:D})=>{D.view.dom.setAttribute("spellcheck","false"),D.view.dom.setAttribute("autocomplete","off"),D.view.dom.setAttribute("autocapitalize","off")}});h.useEffect(()=>{p(e),_==null||_.commands.setContent(e)},[e]);const w=e!==u,x=h.useMemo(()=>y.defaultsDeep({},{content:{...lr,...oh}},r),[r]);if(!_)return null;const S=!!l;return n.jsxs(s.Stack,{gap:4,sx:{flexGrow:1,position:"relative"},children:[n.jsxs(s.Group,{align:"center",children:[n.jsx(s.Text,{size:"14px",fw:500,children:a}),!S&&n.jsx(s.Button,{variant:"filled",color:"blue",size:"compact-xs",disabled:!w,onClick:g,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]}),n.jsxs(G.RichTextEditor,{editor:_,styles:x,children:[n.jsxs(G.RichTextEditor.Toolbar,{sticky:!0,stickyOffset:0,children:[n.jsx(nh,{editor:_}),c&&n.jsx(Gp,{editor:_}),n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(Zp,{editor:_})}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(ah,{}),n.jsx(sh,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Bold,{}),n.jsx(G.RichTextEditor.Italic,{}),n.jsx(G.RichTextEditor.Underline,{}),n.jsx(G.RichTextEditor.ClearFormatting,{}),n.jsx(G.RichTextEditor.Highlight,{}),n.jsx(G.RichTextEditor.Code,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.H1,{}),n.jsx(G.RichTextEditor.H2,{}),n.jsx(G.RichTextEditor.H3,{}),n.jsx(G.RichTextEditor.H4,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Blockquote,{}),n.jsx(G.RichTextEditor.Hr,{}),n.jsx(G.RichTextEditor.BulletList,{}),n.jsx(G.RichTextEditor.OrderedList,{}),n.jsx(G.RichTextEditor.Subscript,{}),n.jsx(G.RichTextEditor.Superscript,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Link,{}),n.jsx(G.RichTextEditor.Unlink,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.AlignLeft,{}),n.jsx(G.RichTextEditor.AlignCenter,{}),n.jsx(G.RichTextEditor.AlignJustify,{}),n.jsx(G.RichTextEditor.AlignRight,{})]}),n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(lh,{})}),n.jsx(eh,{editor:_})]}),n.jsx(G.RichTextEditor.Content,{})]}),S&&n.jsxs(s.Group,{justify:"space-between",pt:"md",children:[n.jsx(s.Button,{variant:"default",size:"xs",onClick:l,children:i("common.actions.cancel")}),n.jsx(s.Button,{variant:"filled",color:"blue",size:"xs",disabled:!w,onClick:g,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]})]})}),ut=({initialValue:e,onChange:t,label:r})=>{const{t:a}=m.useTranslation(),[o,{setTrue:l,setFalse:i}]=O.useBoolean(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(s.Stack,{gap:4,children:[n.jsx(s.Text,{size:"sm",fw:"bold",children:r}),n.jsx(s.Button,{variant:"light",size:"xs",onClick:l,disabled:o,children:a("common.actions.edit_rich_text")})]}),n.jsx(s.Modal,{opened:o,onClose:i,withinPortal:!0,zIndex:400,closeOnEscape:!1,closeOnClickOutside:!1,withCloseButton:!1,size:800,children:o&&n.jsx(pn,{value:e,onChange:t,label:r??"",styles:{root:{flexGrow:1,minHeight:"400px"}},onCancel:i,onSubmit:i})})]})},wo={hex:/^#?([0-9A-F]{3}){1,2}$/i,fullHex:/^#?([0-9A-F]{6})$/i,hexa:/^#?([0-9A-F]{4}){1,2}$/i,rgb:/^rgb\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,rgba:/^rgba\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,hsl:/hsl\(\s*(\d+)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\)/i,hsla:/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(\d*(?:\.\d+)?)\)$/i},ih=y.pick(wo,"fullHex","rgb","rgba","hsl","hsla"),ch=y.pick(wo,"fullHex","rgb","rgba","hsl","hsla");function dh(e){return Object.values(ih).some(t=>t.test(e))}function xo(e){return Object.values(ch).some(t=>t.test(e))}function Co(e){return xo(e)?e:Oe.valid(e)?Oe(e).css():e}const So=({value:e})=>xo(e)?n.jsx(s.ColorSwatch,{ml:8,size:16,color:e}):n.jsx(s.ColorSwatch,{ml:8,size:16,color:""}),uh=({value:e,onChange:t,shouldPatch:r})=>{const{t:a}=m.useTranslation(),[o,l]=h.useState(e);h.useEffect(()=>{r&&l(e)},[e,r]);const i=h.useCallback(c=>{const d=c.currentTarget.value;l(d),dh(d)&&t(d)},[t]);return n.jsx(s.TextInput,{value:o,onChange:i,leftSection:n.jsx(So,{value:o}),size:"xs",placeholder:a("chart.color.not_set"),styles:{root:{flexGrow:1},input:{fontFamily:"monospace",letterSpacing:2,textAlign:"center",textTransform:"uppercase"}}})},ph=["gray","red","grape","blue","cyan","green","yellow"],To=({Trigger:e,value:t,onChange:r,clear:a})=>{const{t:o}=m.useTranslation(),l=s.useMantineTheme(),[i,{set:c,setFalse:d,toggle:u}]=O.useBoolean(),[p,g]=h.useState(!1),b=h.useMemo(()=>{const D=[];return ph.forEach(z=>{const I=l.colors[z];I&&I.forEach(E=>{D.push(E)})}),D},[l.colors]),_=(D,z=!0)=>{r(D),z&&d()},w=h.useCallback(D=>{_(D,!1),g(!1)},[]),x=h.useCallback(D=>{_(D,!1),g(!0)},[]),S=()=>{a(),d()};return n.jsxs(s.Popover,{opened:i,onChange:c,shadow:"md",withinPortal:!0,zIndex:340,withArrow:!0,children:[n.jsx(s.Popover.Target,{children:n.jsx(e,{onClick:u})}),n.jsx(s.Popover.Dropdown,{children:n.jsxs(s.Stack,{gap:"xs",children:[n.jsxs(s.Group,{justify:"flex-end",children:[n.jsx(uh,{value:t,onChange:w,shouldPatch:p}),n.jsx(s.ActionIcon,{variant:"default",onClick:S,title:o("common.actions.clear"),children:n.jsx(T.IconCircleOff,{stroke:1.5,size:"1rem"})}),n.jsx(s.ActionIcon,{variant:"default",onClick:d,title:o("common.actions.close"),children:n.jsx(T.IconX,{stroke:1.5,size:"1rem"})})]}),n.jsxs(s.SimpleGrid,{cols:2,children:[n.jsx(s.ColorPicker,{format:"hex",swatches:b,value:t,onChange:x,size:"sm",withPicker:!1,styles:{swatches:{marginTop:"0 !important"}}}),n.jsx(s.ColorPicker,{format:"hex",fullWidth:!0,value:t,onChange:x})]})]})})]})},hh=({color:e,label:t})=>h.forwardRef(({onClick:r},a)=>n.jsx(s.Button,{ref:a,size:"sm",variant:"default",leftSection:n.jsx(So,{value:e}),onClick:r,children:t})),ye=h.forwardRef(({value:e="",onChange:t,label:r},a)=>{const o=h.useCallback(()=>{t("")},[t]),l=h.useMemo(()=>Co(e),[e]);return n.jsx(To,{value:l,onChange:t,clear:o,Trigger:hh({color:l,label:r})})}),pe={mantissa:2,output:"number",trimMantissa:!0,average:!1,absolute:!1},ko=()=>({mantissa:2,output:"number",trimMantissa:!0,average:!1,absolute:!1});function Y(e,{absolute:t,...r}){if(e===null)return String(e);try{let a=$e(e).value();if(a===void 0||Number.isNaN(a))throw new Error(`[formatNumber]Not a number: ${e}`);return t&&(a=Math.abs(a)),$e(a).format(r)}catch(a){return console.debug(a),String(e)}}function gh(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function Ze({data_field:e,aggregation:t},r){return or(r,e,t)}function Ae({formatter:e,aggregation:t},r){if(typeof r!="string"&&typeof r!="number")return gh(r);if(t.type==="custom")return r;try{return Y(r,e)}catch(a){return console.error(a),r}}function Vt(e,t){return e.replaceAll(/(\$\{([^{\}]+(?=}))\})/g,(...a)=>{const o=a[2],l=t.variableStyleMap[o];if(!l)return`{{${o}}}`;const{variable:i,...c}=l,d=Object.entries(c).map(([b,_])=>`${b}:${_}`).join(";"),u=i.color;if(u.type!=="continuous")return`<span style="${d}">{{${o}}}</span>`;const p=fo(6),g=`try {
|
|
51
|
+
`),ur="dyn_color_",Wp=new RegExp(`^(?!${ur})(.+)$`);function go(e){return e&&e.replace(Wp,`${ur}$1`)}const fo=e=>{const r="abcdefghijklmnopqrstuvwxyz",o=`1234567890${r}${r.toUpperCase()}`.split(""),l=new Uint8Array(e);crypto.getRandomValues(l);const i=l.reduce((c,d)=>`${c}${o[d&61]}`,"");return`${ur}${i}`};function Up(e,t,r){const a={},o=i=>new Function(`return ${ho(i)}`)()({variables:r},t,Qe);return e.querySelectorAll("dynamic-color").forEach(i=>{const c=i.getAttribute("data-value");c&&(a[`#${go(i.id)}`]={color:o(c)})}),a}const jt="data-value",Kp=jt,bo="dynamicColor",yo=Ft.Mark.create({name:bo,addAttributes(){return{id:{default:fo(6),parseHTML:e=>{const t=e.getAttribute("id");return go(t)}},[jt]:{default:null,parseHTML:e=>e.getAttribute(jt)}}},parseHTML(){return[{tag:"dynamic-color",getAttrs:e=>typeof e=="string"?(console.debug(e),!1):[e.getAttribute(jt)]}]},renderHTML({HTMLAttributes:e}){return["dynamic-color",e,0]},addCommands(){return{setDynamicColor:e=>({commands:t})=>{const r=jp(e);return t.setMark(this.name,{[jt]:r})},unsetDynamicColor:()=>({commands:e})=>e.unsetMark(this.name)}}}),Yp=({value:e,onChange:t,onMount:r})=>{const a=h.useRef(null),o=h.useRef(null),l=c=>{if(!c){t("");return}t(c)};h.useEffect(()=>{var d;const c=(d=a.current)==null?void 0:d.getModel();c&&(c.getValue()||c.setValue(e))},[e]);const i=(c,d)=>{a.current=c,o.current=d,r==null||r(c,d)};return n.jsx(Te,{className:"function-editor",height:"100%",defaultLanguage:"javascript",defaultValue:e,onChange:l,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1}},onMount:i})},xt=h.forwardRef(({value:e,onChange:t,label:r,defaultValue:a,restrictions:o=[]},l)=>{const{t:i}=m.useTranslation(),[c,d]=h.useState(e),u=()=>{t(c)},p=()=>{d(e)},g=()=>{d(a)};h.useEffect(()=>{d(e)},[e]);const b=h.useCallback((x,S)=>{if(o.length===0)return;const D=Hd.constrainedEditor(S),z=x.getModel();if(D.initializeIn(x),D.addRestrictionsTo(z,o),!!z&&!z._hasHighlight){D.toggleDevMode(),z.toggleHighlightOfEditableAreas();const I=z.getCurrentEditableRanges(),E=z.getValueInEditableRanges();console.debug({model:z,currentRanges:I,currentValue:E})}},[o]),_=c!==e,w=typeof c=="string"&&c.length===0;return n.jsxs(s.Stack,{gap:4,sx:{height:"100%",".editableArea--multi-line":{backgroundColor:"rgba(255,183,78, 0.1)"},".editableArea--single-line":{backgroundColor:"rgba(255,183,78, 0.1)"}},children:[n.jsxs(s.Group,{mb:6,justify:"space-between",sx:{flexShrink:0,flexGrow:0},children:[n.jsx(s.Group,{justify:"flex-start",children:n.jsx(mo,{})}),n.jsxs(s.Group,{justify:"flex-end",children:[n.jsx(s.Button,{onClick:g,size:"xs",variant:"default",leftSection:n.jsx(T.IconPlayerSkipBack,{size:16}),children:i("common.actions.reset_to_default")}),n.jsx(s.Button,{onClick:p,color:"red",size:"xs",disabled:!_,leftSection:n.jsx(T.IconRecycle,{size:16}),children:i("common.actions.revert_changes")}),n.jsx(s.Button,{color:"green",size:"xs",onClick:u,disabled:!_,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]})]}),n.jsx(s.Text,{size:"14px",children:r}),n.jsxs(s.Box,{sx:{position:"relative",flexGrow:1},children:[w&&n.jsx(s.Overlay,{center:!0,color:"#fff",backgroundOpacity:.5,children:n.jsx(s.Button,{color:"blue",radius:"xl",onClick:g,children:i("common.actions.init_with_default")})}),n.jsx(Yp,{value:c,onChange:d,onMount:b})]})]})}),pr=h.forwardRef(({title:e,value:t,onChange:r,label:a,description:o=null,triggerLabel:l="Edit",triggerButtonProps:i={},renderTriggerButton:c,defaultValue:d,zIndex:u=320,restrictions:p},g)=>{const[b,{open:_,close:w}]=re.useDisclosure(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(s.Modal,{opened:b,onClose:w,title:e,withinPortal:!0,zIndex:u,size:"900px",children:[o,n.jsx(s.Box,{h:600,children:n.jsx(xt,{value:t,onChange:r,defaultValue:d,label:a,restrictions:p})})]}),c==null?void 0:c({onClick:_}),!c&&n.jsx(s.Button,{onClick:_,...i,children:l})]})}),Xp=({onClick:e})=>{const{t}=m.useTranslation();return n.jsx(s.Tooltip,{label:t("rich_text.dynamic_color.label"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"rgb(190, 75, 219)"},onClick:e,children:n.jsx(T.IconMathFunction,{stroke:2,size:16})})})},Zp=({editor:e})=>{const{t}=m.useTranslation(),r=e.getAttributes(bo)[Kp]??"",a=ho(r),o=Qp(r);return n.jsxs(n.Fragment,{children:[n.jsx(pr,{title:t("rich_text.dynamic_color.edit"),label:"",triggerLabel:"",value:a,onChange:l=>{l?e.chain().focus().setDynamicColor(l).run():e.chain().focus().unsetDynamicColor().run()},defaultValue:Fp,renderTriggerButton:Xp,restrictions:o,zIndex:340}),n.jsx(s.Tooltip,{label:t("rich_text.dynamic_color.clear"),children:n.jsx(s.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},disabled:!r,onClick:()=>e.chain().focus().unsetDynamicColor().run(),children:n.jsx(T.IconMathFunctionOff,{stroke:1.5,size:16})})})]})},vo=Ft.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replace(/['"]+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}; line-height: 1.2; overflow: auto`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Jp=["8","10","12","14","16","18","20","24","30","36","48","60","72"].map(e=>`${e}px`),Hp=[{label:"auto",value:""}].concat(Jp.map(e=>({label:e,value:e}))),Rp={input:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"}},eh=({editor:e})=>{const t=e.getAttributes("textStyle").fontSize;return n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(s.NativeSelect,{size:"xs",leftSection:n.jsx(T.IconTextSize,{stroke:1.5,size:16}),data:Hp,styles:Rp,value:t||"",onChange:r=>{const a=r.currentTarget.value;a?e.chain().focus().setFontSize(a).run():e.chain().focus().unsetFontSize().run()}})})},_o=Ft.Node.create({name:"interactionBlock",group:"block",content:"block+",defining:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{blockId:{default:null,parseHTML:e=>e.getAttribute("data-interaction-block-id"),renderHTML:e=>e.blockId?{"data-interaction-block-id":e.blockId}:{}}}},parseHTML(){return[{tag:"div[data-interaction-block-id]"}]},renderHTML({HTMLAttributes:e}){return["div",Ft.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setInteractionBlock:e=>({commands:t})=>t.wrapIn(this.name,{blockId:e}),toggleInteractionBlock:e=>({commands:t})=>t.toggleWrap(this.name,{blockId:e}),unsetInteractionBlock:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-i":()=>this.editor.commands.toggleInteractionBlock("")}}}),It=h.forwardRef(({value:e,styles:t={},sx:r={},dashboardStateValues:a=fr(),variableAggValueMap:o={}},l)=>{const i=Ks(),c=h.useMemo(()=>{const _=[Ms,Ds,G.Link,ms,_s,ys,ws.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),Ss,Cs,xs,Ts.configure({types:["heading","paragraph"]}),vs.configure({placeholder:"This is placeholder"}),ks,bs.Color,vo,yo,_o];return i&&_.push(no),_},[i]),d=zs.useEditor({extensions:c,content:e,editable:!1});h.useEffect(()=>{d==null||d.commands.setContent(e)},[e,d]);const u=h.useMemo(()=>new DOMParser().parseFromString(e,"text/html"),[e]),p=h.useMemo(()=>Up(u,a,o),[u,a,o]),g=h.useMemo(()=>Sp(u,o),[u,o]),b=h.useMemo(()=>y.defaultsDeep({},{content:{...lr,...p,...g}},t),[t,p,g]);return n.jsx(G.RichTextEditor,{editor:d,styles:b,sx:r,children:n.jsx(G.RichTextEditor.Content,{ref:l})})});function mo(){const{t:e}=m.useTranslation(),[t,{open:r,close:a}]=re.useDisclosure(!1);return n.jsxs(n.Fragment,{children:[n.jsx(s.Modal,{opened:t,onClose:a,title:e("function_utils.modal_title"),zIndex:330,withinPortal:!0,children:n.jsx(It,{value:bp(e),styles:{root:{border:"none"},content:{padding:0,table:{marginBottom:0}}}})}),n.jsx(s.Button,{variant:"light",color:"violet",size:"xs",onClick:r,leftSection:n.jsx(T.IconInfoCircle,{size:16}),children:e("function_utils.trigger_text")})]})}const hr=({option:e,checked:t,...r})=>{const{label:a,description:o}=e;return n.jsx("div",{...r,style:{flexGrow:1},children:n.jsxs(s.Group,{justify:"space-between",wrap:"nowrap",children:[n.jsxs(s.Group,{justify:"flex-start",gap:"0.5em",children:[t&&n.jsx(T.IconCheck,{size:16,color:"green"}),n.jsx(s.Text,{size:"sm",sx:{flexGrow:1},children:a})]}),n.jsx(s.Text,{size:"xs",c:"dimmed",children:o})]})})},gr=({value:e,onChange:t,height:r="200px",defaultLanguage:a="sql",theme:o="vs-dark"})=>{const l=c=>{t==null||t(c??"")},i=!t;return n.jsx(Te,{className:"minimal-monaco-editor",height:r,defaultLanguage:a,value:e,onChange:i?void 0:l,theme:o,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:i||!t,"semanticHighlighting.enabled":!0}})},th=({color:e})=>h.forwardRef(({onClick:t},r)=>n.jsx(G.RichTextEditor.Control,{ref:r,onClick:t,children:n.jsx(s.ColorSwatch,{color:e,size:14})})),nh=({editor:e})=>{const t=s.useMantineTheme(),r=e.getAttributes("textStyle").color||t.black,a=h.useMemo(()=>Co(r),[r]),o=h.useCallback(i=>{e.chain().setColor(i).run()},[e]),l=h.useCallback(()=>{e.chain().focus().unsetColor().run()},[e]);return n.jsx(To,{value:a,onChange:o,clear:l,Trigger:th({color:a})})};function rh({opened:e,onClose:t,editor:r}){const{t:a}=m.useTranslation(),[o,l]=h.useState(""),i=()=>{const{state:u}=r,{$from:p}=u.selection;for(let g=p.depth;g>0;g--){const b=p.node(g);if(b.type.name==="interactionBlock")return b.attrs.blockId||""}return""},c=()=>{o.trim()&&(r.chain().focus().toggleInteractionBlock(o.trim()).run(),l(""),t())},d=()=>{l(""),t()};return h.useEffect(()=>{if(e){const u=i();l(u)}},[e]),n.jsx(s.Modal,{opened:e,zIndex:1200,onClose:d,title:a("rich_text.interaction_block.modal_title"),children:n.jsxs(s.Stack,{gap:"md",children:[n.jsx(s.TextInput,{label:a("rich_text.interaction_block.block_id_label"),description:a("rich_text.interaction_block.block_id_description"),placeholder:a("rich_text.interaction_block.block_id_placeholder"),value:o,onChange:u=>l(u.currentTarget.value),onKeyDown:u=>{u.key==="Enter"&&c()}}),n.jsxs(s.Group,{justify:"flex-end",gap:"sm",children:[n.jsx(s.Button,{variant:"default",size:"xs",onClick:d,children:a("common.actions.cancel")}),n.jsx(s.Button,{variant:"filled",color:"blue",size:"xs",onClick:c,disabled:!o.trim(),children:a("common.actions.apply")})]})]})})}function ah(){const{t:e}=m.useTranslation(),{editor:t}=G.useRichTextEditorContext(),[r,a]=h.useState(!1);function o(){a(!0)}if(!t)return null;const l=t.isActive("interactionBlock");return n.jsxs(n.Fragment,{children:[n.jsx(G.RichTextEditor.Control,{onClick:o,active:l,"aria-label":e("rich_text.interaction_block.toggle_tooltip"),title:e("rich_text.interaction_block.toggle_tooltip"),children:n.jsx(T.IconHandClick,{stroke:1.5,size:16})}),n.jsx(rh,{opened:r,onClose:()=>a(!1),editor:t})]})}function sh(){const{t:e}=m.useTranslation(),{editor:t}=G.useRichTextEditorContext();function r(){t==null||t.commands.unsetInteractionBlock()}if(!t)return null;const a=t.isActive("interactionBlock");return n.jsx(G.RichTextEditor.Control,{onClick:r,disabled:!a,"aria-label":e("rich_text.interaction_block.clear_tooltip"),title:e("rich_text.interaction_block.clear_tooltip"),children:n.jsx(T.IconHandOff,{stroke:1.5,size:16})})}const oh={"dynamic-color":{position:"relative"},"dynamic-color:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"1px",border:"double 1px purple"},"color-mapping":{position:"relative"},"color-mapping:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"4px",opacity:.8,background:"linear-gradient(90deg, rgb(255, 225, 225) 0%, rgb(253, 188, 188) 40%, rgb(243, 148, 148) 60%, rgb(250, 66, 66) 80%, rgb(226, 18, 18) 100%)"}};function lh(){const{editor:e}=G.useRichTextEditorContext();return n.jsx(G.RichTextEditor.Control,{onClick:()=>e==null?void 0:e.commands.insertTable({rows:3,cols:3,withHeaderRow:!0}),"aria-label":"Insert table",title:"Insert table",children:n.jsx(T.IconBorderAll,{stroke:1.5,size:16})})}const pn=h.forwardRef(({value:e,onChange:t,styles:r={},label:a,onSubmit:o,onCancel:l})=>{const{t:i}=m.useTranslation(),c=Ys(),d=h.useMemo(()=>{const D=[Ms,Ds,G.Link,ms,_s,ys,ws.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),Ss,Cs,xs,Ts.configure({types:["heading","paragraph"]}),vs.configure({placeholder:"This is placeholder"}),ks,bs.Color,vo,yo,_o];return c&&D.push(no),D},[c]),[u,p]=h.useState(e),g=()=>{t(u),o==null||o()},b=({editor:D})=>{const z=D.getHTML();p(z)},_=zs.useEditor({extensions:d,content:e,onUpdate:b,onCreate:({editor:D})=>{D.view.dom.setAttribute("spellcheck","false"),D.view.dom.setAttribute("autocomplete","off"),D.view.dom.setAttribute("autocapitalize","off")}});h.useEffect(()=>{p(e),_==null||_.commands.setContent(e)},[e]);const w=e!==u,x=h.useMemo(()=>y.defaultsDeep({},{content:{...lr,...oh}},r),[r]);if(!_)return null;const S=!!l;return n.jsxs(s.Stack,{gap:4,sx:{flexGrow:1,position:"relative"},children:[n.jsxs(s.Group,{align:"center",children:[n.jsx(s.Text,{size:"14px",fw:500,children:a}),!S&&n.jsx(s.Button,{variant:"filled",color:"blue",size:"compact-xs",disabled:!w,onClick:g,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]}),n.jsxs(G.RichTextEditor,{editor:_,styles:x,children:[n.jsxs(G.RichTextEditor.Toolbar,{sticky:!0,stickyOffset:0,children:[n.jsx(nh,{editor:_}),c&&n.jsx(Gp,{editor:_}),n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(Zp,{editor:_})}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(ah,{}),n.jsx(sh,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Bold,{}),n.jsx(G.RichTextEditor.Italic,{}),n.jsx(G.RichTextEditor.Underline,{}),n.jsx(G.RichTextEditor.ClearFormatting,{}),n.jsx(G.RichTextEditor.Highlight,{}),n.jsx(G.RichTextEditor.Code,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.H1,{}),n.jsx(G.RichTextEditor.H2,{}),n.jsx(G.RichTextEditor.H3,{}),n.jsx(G.RichTextEditor.H4,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Blockquote,{}),n.jsx(G.RichTextEditor.Hr,{}),n.jsx(G.RichTextEditor.BulletList,{}),n.jsx(G.RichTextEditor.OrderedList,{}),n.jsx(G.RichTextEditor.Subscript,{}),n.jsx(G.RichTextEditor.Superscript,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.Link,{}),n.jsx(G.RichTextEditor.Unlink,{})]}),n.jsxs(G.RichTextEditor.ControlsGroup,{children:[n.jsx(G.RichTextEditor.AlignLeft,{}),n.jsx(G.RichTextEditor.AlignCenter,{}),n.jsx(G.RichTextEditor.AlignJustify,{}),n.jsx(G.RichTextEditor.AlignRight,{})]}),n.jsx(G.RichTextEditor.ControlsGroup,{children:n.jsx(lh,{})}),n.jsx(eh,{editor:_})]}),n.jsx(G.RichTextEditor.Content,{})]}),S&&n.jsxs(s.Group,{justify:"space-between",pt:"md",children:[n.jsx(s.Button,{variant:"default",size:"xs",onClick:l,children:i("common.actions.cancel")}),n.jsx(s.Button,{variant:"filled",color:"blue",size:"xs",disabled:!w,onClick:g,leftSection:n.jsx(T.IconDeviceFloppy,{size:16}),children:i("common.actions.save_changes")})]})]})}),ut=({initialValue:e,onChange:t,label:r})=>{const{t:a}=m.useTranslation(),[o,{setTrue:l,setFalse:i}]=O.useBoolean(!1);return n.jsxs(n.Fragment,{children:[n.jsxs(s.Stack,{gap:4,children:[n.jsx(s.Text,{size:"sm",fw:"bold",children:r}),n.jsx(s.Button,{variant:"light",size:"xs",onClick:l,disabled:o,children:a("common.actions.edit_rich_text")})]}),n.jsx(s.Modal,{opened:o,onClose:i,withinPortal:!0,zIndex:400,closeOnEscape:!1,closeOnClickOutside:!1,withCloseButton:!1,size:800,children:o&&n.jsx(pn,{value:e,onChange:t,label:r??"",styles:{root:{flexGrow:1,minHeight:"400px"}},onCancel:i,onSubmit:i})})]})},wo={hex:/^#?([0-9A-F]{3}){1,2}$/i,fullHex:/^#?([0-9A-F]{6})$/i,hexa:/^#?([0-9A-F]{4}){1,2}$/i,rgb:/^rgb\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,rgba:/^rgba\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,hsl:/hsl\(\s*(\d+)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\)/i,hsla:/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(\d*(?:\.\d+)?)\)$/i},ih=y.pick(wo,"fullHex","rgb","rgba","hsl","hsla"),ch=y.pick(wo,"fullHex","rgb","rgba","hsl","hsla");function dh(e){return Object.values(ih).some(t=>t.test(e))}function xo(e){return Object.values(ch).some(t=>t.test(e))}function Co(e){return xo(e)?e:Oe.valid(e)?Oe(e).css():e}const So=({value:e})=>xo(e)?n.jsx(s.ColorSwatch,{ml:8,size:16,color:e}):n.jsx(s.ColorSwatch,{ml:8,size:16,color:""}),uh=({value:e,onChange:t,shouldPatch:r})=>{const{t:a}=m.useTranslation(),[o,l]=h.useState(e);h.useEffect(()=>{r&&l(e)},[e,r]);const i=h.useCallback(c=>{const d=c.currentTarget.value;l(d),dh(d)&&t(d)},[t]);return n.jsx(s.TextInput,{value:o,onChange:i,leftSection:n.jsx(So,{value:o}),size:"xs",placeholder:a("chart.color.not_set"),styles:{root:{flexGrow:1},input:{fontFamily:"monospace",letterSpacing:2,textAlign:"center",textTransform:"uppercase"}}})},ph=["gray","red","grape","blue","cyan","green","yellow"],To=({Trigger:e,value:t,onChange:r,clear:a})=>{const{t:o}=m.useTranslation(),l=s.useMantineTheme(),[i,{set:c,setFalse:d,toggle:u}]=O.useBoolean(),[p,g]=h.useState(!1),b=h.useMemo(()=>{const D=[];return ph.forEach(z=>{const I=l.colors[z];I&&I.forEach(E=>{D.push(E)})}),D},[l.colors]),_=(D,z=!0)=>{r(D),z&&d()},w=h.useCallback(D=>{_(D,!1),g(!1)},[]),x=h.useCallback(D=>{_(D,!1),g(!0)},[]),S=()=>{a(),d()};return n.jsxs(s.Popover,{opened:i,onChange:c,shadow:"md",withinPortal:!0,zIndex:340,withArrow:!0,children:[n.jsx(s.Popover.Target,{children:n.jsx(e,{onClick:u})}),n.jsx(s.Popover.Dropdown,{children:n.jsxs(s.Stack,{gap:"xs",children:[n.jsxs(s.Group,{justify:"flex-end",children:[n.jsx(uh,{value:t,onChange:w,shouldPatch:p}),n.jsx(s.ActionIcon,{variant:"default",onClick:S,title:o("common.actions.clear"),children:n.jsx(T.IconCircleOff,{stroke:1.5,size:"1rem"})}),n.jsx(s.ActionIcon,{variant:"default",onClick:d,title:o("common.actions.close"),children:n.jsx(T.IconX,{stroke:1.5,size:"1rem"})})]}),n.jsxs(s.SimpleGrid,{cols:2,children:[n.jsx(s.ColorPicker,{format:"hex",swatches:b,value:t,onChange:x,size:"sm",withPicker:!1,styles:{swatches:{marginTop:"0 !important"}}}),n.jsx(s.ColorPicker,{format:"hex",fullWidth:!0,value:t,onChange:x})]})]})})]})},hh=({color:e,label:t})=>h.forwardRef(({onClick:r},a)=>n.jsx(s.Button,{ref:a,size:"sm",variant:"default",leftSection:n.jsx(So,{value:e}),onClick:r,children:t})),ye=h.forwardRef(({value:e="",onChange:t,label:r},a)=>{const o=h.useCallback(()=>{t("")},[t]),l=h.useMemo(()=>Co(e),[e]);return n.jsx(To,{value:l,onChange:t,clear:o,Trigger:hh({color:l,label:r})})}),pe={mantissa:2,output:"number",trimMantissa:!0,average:!1,absolute:!1},ko=()=>({mantissa:2,output:"number",trimMantissa:!0,average:!1,absolute:!1});function Y(e,{absolute:t,...r}){if(e===null)return String(e);try{let a=$e(e).value();if(a===void 0||Number.isNaN(a))throw new Error(`[formatNumber]Not a number: ${e}`);return t&&(a=Math.abs(a)),$e(a).format(r)}catch(a){return console.debug(a),String(e)}}function gh(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function Ze({data_field:e,aggregation:t},r){return or(r,e,t)}function Ae({formatter:e,aggregation:t},r){if(typeof r!="string"&&typeof r!="number")return gh(r);if(t.type==="custom")return r;try{return Y(r,e)}catch(a){return console.error(a),r}}function Vt(e,t){return e.replaceAll(/(\$\{([^{\}]+(?=}))\})/g,(...a)=>{const o=a[2],l=t.variableStyleMap[o];if(!l)return`{{${o}}}`;const{variable:i,...c}=l,d=Object.entries(c).map(([b,_])=>`${b}:${_}`).join(";"),u=i.color;if(u.type!=="continuous")return`<span style="${d}">{{${o}}}</span>`;const p=fo(6),g=`try {
|
|
52
52
|
return utils.popmotion.interpolate(${JSON.stringify(u.valueRange)}, ${JSON.stringify(u.colorRange)})(variables["${o}"]);
|
|
53
53
|
} catch (error) {
|
|
54
54
|
console.error(error);
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -659,6 +659,14 @@ export declare const en: {
|
|
|
659
659
|
var: string;
|
|
660
660
|
};
|
|
661
661
|
};
|
|
662
|
+
interaction_block: {
|
|
663
|
+
modal_title: string;
|
|
664
|
+
block_id_label: string;
|
|
665
|
+
block_id_description: string;
|
|
666
|
+
block_id_placeholder: string;
|
|
667
|
+
toggle_tooltip: string;
|
|
668
|
+
clear_tooltip: string;
|
|
669
|
+
};
|
|
662
670
|
};
|
|
663
671
|
chart: {
|
|
664
672
|
chart_config: string;
|
package/dist/i18n/zh.d.ts
CHANGED
|
@@ -659,6 +659,14 @@ export declare const zh: {
|
|
|
659
659
|
var: string;
|
|
660
660
|
};
|
|
661
661
|
};
|
|
662
|
+
interaction_block: {
|
|
663
|
+
modal_title: string;
|
|
664
|
+
block_id_label: string;
|
|
665
|
+
block_id_description: string;
|
|
666
|
+
block_id_placeholder: string;
|
|
667
|
+
toggle_tooltip: string;
|
|
668
|
+
clear_tooltip: string;
|
|
669
|
+
};
|
|
662
670
|
};
|
|
663
671
|
chart: {
|
|
664
672
|
chart_config: string;
|