@splunk/visualizations 24.7.0 → 25.0.0

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.
Files changed (285) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_ChoroplethTooltip.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_ChoroplethTooltip_with_additional_fields.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_choropleth_layer.png +0 -0
  4. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Area_Editor.png +0 -0
  5. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bar_Editor.png +0 -0
  6. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Bubble_Editor.png +0 -0
  7. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_ChoroplethSvg_Editor.png +0 -0
  8. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Column_Editor.png +0 -0
  9. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Ellipse_Editor.png +0 -0
  10. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_FillerGauge_Editor.png +0 -0
  11. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Image_Editor.png +0 -0
  12. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Line_Editor.png +0 -0
  13. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_LinkGraph_Editor.png +0 -0
  14. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  15. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Markdown_Editor.png +0 -0
  16. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_MarkerGauge_Editor.png +0 -0
  17. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Parallel_Coordinates_Editor.png +0 -0
  18. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Pie_Editor.png +0 -0
  19. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Punchcard_Editor.png +0 -0
  20. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Rectangle_Editor.png +0 -0
  21. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Sankey_Editor.png +0 -0
  22. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Scatter_Editor.png +0 -0
  23. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Editor.png +0 -0
  24. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Icon_Editor.png +0 -0
  25. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Single_Value_Radial_Editor.png +0 -0
  26. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Table_Editor.png +0 -0
  27. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Background_Color_grey.png +0 -0
  28. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Basic_Bubble.png +0 -0
  29. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Bubble_Size_Max_90.png +0 -0
  30. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Bubble_Size_Method_area_default.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Bubble_Size_Method_diameter.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Bubble_Size_Min_40.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Result_Limit_0_Number_of_Results_30.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Result_Limit_10_Number_of_Results_30.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Result_Limit_3a_invalid_Number_of_Results_30.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Result_Limit_50_Number_of_Results_30.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_X_Axis_Extend_Range_false.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_X_Axis_Extend_Range_true_default.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_X_Axis_Minor_Grid_true.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_X_Axis_With_Zero_false_default.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_X_Axis_With_Zero_true.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_Extend_Range_false.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_Extend_Range_true_default.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_Major_Grid_false.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_Minor_Grid_true.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_With_Zero_false_default.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Show_Y_Axis_With_Zero_true.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Label_Rotation_45.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Label_Rotation_90.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Label_Rotation_negative_45.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Label_Rotation_negative_90.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Label_Visibility_and_Y_Axis_Label_Visibility_hide.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Line_Visibility_hide_default.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Line_Visibility_show.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Major_Tick_Interval_6.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Major_Tick_Size_15_Minor_Tick_Size_10.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Major_Tick_Visibility_hide.png +0 -0
  58. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Major_Tick_Visibility_show.png +0 -0
  59. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Maximum_Number_14.png +0 -0
  60. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Minimum_Number_10.png +0 -0
  61. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Minor_Tick_Visibility_hide.png +0 -0
  62. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Minor_Tick_Visibility_show.png +0 -0
  63. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_X_Axis_Scale_log.png +0 -0
  64. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Abbreviation_auto_default.png +0 -0
  65. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Abbreviation_off.png +0 -0
  66. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Line_Visibility_show.png +0 -0
  67. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Major_Tick_Interval_150.png +0 -0
  68. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Major_Tick_Size_15_Minor_Tick_Size_10.png +0 -0
  69. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Major_Tick_Visibility_hide.png +0 -0
  70. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Major_Tick_Visibility_show.png +0 -0
  71. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Maximum_Number_1500.png +0 -0
  72. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Minimum_Number_500.png +0 -0
  73. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Minor_Tick_Visibility_hide.png +0 -0
  74. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Minor_Tick_Visibility_show.png +0 -0
  75. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Scale_log.png +0 -0
  76. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_and_X_Axis_Title_Text_hide.png +0 -0
  77. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_and_X_Axis_Title_Text_specified.png +0 -0
  78. package/.loki/reference/chrome_docker_Visualizations_Column_Column_Chart_Overlay_on_Multiple_Overlay_Fields_with_space_specified.png +0 -0
  79. package/.loki/reference/chrome_docker_Visualizations_Column_Column_Chart_Overlay_on_Overlay_Field_with_space_specified.png +0 -0
  80. package/.loki/reference/chrome_docker_Visualizations_Column_Column_Y2_Axis_Mapped_Field_With_Space_specified.png +0 -0
  81. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Choropleth_Layer.png +0 -0
  82. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Choropleth_Layer_Opacities_scaled_to_be_less_than_max_of_0_8.png +0 -0
  83. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Choropleth_Layer_Result_Limit_Set_To_1.png +0 -0
  84. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Choropleth_Layer_String_GeoJson_Data.png +0 -0
  85. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Choropleth_Layer_With_additional_fields.png +0 -0
  86. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Background_Color_af575a.png +0 -0
  87. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Basic_Markdown.png +0 -0
  88. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Begin_with_Text_Instead_of_Header.png +0 -0
  89. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Font_Color_purple.png +0 -0
  90. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Font_Size_extraLarge.png +0 -0
  91. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Background_Color_grey.png +0 -0
  92. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Basic_Scatter.png +0 -0
  93. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Marker_Size_7.png +0 -0
  94. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_X_Axis_Extend_Range_false.png +0 -0
  95. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_X_Axis_Extend_Range_true_default.png +0 -0
  96. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_X_Axis_Minor_Grid_true.png +0 -0
  97. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_X_Axis_With_Zero_false_default.png +0 -0
  98. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_X_Axis_With_Zero_true.png +0 -0
  99. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_Extend_Range_false.png +0 -0
  100. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_Extend_Range_true_default.png +0 -0
  101. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_Major_Grid_false.png +0 -0
  102. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_Minor_Grid_true.png +0 -0
  103. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_With_Zero_false_default.png +0 -0
  104. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Show_Y_Axis_With_Zero_true.png +0 -0
  105. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Label_Rotation_45.png +0 -0
  106. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Label_Rotation_90.png +0 -0
  107. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Label_Rotation_negative_45.png +0 -0
  108. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Label_Rotation_negative_90.png +0 -0
  109. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Label_Visibility_and_Y_Axis_Label_Visibility_hide.png +0 -0
  110. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Line_Visibility_hide_default.png +0 -0
  111. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Line_Visibility_show.png +0 -0
  112. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Major_Tick_Interval_6.png +0 -0
  113. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Major_Tick_Size_15_X_Axis_Minor_Tick_Size_10.png +0 -0
  114. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Major_Tick_Visibility_hide.png +0 -0
  115. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Major_Tick_Visibility_show.png +0 -0
  116. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Maximum_Number_14.png +0 -0
  117. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Minimum_Number_10.png +0 -0
  118. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Minor_Tick_Visibility_hide.png +0 -0
  119. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Minor_Tick_Visibility_show.png +0 -0
  120. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Scale_log.png +0 -0
  121. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Title_Text_and_Y_Axis_Title_Text_hide.png +0 -0
  122. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_X_Axis_Title_Text_and_Y_Axis_Title_Text_specified.png +0 -0
  123. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Line_Visibility_show.png +0 -0
  124. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Major_Tick_Interval_150.png +0 -0
  125. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Major_Tick_Size_15_Y_Axis_Minor_Tick_Size_10.png +0 -0
  126. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Major_Tick_Visibility_hide.png +0 -0
  127. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Major_Tick_Visibility_show.png +0 -0
  128. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Maximum_Number_1000.png +0 -0
  129. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Minimum_Number_500.png +0 -0
  130. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Minor_Tick_Visibility_hide.png +0 -0
  131. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Minor_Tick_Visibility_show.png +0 -0
  132. package/.loki/reference/chrome_docker_Visualizations_Scatter_Scatter_Y_Axis_Scale_log.png +0 -0
  133. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Basic_Single_Value_Icon.png +0 -0
  134. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Change_Icon_Color_For_A_Remote_Icon.png +0 -0
  135. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_The_Icon_As_A_Remote_Icon.png +0 -0
  136. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_the_backgroundColor_based_on_the_majorValue.png +0 -0
  137. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_the_icon_color_based_on_the_majorValue.png +0 -0
  138. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Set_the_majorColor_based_on_the_majorValue.png +0 -0
  139. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Use_Mixed_Type_Series_Data.png +0 -0
  140. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Icon_Single_Value_Icon_Use_Time_Type_Series_Data.png +0 -0
  141. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Background_From_Major_Value.png +0 -0
  142. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Background_From_Trend_Value.png +0 -0
  143. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Basic_Single_Value_Radial.png +0 -0
  144. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Major_Value_Color.png +0 -0
  145. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Major_Value_Color_By_Trend_Value.png +0 -0
  146. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Max_Value_1000.png +0 -0
  147. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Radial_Single_Value_Radial_Radial_Color_By_Major_Value.png +0 -0
  148. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Basic_Single_Value.png +0 -0
  149. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Change_The_Color_Of_Major_Value_Based_On_Its_Value.png +0 -0
  150. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_The_Background_Color_Based_On_The_Major_Value.png +0 -0
  151. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_The_Background_Color_Based_On_The_Trend_Value.png +0 -0
  152. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_The_Color_Of_Major_Value_Based_On_The_Trend_Value.png +0 -0
  153. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_The_Color_Of_The_Trend_Indicators_And_Number_Based_On_The_Trend_Value.png +0 -0
  154. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Set_The_Major_Value_Based_On_String_Type_Data.png +0 -0
  155. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Trend_Index_Out_Of_Range.png +0 -0
  156. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Use_Mixed_Type_Series_Data.png +0 -0
  157. package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Use_Time_Type_Series_Data.png +0 -0
  158. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
  159. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Auto_Expand_Last_Column.png +0 -0
  160. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Monospace.png +0 -0
  161. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
  162. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
  163. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
  164. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
  165. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Zone_Time_Formatting.png +0 -0
  166. package/Area.config.js +1119 -241
  167. package/Area.config.js.map +1 -1
  168. package/Area.js +1241 -402
  169. package/Area.js.map +1 -1
  170. package/Bar.config.js +1089 -153
  171. package/Bar.config.js.map +1 -1
  172. package/Bar.js +1262 -365
  173. package/Bar.js.map +1 -1
  174. package/Bubble.config.js +702 -60
  175. package/Bubble.config.js.map +1 -1
  176. package/Bubble.js +806 -203
  177. package/Bubble.js.map +1 -1
  178. package/ChoroplethSvg.config.js +62 -38
  179. package/ChoroplethSvg.config.js.map +1 -1
  180. package/ChoroplethSvg.js +168 -178
  181. package/ChoroplethSvg.js.map +1 -1
  182. package/Column.config.js +1059 -170
  183. package/Column.config.js.map +1 -1
  184. package/Column.js +1234 -384
  185. package/Column.js.map +1 -1
  186. package/Ellipse.config.js +55 -31
  187. package/Ellipse.config.js.map +1 -1
  188. package/Ellipse.js +135 -145
  189. package/Ellipse.js.map +1 -1
  190. package/FillerGauge.config.js +67 -43
  191. package/FillerGauge.config.js.map +1 -1
  192. package/FillerGauge.js +157 -172
  193. package/FillerGauge.js.map +1 -1
  194. package/Image.config.js +52 -25
  195. package/Image.config.js.map +1 -1
  196. package/Image.js +132 -140
  197. package/Image.js.map +1 -1
  198. package/Line.config.js +1035 -108
  199. package/Line.config.js.map +1 -1
  200. package/Line.js +1199 -311
  201. package/Line.js.map +1 -1
  202. package/LinkGraph.config.js +78 -58
  203. package/LinkGraph.config.js.map +1 -1
  204. package/LinkGraph.js +179 -194
  205. package/LinkGraph.js.map +1 -1
  206. package/Map.config.js +787 -78
  207. package/Map.config.js.map +1 -1
  208. package/Map.js +846 -352
  209. package/Map.js.map +1 -1
  210. package/Markdown.config.js +73 -48
  211. package/Markdown.config.js.map +1 -1
  212. package/Markdown.js +271 -259
  213. package/Markdown.js.map +1 -1
  214. package/MarkerGauge.config.js +77 -50
  215. package/MarkerGauge.config.js.map +1 -1
  216. package/MarkerGauge.js +2079 -1987
  217. package/MarkerGauge.js.map +1 -1
  218. package/ParallelCoordinates.config.js +75 -48
  219. package/ParallelCoordinates.config.js.map +1 -1
  220. package/ParallelCoordinates.js +166 -181
  221. package/ParallelCoordinates.js.map +1 -1
  222. package/Pie.config.js +77 -50
  223. package/Pie.config.js.map +1 -1
  224. package/Pie.js +1139 -1042
  225. package/Pie.js.map +1 -1
  226. package/Punchcard.config.js +76 -49
  227. package/Punchcard.config.js.map +1 -1
  228. package/Punchcard.js +196 -211
  229. package/Punchcard.js.map +1 -1
  230. package/Rectangle.config.js +83 -56
  231. package/Rectangle.config.js.map +1 -1
  232. package/Rectangle.js +256 -264
  233. package/Rectangle.js.map +1 -1
  234. package/Sankey.config.js +82 -55
  235. package/Sankey.config.js.map +1 -1
  236. package/Sankey.js +190 -205
  237. package/Sankey.js.map +1 -1
  238. package/Scatter.config.js +790 -135
  239. package/Scatter.config.js.map +1 -1
  240. package/Scatter.js +1072 -485
  241. package/Scatter.js.map +1 -1
  242. package/SingleValue.config.js +85 -56
  243. package/SingleValue.config.js.map +1 -1
  244. package/SingleValue.js +415 -411
  245. package/SingleValue.js.map +1 -1
  246. package/SingleValueBasic.js +37 -25
  247. package/SingleValueBasic.js.map +1 -1
  248. package/SingleValueIcon.config.js +81 -57
  249. package/SingleValueIcon.config.js.map +1 -1
  250. package/SingleValueIcon.js +195 -211
  251. package/SingleValueIcon.js.map +1 -1
  252. package/SingleValueRadial.config.js +80 -51
  253. package/SingleValueRadial.config.js.map +1 -1
  254. package/SingleValueRadial.js +342 -338
  255. package/SingleValueRadial.js.map +1 -1
  256. package/Table.config.js +56 -36
  257. package/Table.config.js.map +1 -1
  258. package/Table.js +1610 -1553
  259. package/Table.js.map +1 -1
  260. package/common/Charting.js +10 -10
  261. package/common/Charting.js.map +1 -1
  262. package/common/ChartingApi.js +2 -2
  263. package/common/ChartingApi.js.map +1 -1
  264. package/common/EventsDoc.js +3 -3
  265. package/common/EventsDoc.js.map +1 -1
  266. package/common/OptionsDoc.js +49 -21
  267. package/common/OptionsDoc.js.map +1 -1
  268. package/common/SplunkVisualization.js +4 -4
  269. package/common/SplunkVisualization.js.map +1 -1
  270. package/common/ThemesDoc.js +2 -2
  271. package/common/chartingUtils.js +2 -2
  272. package/common/gaugeUtils.js +2 -2
  273. package/common/utils/configUtils.js +30 -4
  274. package/common/utils/configUtils.js.map +1 -1
  275. package/common/utils/hocUtils.js +26 -56
  276. package/common/utils/hocUtils.js.map +1 -1
  277. package/common/utils/singleValueUtils.js +4 -2
  278. package/common/utils/singleValueUtils.js.map +1 -1
  279. package/common/utils/testHelper.js +8 -8
  280. package/common/utils/testHelper.js.map +1 -1
  281. package/common/withDashboardViz.js +32 -68
  282. package/common/withDashboardViz.js.map +1 -1
  283. package/package.json +11 -11
  284. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Maximum_Number_800.png +0 -0
  285. package/.loki/reference/chrome_docker_Visualizations_Bubble_Bubble_Y_Axis_Minimum_Number_300.png +0 -0
package/MarkerGauge.js CHANGED
@@ -87,504 +87,411 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 211);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 213);
91
91
  /******/ })
92
92
  /************************************************************************/
93
- /******/ ({
94
-
95
- /***/ 0:
93
+ /******/ ([
94
+ /* 0 */
96
95
  /***/ (function(module, exports) {
97
96
 
98
97
  module.exports = require("prop-types");
99
98
 
100
99
  /***/ }),
101
-
102
- /***/ 1:
100
+ /* 1 */
103
101
  /***/ (function(module, exports) {
104
102
 
105
103
  module.exports = require("react");
106
104
 
107
105
  /***/ }),
106
+ /* 2 */
107
+ /***/ (function(module, exports) {
108
+
109
+ module.exports = require("lodash");
108
110
 
109
- /***/ 10:
111
+ /***/ }),
112
+ /* 3 */
110
113
  /***/ (function(module, exports) {
111
114
 
112
- module.exports = require("@babel/runtime/helpers/classCallCheck");
115
+ module.exports = require("@splunk/ui-utils/i18n");
113
116
 
114
117
  /***/ }),
118
+ /* 4 */
119
+ /***/ (function(module, exports) {
115
120
 
116
- /***/ 100:
117
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
121
+ module.exports = require("styled-components");
122
+
123
+ /***/ }),
124
+ /* 5 */
125
+ /***/ (function(module, exports, __webpack_require__) {
118
126
 
119
127
  "use strict";
120
- __webpack_require__.r(__webpack_exports__);
121
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
122
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
123
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
124
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
125
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
126
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
127
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
128
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
129
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
130
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
131
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23);
132
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
133
128
 
134
129
 
130
+ Object.defineProperty(exports, "__esModule", {
131
+ value: true
132
+ });
133
+ exports.VizBehavior = void 0;
134
+ var VizBehavior;
135
135
 
136
+ (function (VizBehavior) {
137
+ /**
138
+ * Dynamic Options Behavior.
139
+ * This allows visualization options to be powered by data
140
+ *
141
+ * **Example**
142
+ *
143
+ * sparklineValues: ">primary|seriesByIndex(0)"
144
+ * would configure sparklineValues with an array of data points
145
+ * coming from the first series in the primary datasource
146
+ *
147
+ */
148
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
149
+ VizBehavior["EVENTS"] = "events";
150
+ /**
151
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
152
+ * missing.
153
+ * @type {string}
154
+ */
136
155
 
156
+ VizBehavior["PLACEHOLDER"] = "placeholder";
157
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
158
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
137
159
 
138
- var DEFAULT_NUM_OF_TICKS = 5;
139
- var TICK_LENGTH_DELTA = 5;
140
- var TICK_LABEL_PADDING_FACTOR = 3.2;
141
- var MajorTickLine = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.line.withConfig({
142
- displayName: "GaugeMajorTicks__MajorTickLine",
143
- componentId: "mchiad-0"
144
- })(["stroke:", ";stroke-width:2px;stroke-dasharray:", ";"], function (props) {
145
- return props.majorTickStrokeColor;
146
- }, function (props) {
147
- return props.index === 0 ? 0 : 3;
148
- });
149
- var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
150
- displayName: "GaugeMajorTicks__MajorTickLabel",
151
- componentId: "mchiad-1"
152
- })(["font-size:12px;font-family:Splunk Platform Sans,sans-serif;line-height:19px;fill:", ";text-anchor:middle;text-align:center;"], function (props) {
153
- return props.majorTickFillColor;
154
- });
155
- var MajorTick = function MajorTick(_ref) {
156
- var index = _ref.index,
157
- x1 = _ref.x1,
158
- y1 = _ref.y1,
159
- x2 = _ref.x2,
160
- y2 = _ref.y2,
161
- showLabels = _ref.showLabels,
162
- label = _ref.label,
163
- labelX = _ref.labelX,
164
- labelY = _ref.labelY,
165
- majorTickStrokeColor = _ref.majorTickStrokeColor,
166
- majorTickFillColor = _ref.majorTickFillColor;
167
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
168
- index: index,
169
- x1: x1,
170
- y1: y1,
171
- x2: x2,
172
- y2: y2,
173
- majorTickStrokeColor: majorTickStrokeColor
174
- }), showLabels && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLabel, {
175
- x: labelX,
176
- y: labelY,
177
- majorTickFillColor: majorTickFillColor
178
- }, Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["isNumerial"])(label) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(label, 0, {
179
- useThousandSeparators: true,
180
- useTrendUnits: true
181
- }) : label));
182
- };
183
- MajorTick.propTypes = {
184
- index: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
185
- x1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
186
- y1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
187
- x2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
188
- y2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
189
- showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
190
- label: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
191
- labelX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
192
- labelY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
193
- majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
194
- majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
195
- };
196
- /**
197
- * calculate position for each major tick
198
- * @method positionMajorTick
199
- * @param {Object} input
200
- * @param {Number} input.width
201
- * @param {Number} input.height
202
- * @param {Number} input.startX start x for rendering the first major tick
203
- * @param {Number} input.startY start y for rendering the first major tick
204
- * @param {String} input.orientation
205
- * @param {Number} input.numOfTicks how many ticks need to render
206
- * @param {Number} input.i index of major tick
207
- * @return {Object} MajorTick positions
208
- */
160
+ /***/ }),
161
+ /* 6 */
162
+ /***/ (function(module, exports, __webpack_require__) {
209
163
 
210
- var positionMajorTick = function positionMajorTick(_ref2) {
211
- var width = _ref2.width,
212
- height = _ref2.height,
213
- startX = _ref2.startX,
214
- startY = _ref2.startY,
215
- orientation = _ref2.orientation,
216
- numOfTicks = _ref2.numOfTicks,
217
- i = _ref2.i;
218
- var x1 = startX;
219
- var y1 = startY;
220
- var x2 = startX;
221
- var y2 = startY;
222
- var labelX = startX;
223
- var labelY;
164
+ "use strict";
224
165
 
225
- if (orientation === 'vertical') {
226
- var y = height / numOfTicks * (numOfTicks - i) + startY;
227
- x1 -= TICK_LENGTH_DELTA;
228
- y1 = y;
229
- x2 += width + TICK_LENGTH_DELTA;
230
- y2 = y;
231
- labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
232
- labelY = y;
233
- } else {
234
- var x = width / numOfTicks * i + startX;
235
- x1 = x;
236
- y1 -= TICK_LENGTH_DELTA;
237
- x2 = x;
238
- y2 += height + TICK_LENGTH_DELTA;
239
- labelX = x;
240
- labelY = y2 + 16;
166
+
167
+ var _toConsumableArray = __webpack_require__(9);
168
+
169
+ var _defineProperty = __webpack_require__(7);
170
+
171
+ var __rest = this && this.__rest || function (s, e) {
172
+ var t = {};
173
+
174
+ for (var p in s) {
175
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
241
176
  }
242
177
 
243
- return {
244
- x1: x1,
245
- y1: y1,
246
- x2: x2,
247
- y2: y2,
248
- labelX: labelX,
249
- labelY: labelY
250
- };
178
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
179
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
180
+ }
181
+ return t;
251
182
  };
252
183
 
253
- var MajorTicks = function MajorTicks(_ref3) {
254
- var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
184
+ Object.defineProperty(exports, "__esModule", {
185
+ value: true
186
+ });
187
+ exports.insertLayout = exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
255
188
 
256
- var width = props.width,
257
- height = props.height,
258
- startX = props.startX,
259
- startY = props.startY,
260
- min = props.min,
261
- max = props.max,
262
- majorUnit = props.majorUnit,
263
- orientation = props.orientation,
264
- showLabels = props.showLabels,
265
- usePercentageRange = props.usePercentageRange,
266
- majorTickFillColor = props.majorTickFillColor,
267
- majorTickStrokeColor = props.majorTickStrokeColor;
268
- var range = max - min;
269
- var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
270
- var majorTicks = [];
189
+ var lodash_1 = __webpack_require__(2);
271
190
 
272
- for (var i = 0; i <= numOfTicks; i += 1) {
273
- var _positionMajorTick = positionMajorTick({
274
- width: width,
275
- height: height,
276
- startX: startX,
277
- startY: startY,
278
- orientation: orientation,
279
- numOfTicks: numOfTicks,
280
- i: i
281
- }),
282
- x1 = _positionMajorTick.x1,
283
- y1 = _positionMajorTick.y1,
284
- x2 = _positionMajorTick.x2,
285
- y2 = _positionMajorTick.y2,
286
- labelX = _positionMajorTick.labelX,
287
- labelY = _positionMajorTick.labelY;
191
+ var schemaUtils_1 = __webpack_require__(16);
288
192
 
289
- var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
290
- majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
291
- key: i,
292
- index: i,
293
- x1: x1,
294
- y1: y1,
295
- x2: x2,
296
- y2: y2,
297
- showLabels: showLabels,
298
- label: label,
299
- labelX: labelX,
300
- labelY: labelY,
301
- majorTickFillColor: majorTickFillColor,
302
- majorTickStrokeColor: majorTickStrokeColor
303
- }));
304
- } // if the gauge is not divided evenly, put the last tick at the end of the gauge
193
+ var VizBehavior_1 = __webpack_require__(5);
305
194
 
195
+ var dynamicOptionsDSLType = {
196
+ type: 'string',
197
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
198
+ };
199
+ /**
200
+ * Helper function to extend an options schema with dynamic options DSL
201
+ * @param optionsSchema a visualization's options schema
202
+ * @returns an updated options schema that additionally allows strings starting with > for each option
203
+ */
306
204
 
307
- if (!Number.isInteger(numOfTicks)) {
308
- var extraNumOfTicks = Math.ceil(numOfTicks);
205
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
206
+ var enhancedOptionsSchema = {};
207
+ Object.keys(optionsSchema).forEach(function (key) {
208
+ var _a = optionsSchema[key],
209
+ title = _a.title,
210
+ description = _a.description,
211
+ readOnly = _a.readOnly,
212
+ writeOnly = _a.writeOnly,
213
+ examples = _a.examples,
214
+ defaultValue = _a.default,
215
+ type = _a.type,
216
+ properties = _a.properties,
217
+ patternProperties = _a.patternProperties,
218
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
309
219
 
310
- var _positionMajorTick2 = positionMajorTick({
311
- width: width,
312
- height: height,
313
- startX: startX,
314
- startY: startY,
315
- orientation: orientation,
316
- numOfTicks: extraNumOfTicks,
317
- i: extraNumOfTicks
318
- }),
319
- _x = _positionMajorTick2.x1,
320
- _y = _positionMajorTick2.y1,
321
- _x2 = _positionMajorTick2.x2,
322
- _y2 = _positionMajorTick2.y2,
323
- _labelX = _positionMajorTick2.labelX,
324
- _labelY = _positionMajorTick2.labelY;
325
-
326
- majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
327
- key: extraNumOfTicks,
328
- id: extraNumOfTicks,
329
- x1: _x,
330
- y1: _y,
331
- x2: _x2,
332
- y2: _y2,
333
- showLabels: showLabels,
334
- label: usePercentageRange ? '100%' : max,
335
- labelX: _labelX,
336
- labelY: _labelY,
337
- majorTickFillColor: majorTickFillColor,
338
- majorTickStrokeColor: majorTickStrokeColor
339
- }));
340
- }
220
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
221
+ title: title
222
+ }), description !== undefined && {
223
+ description: description
224
+ }), readOnly !== undefined && {
225
+ readOnly: readOnly
226
+ }), writeOnly !== undefined && {
227
+ writeOnly: writeOnly
228
+ }), examples !== undefined && {
229
+ examples: examples
230
+ }), defaultValue !== undefined && {
231
+ default: defaultValue
232
+ });
341
233
 
342
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
343
- };
234
+ if (type === 'object') {
235
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
236
+ type: type
237
+ }), properties && {
238
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
239
+ });
344
240
 
345
- MajorTicks.propTypes = {
346
- width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
347
- height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
348
- startX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
349
- startY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
350
- min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
351
- max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
352
- majorUnit: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
353
- orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
354
- showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
355
- usePercentageRange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
356
- majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
357
- majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
358
- };
359
- MajorTicks.defaultProps = {
360
- min: 0,
361
- max: 100,
362
- majorUnit: 'auto',
363
- orientation: 'horizontal',
364
- showLabels: true,
365
- usePercentageRange: false
366
- };
367
- /* harmony default export */ __webpack_exports__["default"] = (MajorTicks);
241
+ if (patternProperties) {
242
+ var enhancedPatternProperties = {};
243
+ Object.keys(patternProperties).forEach(function (opt) {
244
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
245
+ });
246
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
247
+ }
248
+ } else {
249
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
250
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
251
+ type: type
252
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
253
+ });
254
+ }
255
+ });
256
+ return enhancedOptionsSchema;
257
+ }
368
258
 
369
- /***/ }),
259
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
260
+ /**
261
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
262
+ * @param vizConfig a Visualization Config
263
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
264
+ */
370
265
 
371
- /***/ 101:
372
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
266
+ function enhanceConfig(vizConfig) {
267
+ var enhancedConfig = vizConfig;
373
268
 
374
- "use strict";
375
- __webpack_require__.r(__webpack_exports__);
376
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
377
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
378
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46);
379
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
380
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
381
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
382
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
383
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
384
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
385
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
386
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23);
387
- /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
269
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
270
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
271
+ }
388
272
 
273
+ return enhancedConfig;
274
+ }
389
275
 
276
+ exports.enhanceConfig = enhanceConfig;
390
277
 
278
+ function isDynamicOption(option) {
279
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
280
+ }
391
281
 
282
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
283
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
392
284
 
393
- var MARKER_THICKNESS = 15;
394
- var MARKER_INNER_LENGTH = 30;
395
- var MARKER_LABEL_WIDTH = 60;
396
- var MARKER_LABEL_HEIGHT = 25;
397
- var RADIUS = 2;
398
- var DELTA_LENGTH = 12;
399
- var ValueMarkerRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.path.withConfig({
400
- displayName: "GaugeValueMarker__ValueMarkerRect",
401
- componentId: "sc-1bxkeao-0"
402
- })(["stroke-width:2px;fill:", ";"], function (props) {
403
- return props.valueMarkerFillColor;
404
- });
405
- var ValueMarkerLabelRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.rect.withConfig({
406
- displayName: "GaugeValueMarker__ValueMarkerLabelRect",
407
- componentId: "sc-1bxkeao-1"
408
- })(["fill:", ";"], function (props) {
409
- return props.valueMarkerFillColor;
410
- });
411
- var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
412
- displayName: "GaugeValueMarker__ValueMarkerLabel",
413
- componentId: "sc-1bxkeao-2"
414
- })(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
415
- return props.valueMarkerLabelFillColor;
416
- });
417
285
  /**
418
- * calculate the path of Value Marker shape
419
- * @method positionValueMarkerRect
420
- * @param {Object} input
421
- * @param {Number} input.x
422
- * @param {Number} input.y
423
- * @param {String} input.orientation
424
- * @param {Number} input.valueMarkerRectLength
425
- * @return {String} d containing a series of path commands that define the path to be
286
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
287
+ * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
288
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
289
+ * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
290
+ *
291
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
426
292
  */
427
293
 
428
- var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
429
- var x = _ref.x,
430
- y = _ref.y,
431
- orientation = _ref.orientation,
432
- valueMarkerRectLength = _ref.valueMarkerRectLength;
433
- var hLength = MARKER_THICKNESS;
434
- var vLength = valueMarkerRectLength;
435
- var markerStartX = x - MARKER_THICKNESS;
436
- var markerStartY = y;
437
- var innerHLength = hLength / 3;
438
- var innerVLength = MARKER_INNER_LENGTH;
439
- var innerStartX = markerStartX + innerHLength;
440
- var innerStartY = markerStartY + 7;
441
-
442
- if (orientation === 'vertical') {
443
- hLength = valueMarkerRectLength;
444
- vLength = MARKER_THICKNESS;
445
- markerStartX = x;
446
- innerHLength = MARKER_INNER_LENGTH;
447
- innerVLength = vLength / 3;
448
- innerStartX = markerStartX + 7;
449
- innerStartY = markerStartY + innerVLength;
450
- }
451
-
452
- return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
453
- };
294
+ function hasCompatibleContexts(vizContext, presetContext) {
295
+ var presetContextKeys = Object.keys(presetContext);
296
+ return presetContextKeys.every(function (contextKey) {
297
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
298
+ });
299
+ }
454
300
  /**
455
- * calculate the position of value marker label
456
- * @method positionLabel
457
- * @param {Object} input
458
- * @param {Number} input.x
459
- * @param {Number} input.y
460
- * @param {Number} input.length gauge thickness
461
- * @param {String} input.orientation
462
- * @return {Object} positions
463
- * @return {Number} positions.labelRectX x of value marker label rect
464
- * @return {Number} positions.labelRectY y of value marker label rect
465
- * @return {Number} positions.labelX x of value marker label text
466
- * @return {Number} positions.labelY y of value marker label text
301
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
467
302
  */
468
303
 
469
- var positionLabel = function positionLabel(_ref2) {
470
- var x = _ref2.x,
471
- y = _ref2.y,
472
- length = _ref2.length,
473
- orientation = _ref2.orientation; // for horizontal view
474
304
 
475
- var labelRectX = x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
476
- var labelRectY = y + length;
305
+ function hasCompatibleOptions(vizOptions, presetOptions) {
306
+ var presetOptionKeys = Object.keys(presetOptions);
307
+ return presetOptionKeys.every(function (optionKey) {
308
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
309
+ });
310
+ }
311
+ /**
312
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
313
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
314
+ *
315
+ * @param {Object} vizContext - the current vizContext definition
316
+ * @param {Object} vizOptions - the current vizOptions definition
317
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
318
+ */
477
319
 
478
- if (orientation === 'vertical') {
479
- labelRectX = x + length;
480
- labelRectY = y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
481
- }
482
320
 
483
- var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
484
- var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
485
- return {
486
- labelRectX: labelRectX,
487
- labelRectY: labelRectY,
488
- labelX: labelX,
489
- labelY: labelY
490
- };
491
- };
321
+ function getInitialPreset(vizContext, vizOptions, presets) {
322
+ return presets.find(function (preset) {
323
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
324
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
325
+ var presetContextKeys = Object.keys(presetContext);
326
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
327
+ // if not, then the preset is invalid in config.ts
492
328
 
493
- var ValueMarker = function ValueMarker(_ref3) {
494
- var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
329
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
330
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
331
+ });
332
+ }
495
333
 
496
- var x = props.x,
497
- y = props.y,
498
- length = props.length,
499
- min = props.min,
500
- max = props.max,
501
- value = props.value,
502
- orientation = props.orientation,
503
- showValue = props.showValue,
504
- usePercentageValue = props.usePercentageValue,
505
- valueMarkerFillColor = props.valueMarkerFillColor,
506
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
507
- var valueMarkerRectLength = length + DELTA_LENGTH;
334
+ exports.getInitialPreset = getInitialPreset;
335
+ /**
336
+ * generates number precision values for a Select editor
337
+ *
338
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
339
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
340
+ */
508
341
 
509
- var _positionLabel = positionLabel({
510
- x: x,
511
- y: y,
512
- length: length,
513
- orientation: orientation
514
- }),
515
- labelRectX = _positionLabel.labelRectX,
516
- labelRectY = _positionLabel.labelRectY,
517
- labelX = _positionLabel.labelX,
518
- labelY = _positionLabel.labelY;
342
+ function generatePrecisionValues(numPrecisionValues) {
343
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
344
+ return {
345
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
346
+ value: i
347
+ };
348
+ });
349
+ }
519
350
 
520
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
521
- "data-test": "value-marker-rect",
522
- d: positionValueMarkerRect({
523
- x: x,
524
- y: y,
525
- orientation: orientation,
526
- valueMarkerRectLength: valueMarkerRectLength
527
- }),
528
- valueMarkerFillColor: valueMarkerFillColor
529
- }), showValue && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabelRect, {
530
- "data-test": "value-marker-label-rect",
531
- x: labelRectX,
532
- y: labelRectY,
533
- width: MARKER_LABEL_WIDTH,
534
- height: MARKER_LABEL_HEIGHT,
535
- rx: RADIUS,
536
- ry: RADIUS,
537
- valueMarkerFillColor: valueMarkerFillColor
538
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabel, {
539
- "data-test": "value-marker-label",
540
- x: labelX,
541
- y: labelY,
542
- valueMarkerLabelFillColor: valueMarkerLabelFillColor
543
- }, usePercentageValue ? "".concat((value / (max - min) * 100).toFixed(2), "%") : Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(value, 0, {
544
- useThousandSeparators: true,
545
- useTrendUnits: true
546
- }))));
351
+ exports.generatePrecisionValues = generatePrecisionValues;
352
+ /**
353
+ * insert layout in layout array, return a new layout array instead of updating the original
354
+ *
355
+ * @param {EditorLayoutConfig[][]} layout - editor layout
356
+ * @param {Number} index - the index to insert layout item(s)
357
+ * @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
358
+ * @returns {EditorLayoutConfig[][]} new editor layout with insertion
359
+ */
360
+
361
+ var insertLayout = function insertLayout(layout, index) {
362
+ for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
363
+ layoutItems[_key - 2] = arguments[_key];
364
+ }
365
+
366
+ return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
547
367
  };
548
368
 
549
- ValueMarker.propTypes = {
550
- x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
551
- y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
552
- length: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
553
- min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
554
- max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
555
- value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
556
- orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
557
- showValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
558
- usePercentageValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
559
- valueMarkerFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
560
- valueMarkerLabelFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
369
+ exports.insertLayout = insertLayout;
370
+
371
+ /***/ }),
372
+ /* 7 */
373
+ /***/ (function(module, exports) {
374
+
375
+ module.exports = require("@babel/runtime/helpers/defineProperty");
376
+
377
+ /***/ }),
378
+ /* 8 */
379
+ /***/ (function(module, exports, __webpack_require__) {
380
+
381
+ "use strict";
382
+
383
+
384
+ var _typeof = __webpack_require__(23);
385
+
386
+ Object.defineProperty(exports, "__esModule", {
387
+ value: true
388
+ });
389
+ exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
390
+
391
+ var lodash_1 = __webpack_require__(2);
392
+
393
+ var mapUtils_1 = __webpack_require__(41);
394
+ /**
395
+ * @method extendStaticWrapperProps
396
+ * @param {Object} props
397
+ * @param {DashboardVizType} props.Wrapper
398
+ * @param {DashboardVizType} props.Visualization
399
+ */
400
+
401
+
402
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
403
+ var Wrapper = _ref.Wrapper,
404
+ Visualization = _ref.Visualization;
405
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
406
+ extendProperties.forEach(function (prop) {
407
+ if (Visualization[prop]) {
408
+ // eslint-disable-next-line no-param-reassign
409
+ Wrapper[prop] = Visualization[prop];
410
+ }
411
+ });
561
412
  };
562
- ValueMarker.defaultProps = {
563
- min: 0,
564
- max: 100,
565
- orientation: 'horizontal',
566
- showValue: true,
567
- usePercentageValue: false
413
+
414
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
415
+ /**
416
+ * helper to deeply merge objects while preserving arrays in earlier source objects
417
+ * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays of primitives will be preserved if already present in the resultant merged object
418
+ * this prevents default arrays of primitives from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one).
419
+ * Array of objects gets merged with the defaults, where the defaults can be an array of objects. Closest matching default object from the defaults list based on key - value pair
420
+ * will be used for merging defaults for each object in the array. If no closest match found, first object in default array list used for merging.
421
+ *
422
+ * @method deepMergeWithArrayPrimitiveOverrides
423
+ * @param {Object} initial - target object to merge values into
424
+ * @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
425
+ *
426
+ * @returns {Object}
427
+ */
428
+
429
+ var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
430
+ var clone = lodash_1.cloneDeep(initial);
431
+
432
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
433
+ sources[_key - 1] = arguments[_key];
434
+ }
435
+
436
+ sources.forEach(function (sourceToApply) {
437
+ Object.keys(sourceToApply).forEach(function (sourceKey) {
438
+ if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
439
+ clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
440
+ }
441
+
442
+ if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
443
+ clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
444
+ } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
445
+ // If option is an array of objects
446
+ for (var i = 0; i < clone[sourceKey].length; i += 1) {
447
+ if (_typeof(clone[sourceKey][i]) === 'object') {
448
+ var closestMatchIdx = mapUtils_1.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
449
+
450
+ if (closestMatchIdx > -1) {
451
+ clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
452
+ }
453
+ }
454
+ }
455
+ }
456
+ });
457
+ });
458
+ return clone;
568
459
  };
569
- /* harmony default export */ __webpack_exports__["default"] = (ValueMarker);
460
+
461
+ exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
570
462
 
571
463
  /***/ }),
464
+ /* 9 */
465
+ /***/ (function(module, exports) {
466
+
467
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
572
468
 
573
- /***/ 11:
469
+ /***/ }),
470
+ /* 10 */
574
471
  /***/ (function(module, exports) {
575
472
 
576
473
  module.exports = require("@splunk/themes/variables");
577
474
 
578
475
  /***/ }),
476
+ /* 11 */
477
+ /***/ (function(module, exports) {
478
+
479
+ module.exports = require("@splunk/visualizations-shared/Message");
579
480
 
580
- /***/ 12:
481
+ /***/ }),
482
+ /* 12 */
581
483
  /***/ (function(module, exports) {
582
484
 
583
- module.exports = require("@splunk/visualizations-shared/colorUtils");
485
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
584
486
 
585
487
  /***/ }),
488
+ /* 13 */
489
+ /***/ (function(module, exports) {
586
490
 
587
- /***/ 13:
491
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
492
+
493
+ /***/ }),
494
+ /* 14 */
588
495
  /***/ (function(module, exports, __webpack_require__) {
589
496
 
590
497
  "use strict";
@@ -598,11 +505,11 @@ var React = __webpack_require__(1);
598
505
 
599
506
  var styled_components_1 = __webpack_require__(4);
600
507
 
601
- var SizeAwareWrapper_1 = __webpack_require__(17);
508
+ var SizeAwareWrapper_1 = __webpack_require__(18);
602
509
 
603
- var style_1 = __webpack_require__(14);
510
+ var style_1 = __webpack_require__(15);
604
511
 
605
- var colorUtils_1 = __webpack_require__(12);
512
+ var colorUtils_1 = __webpack_require__(13);
606
513
 
607
514
  var Item = styled_components_1.default.div.attrs(function (_ref) {
608
515
  var width = _ref.width;
@@ -659,7 +566,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
659
566
 
660
567
  return React.createElement(FixSizeItem, {
661
568
  "data-test": "fix-size-item",
662
- "data-splunk-visualization-version": "24.7.0 - c7389a161",
569
+ "data-splunk-visualization-version": "25.0.0 - 5e0f30e5a",
663
570
  width: width,
664
571
  height: height,
665
572
  backgroundColor: backgroundColor
@@ -680,541 +587,251 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
680
587
  exports.default = withFixedSizeContainer;
681
588
 
682
589
  /***/ }),
683
-
684
- /***/ 131:
685
- /***/ (function(module, exports, __webpack_require__) {
686
-
687
- "use strict";
688
-
689
-
690
- var __rest = this && this.__rest || function (s, e) {
691
- var t = {};
692
-
693
- for (var p in s) {
694
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
695
- }
696
-
697
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
698
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
699
- }
700
- return t;
701
- };
702
-
703
- Object.defineProperty(exports, "__esModule", {
704
- value: true
705
- });
706
- exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
707
-
708
- var lodash_1 = __webpack_require__(2);
709
-
710
- var MarkerGauge_1 = __webpack_require__(212);
711
-
712
- var config_1 = __webpack_require__(214);
713
-
714
- exports.config = config_1.default;
715
-
716
- var withDashboardViz_1 = __webpack_require__(29);
717
-
718
- var gaugeUtils_1 = __webpack_require__(76);
719
-
720
- exports.PureMarkerGauge = MarkerGauge_1.default;
721
- var validOptions = Object.keys(config_1.default.optionsSchema);
722
-
723
- var computeVizProps = function computeVizProps(_a) {
724
- var props = __rest(_a, []);
725
-
726
- var options = lodash_1.chain(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
727
- var defaultColors = {
728
- fillColor: config_1.default.themes.defaultFillColor(props),
729
- majorTickFillColor: config_1.default.themes.majorTickFillColor(props),
730
- majorTickStrokeColor: config_1.default.themes.majorTickStrokeColor(props),
731
- valueMarkerFillColor: config_1.default.themes.valueMarkerFillColor(props),
732
- valueMarkerLabelFillColor: config_1.default.themes.valueMarkerLabelFillColor(props)
733
- };
734
- return Object.assign(Object.assign({}, options), defaultColors);
735
- };
736
-
737
- exports.computeVizProps = computeVizProps;
738
- var viz = withDashboardViz_1.default({
739
- ReactViz: MarkerGauge_1.default,
740
- computeVizProps: exports.computeVizProps,
741
- vizConfig: config_1.default
742
- });
743
- exports.default = viz;
744
-
745
- /***/ }),
746
-
747
- /***/ 14:
590
+ /* 15 */
748
591
  /***/ (function(module, exports) {
749
592
 
750
593
  module.exports = require("@splunk/visualizations-shared/style");
751
594
 
752
595
  /***/ }),
753
-
754
- /***/ 15:
596
+ /* 16 */
755
597
  /***/ (function(module, exports) {
756
598
 
757
599
  module.exports = require("@splunk/visualizations-shared/schemaUtils");
758
600
 
759
601
  /***/ }),
760
-
761
- /***/ 16:
602
+ /* 17 */
762
603
  /***/ (function(module, exports) {
763
604
 
764
605
  module.exports = require("@babel/runtime/helpers/createClass");
765
606
 
766
607
  /***/ }),
767
-
768
- /***/ 17:
608
+ /* 18 */
769
609
  /***/ (function(module, exports) {
770
610
 
771
611
  module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
772
612
 
773
613
  /***/ }),
774
-
775
- /***/ 19:
614
+ /* 19 */,
615
+ /* 20 */
776
616
  /***/ (function(module, exports) {
777
617
 
778
- module.exports = require("@splunk/visualization-context/TimezoneContext");
618
+ module.exports = require("@splunk/themes/pick");
779
619
 
780
620
  /***/ }),
781
-
782
- /***/ 2:
621
+ /* 21 */
783
622
  /***/ (function(module, exports) {
784
623
 
785
- module.exports = require("lodash");
624
+ module.exports = require("@splunk/visualization-context/TimezoneContext");
786
625
 
787
626
  /***/ }),
788
-
789
- /***/ 21:
627
+ /* 22 */,
628
+ /* 23 */
790
629
  /***/ (function(module, exports) {
791
630
 
792
631
  module.exports = require("@babel/runtime/helpers/typeof");
793
632
 
794
633
  /***/ }),
634
+ /* 24 */
635
+ /***/ (function(module, exports) {
636
+
637
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
795
638
 
796
- /***/ 211:
639
+ /***/ }),
640
+ /* 25 */
797
641
  /***/ (function(module, exports, __webpack_require__) {
798
642
 
799
643
  "use strict";
800
644
 
801
645
 
802
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
803
- if (k2 === undefined) k2 = k;
804
- Object.defineProperty(o, k2, {
805
- enumerable: true,
806
- get: function get() {
807
- return m[k];
808
- }
809
- });
810
- } : function (o, m, k, k2) {
811
- if (k2 === undefined) k2 = k;
812
- o[k2] = m[k];
813
- });
814
-
815
- var __exportStar = this && this.__exportStar || function (m, exports) {
816
- for (var p in m) {
817
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
818
- }
819
- };
820
-
821
646
  Object.defineProperty(exports, "__esModule", {
822
647
  value: true
823
648
  });
824
- exports.default = void 0;
649
+ exports.pickFieldFromJSONSchema = void 0;
650
+
651
+ var lodash_1 = __webpack_require__(2);
652
+
653
+ var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
654
+ var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
655
+ return Object.keys(optionsSchema).reduce(function (accum, k) {
656
+ if (lodash_1.has(optionsSchema[k], fieldName)) {
657
+ accum[k] = optionsSchema[k][fieldName];
658
+ } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
659
+ var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
825
660
 
826
- __exportStar(__webpack_require__(131), exports);
661
+ if (!lodash_1.isEmpty(nestedSchema)) {
662
+ accum[k] = nestedSchema;
663
+ }
664
+ }
827
665
 
828
- var MarkerGauge_1 = __webpack_require__(131);
666
+ return accum;
667
+ }, {});
668
+ };
829
669
 
830
- Object.defineProperty(exports, "default", {
831
- enumerable: true,
832
- get: function get() {
833
- return MarkerGauge_1.default;
834
- }
835
- });
670
+ exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
836
671
 
837
672
  /***/ }),
838
-
839
- /***/ 212:
673
+ /* 26 */
840
674
  /***/ (function(module, exports, __webpack_require__) {
841
675
 
842
676
  "use strict";
843
677
 
844
678
 
845
- var __rest = this && this.__rest || function (s, e) {
846
- var t = {};
847
-
848
- for (var p in s) {
849
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
850
- }
851
-
852
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
853
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
854
- }
855
- return t;
856
- };
857
-
858
679
  Object.defineProperty(exports, "__esModule", {
859
680
  value: true
860
681
  });
682
+ exports.shouldShowIconPlaceholder = void 0;
861
683
 
862
684
  var React = __webpack_require__(1);
863
685
 
864
- var react_1 = __webpack_require__(1);
865
-
866
686
  var T = __webpack_require__(0);
867
687
 
868
- var styled_components_1 = __webpack_require__(4);
869
-
870
688
  var lodash_1 = __webpack_require__(2);
871
689
 
872
690
  var i18n_1 = __webpack_require__(3);
873
691
 
874
- var style_1 = __webpack_require__(14);
875
-
876
- var SizeAwareWrapper_1 = __webpack_require__(17);
877
-
878
- var Message_1 = __webpack_require__(9);
879
-
880
- var id_1 = __webpack_require__(213);
881
-
882
- var gaugeUtils_1 = __webpack_require__(76);
692
+ var Message_1 = __webpack_require__(11);
883
693
 
884
- var GaugeMajorTicks_1 = __webpack_require__(100);
694
+ var FixedSizeContainer_1 = __webpack_require__(14);
695
+ /**
696
+ * @method shouldShowIconPlaceholder
697
+ * @param {object} dataSources
698
+ * @param {boolean} loading
699
+ * @returns {boolean}
700
+ */
885
701
 
886
- var GaugeValueMarker_1 = __webpack_require__(101);
887
702
 
888
- var MAX_VERTICAL_CONTAINER_WIDTH = 200;
889
- var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
890
- var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
891
- var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
892
- var Container = styled_components_1.default.div.withConfig({
893
- displayName: "MarkerGauge__Container",
894
- componentId: "sc-10z02va-0"
895
- })(["overflow:hidden;", ";background-color:", ";"], function (props) {
896
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
897
- }, function (props) {
898
- return props.backgroundColor;
899
- });
900
- var MarkerGaugeWrapper = styled_components_1.default.div.withConfig({
901
- displayName: "MarkerGauge__MarkerGaugeWrapper",
902
- componentId: "sc-10z02va-1"
903
- })(["display:flex;justify-content:center;flex-direction:row;width:100%;height:100%;background-color:", ";"], function (props) {
904
- return props.backgroundColor;
905
- });
906
- var MarkerGaugeContainer = styled_components_1.default.div.withConfig({
907
- displayName: "MarkerGauge__MarkerGaugeContainer",
908
- componentId: "sc-10z02va-2"
909
- })(["overflow:hidden;position:relative;", ";"], function (props) {
910
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
911
- });
912
- var MarkerGaugeSVG = styled_components_1.default.svg.withConfig({
913
- displayName: "MarkerGauge__MarkerGaugeSVG",
914
- componentId: "sc-10z02va-3"
915
- })(["", ";"], function (props) {
916
- return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
917
- });
918
- var BackgroundBar = styled_components_1.default.rect.attrs({
919
- 'data-test': 'background-bar-rect'
920
- }).withConfig({
921
- displayName: "MarkerGauge__BackgroundBar",
922
- componentId: "sc-10z02va-4"
923
- })(["fill:", ";"], function (props) {
924
- return props.fillColor;
925
- });
926
- var MarkerBar = styled_components_1.default.rect.attrs({
927
- 'data-test': 'marker-bar-rect'
928
- }).withConfig({
929
- displayName: "MarkerGauge__MarkerBar",
930
- componentId: "sc-10z02va-5"
931
- })([""]);
703
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
704
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
705
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
706
+ var noData = data === undefined;
707
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
708
+ var noFields = fields === undefined;
709
+ return loading || noData || noFields;
710
+ };
932
711
 
933
- var MarkerGauge = function MarkerGauge(_a) {
934
- var props = __rest(_a, []);
712
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
713
+ var propTypes = {
714
+ icon: T.func,
715
+ width: T.oneOfType([T.string, T.number]),
716
+ height: T.oneOfType([T.string, T.number]),
717
+ // eslint-disable-next-line react/no-unused-prop-types
718
+ backgroundColor: T.string,
719
+ iconColor: T.string
720
+ };
721
+ /**
722
+ * @method IconPlaceholder
723
+ * @param {IconPlaceholderProps} props
724
+ * @returns {React.ReactElement}
725
+ */
935
726
 
727
+ var IconPlaceholder = function IconPlaceholder(props) {
936
728
  var width = props.width,
937
729
  height = props.height,
938
- value = props.value,
939
- orientation = props.orientation,
940
- majorUnit = props.majorUnit,
941
- showLabels = props.showLabels,
942
- showValue = props.showValue,
943
- usePercentageRange = props.usePercentageRange,
944
- usePercentageValue = props.usePercentageValue,
945
- backgroundColor = props.backgroundColor,
946
- fillColor = props.fillColor,
947
- ranges = props.ranges,
948
- majorTickFillColor = props.majorTickFillColor,
949
- majorTickStrokeColor = props.majorTickStrokeColor,
950
- valueMarkerFillColor = props.valueMarkerFillColor,
951
- valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
952
- /**
953
- * Standard error message render
954
- */
730
+ icon = props.icon,
731
+ iconColor = props.iconColor;
955
732
 
956
- var errorMessage = react_1.useCallback(function (containerWidth, containerHeight, err, errID) {
957
- return React.createElement(Message_1.default, {
958
- width: containerWidth,
959
- height: containerHeight,
960
- message: err,
961
- level: "info",
962
- id: errID
733
+ if (icon) {
734
+ return React.createElement(icon, {
735
+ style: {
736
+ left: '50%',
737
+ top: '50%',
738
+ color: iconColor,
739
+ opacity: 0.15,
740
+ position: 'absolute',
741
+ transform: 'translate(-50%, -50%)'
742
+ },
743
+ width: '50%',
744
+ height: '50%'
963
745
  });
964
- }, []);
965
- var errorId = react_1.useMemo(function () {
966
- return id_1.createDOMID();
967
- }, []);
968
- /**
969
- * Pre-calculate linearGradientId, error, sortedRanges, gauge range and linear gradient
970
- */
746
+ }
971
747
 
972
- var error = react_1.useMemo(function () {
973
- return gaugeUtils_1.validateRanges(ranges);
974
- }, [ranges]);
975
- var sortedRanges = react_1.useMemo(function () {
976
- return gaugeUtils_1.getSortedRanges(ranges);
977
- }, [ranges]);
748
+ return React.createElement(Message_1.default, {
749
+ width: width,
750
+ height: height,
751
+ level: "warning",
752
+ message: i18n_1._('No DataSource Connected')
753
+ });
754
+ };
978
755
 
979
- var _react_1$useMemo = react_1.useMemo(function () {
980
- return gaugeUtils_1.getGaugeRange(sortedRanges);
981
- }, [sortedRanges]),
982
- min = _react_1$useMemo.min,
983
- max = _react_1$useMemo.max;
756
+ IconPlaceholder.propTypes = propTypes;
757
+ IconPlaceholder.defaultProps = {
758
+ width: '100%',
759
+ height: 250
760
+ };
761
+ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
984
762
 
985
- var linearGradientId = react_1.useMemo(function () {
986
- return id_1.createDOMID('marker');
987
- }, []);
988
- var linearGradient = react_1.useMemo(function () {
989
- var stops = gaugeUtils_1.getGradientStops({
990
- ranges: sortedRanges,
991
- orientation: orientation
992
- });
763
+ /***/ }),
764
+ /* 27 */
765
+ /***/ (function(module, exports, __webpack_require__) {
993
766
 
994
- var _gaugeUtils_1$getGrad = gaugeUtils_1.getGradientDimensions(orientation),
995
- x1 = _gaugeUtils_1$getGrad.x1,
996
- y1 = _gaugeUtils_1$getGrad.y1,
997
- x2 = _gaugeUtils_1$getGrad.x2,
998
- y2 = _gaugeUtils_1$getGrad.y2;
767
+ "use strict";
999
768
 
1000
- var linearGradientStops = stops.map(function (stop) {
1001
- return React.createElement("stop", {
1002
- key: "".concat(stop.offset, "_").concat(stop.stopColor),
1003
- offset: stop.offset,
1004
- stopColor: stop.stopColor
1005
- });
1006
- });
1007
- return React.createElement("linearGradient", {
1008
- id: linearGradientId,
1009
- x1: x1,
1010
- y1: y1,
1011
- x2: x2,
1012
- y2: y2
1013
- }, linearGradientStops);
1014
- }, [sortedRanges, orientation, linearGradientId]);
1015
- /**
1016
- * Calculate marker gauge dimensions
1017
- */
1018
769
 
1019
- var calculateMarkerGaugeDimensions = react_1.useCallback(function (containerWidth, containerHeight) {
1020
- var _gaugeUtils_1$getGaug = gaugeUtils_1.getGaugeDimensions({
1021
- containerWidth: containerWidth,
1022
- containerHeight: containerHeight,
1023
- orientation: orientation
1024
- }),
1025
- gaugeLength = _gaugeUtils_1$getGaug.gaugeLength,
1026
- gaugeStartX = _gaugeUtils_1$getGaug.gaugeStartX,
1027
- gaugeStartY = _gaugeUtils_1$getGaug.gaugeStartY,
1028
- gaugeWidth = _gaugeUtils_1$getGaug.gaugeWidth,
1029
- gaugeHeight = _gaugeUtils_1$getGaug.gaugeHeight;
770
+ var _defineProperty = __webpack_require__(7);
1030
771
 
1031
- var _gaugeUtils_1$getMark = gaugeUtils_1.getMarkerBarDimensions({
1032
- gaugeLength: gaugeLength,
1033
- gaugeStartX: gaugeStartX,
1034
- gaugeStartY: gaugeStartY,
1035
- gaugeWidth: gaugeWidth,
1036
- gaugeHeight: gaugeHeight,
1037
- orientation: orientation
1038
- }),
1039
- markerBarLength = _gaugeUtils_1$getMark.markerBarLength,
1040
- markerBarX = _gaugeUtils_1$getMark.markerBarX,
1041
- markerBarY = _gaugeUtils_1$getMark.markerBarY,
1042
- markerBarWidth = _gaugeUtils_1$getMark.markerBarWidth,
1043
- markerBarHeight = _gaugeUtils_1$getMark.markerBarHeight;
772
+ Object.defineProperty(exports, "__esModule", {
773
+ value: true
774
+ });
775
+ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1044
776
 
1045
- var _gaugeUtils_1$getMark2 = gaugeUtils_1.getMarkerGaugeValueMarkerPositions({
1046
- markerBarX: markerBarX,
1047
- markerBarY: markerBarY,
1048
- markerBarHeight: markerBarHeight,
1049
- markerBarLength: markerBarLength,
1050
- orientation: orientation,
1051
- value: value,
1052
- min: min,
1053
- max: max
1054
- }),
1055
- valueMarkerX = _gaugeUtils_1$getMark2.valueMarkerX,
1056
- valueMarkerY = _gaugeUtils_1$getMark2.valueMarkerY;
777
+ var T = __webpack_require__(0);
1057
778
 
1058
- return {
1059
- markerBarX: markerBarX,
1060
- markerBarY: markerBarY,
1061
- markerBarWidth: markerBarWidth,
1062
- markerBarHeight: markerBarHeight,
1063
- valueMarkerX: valueMarkerX,
1064
- valueMarkerY: valueMarkerY,
1065
- gaugeStartX: gaugeStartX,
1066
- gaugeStartY: gaugeStartY,
1067
- gaugeWidth: gaugeWidth,
1068
- gaugeHeight: gaugeHeight
1069
- };
1070
- }, [orientation, value, min, max]);
1071
- var renderVisualization = react_1.useCallback(function (_ref) {
1072
- var containerWidth = _ref.width,
1073
- containerHeight = _ref.height;
779
+ var lodash_1 = __webpack_require__(2);
1074
780
 
1075
- // todo: need change the size when get design for smaller space
1076
- // 58 is the title & description header height in dashboard visualization
1077
- if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
1078
- return errorMessage(containerWidth, containerHeight, i18n_1._('Too small to render content'), errorId);
1079
- }
781
+ var DataSource_1 = __webpack_require__(37);
1080
782
 
1081
- if (error) {
1082
- return errorMessage(containerWidth, containerHeight, error, errorId);
1083
- }
783
+ exports.SortParamsPropTypes = T.shape({
784
+ currentSortKey: T.string,
785
+ currentSortDir: T.oneOf(DataSource_1.validSortDirs),
786
+ onSort: T.func
787
+ });
1084
788
 
1085
- var _calculateMarkerGauge = calculateMarkerGaugeDimensions(containerWidth, containerHeight),
1086
- markerBarX = _calculateMarkerGauge.markerBarX,
1087
- markerBarY = _calculateMarkerGauge.markerBarY,
1088
- markerBarWidth = _calculateMarkerGauge.markerBarWidth,
1089
- markerBarHeight = _calculateMarkerGauge.markerBarHeight,
1090
- valueMarkerX = _calculateMarkerGauge.valueMarkerX,
1091
- valueMarkerY = _calculateMarkerGauge.valueMarkerY,
1092
- gaugeStartX = _calculateMarkerGauge.gaugeStartX,
1093
- gaugeStartY = _calculateMarkerGauge.gaugeStartY,
1094
- gaugeWidth = _calculateMarkerGauge.gaugeWidth,
1095
- gaugeHeight = _calculateMarkerGauge.gaugeHeight;
789
+ var getSortingParams = function getSortingParams(_ref) {
790
+ var requestParams = _ref.requestParams,
791
+ onRequestParamsChange = _ref.onRequestParamsChange;
792
+ var currentSortKey;
793
+ var currentSortDir;
794
+ var nextSortDirMap = {
795
+ asc: 'desc',
796
+ desc: 'asc',
797
+ none: 'asc'
798
+ };
799
+ var onSort;
1096
800
 
1097
- return React.createElement(MarkerGaugeWrapper, {
1098
- backgroundColor: backgroundColor
1099
- }, React.createElement(MarkerGaugeContainer, {
1100
- width: containerWidth,
1101
- height: containerHeight
1102
- }, React.createElement(MarkerGaugeSVG, {
1103
- width: containerWidth,
1104
- height: containerHeight
1105
- }, linearGradient, React.createElement(BackgroundBar, {
1106
- x: gaugeStartX,
1107
- y: gaugeStartY,
1108
- width: gaugeWidth,
1109
- height: gaugeHeight,
1110
- fillColor: fillColor
1111
- }), React.createElement(GaugeMajorTicks_1.default, {
1112
- width: gaugeWidth,
1113
- height: gaugeHeight,
1114
- startX: gaugeStartX,
1115
- startY: gaugeStartY,
1116
- min: min,
1117
- max: max,
1118
- majorUnit: majorUnit,
1119
- orientation: orientation,
1120
- showLabels: showLabels,
1121
- usePercentageRange: usePercentageRange,
1122
- majorTickFillColor: majorTickFillColor,
1123
- majorTickStrokeColor: majorTickStrokeColor
1124
- }), React.createElement(MarkerBar, {
1125
- x: markerBarX,
1126
- y: markerBarY,
1127
- width: markerBarWidth,
1128
- height: markerBarHeight,
1129
- fill: "url(#".concat(linearGradientId, ")")
1130
- }), React.createElement(GaugeValueMarker_1.default, {
1131
- x: valueMarkerX,
1132
- y: valueMarkerY,
1133
- length: gaugeUtils_1.GAUGE_THICKNESS,
1134
- min: min,
1135
- max: max,
1136
- value: value,
1137
- orientation: orientation,
1138
- showValue: showValue,
1139
- usePercentageValue: usePercentageValue,
1140
- valueMarkerFillColor: valueMarkerFillColor,
1141
- valueMarkerLabelFillColor: valueMarkerLabelFillColor
1142
- }))));
1143
- }, [orientation, error, calculateMarkerGaugeDimensions, backgroundColor, linearGradient, fillColor, min, max, majorUnit, showLabels, usePercentageRange, majorTickFillColor, majorTickStrokeColor, linearGradientId, value, showValue, usePercentageValue, valueMarkerFillColor, valueMarkerLabelFillColor, errorMessage, errorId]);
1144
- return React.createElement(Container, {
1145
- width: width,
1146
- height: height,
1147
- backgroundColor: backgroundColor
1148
- }, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
1149
- return renderVisualization(containerDimension);
1150
- }));
1151
- };
801
+ if (lodash_1.isFunction(onRequestParamsChange)) {
802
+ if (requestParams && lodash_1.has(requestParams, 'sort')) {
803
+ currentSortKey = Object.keys(requestParams.sort).shift();
804
+ currentSortDir = requestParams.sort[currentSortKey];
805
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
1152
806
 
1153
- MarkerGauge.propTypes = {
1154
- width: T.oneOfType([T.string, T.number]),
1155
- height: T.oneOfType([T.string, T.number]),
1156
- value: T.number,
1157
- // valueFieldName: T.string, // todo: need add it back when displaying name later
1158
- orientation: T.oneOf(['horizontal', 'vertical']),
1159
- majorUnit: T.oneOfType([T.string, T.number]),
1160
- showLabels: T.bool,
1161
- showValue: T.bool,
1162
- usePercentageRange: T.bool,
1163
- usePercentageValue: T.bool,
1164
- backgroundColor: T.string,
1165
- fillColor: T.string,
1166
- ranges: T.arrayOf(T.shape({
1167
- from: T.number.isRequired,
1168
- to: T.number.isRequired,
1169
- value: T.string.isRequired
1170
- })),
1171
- majorTickFillColor: T.string,
1172
- majorTickStrokeColor: T.string,
1173
- valueMarkerFillColor: T.string,
1174
- valueMarkerLabelFillColor: T.string
1175
- };
1176
- MarkerGauge.defaultProps = {
1177
- width: '100%',
1178
- height: 250,
1179
- orientation: 'vertical',
1180
- majorUnit: 'auto',
1181
- showLabels: true,
1182
- showValue: true,
1183
- usePercentageRange: false,
1184
- usePercentageValue: false,
1185
- backgroundColor: 'transparent',
1186
- value: 0,
1187
- fillColor: '#f2f4f5',
1188
- majorTickFillColor: '#3c444d',
1189
- majorTickStrokeColor: '#6b7785',
1190
- valueMarkerFillColor: '#3c444d',
1191
- valueMarkerLabelFillColor: '#f2f4f5',
1192
- ranges: [{
1193
- from: 0,
1194
- to: 50,
1195
- value: '#4BEBA8'
1196
- }, {
1197
- from: 50,
1198
- to: 90,
1199
- value: '#F4DF7A'
1200
- }, {
1201
- from: 90,
1202
- to: 100,
1203
- value: '#CB3B43'
1204
- }]
1205
- };
1206
- exports.default = MarkerGauge;
1207
807
 
1208
- /***/ }),
808
+ onSort = function onSort(e, _ref2) {
809
+ var sortKey = _ref2.sortKey,
810
+ sortDir = _ref2.sortDir;
1209
811
 
1210
- /***/ 213:
1211
- /***/ (function(module, exports) {
812
+ if (typeof sortKey === 'string') {
813
+ var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
814
+ onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
815
+ offset: 0,
816
+ sort: _defineProperty({}, sortKey, nextSortDir)
817
+ }));
818
+ } else {
819
+ onRequestParamsChange(requestParams);
820
+ }
821
+ };
822
+ }
1212
823
 
1213
- module.exports = require("@splunk/ui-utils/id");
824
+ return {
825
+ currentSortKey: currentSortKey,
826
+ currentSortDir: currentSortDir,
827
+ onSort: onSort
828
+ };
829
+ };
1214
830
 
1215
- /***/ }),
831
+ exports.getSortingParams = getSortingParams;
1216
832
 
1217
- /***/ 214:
833
+ /***/ }),
834
+ /* 28 */
1218
835
  /***/ (function(module, exports, __webpack_require__) {
1219
836
 
1220
837
  "use strict";
@@ -1223,272 +840,62 @@ module.exports = require("@splunk/ui-utils/id");
1223
840
  Object.defineProperty(exports, "__esModule", {
1224
841
  value: true
1225
842
  });
843
+ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1226
844
 
1227
- var i18n_1 = __webpack_require__(3);
1228
-
1229
- var GaugeMarker_1 = __webpack_require__(215);
1230
-
1231
- var placeholders_1 = __webpack_require__(44);
845
+ var T = __webpack_require__(0);
1232
846
 
1233
- var schemaUtils_1 = __webpack_require__(15);
847
+ var lodash_1 = __webpack_require__(2);
1234
848
 
1235
- var variables_1 = __webpack_require__(11);
849
+ exports.PaginatorParamsPropTypes = T.shape({
850
+ isPaging: T.bool,
851
+ current: T.number,
852
+ totalPages: T.number,
853
+ onChange: T.func
854
+ });
1236
855
 
1237
- var pick_1 = __webpack_require__(22);
856
+ var getPaginationParams = function getPaginationParams(_ref) {
857
+ var requestParams = _ref.requestParams,
858
+ meta = _ref.meta,
859
+ onRequestParamsChange = _ref.onRequestParamsChange;
860
+ var totalCount = meta && meta.totalCount || 0;
861
+ var offset = requestParams && requestParams.offset || 0;
862
+ var count = requestParams && requestParams.count;
863
+ var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
864
+ var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
865
+ var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
1238
866
 
1239
- var Gauge_1 = __webpack_require__(99);
867
+ var onChangeHandler = function onChangeHandler(e, _ref2) {
868
+ var page = _ref2.page,
869
+ countArg = _ref2.count;
870
+ var newParams = lodash_1.cloneDeep(requestParams);
1240
871
 
1241
- var VizBehavior_1 = __webpack_require__(5);
1242
-
1243
- var VizCategory_1 = __webpack_require__(28);
1244
-
1245
- var configUtils_1 = __webpack_require__(6);
1246
-
1247
- var BackgroundColor_1 = __webpack_require__(48);
1248
-
1249
- var dataContract = {
1250
- requiredDataSources: [{
1251
- name: 'primary',
1252
- description: 'DataSource that powers the visualization'
1253
- }],
1254
- optionalDataSources: [],
1255
- initialRequestParams: {
1256
- primary: {
1257
- offset: 0,
1258
- count: 10000
1259
- }
1260
- }
1261
- };
1262
- var size = {
1263
- initialWidth: 300,
1264
- initialHeight: 300
1265
- };
1266
- var defaultContext = {};
1267
- var optionsSchema = {
1268
- backgroundColor: {
1269
- description: 'Specify the color used for the background. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
1270
- type: 'string',
1271
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
1272
- default: '> themes.defaultBackgroundColor'
1273
- },
1274
- gaugeRanges: {
1275
- description: 'Specify the overall range of the gauge as a series of continuous, color-coded subranges. For example, [{"from": 0, "to": 20, "value": "#4BEBA8"}, {"from": 20, "to": 50, "value": "#F4DF7A"}].',
1276
- default: [{
1277
- from: 0,
1278
- to: 50,
1279
- value: '#118832'
1280
- }, {
1281
- from: 50,
1282
- to: 90,
1283
- value: '#CBA700'
1284
- }, {
1285
- from: 90,
1286
- to: 100,
1287
- value: '#D41F1F'
1288
- }],
1289
- type: 'array',
1290
- items: {
1291
- type: 'object',
1292
- properties: {
1293
- from: {
1294
- type: 'number',
1295
- description: 'Starting value for range.'
1296
- },
1297
- to: {
1298
- type: 'number',
1299
- description: 'Ending value for range.'
1300
- },
1301
- value: {
1302
- description: 'Color for sub range.',
1303
- type: 'string',
1304
- pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN // insert pattern for color variables - #HEX etc
1305
-
1306
- }
1307
- },
1308
- required: ['from', 'to', 'value'],
1309
- additionalProperties: false
872
+ if (typeof countArg === 'number') {
873
+ newParams.count = countArg;
874
+ newParams.offset = 0;
1310
875
  }
1311
- },
1312
- labelDisplay: {
1313
- description: 'Specify whether to display the labels as numbers, percentages, or off.',
1314
- default: 'number',
1315
- type: 'string',
1316
- pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
1317
- },
1318
- majorTickInterval: {
1319
- description: 'Specify, in pixels, the spacing between major tick marks.',
1320
- default: 'auto',
1321
- type: ['string', 'number']
1322
- },
1323
- orientation: {
1324
- description: 'Specify the axis orientation of the gauge.',
1325
- default: 'vertical',
1326
- type: 'string',
1327
- pattern: schemaUtils_1.getPattern(['horizontal', 'vertical'])
1328
- },
1329
- value: {
1330
- description: 'Specify the dataSource applied to the value of the marker gauge.',
1331
- type: 'string',
1332
- default: '> primary | seriesByType("number") | lastPoint()'
1333
- },
1334
- valueDisplay: {
1335
- description: 'Specify whether to display the value as a number, percentage, or off.',
1336
- default: 'number',
1337
- type: 'string',
1338
- pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
1339
- }
1340
- };
1341
- var themes = {
1342
- defaultFillColor: function defaultFillColor(props) {
1343
- return pick_1.default({
1344
- enterprise: variables_1.default.backgroundColorHover(props),
1345
- prisma: variables_1.default.neutral100(props)
1346
- })(props);
1347
- },
1348
- defaultBackgroundColor: function defaultBackgroundColor(props) {
1349
- return pick_1.default({
1350
- enterprise: {
1351
- dark: variables_1.default.black(props),
1352
- light: variables_1.default.backgroundColor(props)
1353
- },
1354
- prisma: variables_1.default.backgroundColorSidebar(props)
1355
- })(props);
1356
- },
1357
- majorTickFillColor: function majorTickFillColor(props) {
1358
- return pick_1.default({
1359
- enterprise: {
1360
- light: variables_1.default.gray30(props),
1361
- dark: variables_1.default.textGray(props) // was #D7DAE0
1362
876
 
1363
- },
1364
- prisma: {
1365
- // TODO: missed colors :(
1366
- light: variables_1.default.neutral100(props),
1367
- dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
1368
-
1369
- }
1370
- })(props);
1371
- },
1372
- majorTickStrokeColor: function majorTickStrokeColor(props) {
1373
- return pick_1.default({
1374
- enterprise: {
1375
- light: variables_1.default.textGray(props),
1376
- dark: variables_1.default.contentColorMuted(props)
1377
- },
1378
- prisma: variables_1.default.contentColorMuted(props)
1379
- })(props);
1380
- },
1381
- valueMarkerFillColor: function valueMarkerFillColor(props) {
1382
- return pick_1.default({
1383
- enterprise: variables_1.default.textColor(props),
1384
- prisma: {
1385
- dark: variables_1.default.white(props),
1386
- light: variables_1.default.black(props)
1387
- }
1388
- })(props);
1389
- },
1390
- valueMarkerLabelFillColor: function valueMarkerLabelFillColor(props) {
1391
- return pick_1.default({
1392
- enterprise: {
1393
- light: variables_1.default.gray96(props),
1394
- dark: variables_1.default.black(props)
1395
- },
1396
- prisma: variables_1.default.black(props)
1397
- })(props);
1398
- }
1399
- };
1400
- var editorConfig = [{
1401
- label: i18n_1._('Select Data Field'),
1402
- layout: [[{
1403
- label: '',
1404
- editor: 'editor.columnSelector',
1405
- option: 'value',
1406
- context: 'defaultContext',
1407
- editorProps: {
1408
- dataSourceKey: 'primary',
1409
- prepareValue: function prepareValue(definition) {
1410
- var value = definition.options.value;
1411
- return {
1412
- context: {},
1413
- options: {
1414
- value: "".concat(value, " | lastPoint()")
1415
- }
1416
- };
1417
- }
1418
- }
1419
- }]]
1420
- }, Gauge_1.default, {
1421
- label: i18n_1._('Coloring'),
1422
- open: true,
1423
- layout: [[{
1424
- label: i18n_1._('Gauge Ranges'),
1425
- option: 'gaugeRanges',
1426
- editor: 'editor.threshold',
1427
- editorProps: {
1428
- openRanges: false,
1429
- isTogglable: false // Can not disable thresholds
877
+ var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1430
878
 
879
+ if (typeof page === 'number' && page > 0) {
880
+ newParams.count = pageCount;
881
+ newParams.offset = (page - 1) * pageCount;
1431
882
  }
1432
- }], BackgroundColor_1.default({
1433
- themes: themes,
1434
- labelPosition: 'top'
1435
- })]
1436
- }];
1437
- /**
1438
- * visualization configuration
1439
- */
1440
-
1441
- var config = {
1442
- /**
1443
- * unique viz key
1444
- */
1445
- key: 'splunk.markergauge',
1446
883
 
1447
- /**
1448
- * viz name
1449
- */
1450
- name: 'MarkerGauge',
1451
- category: VizCategory_1.VizCategory.GAUGE,
884
+ onRequestParamsChange(newParams);
885
+ };
1452
886
 
1453
- /**
1454
- * viz icon
1455
- */
1456
- icon: GaugeMarker_1.default,
1457
- placeholderIcon: placeholders_1.MarkerGauge,
1458
- dataContract: dataContract,
1459
- size: size,
1460
- defaultContext: defaultContext,
1461
- optionsSchema: optionsSchema,
1462
- editorConfig: editorConfig,
1463
- supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
1464
- themes: themes
887
+ return {
888
+ isPaging: isPaging,
889
+ current: current,
890
+ totalPages: totalPages,
891
+ onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
892
+ };
1465
893
  };
1466
- exports.default = configUtils_1.enhanceConfig(config);
1467
-
1468
- /***/ }),
1469
-
1470
- /***/ 215:
1471
- /***/ (function(module, exports) {
1472
-
1473
- module.exports = require("@splunk/react-icons/GaugeMarker");
1474
-
1475
- /***/ }),
1476
-
1477
- /***/ 22:
1478
- /***/ (function(module, exports) {
1479
-
1480
- module.exports = require("@splunk/themes/pick");
1481
-
1482
- /***/ }),
1483
-
1484
- /***/ 23:
1485
- /***/ (function(module, exports) {
1486
894
 
1487
- module.exports = require("@splunk/visualizations-shared/numberUtils");
895
+ exports.getPaginationParams = getPaginationParams;
1488
896
 
1489
897
  /***/ }),
1490
-
1491
- /***/ 24:
898
+ /* 29 */
1492
899
  /***/ (function(module, exports, __webpack_require__) {
1493
900
 
1494
901
  "use strict";
@@ -1497,270 +904,8 @@ module.exports = require("@splunk/visualizations-shared/numberUtils");
1497
904
  Object.defineProperty(exports, "__esModule", {
1498
905
  value: true
1499
906
  });
1500
- exports.pickFieldFromJSONSchema = void 0;
1501
-
1502
- var lodash_1 = __webpack_require__(2);
1503
-
1504
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1505
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1506
- return Object.keys(optionsSchema).reduce(function (accum, k) {
1507
- if (lodash_1.has(optionsSchema[k], fieldName)) {
1508
- accum[k] = optionsSchema[k][fieldName];
1509
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
1510
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
1511
-
1512
- if (!lodash_1.isEmpty(nestedSchema)) {
1513
- accum[k] = nestedSchema;
1514
- }
1515
- }
1516
-
1517
- return accum;
1518
- }, {});
1519
- };
1520
-
1521
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1522
-
1523
- /***/ }),
1524
-
1525
- /***/ 25:
1526
- /***/ (function(module, exports, __webpack_require__) {
1527
-
1528
- "use strict";
1529
-
1530
-
1531
- Object.defineProperty(exports, "__esModule", {
1532
- value: true
1533
- });
1534
- exports.shouldShowIconPlaceholder = void 0;
1535
-
1536
- var React = __webpack_require__(1);
1537
-
1538
- var T = __webpack_require__(0);
1539
-
1540
- var lodash_1 = __webpack_require__(2);
1541
-
1542
- var i18n_1 = __webpack_require__(3);
1543
-
1544
- var Message_1 = __webpack_require__(9);
1545
-
1546
- var FixedSizeContainer_1 = __webpack_require__(13);
1547
- /**
1548
- * @method shouldShowIconPlaceholder
1549
- * @param {object} dataSources
1550
- * @param {boolean} loading
1551
- * @returns {boolean}
1552
- */
1553
-
1554
-
1555
- var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1556
- var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1557
- var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1558
- var noData = data === undefined;
1559
- var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1560
- var noFields = fields === undefined;
1561
- return loading || noData || noFields;
1562
- };
1563
-
1564
- exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1565
- var propTypes = {
1566
- icon: T.func,
1567
- width: T.oneOfType([T.string, T.number]),
1568
- height: T.oneOfType([T.string, T.number]),
1569
- // eslint-disable-next-line react/no-unused-prop-types
1570
- backgroundColor: T.string,
1571
- iconColor: T.string
1572
- };
1573
- /**
1574
- * @method IconPlaceholder
1575
- * @param {IconPlaceholderProps} props
1576
- * @returns {React.ReactElement}
1577
- */
1578
-
1579
- var IconPlaceholder = function IconPlaceholder(props) {
1580
- var width = props.width,
1581
- height = props.height,
1582
- icon = props.icon,
1583
- iconColor = props.iconColor;
1584
-
1585
- if (icon) {
1586
- return React.createElement(icon, {
1587
- style: {
1588
- left: '50%',
1589
- top: '50%',
1590
- color: iconColor,
1591
- opacity: 0.15,
1592
- position: 'absolute',
1593
- transform: 'translate(-50%, -50%)'
1594
- },
1595
- width: '50%',
1596
- height: '50%'
1597
- });
1598
- }
1599
-
1600
- return React.createElement(Message_1.default, {
1601
- width: width,
1602
- height: height,
1603
- level: "warning",
1604
- message: i18n_1._('No DataSource Connected')
1605
- });
1606
- };
1607
-
1608
- IconPlaceholder.propTypes = propTypes;
1609
- IconPlaceholder.defaultProps = {
1610
- width: '100%',
1611
- height: 250
1612
- };
1613
- exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1614
-
1615
- /***/ }),
1616
-
1617
- /***/ 26:
1618
- /***/ (function(module, exports, __webpack_require__) {
1619
-
1620
- "use strict";
1621
-
1622
-
1623
- var _defineProperty = __webpack_require__(7);
1624
-
1625
- Object.defineProperty(exports, "__esModule", {
1626
- value: true
1627
- });
1628
- exports.getSortingParams = exports.SortParamsPropTypes = void 0;
1629
-
1630
- var T = __webpack_require__(0);
1631
-
1632
- var lodash_1 = __webpack_require__(2);
1633
-
1634
- var DataSource_1 = __webpack_require__(36);
1635
-
1636
- exports.SortParamsPropTypes = T.shape({
1637
- currentSortKey: T.string,
1638
- currentSortDir: T.oneOf(DataSource_1.validSortDirs),
1639
- onSort: T.func
1640
- });
1641
-
1642
- var getSortingParams = function getSortingParams(_ref) {
1643
- var requestParams = _ref.requestParams,
1644
- onRequestParamsChange = _ref.onRequestParamsChange;
1645
- var currentSortKey;
1646
- var currentSortDir;
1647
- var nextSortDirMap = {
1648
- asc: 'desc',
1649
- desc: 'asc',
1650
- none: 'asc'
1651
- };
1652
- var onSort;
1653
-
1654
- if (lodash_1.isFunction(onRequestParamsChange)) {
1655
- if (requestParams && lodash_1.has(requestParams, 'sort')) {
1656
- currentSortKey = Object.keys(requestParams.sort).shift();
1657
- currentSortDir = requestParams.sort[currentSortKey];
1658
- } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
1659
-
1660
-
1661
- onSort = function onSort(e, _ref2) {
1662
- var sortKey = _ref2.sortKey,
1663
- sortDir = _ref2.sortDir;
1664
-
1665
- if (typeof sortKey === 'string') {
1666
- var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
1667
- onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
1668
- offset: 0,
1669
- sort: _defineProperty({}, sortKey, nextSortDir)
1670
- }));
1671
- } else {
1672
- onRequestParamsChange(requestParams);
1673
- }
1674
- };
1675
- }
1676
-
1677
- return {
1678
- currentSortKey: currentSortKey,
1679
- currentSortDir: currentSortDir,
1680
- onSort: onSort
1681
- };
1682
- };
1683
-
1684
- exports.getSortingParams = getSortingParams;
1685
-
1686
- /***/ }),
1687
-
1688
- /***/ 27:
1689
- /***/ (function(module, exports, __webpack_require__) {
1690
-
1691
- "use strict";
1692
-
1693
-
1694
- Object.defineProperty(exports, "__esModule", {
1695
- value: true
1696
- });
1697
- exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
1698
-
1699
- var T = __webpack_require__(0);
1700
-
1701
- var lodash_1 = __webpack_require__(2);
1702
-
1703
- exports.PaginatorParamsPropTypes = T.shape({
1704
- isPaging: T.bool,
1705
- current: T.number,
1706
- totalPages: T.number,
1707
- onChange: T.func
1708
- });
1709
-
1710
- var getPaginationParams = function getPaginationParams(_ref) {
1711
- var requestParams = _ref.requestParams,
1712
- meta = _ref.meta,
1713
- onRequestParamsChange = _ref.onRequestParamsChange;
1714
- var totalCount = meta && meta.totalCount || 0;
1715
- var offset = requestParams && requestParams.offset || 0;
1716
- var count = requestParams && requestParams.count;
1717
- var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
1718
- var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
1719
- var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
1720
-
1721
- var onChangeHandler = function onChangeHandler(e, _ref2) {
1722
- var page = _ref2.page,
1723
- countArg = _ref2.count;
1724
- var newParams = lodash_1.cloneDeep(requestParams);
1725
-
1726
- if (typeof countArg === 'number') {
1727
- newParams.count = countArg;
1728
- newParams.offset = 0;
1729
- }
1730
-
1731
- var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
1732
-
1733
- if (typeof page === 'number' && page > 0) {
1734
- newParams.count = pageCount;
1735
- newParams.offset = (page - 1) * pageCount;
1736
- }
1737
-
1738
- onRequestParamsChange(newParams);
1739
- };
1740
-
1741
- return {
1742
- isPaging: isPaging,
1743
- current: current,
1744
- totalPages: totalPages,
1745
- onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
1746
- };
1747
- };
1748
-
1749
- exports.getPaginationParams = getPaginationParams;
1750
-
1751
- /***/ }),
1752
-
1753
- /***/ 28:
1754
- /***/ (function(module, exports, __webpack_require__) {
1755
-
1756
- "use strict";
1757
-
1758
-
1759
- Object.defineProperty(exports, "__esModule", {
1760
- value: true
1761
- });
1762
- exports.VizCategory = void 0;
1763
- var VizCategory;
907
+ exports.VizCategory = void 0;
908
+ var VizCategory;
1764
909
 
1765
910
  (function (VizCategory) {
1766
911
  VizCategory["SINGLE_VALUE"] = "Single Value";
@@ -1778,8 +923,7 @@ var VizCategory;
1778
923
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
1779
924
 
1780
925
  /***/ }),
1781
-
1782
- /***/ 29:
926
+ /* 30 */
1783
927
  /***/ (function(module, exports, __webpack_require__) {
1784
928
 
1785
929
  "use strict";
@@ -1793,35 +937,35 @@ var React = __webpack_require__(1);
1793
937
 
1794
938
  var lodash_1 = __webpack_require__(2);
1795
939
 
1796
- var getSettingsFromThemedProps_1 = __webpack_require__(30);
940
+ var getSettingsFromThemedProps_1 = __webpack_require__(31);
1797
941
 
1798
- var Options_1 = __webpack_require__(31);
942
+ var Options_1 = __webpack_require__(32);
1799
943
 
1800
- var SanitizeProps_1 = __webpack_require__(32);
944
+ var SanitizeProps_1 = __webpack_require__(33);
1801
945
 
1802
- var TimezoneContext_1 = __webpack_require__(19);
946
+ var TimezoneContext_1 = __webpack_require__(21);
1803
947
 
1804
- var moment_1 = __webpack_require__(33);
948
+ var moment_1 = __webpack_require__(34);
1805
949
 
1806
950
  var styled_components_1 = __webpack_require__(4);
1807
951
 
1808
- var SplunkVisualization_1 = __webpack_require__(34);
952
+ var SplunkVisualization_1 = __webpack_require__(35);
1809
953
 
1810
954
  var VizBehavior_1 = __webpack_require__(5);
1811
955
 
1812
- var getSorting_1 = __webpack_require__(26);
956
+ var getSorting_1 = __webpack_require__(27);
1813
957
 
1814
- var getPagination_1 = __webpack_require__(27);
958
+ var getPagination_1 = __webpack_require__(28);
1815
959
 
1816
- var useDeepMemo_1 = __webpack_require__(37);
960
+ var useDeepMemo_1 = __webpack_require__(38);
1817
961
 
1818
- var JSONSchemaUtils_1 = __webpack_require__(24);
962
+ var JSONSchemaUtils_1 = __webpack_require__(25);
1819
963
 
1820
- var MissingPropsMessage_1 = __webpack_require__(38);
964
+ var MissingPropsMessage_1 = __webpack_require__(39);
1821
965
 
1822
- var withEditModeCover_1 = __webpack_require__(39);
966
+ var withEditModeCover_1 = __webpack_require__(40);
1823
967
 
1824
- var withPlaceholder_1 = __webpack_require__(40);
968
+ var withPlaceholder_1 = __webpack_require__(42);
1825
969
 
1826
970
  var hocUtils_1 = __webpack_require__(8);
1827
971
  /**
@@ -2024,49 +1168,37 @@ var withDashboardViz = function withDashboardViz(opts) {
2024
1168
  exports.default = withDashboardViz;
2025
1169
 
2026
1170
  /***/ }),
2027
-
2028
- /***/ 3:
2029
- /***/ (function(module, exports) {
2030
-
2031
- module.exports = require("@splunk/ui-utils/i18n");
2032
-
2033
- /***/ }),
2034
-
2035
- /***/ 30:
1171
+ /* 31 */
2036
1172
  /***/ (function(module, exports) {
2037
1173
 
2038
1174
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
2039
1175
 
2040
1176
  /***/ }),
2041
-
2042
- /***/ 31:
1177
+ /* 32 */
2043
1178
  /***/ (function(module, exports) {
2044
1179
 
2045
1180
  module.exports = require("@splunk/visualization-encoding/Options");
2046
1181
 
2047
1182
  /***/ }),
2048
-
2049
- /***/ 32:
1183
+ /* 33 */
2050
1184
  /***/ (function(module, exports) {
2051
1185
 
2052
1186
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
2053
1187
 
2054
1188
  /***/ }),
2055
-
2056
- /***/ 33:
1189
+ /* 34 */
2057
1190
  /***/ (function(module, exports) {
2058
1191
 
2059
1192
  module.exports = require("@splunk/moment");
2060
1193
 
2061
1194
  /***/ }),
2062
-
2063
- /***/ 34:
1195
+ /* 35 */
2064
1196
  /***/ (function(module, exports, __webpack_require__) {
2065
1197
 
2066
1198
  "use strict";
2067
1199
 
2068
1200
 
2069
- var _classCallCheck = __webpack_require__(10);
1201
+ var _classCallCheck = __webpack_require__(12);
2070
1202
 
2071
1203
  Object.defineProperty(exports, "__esModule", {
2072
1204
  value: true
@@ -2078,7 +1210,7 @@ var T = __webpack_require__(0);
2078
1210
 
2079
1211
  var lodash_1 = __webpack_require__(2);
2080
1212
 
2081
- var VizActionHandler_1 = __webpack_require__(35); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1213
+ var VizActionHandler_1 = __webpack_require__(36); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2082
1214
 
2083
1215
 
2084
1216
  exports.INITIAL_WIDTH = 250;
@@ -2211,16 +1343,15 @@ SplunkVisualization.defaultProps = {
2211
1343
  exports.default = SplunkVisualization;
2212
1344
 
2213
1345
  /***/ }),
2214
-
2215
- /***/ 35:
1346
+ /* 36 */
2216
1347
  /***/ (function(module, exports, __webpack_require__) {
2217
1348
 
2218
1349
  "use strict";
2219
1350
 
2220
1351
 
2221
- var _classCallCheck = __webpack_require__(10);
1352
+ var _classCallCheck = __webpack_require__(12);
2222
1353
 
2223
- var _createClass = __webpack_require__(16);
1354
+ var _createClass = __webpack_require__(17);
2224
1355
 
2225
1356
  Object.defineProperty(exports, "__esModule", {
2226
1357
  value: true
@@ -2249,8 +1380,7 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
2249
1380
  exports.DefaultVizActionHandler = DefaultVizActionHandler;
2250
1381
 
2251
1382
  /***/ }),
2252
-
2253
- /***/ 36:
1383
+ /* 37 */
2254
1384
  /***/ (function(module, exports, __webpack_require__) {
2255
1385
 
2256
1386
  "use strict";
@@ -2263,8 +1393,7 @@ exports.validSortDirs = void 0;
2263
1393
  exports.validSortDirs = ['asc', 'desc', 'none'];
2264
1394
 
2265
1395
  /***/ }),
2266
-
2267
- /***/ 37:
1396
+ /* 38 */
2268
1397
  /***/ (function(module, exports, __webpack_require__) {
2269
1398
 
2270
1399
  "use strict";
@@ -2309,8 +1438,7 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
2309
1438
  exports.useDeepMemo = useDeepMemo;
2310
1439
 
2311
1440
  /***/ }),
2312
-
2313
- /***/ 38:
1441
+ /* 39 */
2314
1442
  /***/ (function(module, exports, __webpack_require__) {
2315
1443
 
2316
1444
  "use strict";
@@ -2327,9 +1455,9 @@ var T = __webpack_require__(0);
2327
1455
 
2328
1456
  var i18n_1 = __webpack_require__(3);
2329
1457
 
2330
- var Message_1 = __webpack_require__(9);
1458
+ var Message_1 = __webpack_require__(11);
2331
1459
 
2332
- var FixedSizeContainer_1 = __webpack_require__(13);
1460
+ var FixedSizeContainer_1 = __webpack_require__(14);
2333
1461
  /**
2334
1462
  * @method isMissing
2335
1463
  * @param {any} v
@@ -2390,8 +1518,7 @@ exports.MissingPropsMessage.defaultProps = {
2390
1518
  exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
2391
1519
 
2392
1520
  /***/ }),
2393
-
2394
- /***/ 39:
1521
+ /* 40 */
2395
1522
  /***/ (function(module, exports, __webpack_require__) {
2396
1523
 
2397
1524
  "use strict";
@@ -2412,7 +1539,7 @@ var Cover = styled_components_1.default.div.withConfig({
2412
1539
  componentId: "sc-1gsbnxb-0"
2413
1540
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
2414
1541
  var Blocker = styled_components_1.default.div.attrs({
2415
- 'data-splunk-visualization-version': "24.7.0 - c7389a161"
1542
+ 'data-splunk-visualization-version': "25.0.0 - 5e0f30e5a"
2416
1543
  }).withConfig({
2417
1544
  displayName: "withEditModeCover__Blocker",
2418
1545
  componentId: "sc-1gsbnxb-1"
@@ -2443,15 +1570,13 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
2443
1570
  exports.default = withEditModeCover;
2444
1571
 
2445
1572
  /***/ }),
2446
-
2447
- /***/ 4:
1573
+ /* 41 */
2448
1574
  /***/ (function(module, exports) {
2449
1575
 
2450
- module.exports = require("styled-components");
1576
+ module.exports = require("@splunk/visualizations-shared/mapUtils");
2451
1577
 
2452
1578
  /***/ }),
2453
-
2454
- /***/ 40:
1579
+ /* 42 */
2455
1580
  /***/ (function(module, exports, __webpack_require__) {
2456
1581
 
2457
1582
  "use strict";
@@ -2463,11 +1588,11 @@ Object.defineProperty(exports, "__esModule", {
2463
1588
 
2464
1589
  var React = __webpack_require__(1);
2465
1590
 
2466
- var colorUtils_1 = __webpack_require__(12);
1591
+ var colorUtils_1 = __webpack_require__(13);
2467
1592
 
2468
- var variables_1 = __webpack_require__(11);
1593
+ var variables_1 = __webpack_require__(10);
2469
1594
 
2470
- var IconPlaceholder_1 = __webpack_require__(25);
1595
+ var IconPlaceholder_1 = __webpack_require__(26);
2471
1596
 
2472
1597
  var VizBehavior_1 = __webpack_require__(5);
2473
1598
 
@@ -2515,36 +1640,28 @@ var withPlaceholder = function withPlaceholder(Visualization) {
2515
1640
  exports.default = withPlaceholder;
2516
1641
 
2517
1642
  /***/ }),
2518
-
2519
- /***/ 41:
2520
- /***/ (function(module, exports) {
2521
-
2522
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
2523
-
2524
- /***/ }),
2525
-
2526
- /***/ 42:
1643
+ /* 43 */
2527
1644
  /***/ (function(module, exports) {
2528
1645
 
2529
1646
  module.exports = require("@splunk/visualizations-shared/colorConstants");
2530
1647
 
2531
1648
  /***/ }),
2532
-
2533
- /***/ 44:
1649
+ /* 44 */,
1650
+ /* 45 */
2534
1651
  /***/ (function(module, exports) {
2535
1652
 
2536
1653
  module.exports = require("@splunk/visualization-icons/placeholders");
2537
1654
 
2538
1655
  /***/ }),
2539
-
2540
- /***/ 46:
1656
+ /* 46 */,
1657
+ /* 47 */
2541
1658
  /***/ (function(module, exports) {
2542
1659
 
2543
1660
  module.exports = require("@babel/runtime/helpers/extends");
2544
1661
 
2545
1662
  /***/ }),
2546
-
2547
- /***/ 48:
1663
+ /* 48 */,
1664
+ /* 49 */
2548
1665
  /***/ (function(module, exports, __webpack_require__) {
2549
1666
 
2550
1667
  "use strict";
@@ -2574,372 +1691,164 @@ var background = function background(_ref) {
2574
1691
  exports.default = background;
2575
1692
 
2576
1693
  /***/ }),
2577
-
2578
- /***/ 5:
2579
- /***/ (function(module, exports, __webpack_require__) {
2580
-
2581
- "use strict";
2582
-
2583
-
2584
- Object.defineProperty(exports, "__esModule", {
2585
- value: true
2586
- });
2587
- exports.VizBehavior = void 0;
2588
- var VizBehavior;
2589
-
2590
- (function (VizBehavior) {
2591
- /**
2592
- * Dynamic Options Behavior.
2593
- * This allows visualization options to be powered by data
2594
- *
2595
- * **Example**
2596
- *
2597
- * sparklineValues: ">primary|seriesByIndex(0)"
2598
- * would configure sparklineValues with an array of data points
2599
- * coming from the first series in the primary datasource
2600
- *
2601
- */
2602
- VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
2603
- VizBehavior["EVENTS"] = "events";
2604
- /**
2605
- * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
2606
- * missing.
2607
- * @type {string}
2608
- */
2609
-
2610
- VizBehavior["PLACEHOLDER"] = "placeholder";
2611
- VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
2612
- })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
2613
-
2614
- /***/ }),
2615
-
2616
- /***/ 6:
1694
+ /* 50 */,
1695
+ /* 51 */,
1696
+ /* 52 */,
1697
+ /* 53 */,
1698
+ /* 54 */,
1699
+ /* 55 */,
1700
+ /* 56 */,
1701
+ /* 57 */,
1702
+ /* 58 */,
1703
+ /* 59 */,
1704
+ /* 60 */,
1705
+ /* 61 */,
1706
+ /* 62 */,
1707
+ /* 63 */,
1708
+ /* 64 */,
1709
+ /* 65 */,
1710
+ /* 66 */,
1711
+ /* 67 */,
1712
+ /* 68 */,
1713
+ /* 69 */,
1714
+ /* 70 */,
1715
+ /* 71 */,
1716
+ /* 72 */,
1717
+ /* 73 */,
1718
+ /* 74 */,
1719
+ /* 75 */,
1720
+ /* 76 */,
1721
+ /* 77 */,
1722
+ /* 78 */,
1723
+ /* 79 */,
1724
+ /* 80 */
2617
1725
  /***/ (function(module, exports, __webpack_require__) {
2618
1726
 
2619
1727
  "use strict";
2620
1728
 
2621
1729
 
2622
- var _defineProperty = __webpack_require__(7);
2623
-
2624
- var __rest = this && this.__rest || function (s, e) {
2625
- var t = {};
2626
-
2627
- for (var p in s) {
2628
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2629
- }
2630
-
2631
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2632
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2633
- }
2634
- return t;
2635
- };
1730
+ var _toConsumableArray = __webpack_require__(9);
2636
1731
 
2637
1732
  Object.defineProperty(exports, "__esModule", {
2638
1733
  value: true
2639
1734
  });
2640
- exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
1735
+ exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToOldKey = exports.getGradientDimensions = exports.getGradientStops = exports.getGradientStopColors = exports.getGradientStopOffsets = exports.getGaugeRange = exports.validateRanges = exports.getSortedRanges = exports.getMarkerGaugeValueMarkerPositions = exports.getMarkerBarDimensions = exports.getFillerGaugeValueMarkerPositions = exports.getFillBarDimensions = exports.getGaugeBarHeight = exports.getGaugeBarWidth = exports.getGaugeBarStartPositions = exports.getGaugeBarLength = exports.assignGaugeColor = exports.getGaugeDimensions = exports.getGaugeStartPosition = exports.getGaugeLength = exports.getGaugeHeight = exports.getGaugeWidth = exports.FILL_THICKNESS = exports.GAUGE_THICKNESS = void 0;
2641
1736
 
2642
1737
  var lodash_1 = __webpack_require__(2);
2643
1738
 
2644
- var schemaUtils_1 = __webpack_require__(15);
1739
+ var colorConstants_1 = __webpack_require__(43);
2645
1740
 
2646
- var VizBehavior_1 = __webpack_require__(5);
1741
+ var i18n_1 = __webpack_require__(3);
2647
1742
 
2648
- var dynamicOptionsDSLType = {
2649
- type: 'string',
2650
- pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
2651
- };
1743
+ exports.GAUGE_THICKNESS = 50;
1744
+ exports.FILL_THICKNESS = 38;
1745
+ var GRADIENT_STOP_OFFSET_MIN = 0;
1746
+ var GRADIENT_STOP_OFFSET_MAX = 100;
2652
1747
  /**
2653
- * Helper function to extend an options schema with dynamic options DSL
2654
- * @param optionsSchema a visualization's options schema
2655
- * @returns an updated options schema that additionally allows strings starting with > for each option
1748
+ * get width for the whole gauge viz for horizontal or vertical view
1749
+ * @method getGaugeWidth
1750
+ * @param {Object} input
1751
+ * @param {Number} containerWidth
1752
+ * @param {String} orientation
1753
+ * @return {Number} width
2656
1754
  */
2657
1755
 
2658
- function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
2659
- var enhancedOptionsSchema = {};
2660
- Object.keys(optionsSchema).forEach(function (key) {
2661
- var _a = optionsSchema[key],
2662
- title = _a.title,
2663
- description = _a.description,
2664
- readOnly = _a.readOnly,
2665
- writeOnly = _a.writeOnly,
2666
- examples = _a.examples,
2667
- defaultValue = _a.default,
2668
- type = _a.type,
2669
- properties = _a.properties,
2670
- patternProperties = _a.patternProperties,
2671
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
1756
+ var getGaugeWidth = function getGaugeWidth(_ref) {
1757
+ var containerWidth = _ref.containerWidth,
1758
+ orientation = _ref.orientation;
1759
+ return orientation === 'vertical' ? exports.GAUGE_THICKNESS : containerWidth * 0.8;
1760
+ };
2672
1761
 
2673
- var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
2674
- title: title
2675
- }), description !== undefined && {
2676
- description: description
2677
- }), readOnly !== undefined && {
2678
- readOnly: readOnly
2679
- }), writeOnly !== undefined && {
2680
- writeOnly: writeOnly
2681
- }), examples !== undefined && {
2682
- examples: examples
2683
- }), defaultValue !== undefined && {
2684
- default: defaultValue
2685
- });
1762
+ exports.getGaugeWidth = getGaugeWidth;
1763
+ /**
1764
+ * get height for the whole gauge viz for horizontal or vertical view
1765
+ * @method getGaugeHeight
1766
+ * @param {Object} input
1767
+ * @param {Number} containerHeight
1768
+ * @param {String} orientation
1769
+ * @return {Number} height
1770
+ */
2686
1771
 
2687
- if (type === 'object') {
2688
- enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
2689
- type: type
2690
- }), properties && {
2691
- properties: enhanceOptionsSchemaWithDynamicOptions(properties)
2692
- });
1772
+ var getGaugeHeight = function getGaugeHeight(_ref2) {
1773
+ var containerHeight = _ref2.containerHeight,
1774
+ orientation = _ref2.orientation;
1775
+ return orientation === 'vertical' ? containerHeight * 0.8 : exports.GAUGE_THICKNESS;
1776
+ };
2693
1777
 
2694
- if (patternProperties) {
2695
- var enhancedPatternProperties = {};
2696
- Object.keys(patternProperties).forEach(function (opt) {
2697
- enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
2698
- });
2699
- enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
2700
- }
2701
- } else {
2702
- enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
2703
- anyOf: [Object.assign(Object.assign({}, type !== undefined && {
2704
- type: type
2705
- }), remainingSchemaEntry), dynamicOptionsDSLType]
2706
- });
2707
- }
1778
+ exports.getGaugeHeight = getGaugeHeight;
1779
+ /**
1780
+ * get how long the gauge shoud be.
1781
+ * In horizontal view, gauge length equals to gauge width. In vertical view, it equals to gauge height.
1782
+ * @method getGaugeLength
1783
+ * @param {Object} input
1784
+ * @param {Number} input.containerWidth
1785
+ * @param {Number} input.containerHeight
1786
+ * @param {String} input.orientation
1787
+ * @return {Number} gaugeLength
1788
+ */
1789
+
1790
+ var getGaugeLength = function getGaugeLength(_ref3) {
1791
+ var containerWidth = _ref3.containerWidth,
1792
+ containerHeight = _ref3.containerHeight,
1793
+ orientation = _ref3.orientation;
1794
+ return orientation === 'vertical' ? exports.getGaugeHeight({
1795
+ containerHeight: containerHeight,
1796
+ orientation: orientation
1797
+ }) : exports.getGaugeWidth({
1798
+ containerWidth: containerWidth,
1799
+ orientation: orientation
2708
1800
  });
2709
- return enhancedOptionsSchema;
2710
- }
1801
+ };
2711
1802
 
2712
- exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
1803
+ exports.getGaugeLength = getGaugeLength;
2713
1804
  /**
2714
- * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
2715
- * @param vizConfig a Visualization Config
2716
- * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
1805
+ * get start x and y for rendering gauge
1806
+ * @method getGaugeStartPosition
1807
+ * @param {Object} input
1808
+ * @param {Number} containerWidth
1809
+ * @param {Number} containerHeight
1810
+ * @param {Number} gaugeLength
1811
+ * @param {String} orientation
1812
+ * @return {Object} position
1813
+ * @return {Number} position.gaugeStartX
1814
+ * @return {Number} position.gaugeStartY
2717
1815
  */
2718
1816
 
2719
- function enhanceConfig(vizConfig) {
2720
- var enhancedConfig = vizConfig;
1817
+ var getGaugeStartPosition = function getGaugeStartPosition(_ref4) {
1818
+ var containerWidth = _ref4.containerWidth,
1819
+ containerHeight = _ref4.containerHeight,
1820
+ gaugeLength = _ref4.gaugeLength,
1821
+ orientation = _ref4.orientation;
1822
+ // for horizontal view
1823
+ var gaugeStartX = (containerWidth - gaugeLength) / 2.0;
1824
+ var gaugeStartY = (containerHeight - exports.GAUGE_THICKNESS) / 2.0;
2721
1825
 
2722
- if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
2723
- enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
1826
+ if (orientation === 'vertical') {
1827
+ gaugeStartX = (containerWidth - exports.GAUGE_THICKNESS) / 2.0;
1828
+ gaugeStartY = (containerHeight - gaugeLength) / 2.0;
2724
1829
  }
2725
1830
 
2726
- return enhancedConfig;
2727
- }
2728
-
2729
- exports.enhanceConfig = enhanceConfig;
2730
-
2731
- function isDynamicOption(option) {
2732
- return option && typeof option === 'string' && option.trim().startsWith('>') || false;
2733
- }
2734
-
2735
- exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
2736
- // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
1831
+ return {
1832
+ gaugeStartX: gaugeStartX,
1833
+ gaugeStartY: gaugeStartY
1834
+ };
1835
+ };
2737
1836
 
1837
+ exports.getGaugeStartPosition = getGaugeStartPosition;
2738
1838
  /**
2739
- * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
2740
- * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
2741
- * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
2742
- * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
2743
- *
2744
- * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
2745
- */
2746
-
2747
- function hasCompatibleContexts(vizContext, presetContext) {
2748
- var presetContextKeys = Object.keys(presetContext);
2749
- return presetContextKeys.every(function (contextKey) {
2750
- return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
2751
- });
2752
- }
2753
- /**
2754
- * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
2755
- */
2756
-
2757
-
2758
- function hasCompatibleOptions(vizOptions, presetOptions) {
2759
- var presetOptionKeys = Object.keys(presetOptions);
2760
- return presetOptionKeys.every(function (optionKey) {
2761
- return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
2762
- });
2763
- }
2764
- /**
2765
- * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
2766
- * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
2767
- *
2768
- * @param {Object} vizContext - the current vizContext definition
2769
- * @param {Object} vizOptions - the current vizOptions definition
2770
- * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
2771
- */
2772
-
2773
-
2774
- function getInitialPreset(vizContext, vizOptions, presets) {
2775
- return presets.find(function (preset) {
2776
- var presetContext = lodash_1.get(preset, ['value', 'context'], {});
2777
- var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
2778
- var presetContextKeys = Object.keys(presetContext);
2779
- var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
2780
- // if not, then the preset is invalid in config.ts
2781
-
2782
- if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
2783
- return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
2784
- });
2785
- }
2786
-
2787
- exports.getInitialPreset = getInitialPreset;
2788
- /**
2789
- * generates number precision values for a Select editor
2790
- *
2791
- * @param {Number} numPrecisionValues - number of integer precision values to generate
2792
- * @returns {{ label: string; value; string }[]} array of { label, value } tuples
2793
- */
2794
-
2795
- function generatePrecisionValues(numPrecisionValues) {
2796
- return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
2797
- return {
2798
- label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
2799
- value: i
2800
- };
2801
- });
2802
- }
2803
-
2804
- exports.generatePrecisionValues = generatePrecisionValues;
2805
-
2806
- /***/ }),
2807
-
2808
- /***/ 7:
2809
- /***/ (function(module, exports) {
2810
-
2811
- module.exports = require("@babel/runtime/helpers/defineProperty");
2812
-
2813
- /***/ }),
2814
-
2815
- /***/ 76:
2816
- /***/ (function(module, exports, __webpack_require__) {
2817
-
2818
- "use strict";
2819
-
2820
-
2821
- var _toConsumableArray = __webpack_require__(41);
2822
-
2823
- Object.defineProperty(exports, "__esModule", {
2824
- value: true
2825
- });
2826
- exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToOldKey = exports.getGradientDimensions = exports.getGradientStops = exports.getGradientStopColors = exports.getGradientStopOffsets = exports.getGaugeRange = exports.validateRanges = exports.getSortedRanges = exports.getMarkerGaugeValueMarkerPositions = exports.getMarkerBarDimensions = exports.getFillerGaugeValueMarkerPositions = exports.getFillBarDimensions = exports.getGaugeBarHeight = exports.getGaugeBarWidth = exports.getGaugeBarStartPositions = exports.getGaugeBarLength = exports.assignGaugeColor = exports.getGaugeDimensions = exports.getGaugeStartPosition = exports.getGaugeLength = exports.getGaugeHeight = exports.getGaugeWidth = exports.FILL_THICKNESS = exports.GAUGE_THICKNESS = void 0;
2827
-
2828
- var lodash_1 = __webpack_require__(2);
2829
-
2830
- var colorConstants_1 = __webpack_require__(42);
2831
-
2832
- var i18n_1 = __webpack_require__(3);
2833
-
2834
- exports.GAUGE_THICKNESS = 50;
2835
- exports.FILL_THICKNESS = 38;
2836
- var GRADIENT_STOP_OFFSET_MIN = 0;
2837
- var GRADIENT_STOP_OFFSET_MAX = 100;
2838
- /**
2839
- * get width for the whole gauge viz for horizontal or vertical view
2840
- * @method getGaugeWidth
2841
- * @param {Object} input
2842
- * @param {Number} containerWidth
2843
- * @param {String} orientation
2844
- * @return {Number} width
2845
- */
2846
-
2847
- var getGaugeWidth = function getGaugeWidth(_ref) {
2848
- var containerWidth = _ref.containerWidth,
2849
- orientation = _ref.orientation;
2850
- return orientation === 'vertical' ? exports.GAUGE_THICKNESS : containerWidth * 0.8;
2851
- };
2852
-
2853
- exports.getGaugeWidth = getGaugeWidth;
2854
- /**
2855
- * get height for the whole gauge viz for horizontal or vertical view
2856
- * @method getGaugeHeight
2857
- * @param {Object} input
2858
- * @param {Number} containerHeight
2859
- * @param {String} orientation
2860
- * @return {Number} height
2861
- */
2862
-
2863
- var getGaugeHeight = function getGaugeHeight(_ref2) {
2864
- var containerHeight = _ref2.containerHeight,
2865
- orientation = _ref2.orientation;
2866
- return orientation === 'vertical' ? containerHeight * 0.8 : exports.GAUGE_THICKNESS;
2867
- };
2868
-
2869
- exports.getGaugeHeight = getGaugeHeight;
2870
- /**
2871
- * get how long the gauge shoud be.
2872
- * In horizontal view, gauge length equals to gauge width. In vertical view, it equals to gauge height.
2873
- * @method getGaugeLength
2874
- * @param {Object} input
2875
- * @param {Number} input.containerWidth
2876
- * @param {Number} input.containerHeight
2877
- * @param {String} input.orientation
2878
- * @return {Number} gaugeLength
2879
- */
2880
-
2881
- var getGaugeLength = function getGaugeLength(_ref3) {
2882
- var containerWidth = _ref3.containerWidth,
2883
- containerHeight = _ref3.containerHeight,
2884
- orientation = _ref3.orientation;
2885
- return orientation === 'vertical' ? exports.getGaugeHeight({
2886
- containerHeight: containerHeight,
2887
- orientation: orientation
2888
- }) : exports.getGaugeWidth({
2889
- containerWidth: containerWidth,
2890
- orientation: orientation
2891
- });
2892
- };
2893
-
2894
- exports.getGaugeLength = getGaugeLength;
2895
- /**
2896
- * get start x and y for rendering gauge
2897
- * @method getGaugeStartPosition
2898
- * @param {Object} input
2899
- * @param {Number} containerWidth
2900
- * @param {Number} containerHeight
2901
- * @param {Number} gaugeLength
2902
- * @param {String} orientation
2903
- * @return {Object} position
2904
- * @return {Number} position.gaugeStartX
2905
- * @return {Number} position.gaugeStartY
2906
- */
2907
-
2908
- var getGaugeStartPosition = function getGaugeStartPosition(_ref4) {
2909
- var containerWidth = _ref4.containerWidth,
2910
- containerHeight = _ref4.containerHeight,
2911
- gaugeLength = _ref4.gaugeLength,
2912
- orientation = _ref4.orientation;
2913
- // for horizontal view
2914
- var gaugeStartX = (containerWidth - gaugeLength) / 2.0;
2915
- var gaugeStartY = (containerHeight - exports.GAUGE_THICKNESS) / 2.0;
2916
-
2917
- if (orientation === 'vertical') {
2918
- gaugeStartX = (containerWidth - exports.GAUGE_THICKNESS) / 2.0;
2919
- gaugeStartY = (containerHeight - gaugeLength) / 2.0;
2920
- }
2921
-
2922
- return {
2923
- gaugeStartX: gaugeStartX,
2924
- gaugeStartY: gaugeStartY
2925
- };
2926
- };
2927
-
2928
- exports.getGaugeStartPosition = getGaugeStartPosition;
2929
- /**
2930
- * get dimensions for the whole gauge viz,
2931
- * which can be useful to calculate background bar and major ticks positions.
2932
- * @method getGaugeDimensions
2933
- * @param {Object} input
2934
- * @param {Number} input.containerWidth
2935
- * @param {Number} input.containerHeight
2936
- * @param {String} input.orientation 'horizontal' or 'vertical'
2937
- * @return {Object} gaugeDimensions
2938
- * @return {Number} gaugeDimensions.gaugeLength how long the gauge shoud be in horizontal or vertical orientation.
2939
- * @return {Number} gaugeDimensions.gaugeStartX start x to render gauge
2940
- * @return {Number} gaugeDimensions.gaugeStartY start y to render gauge
2941
- * @return {Number} gaugeDimensions.gaugeWidth natural width of gauge
2942
- * @return {Number} gaugeDimensions.gaugeHeight natural height of gauge
1839
+ * get dimensions for the whole gauge viz,
1840
+ * which can be useful to calculate background bar and major ticks positions.
1841
+ * @method getGaugeDimensions
1842
+ * @param {Object} input
1843
+ * @param {Number} input.containerWidth
1844
+ * @param {Number} input.containerHeight
1845
+ * @param {String} input.orientation 'horizontal' or 'vertical'
1846
+ * @return {Object} gaugeDimensions
1847
+ * @return {Number} gaugeDimensions.gaugeLength how long the gauge shoud be in horizontal or vertical orientation.
1848
+ * @return {Number} gaugeDimensions.gaugeStartX start x to render gauge
1849
+ * @return {Number} gaugeDimensions.gaugeStartY start y to render gauge
1850
+ * @return {Number} gaugeDimensions.gaugeWidth natural width of gauge
1851
+ * @return {Number} gaugeDimensions.gaugeHeight natural height of gauge
2943
1852
  */
2944
1853
 
2945
1854
  var getGaugeDimensions = function getGaugeDimensions(_ref5) {
@@ -3544,243 +2453,1426 @@ var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options)
3544
2453
  var optionString = "".concat(labelOrValue, "Display");
3545
2454
  var newOptions = Object.assign({}, options);
3546
2455
 
3547
- if (newOptions[optionString]) {
3548
- if (newOptions[optionString] === 'number') {
3549
- newOptions[showKey] = true;
3550
- newOptions[percentKey] = false;
3551
- } else if (newOptions[optionString] === 'percentage') {
3552
- newOptions[showKey] = true;
3553
- newOptions[percentKey] = true;
3554
- } else {
3555
- newOptions[showKey] = false;
3556
- newOptions[percentKey] = false;
2456
+ if (newOptions[optionString]) {
2457
+ if (newOptions[optionString] === 'number') {
2458
+ newOptions[showKey] = true;
2459
+ newOptions[percentKey] = false;
2460
+ } else if (newOptions[optionString] === 'percentage') {
2461
+ newOptions[showKey] = true;
2462
+ newOptions[percentKey] = true;
2463
+ } else {
2464
+ newOptions[showKey] = false;
2465
+ newOptions[percentKey] = false;
2466
+ }
2467
+ }
2468
+
2469
+ return lodash_1.omit(newOptions, [optionString]);
2470
+ };
2471
+
2472
+ exports.mapValueLabelDisplay = mapValueLabelDisplay;
2473
+ /**
2474
+ * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that pure component accepts
2475
+ * This is for options that has new key name and can not directly be mapped with pure component props
2476
+ * @method convertToGaugeProperties
2477
+ * @param {Object} originalOptions
2478
+ * @returns {Object}
2479
+ */
2480
+
2481
+ var convertToGaugeProperties = function convertToGaugeProperties(originalOptions) {
2482
+ return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(function (options) {
2483
+ return exports.mapValueLabelDisplay('label', options);
2484
+ }).thru(function (options) {
2485
+ return exports.mapValueLabelDisplay('value', options);
2486
+ }).value();
2487
+ };
2488
+
2489
+ exports.convertToGaugeProperties = convertToGaugeProperties;
2490
+
2491
+ /***/ }),
2492
+ /* 81 */,
2493
+ /* 82 */,
2494
+ /* 83 */,
2495
+ /* 84 */,
2496
+ /* 85 */,
2497
+ /* 86 */,
2498
+ /* 87 */,
2499
+ /* 88 */,
2500
+ /* 89 */,
2501
+ /* 90 */,
2502
+ /* 91 */,
2503
+ /* 92 */,
2504
+ /* 93 */,
2505
+ /* 94 */,
2506
+ /* 95 */,
2507
+ /* 96 */,
2508
+ /* 97 */,
2509
+ /* 98 */,
2510
+ /* 99 */,
2511
+ /* 100 */
2512
+ /***/ (function(module, exports, __webpack_require__) {
2513
+
2514
+ "use strict";
2515
+
2516
+
2517
+ Object.defineProperty(exports, "__esModule", {
2518
+ value: true
2519
+ });
2520
+
2521
+ var i18n_1 = __webpack_require__(3);
2522
+
2523
+ var gauge = {
2524
+ label: i18n_1._('Gauge Settings'),
2525
+ layout: [[{
2526
+ label: i18n_1._('Value Display'),
2527
+ option: 'valueDisplay',
2528
+ editor: 'editor.radioBar',
2529
+ editorProps: {
2530
+ values: [{
2531
+ label: i18n_1._('Number'),
2532
+ value: 'number'
2533
+ }, {
2534
+ label: i18n_1._('Percentage'),
2535
+ value: 'percentage'
2536
+ }, {
2537
+ label: i18n_1._('Off'),
2538
+ value: 'off'
2539
+ }]
2540
+ }
2541
+ }], [{
2542
+ label: i18n_1._('Label Display'),
2543
+ option: 'labelDisplay',
2544
+ editor: 'editor.radioBar',
2545
+ editorProps: {
2546
+ values: [{
2547
+ label: i18n_1._('Numbers'),
2548
+ value: 'number'
2549
+ }, {
2550
+ label: i18n_1._('Percentages'),
2551
+ value: 'percentage'
2552
+ }, {
2553
+ label: i18n_1._('Off'),
2554
+ value: 'off'
2555
+ }]
2556
+ }
2557
+ }], [{
2558
+ label: i18n_1._('Orientation'),
2559
+ option: 'orientation',
2560
+ editor: 'editor.radioBar',
2561
+ editorProps: {
2562
+ values: [{
2563
+ label: i18n_1._('Vertical'),
2564
+ value: 'vertical'
2565
+ }, {
2566
+ label: i18n_1._('Horizontal'),
2567
+ value: 'horizontal'
2568
+ }]
2569
+ }
2570
+ }]]
2571
+ };
2572
+ exports.default = gauge;
2573
+
2574
+ /***/ }),
2575
+ /* 101 */
2576
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2577
+
2578
+ "use strict";
2579
+ __webpack_require__.r(__webpack_exports__);
2580
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MajorTick", function() { return MajorTick; });
2581
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionMajorTick", function() { return positionMajorTick; });
2582
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47);
2583
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
2584
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
2585
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2586
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
2587
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
2588
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
2589
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
2590
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24);
2591
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+ var DEFAULT_NUM_OF_TICKS = 5;
2598
+ var TICK_LENGTH_DELTA = 5;
2599
+ var TICK_LABEL_PADDING_FACTOR = 3.2;
2600
+ var MajorTickLine = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.line.withConfig({
2601
+ displayName: "GaugeMajorTicks__MajorTickLine",
2602
+ componentId: "mchiad-0"
2603
+ })(["stroke:", ";stroke-width:2px;stroke-dasharray:", ";"], function (props) {
2604
+ return props.majorTickStrokeColor;
2605
+ }, function (props) {
2606
+ return props.index === 0 ? 0 : 3;
2607
+ });
2608
+ var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
2609
+ displayName: "GaugeMajorTicks__MajorTickLabel",
2610
+ componentId: "mchiad-1"
2611
+ })(["font-size:12px;font-family:Splunk Platform Sans,sans-serif;line-height:19px;fill:", ";text-anchor:middle;text-align:center;"], function (props) {
2612
+ return props.majorTickFillColor;
2613
+ });
2614
+ var MajorTick = function MajorTick(_ref) {
2615
+ var index = _ref.index,
2616
+ x1 = _ref.x1,
2617
+ y1 = _ref.y1,
2618
+ x2 = _ref.x2,
2619
+ y2 = _ref.y2,
2620
+ showLabels = _ref.showLabels,
2621
+ label = _ref.label,
2622
+ labelX = _ref.labelX,
2623
+ labelY = _ref.labelY,
2624
+ majorTickStrokeColor = _ref.majorTickStrokeColor,
2625
+ majorTickFillColor = _ref.majorTickFillColor;
2626
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
2627
+ index: index,
2628
+ x1: x1,
2629
+ y1: y1,
2630
+ x2: x2,
2631
+ y2: y2,
2632
+ majorTickStrokeColor: majorTickStrokeColor
2633
+ }), showLabels && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLabel, {
2634
+ x: labelX,
2635
+ y: labelY,
2636
+ majorTickFillColor: majorTickFillColor
2637
+ }, Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["isNumerial"])(label) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(label, 0, {
2638
+ useThousandSeparators: true,
2639
+ useTrendUnits: true
2640
+ }) : label));
2641
+ };
2642
+ MajorTick.propTypes = {
2643
+ index: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2644
+ x1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2645
+ y1: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2646
+ x2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2647
+ y2: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2648
+ showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
2649
+ label: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
2650
+ labelX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2651
+ labelY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2652
+ majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
2653
+ majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
2654
+ };
2655
+ /**
2656
+ * calculate position for each major tick
2657
+ * @method positionMajorTick
2658
+ * @param {Object} input
2659
+ * @param {Number} input.width
2660
+ * @param {Number} input.height
2661
+ * @param {Number} input.startX start x for rendering the first major tick
2662
+ * @param {Number} input.startY start y for rendering the first major tick
2663
+ * @param {String} input.orientation
2664
+ * @param {Number} input.numOfTicks how many ticks need to render
2665
+ * @param {Number} input.i index of major tick
2666
+ * @return {Object} MajorTick positions
2667
+ */
2668
+
2669
+ var positionMajorTick = function positionMajorTick(_ref2) {
2670
+ var width = _ref2.width,
2671
+ height = _ref2.height,
2672
+ startX = _ref2.startX,
2673
+ startY = _ref2.startY,
2674
+ orientation = _ref2.orientation,
2675
+ numOfTicks = _ref2.numOfTicks,
2676
+ i = _ref2.i;
2677
+ var x1 = startX;
2678
+ var y1 = startY;
2679
+ var x2 = startX;
2680
+ var y2 = startY;
2681
+ var labelX = startX;
2682
+ var labelY;
2683
+
2684
+ if (orientation === 'vertical') {
2685
+ var y = height / numOfTicks * (numOfTicks - i) + startY;
2686
+ x1 -= TICK_LENGTH_DELTA;
2687
+ y1 = y;
2688
+ x2 += width + TICK_LENGTH_DELTA;
2689
+ y2 = y;
2690
+ labelX += width + TICK_LENGTH_DELTA * TICK_LABEL_PADDING_FACTOR;
2691
+ labelY = y;
2692
+ } else {
2693
+ var x = width / numOfTicks * i + startX;
2694
+ x1 = x;
2695
+ y1 -= TICK_LENGTH_DELTA;
2696
+ x2 = x;
2697
+ y2 += height + TICK_LENGTH_DELTA;
2698
+ labelX = x;
2699
+ labelY = y2 + 16;
2700
+ }
2701
+
2702
+ return {
2703
+ x1: x1,
2704
+ y1: y1,
2705
+ x2: x2,
2706
+ y2: y2,
2707
+ labelX: labelX,
2708
+ labelY: labelY
2709
+ };
2710
+ };
2711
+
2712
+ var MajorTicks = function MajorTicks(_ref3) {
2713
+ var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
2714
+
2715
+ var width = props.width,
2716
+ height = props.height,
2717
+ startX = props.startX,
2718
+ startY = props.startY,
2719
+ min = props.min,
2720
+ max = props.max,
2721
+ majorUnit = props.majorUnit,
2722
+ orientation = props.orientation,
2723
+ showLabels = props.showLabels,
2724
+ usePercentageRange = props.usePercentageRange,
2725
+ majorTickFillColor = props.majorTickFillColor,
2726
+ majorTickStrokeColor = props.majorTickStrokeColor;
2727
+ var range = max - min;
2728
+ var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
2729
+ var majorTicks = [];
2730
+
2731
+ for (var i = 0; i <= numOfTicks; i += 1) {
2732
+ var _positionMajorTick = positionMajorTick({
2733
+ width: width,
2734
+ height: height,
2735
+ startX: startX,
2736
+ startY: startY,
2737
+ orientation: orientation,
2738
+ numOfTicks: numOfTicks,
2739
+ i: i
2740
+ }),
2741
+ x1 = _positionMajorTick.x1,
2742
+ y1 = _positionMajorTick.y1,
2743
+ x2 = _positionMajorTick.x2,
2744
+ y2 = _positionMajorTick.y2,
2745
+ labelX = _positionMajorTick.labelX,
2746
+ labelY = _positionMajorTick.labelY;
2747
+
2748
+ var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
2749
+ majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
2750
+ key: i,
2751
+ index: i,
2752
+ x1: x1,
2753
+ y1: y1,
2754
+ x2: x2,
2755
+ y2: y2,
2756
+ showLabels: showLabels,
2757
+ label: label,
2758
+ labelX: labelX,
2759
+ labelY: labelY,
2760
+ majorTickFillColor: majorTickFillColor,
2761
+ majorTickStrokeColor: majorTickStrokeColor
2762
+ }));
2763
+ } // if the gauge is not divided evenly, put the last tick at the end of the gauge
2764
+
2765
+
2766
+ if (!Number.isInteger(numOfTicks)) {
2767
+ var extraNumOfTicks = Math.ceil(numOfTicks);
2768
+
2769
+ var _positionMajorTick2 = positionMajorTick({
2770
+ width: width,
2771
+ height: height,
2772
+ startX: startX,
2773
+ startY: startY,
2774
+ orientation: orientation,
2775
+ numOfTicks: extraNumOfTicks,
2776
+ i: extraNumOfTicks
2777
+ }),
2778
+ _x = _positionMajorTick2.x1,
2779
+ _y = _positionMajorTick2.y1,
2780
+ _x2 = _positionMajorTick2.x2,
2781
+ _y2 = _positionMajorTick2.y2,
2782
+ _labelX = _positionMajorTick2.labelX,
2783
+ _labelY = _positionMajorTick2.labelY;
2784
+
2785
+ majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
2786
+ key: extraNumOfTicks,
2787
+ id: extraNumOfTicks,
2788
+ x1: _x,
2789
+ y1: _y,
2790
+ x2: _x2,
2791
+ y2: _y2,
2792
+ showLabels: showLabels,
2793
+ label: usePercentageRange ? '100%' : max,
2794
+ labelX: _labelX,
2795
+ labelY: _labelY,
2796
+ majorTickFillColor: majorTickFillColor,
2797
+ majorTickStrokeColor: majorTickStrokeColor
2798
+ }));
2799
+ }
2800
+
2801
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
2802
+ };
2803
+
2804
+ MajorTicks.propTypes = {
2805
+ width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2806
+ height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2807
+ startX: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2808
+ startY: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2809
+ min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2810
+ max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
2811
+ majorUnit: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number]),
2812
+ orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
2813
+ showLabels: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
2814
+ usePercentageRange: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
2815
+ majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
2816
+ majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
2817
+ };
2818
+ MajorTicks.defaultProps = {
2819
+ min: 0,
2820
+ max: 100,
2821
+ majorUnit: 'auto',
2822
+ orientation: 'horizontal',
2823
+ showLabels: true,
2824
+ usePercentageRange: false
2825
+ };
2826
+ /* harmony default export */ __webpack_exports__["default"] = (MajorTicks);
2827
+
2828
+ /***/ }),
2829
+ /* 102 */
2830
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2831
+
2832
+ "use strict";
2833
+ __webpack_require__.r(__webpack_exports__);
2834
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionValueMarkerRect", function() { return positionValueMarkerRect; });
2835
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "positionLabel", function() { return positionLabel; });
2836
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(47);
2837
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
2838
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
2839
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
2840
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
2841
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
2842
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
2843
+ /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
2844
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24);
2845
+ /* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
2846
+
2847
+
2848
+
2849
+
2850
+
2851
+ var MARKER_THICKNESS = 15;
2852
+ var MARKER_INNER_LENGTH = 30;
2853
+ var MARKER_LABEL_WIDTH = 60;
2854
+ var MARKER_LABEL_HEIGHT = 25;
2855
+ var RADIUS = 2;
2856
+ var DELTA_LENGTH = 12;
2857
+ var ValueMarkerRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.path.withConfig({
2858
+ displayName: "GaugeValueMarker__ValueMarkerRect",
2859
+ componentId: "sc-1bxkeao-0"
2860
+ })(["stroke-width:2px;fill:", ";"], function (props) {
2861
+ return props.valueMarkerFillColor;
2862
+ });
2863
+ var ValueMarkerLabelRect = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.rect.withConfig({
2864
+ displayName: "GaugeValueMarker__ValueMarkerLabelRect",
2865
+ componentId: "sc-1bxkeao-1"
2866
+ })(["fill:", ";"], function (props) {
2867
+ return props.valueMarkerFillColor;
2868
+ });
2869
+ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.text.withConfig({
2870
+ displayName: "GaugeValueMarker__ValueMarkerLabel",
2871
+ componentId: "sc-1bxkeao-2"
2872
+ })(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
2873
+ return props.valueMarkerLabelFillColor;
2874
+ });
2875
+ /**
2876
+ * calculate the path of Value Marker shape
2877
+ * @method positionValueMarkerRect
2878
+ * @param {Object} input
2879
+ * @param {Number} input.x
2880
+ * @param {Number} input.y
2881
+ * @param {String} input.orientation
2882
+ * @param {Number} input.valueMarkerRectLength
2883
+ * @return {String} d containing a series of path commands that define the path to be
2884
+ */
2885
+
2886
+ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
2887
+ var x = _ref.x,
2888
+ y = _ref.y,
2889
+ orientation = _ref.orientation,
2890
+ valueMarkerRectLength = _ref.valueMarkerRectLength;
2891
+ var hLength = MARKER_THICKNESS;
2892
+ var vLength = valueMarkerRectLength;
2893
+ var markerStartX = x - MARKER_THICKNESS;
2894
+ var markerStartY = y;
2895
+ var innerHLength = hLength / 3;
2896
+ var innerVLength = MARKER_INNER_LENGTH;
2897
+ var innerStartX = markerStartX + innerHLength;
2898
+ var innerStartY = markerStartY + 7;
2899
+
2900
+ if (orientation === 'vertical') {
2901
+ hLength = valueMarkerRectLength;
2902
+ vLength = MARKER_THICKNESS;
2903
+ markerStartX = x;
2904
+ innerHLength = MARKER_INNER_LENGTH;
2905
+ innerVLength = vLength / 3;
2906
+ innerStartX = markerStartX + 7;
2907
+ innerStartY = markerStartY + innerVLength;
2908
+ }
2909
+
2910
+ return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
2911
+ };
2912
+ /**
2913
+ * calculate the position of value marker label
2914
+ * @method positionLabel
2915
+ * @param {Object} input
2916
+ * @param {Number} input.x
2917
+ * @param {Number} input.y
2918
+ * @param {Number} input.length gauge thickness
2919
+ * @param {String} input.orientation
2920
+ * @return {Object} positions
2921
+ * @return {Number} positions.labelRectX x of value marker label rect
2922
+ * @return {Number} positions.labelRectY y of value marker label rect
2923
+ * @return {Number} positions.labelX x of value marker label text
2924
+ * @return {Number} positions.labelY y of value marker label text
2925
+ */
2926
+
2927
+ var positionLabel = function positionLabel(_ref2) {
2928
+ var x = _ref2.x,
2929
+ y = _ref2.y,
2930
+ length = _ref2.length,
2931
+ orientation = _ref2.orientation; // for horizontal view
2932
+
2933
+ var labelRectX = x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
2934
+ var labelRectY = y + length;
2935
+
2936
+ if (orientation === 'vertical') {
2937
+ labelRectX = x + length;
2938
+ labelRectY = y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
2939
+ }
2940
+
2941
+ var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
2942
+ var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
2943
+ return {
2944
+ labelRectX: labelRectX,
2945
+ labelRectY: labelRectY,
2946
+ labelX: labelX,
2947
+ labelY: labelY
2948
+ };
2949
+ };
2950
+
2951
+ var ValueMarker = function ValueMarker(_ref3) {
2952
+ var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
2953
+
2954
+ var x = props.x,
2955
+ y = props.y,
2956
+ length = props.length,
2957
+ min = props.min,
2958
+ max = props.max,
2959
+ value = props.value,
2960
+ orientation = props.orientation,
2961
+ showValue = props.showValue,
2962
+ usePercentageValue = props.usePercentageValue,
2963
+ valueMarkerFillColor = props.valueMarkerFillColor,
2964
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
2965
+ var valueMarkerRectLength = length + DELTA_LENGTH;
2966
+
2967
+ var _positionLabel = positionLabel({
2968
+ x: x,
2969
+ y: y,
2970
+ length: length,
2971
+ orientation: orientation
2972
+ }),
2973
+ labelRectX = _positionLabel.labelRectX,
2974
+ labelRectY = _positionLabel.labelRectY,
2975
+ labelX = _positionLabel.labelX,
2976
+ labelY = _positionLabel.labelY;
2977
+
2978
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
2979
+ "data-test": "value-marker-rect",
2980
+ d: positionValueMarkerRect({
2981
+ x: x,
2982
+ y: y,
2983
+ orientation: orientation,
2984
+ valueMarkerRectLength: valueMarkerRectLength
2985
+ }),
2986
+ valueMarkerFillColor: valueMarkerFillColor
2987
+ }), showValue && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabelRect, {
2988
+ "data-test": "value-marker-label-rect",
2989
+ x: labelRectX,
2990
+ y: labelRectY,
2991
+ width: MARKER_LABEL_WIDTH,
2992
+ height: MARKER_LABEL_HEIGHT,
2993
+ rx: RADIUS,
2994
+ ry: RADIUS,
2995
+ valueMarkerFillColor: valueMarkerFillColor
2996
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerLabel, {
2997
+ "data-test": "value-marker-label",
2998
+ x: labelX,
2999
+ y: labelY,
3000
+ valueMarkerLabelFillColor: valueMarkerLabelFillColor
3001
+ }, usePercentageValue ? "".concat((value / (max - min) * 100).toFixed(2), "%") : Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__["formatNumber"])(value, 0, {
3002
+ useThousandSeparators: true,
3003
+ useTrendUnits: true
3004
+ }))));
3005
+ };
3006
+
3007
+ ValueMarker.propTypes = {
3008
+ x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3009
+ y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3010
+ length: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3011
+ min: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3012
+ max: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3013
+ value: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
3014
+ orientation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
3015
+ showValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
3016
+ usePercentageValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,
3017
+ valueMarkerFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
3018
+ valueMarkerLabelFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
3019
+ };
3020
+ ValueMarker.defaultProps = {
3021
+ min: 0,
3022
+ max: 100,
3023
+ orientation: 'horizontal',
3024
+ showValue: true,
3025
+ usePercentageValue: false
3026
+ };
3027
+ /* harmony default export */ __webpack_exports__["default"] = (ValueMarker);
3028
+
3029
+ /***/ }),
3030
+ /* 103 */,
3031
+ /* 104 */,
3032
+ /* 105 */,
3033
+ /* 106 */,
3034
+ /* 107 */,
3035
+ /* 108 */,
3036
+ /* 109 */,
3037
+ /* 110 */,
3038
+ /* 111 */,
3039
+ /* 112 */,
3040
+ /* 113 */,
3041
+ /* 114 */,
3042
+ /* 115 */,
3043
+ /* 116 */,
3044
+ /* 117 */,
3045
+ /* 118 */,
3046
+ /* 119 */,
3047
+ /* 120 */,
3048
+ /* 121 */,
3049
+ /* 122 */,
3050
+ /* 123 */,
3051
+ /* 124 */,
3052
+ /* 125 */,
3053
+ /* 126 */,
3054
+ /* 127 */,
3055
+ /* 128 */,
3056
+ /* 129 */,
3057
+ /* 130 */,
3058
+ /* 131 */,
3059
+ /* 132 */
3060
+ /***/ (function(module, exports, __webpack_require__) {
3061
+
3062
+ "use strict";
3063
+
3064
+
3065
+ var __rest = this && this.__rest || function (s, e) {
3066
+ var t = {};
3067
+
3068
+ for (var p in s) {
3069
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3070
+ }
3071
+
3072
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3073
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3074
+ }
3075
+ return t;
3076
+ };
3077
+
3078
+ Object.defineProperty(exports, "__esModule", {
3079
+ value: true
3080
+ });
3081
+ exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
3082
+
3083
+ var lodash_1 = __webpack_require__(2);
3084
+
3085
+ var MarkerGauge_1 = __webpack_require__(214);
3086
+
3087
+ var config_1 = __webpack_require__(216);
3088
+
3089
+ exports.config = config_1.default;
3090
+
3091
+ var withDashboardViz_1 = __webpack_require__(30);
3092
+
3093
+ var gaugeUtils_1 = __webpack_require__(80);
3094
+
3095
+ exports.PureMarkerGauge = MarkerGauge_1.default;
3096
+ var validOptions = Object.keys(config_1.default.optionsSchema);
3097
+
3098
+ var computeVizProps = function computeVizProps(_a) {
3099
+ var props = __rest(_a, []);
3100
+
3101
+ var options = lodash_1.chain(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
3102
+ var defaultColors = {
3103
+ fillColor: config_1.default.themes.defaultFillColor(props),
3104
+ majorTickFillColor: config_1.default.themes.majorTickFillColor(props),
3105
+ majorTickStrokeColor: config_1.default.themes.majorTickStrokeColor(props),
3106
+ valueMarkerFillColor: config_1.default.themes.valueMarkerFillColor(props),
3107
+ valueMarkerLabelFillColor: config_1.default.themes.valueMarkerLabelFillColor(props)
3108
+ };
3109
+ return Object.assign(Object.assign({}, options), defaultColors);
3110
+ };
3111
+
3112
+ exports.computeVizProps = computeVizProps;
3113
+ var viz = withDashboardViz_1.default({
3114
+ ReactViz: MarkerGauge_1.default,
3115
+ computeVizProps: exports.computeVizProps,
3116
+ vizConfig: config_1.default
3117
+ });
3118
+ exports.default = viz;
3119
+
3120
+ /***/ }),
3121
+ /* 133 */,
3122
+ /* 134 */,
3123
+ /* 135 */,
3124
+ /* 136 */,
3125
+ /* 137 */,
3126
+ /* 138 */,
3127
+ /* 139 */,
3128
+ /* 140 */,
3129
+ /* 141 */,
3130
+ /* 142 */,
3131
+ /* 143 */,
3132
+ /* 144 */,
3133
+ /* 145 */,
3134
+ /* 146 */,
3135
+ /* 147 */,
3136
+ /* 148 */,
3137
+ /* 149 */,
3138
+ /* 150 */,
3139
+ /* 151 */,
3140
+ /* 152 */,
3141
+ /* 153 */,
3142
+ /* 154 */,
3143
+ /* 155 */,
3144
+ /* 156 */,
3145
+ /* 157 */,
3146
+ /* 158 */,
3147
+ /* 159 */,
3148
+ /* 160 */,
3149
+ /* 161 */,
3150
+ /* 162 */,
3151
+ /* 163 */,
3152
+ /* 164 */,
3153
+ /* 165 */,
3154
+ /* 166 */,
3155
+ /* 167 */,
3156
+ /* 168 */,
3157
+ /* 169 */,
3158
+ /* 170 */,
3159
+ /* 171 */,
3160
+ /* 172 */,
3161
+ /* 173 */,
3162
+ /* 174 */,
3163
+ /* 175 */,
3164
+ /* 176 */,
3165
+ /* 177 */,
3166
+ /* 178 */,
3167
+ /* 179 */,
3168
+ /* 180 */,
3169
+ /* 181 */,
3170
+ /* 182 */,
3171
+ /* 183 */,
3172
+ /* 184 */,
3173
+ /* 185 */,
3174
+ /* 186 */,
3175
+ /* 187 */,
3176
+ /* 188 */,
3177
+ /* 189 */,
3178
+ /* 190 */,
3179
+ /* 191 */,
3180
+ /* 192 */,
3181
+ /* 193 */,
3182
+ /* 194 */,
3183
+ /* 195 */,
3184
+ /* 196 */,
3185
+ /* 197 */,
3186
+ /* 198 */,
3187
+ /* 199 */,
3188
+ /* 200 */,
3189
+ /* 201 */,
3190
+ /* 202 */,
3191
+ /* 203 */,
3192
+ /* 204 */,
3193
+ /* 205 */,
3194
+ /* 206 */,
3195
+ /* 207 */,
3196
+ /* 208 */,
3197
+ /* 209 */,
3198
+ /* 210 */,
3199
+ /* 211 */,
3200
+ /* 212 */,
3201
+ /* 213 */
3202
+ /***/ (function(module, exports, __webpack_require__) {
3203
+
3204
+ "use strict";
3205
+
3206
+
3207
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
3208
+ if (k2 === undefined) k2 = k;
3209
+ Object.defineProperty(o, k2, {
3210
+ enumerable: true,
3211
+ get: function get() {
3212
+ return m[k];
3213
+ }
3214
+ });
3215
+ } : function (o, m, k, k2) {
3216
+ if (k2 === undefined) k2 = k;
3217
+ o[k2] = m[k];
3218
+ });
3219
+
3220
+ var __exportStar = this && this.__exportStar || function (m, exports) {
3221
+ for (var p in m) {
3222
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3223
+ }
3224
+ };
3225
+
3226
+ Object.defineProperty(exports, "__esModule", {
3227
+ value: true
3228
+ });
3229
+ exports.default = void 0;
3230
+
3231
+ __exportStar(__webpack_require__(132), exports);
3232
+
3233
+ var MarkerGauge_1 = __webpack_require__(132);
3234
+
3235
+ Object.defineProperty(exports, "default", {
3236
+ enumerable: true,
3237
+ get: function get() {
3238
+ return MarkerGauge_1.default;
3239
+ }
3240
+ });
3241
+
3242
+ /***/ }),
3243
+ /* 214 */
3244
+ /***/ (function(module, exports, __webpack_require__) {
3245
+
3246
+ "use strict";
3247
+
3248
+
3249
+ var __rest = this && this.__rest || function (s, e) {
3250
+ var t = {};
3251
+
3252
+ for (var p in s) {
3253
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
3254
+ }
3255
+
3256
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3257
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
3258
+ }
3259
+ return t;
3260
+ };
3261
+
3262
+ Object.defineProperty(exports, "__esModule", {
3263
+ value: true
3264
+ });
3265
+
3266
+ var React = __webpack_require__(1);
3267
+
3268
+ var react_1 = __webpack_require__(1);
3269
+
3270
+ var T = __webpack_require__(0);
3271
+
3272
+ var styled_components_1 = __webpack_require__(4);
3273
+
3274
+ var lodash_1 = __webpack_require__(2);
3275
+
3276
+ var i18n_1 = __webpack_require__(3);
3277
+
3278
+ var style_1 = __webpack_require__(15);
3279
+
3280
+ var SizeAwareWrapper_1 = __webpack_require__(18);
3281
+
3282
+ var Message_1 = __webpack_require__(11);
3283
+
3284
+ var id_1 = __webpack_require__(215);
3285
+
3286
+ var gaugeUtils_1 = __webpack_require__(80);
3287
+
3288
+ var GaugeMajorTicks_1 = __webpack_require__(101);
3289
+
3290
+ var GaugeValueMarker_1 = __webpack_require__(102);
3291
+
3292
+ var MAX_VERTICAL_CONTAINER_WIDTH = 200;
3293
+ var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
3294
+ var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
3295
+ var MIN_HORIZONTAL_CONTAINER_HEIGHT = 100;
3296
+ var Container = styled_components_1.default.div.withConfig({
3297
+ displayName: "MarkerGauge__Container",
3298
+ componentId: "sc-10z02va-0"
3299
+ })(["overflow:hidden;", ";background-color:", ";"], function (props) {
3300
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
3301
+ }, function (props) {
3302
+ return props.backgroundColor;
3303
+ });
3304
+ var MarkerGaugeWrapper = styled_components_1.default.div.withConfig({
3305
+ displayName: "MarkerGauge__MarkerGaugeWrapper",
3306
+ componentId: "sc-10z02va-1"
3307
+ })(["display:flex;justify-content:center;flex-direction:row;width:100%;height:100%;background-color:", ";"], function (props) {
3308
+ return props.backgroundColor;
3309
+ });
3310
+ var MarkerGaugeContainer = styled_components_1.default.div.withConfig({
3311
+ displayName: "MarkerGauge__MarkerGaugeContainer",
3312
+ componentId: "sc-10z02va-2"
3313
+ })(["overflow:hidden;position:relative;", ";"], function (props) {
3314
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
3315
+ });
3316
+ var MarkerGaugeSVG = styled_components_1.default.svg.withConfig({
3317
+ displayName: "MarkerGauge__MarkerGaugeSVG",
3318
+ componentId: "sc-10z02va-3"
3319
+ })(["", ";"], function (props) {
3320
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
3321
+ });
3322
+ var BackgroundBar = styled_components_1.default.rect.attrs({
3323
+ 'data-test': 'background-bar-rect'
3324
+ }).withConfig({
3325
+ displayName: "MarkerGauge__BackgroundBar",
3326
+ componentId: "sc-10z02va-4"
3327
+ })(["fill:", ";"], function (props) {
3328
+ return props.fillColor;
3329
+ });
3330
+ var MarkerBar = styled_components_1.default.rect.attrs({
3331
+ 'data-test': 'marker-bar-rect'
3332
+ }).withConfig({
3333
+ displayName: "MarkerGauge__MarkerBar",
3334
+ componentId: "sc-10z02va-5"
3335
+ })([""]);
3336
+
3337
+ var MarkerGauge = function MarkerGauge(_a) {
3338
+ var props = __rest(_a, []);
3339
+
3340
+ var width = props.width,
3341
+ height = props.height,
3342
+ value = props.value,
3343
+ orientation = props.orientation,
3344
+ majorUnit = props.majorUnit,
3345
+ showLabels = props.showLabels,
3346
+ showValue = props.showValue,
3347
+ usePercentageRange = props.usePercentageRange,
3348
+ usePercentageValue = props.usePercentageValue,
3349
+ backgroundColor = props.backgroundColor,
3350
+ fillColor = props.fillColor,
3351
+ ranges = props.ranges,
3352
+ majorTickFillColor = props.majorTickFillColor,
3353
+ majorTickStrokeColor = props.majorTickStrokeColor,
3354
+ valueMarkerFillColor = props.valueMarkerFillColor,
3355
+ valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
3356
+ /**
3357
+ * Standard error message render
3358
+ */
3359
+
3360
+ var errorMessage = react_1.useCallback(function (containerWidth, containerHeight, err, errID) {
3361
+ return React.createElement(Message_1.default, {
3362
+ width: containerWidth,
3363
+ height: containerHeight,
3364
+ message: err,
3365
+ level: "info",
3366
+ id: errID
3367
+ });
3368
+ }, []);
3369
+ var errorId = react_1.useMemo(function () {
3370
+ return id_1.createDOMID();
3371
+ }, []);
3372
+ /**
3373
+ * Pre-calculate linearGradientId, error, sortedRanges, gauge range and linear gradient
3374
+ */
3375
+
3376
+ var error = react_1.useMemo(function () {
3377
+ return gaugeUtils_1.validateRanges(ranges);
3378
+ }, [ranges]);
3379
+ var sortedRanges = react_1.useMemo(function () {
3380
+ return gaugeUtils_1.getSortedRanges(ranges);
3381
+ }, [ranges]);
3382
+
3383
+ var _react_1$useMemo = react_1.useMemo(function () {
3384
+ return gaugeUtils_1.getGaugeRange(sortedRanges);
3385
+ }, [sortedRanges]),
3386
+ min = _react_1$useMemo.min,
3387
+ max = _react_1$useMemo.max;
3388
+
3389
+ var linearGradientId = react_1.useMemo(function () {
3390
+ return id_1.createDOMID('marker');
3391
+ }, []);
3392
+ var linearGradient = react_1.useMemo(function () {
3393
+ var stops = gaugeUtils_1.getGradientStops({
3394
+ ranges: sortedRanges,
3395
+ orientation: orientation
3396
+ });
3397
+
3398
+ var _gaugeUtils_1$getGrad = gaugeUtils_1.getGradientDimensions(orientation),
3399
+ x1 = _gaugeUtils_1$getGrad.x1,
3400
+ y1 = _gaugeUtils_1$getGrad.y1,
3401
+ x2 = _gaugeUtils_1$getGrad.x2,
3402
+ y2 = _gaugeUtils_1$getGrad.y2;
3403
+
3404
+ var linearGradientStops = stops.map(function (stop) {
3405
+ return React.createElement("stop", {
3406
+ key: "".concat(stop.offset, "_").concat(stop.stopColor),
3407
+ offset: stop.offset,
3408
+ stopColor: stop.stopColor
3409
+ });
3410
+ });
3411
+ return React.createElement("linearGradient", {
3412
+ id: linearGradientId,
3413
+ x1: x1,
3414
+ y1: y1,
3415
+ x2: x2,
3416
+ y2: y2
3417
+ }, linearGradientStops);
3418
+ }, [sortedRanges, orientation, linearGradientId]);
3419
+ /**
3420
+ * Calculate marker gauge dimensions
3421
+ */
3422
+
3423
+ var calculateMarkerGaugeDimensions = react_1.useCallback(function (containerWidth, containerHeight) {
3424
+ var _gaugeUtils_1$getGaug = gaugeUtils_1.getGaugeDimensions({
3425
+ containerWidth: containerWidth,
3426
+ containerHeight: containerHeight,
3427
+ orientation: orientation
3428
+ }),
3429
+ gaugeLength = _gaugeUtils_1$getGaug.gaugeLength,
3430
+ gaugeStartX = _gaugeUtils_1$getGaug.gaugeStartX,
3431
+ gaugeStartY = _gaugeUtils_1$getGaug.gaugeStartY,
3432
+ gaugeWidth = _gaugeUtils_1$getGaug.gaugeWidth,
3433
+ gaugeHeight = _gaugeUtils_1$getGaug.gaugeHeight;
3434
+
3435
+ var _gaugeUtils_1$getMark = gaugeUtils_1.getMarkerBarDimensions({
3436
+ gaugeLength: gaugeLength,
3437
+ gaugeStartX: gaugeStartX,
3438
+ gaugeStartY: gaugeStartY,
3439
+ gaugeWidth: gaugeWidth,
3440
+ gaugeHeight: gaugeHeight,
3441
+ orientation: orientation
3442
+ }),
3443
+ markerBarLength = _gaugeUtils_1$getMark.markerBarLength,
3444
+ markerBarX = _gaugeUtils_1$getMark.markerBarX,
3445
+ markerBarY = _gaugeUtils_1$getMark.markerBarY,
3446
+ markerBarWidth = _gaugeUtils_1$getMark.markerBarWidth,
3447
+ markerBarHeight = _gaugeUtils_1$getMark.markerBarHeight;
3448
+
3449
+ var _gaugeUtils_1$getMark2 = gaugeUtils_1.getMarkerGaugeValueMarkerPositions({
3450
+ markerBarX: markerBarX,
3451
+ markerBarY: markerBarY,
3452
+ markerBarHeight: markerBarHeight,
3453
+ markerBarLength: markerBarLength,
3454
+ orientation: orientation,
3455
+ value: value,
3456
+ min: min,
3457
+ max: max
3458
+ }),
3459
+ valueMarkerX = _gaugeUtils_1$getMark2.valueMarkerX,
3460
+ valueMarkerY = _gaugeUtils_1$getMark2.valueMarkerY;
3461
+
3462
+ return {
3463
+ markerBarX: markerBarX,
3464
+ markerBarY: markerBarY,
3465
+ markerBarWidth: markerBarWidth,
3466
+ markerBarHeight: markerBarHeight,
3467
+ valueMarkerX: valueMarkerX,
3468
+ valueMarkerY: valueMarkerY,
3469
+ gaugeStartX: gaugeStartX,
3470
+ gaugeStartY: gaugeStartY,
3471
+ gaugeWidth: gaugeWidth,
3472
+ gaugeHeight: gaugeHeight
3473
+ };
3474
+ }, [orientation, value, min, max]);
3475
+ var renderVisualization = react_1.useCallback(function (_ref) {
3476
+ var containerWidth = _ref.width,
3477
+ containerHeight = _ref.height;
3478
+
3479
+ // todo: need change the size when get design for smaller space
3480
+ // 58 is the title & description header height in dashboard visualization
3481
+ if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
3482
+ return errorMessage(containerWidth, containerHeight, i18n_1._('Too small to render content'), errorId);
3557
3483
  }
3558
- }
3559
3484
 
3560
- return lodash_1.omit(newOptions, [optionString]);
3561
- };
3485
+ if (error) {
3486
+ return errorMessage(containerWidth, containerHeight, error, errorId);
3487
+ }
3562
3488
 
3563
- exports.mapValueLabelDisplay = mapValueLabelDisplay;
3564
- /**
3565
- * Chained helper for mapping the option properties (and values) we expose in config.ts into property values that pure component accepts
3566
- * This is for options that has new key name and can not directly be mapped with pure component props
3567
- * @method convertToGaugeProperties
3568
- * @param {Object} originalOptions
3569
- * @returns {Object}
3570
- */
3489
+ var _calculateMarkerGauge = calculateMarkerGaugeDimensions(containerWidth, containerHeight),
3490
+ markerBarX = _calculateMarkerGauge.markerBarX,
3491
+ markerBarY = _calculateMarkerGauge.markerBarY,
3492
+ markerBarWidth = _calculateMarkerGauge.markerBarWidth,
3493
+ markerBarHeight = _calculateMarkerGauge.markerBarHeight,
3494
+ valueMarkerX = _calculateMarkerGauge.valueMarkerX,
3495
+ valueMarkerY = _calculateMarkerGauge.valueMarkerY,
3496
+ gaugeStartX = _calculateMarkerGauge.gaugeStartX,
3497
+ gaugeStartY = _calculateMarkerGauge.gaugeStartY,
3498
+ gaugeWidth = _calculateMarkerGauge.gaugeWidth,
3499
+ gaugeHeight = _calculateMarkerGauge.gaugeHeight;
3571
3500
 
3572
- var convertToGaugeProperties = function convertToGaugeProperties(originalOptions) {
3573
- return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(function (options) {
3574
- return exports.mapValueLabelDisplay('label', options);
3575
- }).thru(function (options) {
3576
- return exports.mapValueLabelDisplay('value', options);
3577
- }).value();
3501
+ return React.createElement(MarkerGaugeWrapper, {
3502
+ backgroundColor: backgroundColor
3503
+ }, React.createElement(MarkerGaugeContainer, {
3504
+ width: containerWidth,
3505
+ height: containerHeight
3506
+ }, React.createElement(MarkerGaugeSVG, {
3507
+ width: containerWidth,
3508
+ height: containerHeight
3509
+ }, linearGradient, React.createElement(BackgroundBar, {
3510
+ x: gaugeStartX,
3511
+ y: gaugeStartY,
3512
+ width: gaugeWidth,
3513
+ height: gaugeHeight,
3514
+ fillColor: fillColor
3515
+ }), React.createElement(GaugeMajorTicks_1.default, {
3516
+ width: gaugeWidth,
3517
+ height: gaugeHeight,
3518
+ startX: gaugeStartX,
3519
+ startY: gaugeStartY,
3520
+ min: min,
3521
+ max: max,
3522
+ majorUnit: majorUnit,
3523
+ orientation: orientation,
3524
+ showLabels: showLabels,
3525
+ usePercentageRange: usePercentageRange,
3526
+ majorTickFillColor: majorTickFillColor,
3527
+ majorTickStrokeColor: majorTickStrokeColor
3528
+ }), React.createElement(MarkerBar, {
3529
+ x: markerBarX,
3530
+ y: markerBarY,
3531
+ width: markerBarWidth,
3532
+ height: markerBarHeight,
3533
+ fill: "url(#".concat(linearGradientId, ")")
3534
+ }), React.createElement(GaugeValueMarker_1.default, {
3535
+ x: valueMarkerX,
3536
+ y: valueMarkerY,
3537
+ length: gaugeUtils_1.GAUGE_THICKNESS,
3538
+ min: min,
3539
+ max: max,
3540
+ value: value,
3541
+ orientation: orientation,
3542
+ showValue: showValue,
3543
+ usePercentageValue: usePercentageValue,
3544
+ valueMarkerFillColor: valueMarkerFillColor,
3545
+ valueMarkerLabelFillColor: valueMarkerLabelFillColor
3546
+ }))));
3547
+ }, [orientation, error, calculateMarkerGaugeDimensions, backgroundColor, linearGradient, fillColor, min, max, majorUnit, showLabels, usePercentageRange, majorTickFillColor, majorTickStrokeColor, linearGradientId, value, showValue, usePercentageValue, valueMarkerFillColor, valueMarkerLabelFillColor, errorMessage, errorId]);
3548
+ return React.createElement(Container, {
3549
+ width: width,
3550
+ height: height,
3551
+ backgroundColor: backgroundColor
3552
+ }, React.createElement(SizeAwareWrapper_1.default, null, function (containerDimension) {
3553
+ return renderVisualization(containerDimension);
3554
+ }));
3578
3555
  };
3579
3556
 
3580
- exports.convertToGaugeProperties = convertToGaugeProperties;
3557
+ MarkerGauge.propTypes = {
3558
+ width: T.oneOfType([T.string, T.number]),
3559
+ height: T.oneOfType([T.string, T.number]),
3560
+ value: T.number,
3561
+ // valueFieldName: T.string, // todo: need add it back when displaying name later
3562
+ orientation: T.oneOf(['horizontal', 'vertical']),
3563
+ majorUnit: T.oneOfType([T.string, T.number]),
3564
+ showLabels: T.bool,
3565
+ showValue: T.bool,
3566
+ usePercentageRange: T.bool,
3567
+ usePercentageValue: T.bool,
3568
+ backgroundColor: T.string,
3569
+ fillColor: T.string,
3570
+ ranges: T.arrayOf(T.shape({
3571
+ from: T.number.isRequired,
3572
+ to: T.number.isRequired,
3573
+ value: T.string.isRequired
3574
+ })),
3575
+ majorTickFillColor: T.string,
3576
+ majorTickStrokeColor: T.string,
3577
+ valueMarkerFillColor: T.string,
3578
+ valueMarkerLabelFillColor: T.string
3579
+ };
3580
+ MarkerGauge.defaultProps = {
3581
+ width: '100%',
3582
+ height: 250,
3583
+ orientation: 'vertical',
3584
+ majorUnit: 'auto',
3585
+ showLabels: true,
3586
+ showValue: true,
3587
+ usePercentageRange: false,
3588
+ usePercentageValue: false,
3589
+ backgroundColor: 'transparent',
3590
+ value: 0,
3591
+ fillColor: '#f2f4f5',
3592
+ majorTickFillColor: '#3c444d',
3593
+ majorTickStrokeColor: '#6b7785',
3594
+ valueMarkerFillColor: '#3c444d',
3595
+ valueMarkerLabelFillColor: '#f2f4f5',
3596
+ ranges: [{
3597
+ from: 0,
3598
+ to: 50,
3599
+ value: '#4BEBA8'
3600
+ }, {
3601
+ from: 50,
3602
+ to: 90,
3603
+ value: '#F4DF7A'
3604
+ }, {
3605
+ from: 90,
3606
+ to: 100,
3607
+ value: '#CB3B43'
3608
+ }]
3609
+ };
3610
+ exports.default = MarkerGauge;
3581
3611
 
3582
3612
  /***/ }),
3613
+ /* 215 */
3614
+ /***/ (function(module, exports) {
3615
+
3616
+ module.exports = require("@splunk/ui-utils/id");
3583
3617
 
3584
- /***/ 8:
3618
+ /***/ }),
3619
+ /* 216 */
3585
3620
  /***/ (function(module, exports, __webpack_require__) {
3586
3621
 
3587
3622
  "use strict";
3588
3623
 
3589
3624
 
3590
- var _typeof = __webpack_require__(21);
3591
-
3592
3625
  Object.defineProperty(exports, "__esModule", {
3593
3626
  value: true
3594
3627
  });
3595
- exports.findClosestMatchFromDefaultList = exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
3596
3628
 
3597
- var lodash_1 = __webpack_require__(2);
3598
- /**
3599
- * @method extendStaticWrapperProps
3600
- * @param {Object} props
3601
- * @param {DashboardVizType} props.Wrapper
3602
- * @param {DashboardVizType} props.Visualization
3603
- */
3629
+ var i18n_1 = __webpack_require__(3);
3604
3630
 
3631
+ var GaugeMarker_1 = __webpack_require__(217);
3605
3632
 
3606
- var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
3607
- var Wrapper = _ref.Wrapper,
3608
- Visualization = _ref.Visualization;
3609
- var extendProperties = ['propTypes', 'defaultProps', 'config'];
3610
- extendProperties.forEach(function (prop) {
3611
- if (Visualization[prop]) {
3612
- // eslint-disable-next-line no-param-reassign
3613
- Wrapper[prop] = Visualization[prop];
3614
- }
3615
- });
3616
- };
3633
+ var placeholders_1 = __webpack_require__(45);
3617
3634
 
3618
- exports.extendStaticWrapperProps = extendStaticWrapperProps;
3619
- /**
3620
- * helper to deeply merge objects while preserving arrays in earlier source objects
3621
- * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays of primitives will be preserved if already present in the resultant merged object
3622
- * this prevents default arrays of primitives from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one).
3623
- * Array of objects gets merged with the defaults, where the defaults can be an array of objects. Closest matching default object from the defaults list based on key - value pair
3624
- * will be used for merging defaults for each object in the array. If no closest match found, first object in default array list used for merging.
3625
- *
3626
- * @method deepMergeWithArrayPrimitiveOverrides
3627
- * @param {Object} initial - target object to merge values into
3628
- * @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
3629
- *
3630
- * @returns {Object}
3631
- */
3635
+ var schemaUtils_1 = __webpack_require__(16);
3632
3636
 
3633
- var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
3634
- var clone = lodash_1.cloneDeep(initial);
3637
+ var variables_1 = __webpack_require__(10);
3638
+
3639
+ var pick_1 = __webpack_require__(20);
3640
+
3641
+ var Gauge_1 = __webpack_require__(100);
3642
+
3643
+ var VizBehavior_1 = __webpack_require__(5);
3644
+
3645
+ var VizCategory_1 = __webpack_require__(29);
3646
+
3647
+ var configUtils_1 = __webpack_require__(6);
3648
+
3649
+ var BackgroundColor_1 = __webpack_require__(49);
3650
+
3651
+ var dataContract = {
3652
+ requiredDataSources: [{
3653
+ name: 'primary',
3654
+ description: 'DataSource that powers the visualization'
3655
+ }],
3656
+ optionalDataSources: [],
3657
+ initialRequestParams: {
3658
+ primary: {
3659
+ offset: 0,
3660
+ count: 10000
3661
+ }
3662
+ }
3663
+ };
3664
+ var size = {
3665
+ initialWidth: 300,
3666
+ initialHeight: 300
3667
+ };
3668
+ var defaultContext = {};
3669
+ var optionsSchema = {
3670
+ backgroundColor: {
3671
+ description: 'Specify the color used for the background. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
3672
+ type: 'string',
3673
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
3674
+ default: '> themes.defaultBackgroundColor'
3675
+ },
3676
+ gaugeRanges: {
3677
+ description: 'Specify the overall range of the gauge as a series of continuous, color-coded subranges. For example, [{"from": 0, "to": 20, "value": "#4BEBA8"}, {"from": 20, "to": 50, "value": "#F4DF7A"}].',
3678
+ default: [{
3679
+ from: 0,
3680
+ to: 50,
3681
+ value: '#118832'
3682
+ }, {
3683
+ from: 50,
3684
+ to: 90,
3685
+ value: '#CBA700'
3686
+ }, {
3687
+ from: 90,
3688
+ to: 100,
3689
+ value: '#D41F1F'
3690
+ }],
3691
+ type: 'array',
3692
+ items: {
3693
+ type: 'object',
3694
+ properties: {
3695
+ from: {
3696
+ type: 'number',
3697
+ description: 'Starting value for range.'
3698
+ },
3699
+ to: {
3700
+ type: 'number',
3701
+ description: 'Ending value for range.'
3702
+ },
3703
+ value: {
3704
+ description: 'Color for sub range.',
3705
+ type: 'string',
3706
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN // insert pattern for color variables - #HEX etc
3635
3707
 
3636
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3637
- sources[_key - 1] = arguments[_key];
3708
+ }
3709
+ },
3710
+ required: ['from', 'to', 'value'],
3711
+ additionalProperties: false
3712
+ }
3713
+ },
3714
+ labelDisplay: {
3715
+ description: 'Specify whether to display the labels as numbers, percentages, or off.',
3716
+ default: 'number',
3717
+ type: 'string',
3718
+ pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
3719
+ },
3720
+ majorTickInterval: {
3721
+ description: 'Specify, in pixels, the spacing between major tick marks.',
3722
+ default: 'auto',
3723
+ type: ['string', 'number']
3724
+ },
3725
+ orientation: {
3726
+ description: 'Specify the axis orientation of the gauge.',
3727
+ default: 'vertical',
3728
+ type: 'string',
3729
+ pattern: schemaUtils_1.getPattern(['horizontal', 'vertical'])
3730
+ },
3731
+ value: {
3732
+ description: 'Specify the dataSource applied to the value of the marker gauge.',
3733
+ type: 'string',
3734
+ default: '> primary | seriesByType("number") | lastPoint()'
3735
+ },
3736
+ valueDisplay: {
3737
+ description: 'Specify whether to display the value as a number, percentage, or off.',
3738
+ default: 'number',
3739
+ type: 'string',
3740
+ pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
3638
3741
  }
3742
+ };
3743
+ var themes = {
3744
+ defaultFillColor: function defaultFillColor(props) {
3745
+ return pick_1.default({
3746
+ enterprise: variables_1.default.backgroundColorHover(props),
3747
+ prisma: variables_1.default.neutral100(props)
3748
+ })(props);
3749
+ },
3750
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
3751
+ return pick_1.default({
3752
+ enterprise: {
3753
+ dark: variables_1.default.black(props),
3754
+ light: variables_1.default.backgroundColor(props)
3755
+ },
3756
+ prisma: variables_1.default.backgroundColorSidebar(props)
3757
+ })(props);
3758
+ },
3759
+ majorTickFillColor: function majorTickFillColor(props) {
3760
+ return pick_1.default({
3761
+ enterprise: {
3762
+ light: variables_1.default.gray30(props),
3763
+ dark: variables_1.default.textGray(props) // was #D7DAE0
3639
3764
 
3640
- sources.forEach(function (sourceToApply) {
3641
- Object.keys(sourceToApply).forEach(function (sourceKey) {
3642
- if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
3643
- clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
3644
- }
3645
-
3646
- if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
3647
- clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
3648
- } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
3649
- // If option is an array of objects
3650
- for (var i = 0; i < clone[sourceKey].length; i += 1) {
3651
- if (_typeof(clone[sourceKey][i]) === 'object') {
3652
- var closestMatchIdx = exports.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
3765
+ },
3766
+ prisma: {
3767
+ // TODO: missed colors :(
3768
+ light: variables_1.default.neutral100(props),
3769
+ dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
3653
3770
 
3654
- if (closestMatchIdx > -1) {
3655
- clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
3656
- }
3657
- }
3658
- }
3659
3771
  }
3660
- });
3661
- });
3662
- return clone;
3772
+ })(props);
3773
+ },
3774
+ majorTickStrokeColor: function majorTickStrokeColor(props) {
3775
+ return pick_1.default({
3776
+ enterprise: {
3777
+ light: variables_1.default.textGray(props),
3778
+ dark: variables_1.default.contentColorMuted(props)
3779
+ },
3780
+ prisma: variables_1.default.contentColorMuted(props)
3781
+ })(props);
3782
+ },
3783
+ valueMarkerFillColor: function valueMarkerFillColor(props) {
3784
+ return pick_1.default({
3785
+ enterprise: variables_1.default.textColor(props),
3786
+ prisma: {
3787
+ dark: variables_1.default.white(props),
3788
+ light: variables_1.default.black(props)
3789
+ }
3790
+ })(props);
3791
+ },
3792
+ valueMarkerLabelFillColor: function valueMarkerLabelFillColor(props) {
3793
+ return pick_1.default({
3794
+ enterprise: {
3795
+ light: variables_1.default.gray96(props),
3796
+ dark: variables_1.default.black(props)
3797
+ },
3798
+ prisma: variables_1.default.black(props)
3799
+ })(props);
3800
+ }
3663
3801
  };
3802
+ var editorConfig = [{
3803
+ label: i18n_1._('Select Data Field'),
3804
+ layout: [[{
3805
+ label: '',
3806
+ editor: 'editor.columnSelector',
3807
+ option: 'value',
3808
+ context: 'defaultContext',
3809
+ editorProps: {
3810
+ dataSourceKey: 'primary',
3811
+ prepareValue: function prepareValue(definition) {
3812
+ var value = definition.options.value;
3813
+ return {
3814
+ context: {},
3815
+ options: {
3816
+ value: "".concat(value, " | lastPoint()")
3817
+ }
3818
+ };
3819
+ }
3820
+ }
3821
+ }]]
3822
+ }, Gauge_1.default, {
3823
+ label: i18n_1._('Coloring'),
3824
+ open: true,
3825
+ layout: [[{
3826
+ label: i18n_1._('Gauge Ranges'),
3827
+ option: 'gaugeRanges',
3828
+ editor: 'editor.threshold',
3829
+ editorProps: {
3830
+ openRanges: false,
3831
+ isTogglable: false // Can not disable thresholds
3664
3832
 
3665
- exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
3833
+ }
3834
+ }], BackgroundColor_1.default({
3835
+ themes: themes,
3836
+ labelPosition: 'top'
3837
+ })]
3838
+ }];
3666
3839
  /**
3667
- * Finds the closest matching object from the list, which has the max same key value pairs.
3668
- * Returns the index of match if found, or -1
3669
- * For eg :-
3670
- const list = [{
3671
- type: "marker",
3672
- lat: "value1"
3673
- }, {
3674
- type: "bubble",
3675
- size: "value2"
3676
- }];
3677
-
3678
- const obj = {
3679
- type: 'bubble'
3680
- };
3681
-
3682
- findClosestMatch(list, obj) -> returns index 1.
3840
+ * visualization configuration
3683
3841
  */
3684
3842
 
3685
- var findClosestMatchFromDefaultList = function findClosestMatchFromDefaultList(searchList, inputObj) {
3686
- if (!Array.isArray(searchList) || searchList.length === 0) {
3687
- return -1;
3688
- }
3843
+ var config = {
3844
+ /**
3845
+ * unique viz key
3846
+ */
3847
+ key: 'splunk.markergauge',
3689
3848
 
3690
- var keys = Object.keys(inputObj);
3691
- var maxMatchCnt = 0;
3692
- var maxMatchIdx = 0;
3693
- searchList.forEach(function (item, idx) {
3694
- var matchCnt = 0;
3695
- keys.forEach(function (key) {
3696
- if (item[key] === inputObj[key]) {
3697
- matchCnt += 1;
3698
- }
3699
- });
3849
+ /**
3850
+ * viz name
3851
+ */
3852
+ name: 'MarkerGauge',
3853
+ category: VizCategory_1.VizCategory.GAUGE,
3700
3854
 
3701
- if (Math.max(maxMatchCnt, matchCnt) > maxMatchCnt) {
3702
- maxMatchCnt = matchCnt;
3703
- maxMatchIdx = idx;
3704
- }
3705
- });
3706
- return maxMatchIdx;
3855
+ /**
3856
+ * viz icon
3857
+ */
3858
+ icon: GaugeMarker_1.default,
3859
+ placeholderIcon: placeholders_1.MarkerGauge,
3860
+ dataContract: dataContract,
3861
+ size: size,
3862
+ defaultContext: defaultContext,
3863
+ optionsSchema: optionsSchema,
3864
+ editorConfig: editorConfig,
3865
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
3866
+ themes: themes
3707
3867
  };
3708
-
3709
- exports.findClosestMatchFromDefaultList = findClosestMatchFromDefaultList;
3868
+ exports.default = configUtils_1.enhanceConfig(config);
3710
3869
 
3711
3870
  /***/ }),
3712
-
3713
- /***/ 9:
3871
+ /* 217 */
3714
3872
  /***/ (function(module, exports) {
3715
3873
 
3716
- module.exports = require("@splunk/visualizations-shared/Message");
3717
-
3718
- /***/ }),
3719
-
3720
- /***/ 99:
3721
- /***/ (function(module, exports, __webpack_require__) {
3722
-
3723
- "use strict";
3724
-
3725
-
3726
- Object.defineProperty(exports, "__esModule", {
3727
- value: true
3728
- });
3729
-
3730
- var i18n_1 = __webpack_require__(3);
3731
-
3732
- var gauge = {
3733
- label: i18n_1._('Gauge Settings'),
3734
- layout: [[{
3735
- label: i18n_1._('Value Display'),
3736
- option: 'valueDisplay',
3737
- editor: 'editor.radioBar',
3738
- editorProps: {
3739
- values: [{
3740
- label: i18n_1._('Number'),
3741
- value: 'number'
3742
- }, {
3743
- label: i18n_1._('Percentage'),
3744
- value: 'percentage'
3745
- }, {
3746
- label: i18n_1._('Off'),
3747
- value: 'off'
3748
- }]
3749
- }
3750
- }], [{
3751
- label: i18n_1._('Label Display'),
3752
- option: 'labelDisplay',
3753
- editor: 'editor.radioBar',
3754
- editorProps: {
3755
- values: [{
3756
- label: i18n_1._('Numbers'),
3757
- value: 'number'
3758
- }, {
3759
- label: i18n_1._('Percentages'),
3760
- value: 'percentage'
3761
- }, {
3762
- label: i18n_1._('Off'),
3763
- value: 'off'
3764
- }]
3765
- }
3766
- }], [{
3767
- label: i18n_1._('Orientation'),
3768
- option: 'orientation',
3769
- editor: 'editor.radioBar',
3770
- editorProps: {
3771
- values: [{
3772
- label: i18n_1._('Vertical'),
3773
- value: 'vertical'
3774
- }, {
3775
- label: i18n_1._('Horizontal'),
3776
- value: 'horizontal'
3777
- }]
3778
- }
3779
- }]]
3780
- };
3781
- exports.default = gauge;
3874
+ module.exports = require("@splunk/react-icons/GaugeMarker");
3782
3875
 
3783
3876
  /***/ })
3784
-
3785
- /******/ });
3877
+ /******/ ]);
3786
3878
  //# sourceMappingURL=MarkerGauge.js.map