@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-scatter-chart-embed-8efdfab

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 (373) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +6 -4
  2. package/dist/cjs/components/CalculationSelector/index.js +10 -8
  3. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +350 -0
  4. package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
  5. package/dist/cjs/components/DatasourceSelect.js +135 -25
  6. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +18 -16
  7. package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
  8. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +69 -0
  9. package/dist/cjs/components/OptionsEditorRadios/index.js +30 -0
  10. package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +8 -6
  11. package/dist/cjs/components/OptionsEditorTabPanel/index.js +30 -0
  12. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +10 -8
  13. package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
  14. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +55 -14
  15. package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
  16. package/dist/cjs/components/PluginEditor/PluginEditor.js +24 -31
  17. package/dist/cjs/components/PluginEditor/index.js +11 -9
  18. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +5 -3
  19. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +23 -12
  20. package/dist/cjs/components/PluginKindSelect/index.js +10 -8
  21. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
  22. package/dist/cjs/components/PluginRegistry/index.js +10 -8
  23. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +6 -2
  24. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +6 -4
  25. package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
  26. package/dist/cjs/components/ProjectSelect.js +96 -0
  27. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +27 -23
  28. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +21 -19
  29. package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
  30. package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
  31. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
  32. package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
  33. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +438 -229
  34. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +32 -28
  35. package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
  36. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +35 -36
  37. package/dist/cjs/components/Variables/index.js +11 -9
  38. package/dist/cjs/components/Variables/variable-model.js +17 -9
  39. package/dist/cjs/components/index.js +23 -18
  40. package/dist/cjs/constants/index.js +10 -8
  41. package/dist/cjs/constants/user-interface-text.js +3 -1
  42. package/dist/cjs/context/ProjectStoreProvider.js +78 -0
  43. package/dist/cjs/context/index.js +30 -0
  44. package/dist/cjs/context/query-params.js +49 -0
  45. package/dist/cjs/index.js +17 -13
  46. package/dist/cjs/model/index.js +18 -15
  47. package/dist/cjs/model/legend.js +32 -20
  48. package/dist/cjs/model/panels.js +2 -2
  49. package/dist/cjs/model/plugin-base.js +2 -2
  50. package/dist/cjs/model/plugin-loading.js +3 -1
  51. package/dist/cjs/model/trace-queries.js +16 -0
  52. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +67 -35
  53. package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
  54. package/dist/cjs/runtime/DataQueriesProvider/model.js +81 -0
  55. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +43 -26
  56. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +43 -0
  57. package/dist/cjs/runtime/TimeRangeProvider/index.js +12 -9
  58. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +41 -55
  59. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +30 -0
  60. package/dist/cjs/runtime/builtin-variables.js +81 -0
  61. package/dist/cjs/runtime/datasources.js +31 -12
  62. package/dist/cjs/runtime/index.js +17 -13
  63. package/dist/cjs/runtime/plugin-registry.js +41 -11
  64. package/dist/cjs/runtime/template-variables.js +96 -4
  65. package/dist/cjs/runtime/time-series-queries.js +39 -27
  66. package/dist/cjs/runtime/trace-queries.js +76 -0
  67. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
  68. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +18 -15
  69. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
  70. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +31 -13
  71. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
  72. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +9 -7
  73. package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
  74. package/dist/cjs/stories/shared-utils/index.js +10 -8
  75. package/dist/cjs/test/index.js +11 -8
  76. package/dist/cjs/test/mock-data.js +80 -0
  77. package/dist/cjs/test/render.js +13 -11
  78. package/dist/cjs/test/test-plugins/bert/index.js +14 -10
  79. package/dist/cjs/test/test-plugins/ernie/index.js +13 -9
  80. package/dist/cjs/test/test-plugins/index.js +11 -9
  81. package/dist/cjs/test-utils/index.js +10 -8
  82. package/dist/cjs/test-utils/mock-plugin-registry.js +8 -4
  83. package/dist/cjs/utils/action.js +43 -0
  84. package/dist/cjs/utils/index.js +11 -8
  85. package/dist/cjs/utils/variables.js +26 -8
  86. package/dist/cjs/validation/datasource.js +30 -0
  87. package/dist/cjs/validation/index.js +33 -0
  88. package/dist/cjs/validation/resource.js +24 -0
  89. package/dist/cjs/validation/role.js +85 -0
  90. package/dist/cjs/validation/rolebinding.js +55 -0
  91. package/dist/cjs/validation/secret.js +176 -0
  92. package/dist/cjs/validation/variable.js +48 -0
  93. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  94. package/dist/components/CalculationSelector/index.js.map +1 -1
  95. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +15 -0
  96. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
  97. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +342 -0
  98. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
  99. package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
  100. package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
  101. package/dist/components/DatasourceEditorForm/index.js +15 -0
  102. package/dist/components/DatasourceEditorForm/index.js.map +1 -0
  103. package/dist/components/DatasourceSelect.d.ts +6 -0
  104. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  105. package/dist/components/DatasourceSelect.js +118 -23
  106. package/dist/components/DatasourceSelect.js.map +1 -1
  107. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
  108. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  109. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  110. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +16 -0
  111. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
  112. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +61 -0
  113. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
  114. package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
  115. package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
  116. package/dist/components/OptionsEditorRadios/index.js +15 -0
  117. package/dist/components/OptionsEditorRadios/index.js.map +1 -0
  118. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
  119. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
  120. package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
  121. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
  122. package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
  123. package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
  124. package/dist/components/OptionsEditorTabPanel/index.js +15 -0
  125. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
  126. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
  127. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  128. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  129. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -1
  130. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  131. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +45 -6
  132. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  133. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  134. package/dist/components/PluginEditor/PluginEditor.js +15 -24
  135. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  136. package/dist/components/PluginEditor/index.js.map +1 -1
  137. package/dist/components/PluginEditor/plugin-editor-api.d.ts +2 -1
  138. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  139. package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
  140. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  141. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
  142. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  143. package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
  144. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  145. package/dist/components/PluginKindSelect/index.js.map +1 -1
  146. package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
  147. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  148. package/dist/components/PluginRegistry/index.js.map +1 -1
  149. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  150. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -0
  151. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  152. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  153. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  154. package/dist/components/ProjectSelect.d.ts +15 -0
  155. package/dist/components/ProjectSelect.d.ts.map +1 -0
  156. package/dist/components/ProjectSelect.js +91 -0
  157. package/dist/components/ProjectSelect.js.map +1 -0
  158. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
  159. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +19 -17
  160. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
  161. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
  162. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
  163. package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
  164. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +9 -0
  165. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
  166. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
  167. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
  168. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +13 -0
  169. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
  170. package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
  171. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
  172. package/dist/components/TraceQueryEditor/index.d.ts +2 -0
  173. package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
  174. package/dist/components/TraceQueryEditor/index.js +15 -0
  175. package/dist/components/TraceQueryEditor/index.js.map +1 -0
  176. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -8
  177. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  178. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +391 -184
  179. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  180. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  181. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  182. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -19
  183. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +29 -34
  185. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  186. package/dist/components/Variables/index.js.map +1 -1
  187. package/dist/components/Variables/variable-model.js +3 -3
  188. package/dist/components/Variables/variable-model.js.map +1 -1
  189. package/dist/components/index.d.ts +3 -0
  190. package/dist/components/index.d.ts.map +1 -1
  191. package/dist/components/index.js +3 -0
  192. package/dist/components/index.js.map +1 -1
  193. package/dist/constants/index.js.map +1 -1
  194. package/dist/constants/user-interface-text.js.map +1 -1
  195. package/dist/context/ProjectStoreProvider.d.ts +16 -0
  196. package/dist/context/ProjectStoreProvider.d.ts.map +1 -0
  197. package/dist/context/ProjectStoreProvider.js +56 -0
  198. package/dist/context/ProjectStoreProvider.js.map +1 -0
  199. package/dist/context/index.d.ts +2 -0
  200. package/dist/context/index.d.ts.map +1 -0
  201. package/dist/context/index.js +15 -0
  202. package/dist/context/index.js.map +1 -0
  203. package/dist/context/query-params.d.ts +5 -0
  204. package/dist/context/query-params.d.ts.map +1 -0
  205. package/dist/context/query-params.js +41 -0
  206. package/dist/context/query-params.js.map +1 -0
  207. package/dist/index.d.ts +2 -0
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +2 -0
  210. package/dist/index.js.map +1 -1
  211. package/dist/model/datasource.d.ts +2 -1
  212. package/dist/model/datasource.d.ts.map +1 -1
  213. package/dist/model/datasource.js.map +1 -1
  214. package/dist/model/index.d.ts +1 -0
  215. package/dist/model/index.d.ts.map +1 -1
  216. package/dist/model/index.js +1 -0
  217. package/dist/model/index.js.map +1 -1
  218. package/dist/model/legend.d.ts +1 -1
  219. package/dist/model/legend.d.ts.map +1 -1
  220. package/dist/model/legend.js +14 -14
  221. package/dist/model/legend.js.map +1 -1
  222. package/dist/model/panels.d.ts +2 -1
  223. package/dist/model/panels.d.ts.map +1 -1
  224. package/dist/model/panels.js.map +1 -1
  225. package/dist/model/plugin-base.d.ts +1 -0
  226. package/dist/model/plugin-base.d.ts.map +1 -1
  227. package/dist/model/plugin-base.js.map +1 -1
  228. package/dist/model/plugin-loading.js.map +1 -1
  229. package/dist/model/plugins.d.ts +2 -0
  230. package/dist/model/plugins.d.ts.map +1 -1
  231. package/dist/model/plugins.js.map +1 -1
  232. package/dist/model/trace-queries.d.ts +19 -0
  233. package/dist/model/trace-queries.d.ts.map +1 -0
  234. package/dist/model/trace-queries.js +15 -0
  235. package/dist/model/trace-queries.js.map +1 -0
  236. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +5 -5
  237. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  238. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +52 -28
  239. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  240. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  241. package/dist/runtime/DataQueriesProvider/model.d.ts +17 -12
  242. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  243. package/dist/runtime/DataQueriesProvider/model.js +67 -1
  244. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  245. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +4 -3
  246. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  247. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +28 -19
  248. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  249. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +9 -0
  250. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -0
  251. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +30 -0
  252. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
  253. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  254. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  255. package/dist/runtime/TimeRangeProvider/index.js +1 -0
  256. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  257. package/dist/runtime/TimeRangeProvider/query-params.d.ts +4 -4
  258. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  259. package/dist/runtime/TimeRangeProvider/query-params.js +9 -41
  260. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  261. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +7 -0
  262. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -0
  263. package/dist/runtime/TimeRangeProvider/refresh-interval.js +25 -0
  264. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
  265. package/dist/runtime/builtin-variables.d.ts +11 -0
  266. package/dist/runtime/builtin-variables.d.ts.map +1 -0
  267. package/dist/runtime/builtin-variables.js +59 -0
  268. package/dist/runtime/builtin-variables.js.map +1 -0
  269. package/dist/runtime/datasources.d.ts +42 -7
  270. package/dist/runtime/datasources.d.ts.map +1 -1
  271. package/dist/runtime/datasources.js +15 -7
  272. package/dist/runtime/datasources.js.map +1 -1
  273. package/dist/runtime/index.d.ts +2 -0
  274. package/dist/runtime/index.d.ts.map +1 -1
  275. package/dist/runtime/index.js +2 -0
  276. package/dist/runtime/index.js.map +1 -1
  277. package/dist/runtime/plugin-registry.d.ts +2 -0
  278. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  279. package/dist/runtime/plugin-registry.js +19 -2
  280. package/dist/runtime/plugin-registry.js.map +1 -1
  281. package/dist/runtime/template-variables.d.ts +62 -2
  282. package/dist/runtime/template-variables.d.ts.map +1 -1
  283. package/dist/runtime/template-variables.js +83 -1
  284. package/dist/runtime/template-variables.js.map +1 -1
  285. package/dist/runtime/time-series-queries.d.ts +3 -3
  286. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  287. package/dist/runtime/time-series-queries.js +14 -12
  288. package/dist/runtime/time-series-queries.js.map +1 -1
  289. package/dist/runtime/trace-queries.d.ts +14 -0
  290. package/dist/runtime/trace-queries.d.ts.map +1 -0
  291. package/dist/runtime/trace-queries.js +61 -0
  292. package/dist/runtime/trace-queries.js.map +1 -0
  293. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  294. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  295. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
  296. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  297. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
  298. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
  299. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
  300. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
  301. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  302. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +23 -7
  303. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  304. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
  305. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -2
  306. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  307. package/dist/stories/shared-utils/decorators/WithTimeRange.js +2 -2
  308. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  309. package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
  310. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  311. package/dist/stories/shared-utils/decorators/index.js +1 -0
  312. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  313. package/dist/stories/shared-utils/index.js.map +1 -1
  314. package/dist/test/index.d.ts +1 -0
  315. package/dist/test/index.d.ts.map +1 -1
  316. package/dist/test/index.js +1 -0
  317. package/dist/test/index.js.map +1 -1
  318. package/dist/test/mock-data.d.ts +4 -0
  319. package/dist/test/mock-data.d.ts.map +1 -0
  320. package/dist/test/mock-data.js +64 -0
  321. package/dist/test/mock-data.js.map +1 -0
  322. package/dist/test/render.js +2 -2
  323. package/dist/test/render.js.map +1 -1
  324. package/dist/test/setup-tests.js.map +1 -1
  325. package/dist/test/test-plugins/bert/index.js.map +1 -1
  326. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  327. package/dist/test/test-plugins/index.js.map +1 -1
  328. package/dist/test-utils/index.js.map +1 -1
  329. package/dist/test-utils/mock-plugin-registry.js +2 -2
  330. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  331. package/dist/utils/action.d.ts +4 -0
  332. package/dist/utils/action.d.ts.map +1 -0
  333. package/dist/utils/action.js +27 -0
  334. package/dist/utils/action.js.map +1 -0
  335. package/dist/utils/index.d.ts +1 -0
  336. package/dist/utils/index.d.ts.map +1 -1
  337. package/dist/utils/index.js +1 -0
  338. package/dist/utils/index.js.map +1 -1
  339. package/dist/utils/variables.d.ts.map +1 -1
  340. package/dist/utils/variables.js +17 -5
  341. package/dist/utils/variables.js.map +1 -1
  342. package/dist/validation/datasource.d.ts +19 -0
  343. package/dist/validation/datasource.d.ts.map +1 -0
  344. package/dist/validation/datasource.js +22 -0
  345. package/dist/validation/datasource.js.map +1 -0
  346. package/dist/validation/index.d.ts +5 -0
  347. package/dist/validation/index.d.ts.map +1 -0
  348. package/dist/validation/index.js +18 -0
  349. package/dist/validation/index.js.map +1 -0
  350. package/dist/validation/resource.d.ts +3 -0
  351. package/dist/validation/resource.d.ts.map +1 -0
  352. package/dist/validation/resource.js +16 -0
  353. package/dist/validation/resource.js.map +1 -0
  354. package/dist/validation/role.d.ts +228 -0
  355. package/dist/validation/role.d.ts.map +1 -0
  356. package/dist/validation/role.js +66 -0
  357. package/dist/validation/role.js.map +1 -0
  358. package/dist/validation/rolebinding.d.ts +137 -0
  359. package/dist/validation/rolebinding.d.ts.map +1 -0
  360. package/dist/validation/rolebinding.js +47 -0
  361. package/dist/validation/rolebinding.js.map +1 -0
  362. package/dist/validation/secret.d.ts +964 -0
  363. package/dist/validation/secret.d.ts.map +1 -0
  364. package/dist/validation/secret.js +157 -0
  365. package/dist/validation/secret.js.map +1 -0
  366. package/dist/validation/variable.d.ts +96 -0
  367. package/dist/validation/variable.d.ts.map +1 -0
  368. package/dist/validation/variable.js +40 -0
  369. package/dist/validation/variable.js.map +1 -0
  370. package/package.json +9 -6
  371. package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
  372. package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
  373. package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
@@ -12,42 +12,29 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import React, { useCallback, useMemo, useState } from 'react';
15
- import { Box, Typography, Switch, TextField, Grid, FormControl, FormControlLabel, InputLabel, MenuItem, Button, Stack, ClickAwayListener, Divider, Select, capitalize } from '@mui/material';
16
- import { useImmer } from 'use-immer';
15
+ import { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Button, Stack, ClickAwayListener, Divider } from '@mui/material';
17
16
  import { DiscardChangesConfirmationDialog, ErrorBoundary } from '@perses-dev/components';
17
+ import { Controller, FormProvider, useForm } from 'react-hook-form';
18
+ import { zodResolver } from '@hookform/resolvers/zod';
19
+ import { useImmer } from 'use-immer';
20
+ import { getSubmitText, getTitleAction } from '../../../utils';
18
21
  import { VARIABLE_TYPES } from '../variable-model';
19
22
  import { PluginEditor } from '../../PluginEditor';
23
+ import { variableEditorValidationSchema } from '../../../validation';
20
24
  import { VariableListPreview, VariablePreview } from './VariablePreview';
21
25
  import { getVariableDefinitionFromState, getInitialState } from './variable-editor-form-model';
22
- // TODO: Replace with proper validation library
23
- function getValidation(state) {
24
- /** Name validation */ let name = null;
25
- if (!state.name) {
26
- name = 'Name is required';
27
- }
28
- // name can only contain alphanumeric characters and underscores and no spaces
29
- if (state.name && !/^[a-zA-Z0-9_-]+$/.test(state.name)) {
30
- name = 'Name can only contain alphanumeric characters, underscores, and dashes';
31
- }
32
- return {
33
- name,
34
- isValid: !name
35
- };
36
- }
37
26
  function FallbackPreview() {
38
27
  return /*#__PURE__*/ _jsx("div", {
39
28
  children: "Error previewing values"
40
29
  });
41
30
  }
42
- export function VariableEditForm(props) {
43
- const { initialVariableDefinition , onChange , onCancel , action ='update' } = props;
31
+ export function VariableEditorForm(props) {
32
+ const { initialVariableDefinition , initialAction , isDraft , isReadonly , onSave , onClose , onDelete } = props;
44
33
  const initialState = getInitialState(initialVariableDefinition);
45
34
  const [state, setState] = useImmer(initialState);
46
- const validation = useMemo(()=>getValidation(state), [
47
- state
48
- ]);
49
- const [isDiscardDialogStateOpened, setDiscardDialogStateOpened] = useState(false);
35
+ const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
50
36
  const [previewKey, setPreviewKey] = useState(0);
37
+ const [action, setAction] = useState(initialAction);
51
38
  const refreshPreview = ()=>{
52
39
  setPreviewKey((prev)=>prev + 1);
53
40
  };
@@ -60,32 +47,39 @@ export function VariableEditForm(props) {
60
47
  }, [
61
48
  previewKey
62
49
  ]);
63
- const title = useMemo(()=>{
64
- if (action === 'read') return 'View Variable';
65
- if (action === 'create') return 'Create Variable';
66
- if (action === 'update') return 'Edit Variable';
67
- return '';
68
- }, [
69
- action
70
- ]);
50
+ const titleAction = getTitleAction(action, isDraft);
51
+ const submitText = getSubmitText(action, isDraft);
52
+ const form = useForm({
53
+ resolver: zodResolver(variableEditorValidationSchema),
54
+ mode: 'onBlur',
55
+ defaultValues: initialState
56
+ });
57
+ const processForm = ()=>{
58
+ // reset display attributes to undefined when empty, because we don't want to save empty strings
59
+ onSave(getVariableDefinitionFromState({
60
+ ...state,
61
+ title: state.title === '' ? undefined : state.title,
62
+ description: state.description === '' ? undefined : state.description
63
+ }));
64
+ };
71
65
  // When user click on cancel, several possibilities:
72
66
  // - create action: ask for discard approval
73
67
  // - update action: ask for discard approval if changed
74
68
  // - read action: don´t ask for discard approval
75
69
  const handleCancel = useCallback(()=>{
76
- if (action === 'create' || action === 'update' && JSON.stringify(initialState) !== JSON.stringify(state)) {
77
- setDiscardDialogStateOpened(true);
70
+ if (JSON.stringify(initialState) !== JSON.stringify(state)) {
71
+ setDiscardDialogOpened(true);
78
72
  } else {
79
- onCancel();
73
+ onClose();
80
74
  }
81
75
  }, [
82
- state,
83
76
  initialState,
84
- action,
85
- setDiscardDialogStateOpened,
86
- onCancel
77
+ state,
78
+ onClose
87
79
  ]);
88
- return /*#__PURE__*/ _jsxs(_Fragment, {
80
+ var _state_title, _state_description, _state_listVariableFields_capturingRegexp, _state_listVariableFields_sort, _state_listVariableFields_customAllValue;
81
+ return /*#__PURE__*/ _jsxs(FormProvider, {
82
+ ...form,
89
83
  children: [
90
84
  /*#__PURE__*/ _jsxs(Box, {
91
85
  sx: {
@@ -95,32 +89,69 @@ export function VariableEditForm(props) {
95
89
  borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
96
90
  },
97
91
  children: [
98
- /*#__PURE__*/ _jsx(Typography, {
92
+ /*#__PURE__*/ _jsxs(Typography, {
99
93
  variant: "h2",
100
- children: title
94
+ children: [
95
+ titleAction,
96
+ " Variable"
97
+ ]
101
98
  }),
102
- /*#__PURE__*/ _jsxs(Stack, {
99
+ /*#__PURE__*/ _jsx(Stack, {
103
100
  direction: "row",
104
101
  spacing: 1,
105
102
  sx: {
106
103
  marginLeft: 'auto'
107
104
  },
108
- children: [
109
- action !== 'read' && /*#__PURE__*/ _jsx(Button, {
110
- disabled: !validation.isValid,
111
- variant: "contained",
112
- onClick: ()=>{
113
- onChange(getVariableDefinitionFromState(state));
114
- },
115
- children: capitalize(action)
116
- }),
117
- /*#__PURE__*/ _jsx(Button, {
118
- color: "secondary",
119
- variant: "outlined",
120
- onClick: handleCancel,
121
- children: action === 'read' ? 'Close' : 'Cancel'
122
- })
123
- ]
105
+ children: action === 'read' ? /*#__PURE__*/ _jsxs(_Fragment, {
106
+ children: [
107
+ /*#__PURE__*/ _jsx(Button, {
108
+ disabled: isReadonly,
109
+ variant: "contained",
110
+ onClick: ()=>setAction('update'),
111
+ children: "Edit"
112
+ }),
113
+ /*#__PURE__*/ _jsx(Button, {
114
+ color: "error",
115
+ disabled: isReadonly,
116
+ variant: "outlined",
117
+ onClick: onDelete,
118
+ children: "Delete"
119
+ }),
120
+ /*#__PURE__*/ _jsx(Divider, {
121
+ orientation: "vertical",
122
+ flexItem: true,
123
+ sx: (theme)=>({
124
+ borderColor: theme.palette.grey['500'],
125
+ '&.MuiDivider-root': {
126
+ marginLeft: 2,
127
+ marginRight: 1
128
+ }
129
+ })
130
+ }),
131
+ /*#__PURE__*/ _jsx(Button, {
132
+ color: "secondary",
133
+ variant: "outlined",
134
+ onClick: onClose,
135
+ children: "Close"
136
+ })
137
+ ]
138
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
139
+ children: [
140
+ /*#__PURE__*/ _jsx(Button, {
141
+ type: "submit",
142
+ variant: "contained",
143
+ disabled: !form.formState.isValid,
144
+ onClick: form.handleSubmit(processForm),
145
+ children: submitText
146
+ }),
147
+ /*#__PURE__*/ _jsx(Button, {
148
+ color: "secondary",
149
+ variant: "outlined",
150
+ onClick: handleCancel,
151
+ children: "Cancel"
152
+ })
153
+ ]
154
+ })
124
155
  })
125
156
  ]
126
157
  }),
@@ -138,19 +169,31 @@ export function VariableEditForm(props) {
138
169
  /*#__PURE__*/ _jsx(Grid, {
139
170
  item: true,
140
171
  xs: 8,
141
- children: /*#__PURE__*/ _jsx(TextField, {
142
- required: true,
143
- error: !!validation.name,
144
- fullWidth: true,
145
- label: "Name",
146
- value: state.name,
147
- helperText: validation.name,
148
- InputProps: {
149
- readOnly: action === 'update' || action === 'read'
150
- },
151
- onChange: (v)=>{
152
- setState((draft)=>{
153
- draft.name = v.target.value;
172
+ children: /*#__PURE__*/ _jsx(Controller, {
173
+ name: "name",
174
+ render: ({ field , fieldState })=>{
175
+ var _fieldState_error;
176
+ /*#__PURE__*/ return _jsx(TextField, {
177
+ ...field,
178
+ required: true,
179
+ fullWidth: true,
180
+ label: "Name",
181
+ InputLabelProps: {
182
+ shrink: action === 'read' ? true : undefined
183
+ },
184
+ InputProps: {
185
+ disabled: action === 'update' && !isDraft,
186
+ readOnly: action === 'read'
187
+ },
188
+ error: !!fieldState.error,
189
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
190
+ value: state.name,
191
+ onChange: (event)=>{
192
+ field.onChange(event);
193
+ setState((draft)=>{
194
+ draft.name = event.target.value;
195
+ });
196
+ }
154
197
  });
155
198
  }
156
199
  })
@@ -158,16 +201,29 @@ export function VariableEditForm(props) {
158
201
  /*#__PURE__*/ _jsx(Grid, {
159
202
  item: true,
160
203
  xs: 4,
161
- children: /*#__PURE__*/ _jsx(TextField, {
162
- fullWidth: true,
163
- label: "Display Label",
164
- value: state.title || '',
165
- InputProps: {
166
- readOnly: action === 'read'
167
- },
168
- onChange: (v)=>{
169
- setState((draft)=>{
170
- draft.title = v.target.value;
204
+ children: /*#__PURE__*/ _jsx(Controller, {
205
+ name: "title",
206
+ render: ({ field , fieldState })=>{
207
+ var _fieldState_error;
208
+ /*#__PURE__*/ return _jsx(TextField, {
209
+ ...field,
210
+ fullWidth: true,
211
+ label: "Display Label",
212
+ InputLabelProps: {
213
+ shrink: action === 'read' ? true : undefined
214
+ },
215
+ InputProps: {
216
+ readOnly: action === 'read'
217
+ },
218
+ error: !!fieldState.error,
219
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
220
+ value: (_state_title = state.title) !== null && _state_title !== void 0 ? _state_title : '',
221
+ onChange: (event)=>{
222
+ field.onChange(event);
223
+ setState((draft)=>{
224
+ draft.title = event.target.value;
225
+ });
226
+ }
171
227
  });
172
228
  }
173
229
  })
@@ -175,16 +231,29 @@ export function VariableEditForm(props) {
175
231
  /*#__PURE__*/ _jsx(Grid, {
176
232
  item: true,
177
233
  xs: 8,
178
- children: /*#__PURE__*/ _jsx(TextField, {
179
- fullWidth: true,
180
- label: "Description",
181
- value: state.description,
182
- InputProps: {
183
- readOnly: action === 'read'
184
- },
185
- onChange: (v)=>{
186
- setState((draft)=>{
187
- draft.description = v.target.value;
234
+ children: /*#__PURE__*/ _jsx(Controller, {
235
+ name: "description",
236
+ render: ({ field , fieldState })=>{
237
+ var _fieldState_error;
238
+ /*#__PURE__*/ return _jsx(TextField, {
239
+ ...field,
240
+ fullWidth: true,
241
+ label: "Description",
242
+ InputLabelProps: {
243
+ shrink: action === 'read' ? true : undefined
244
+ },
245
+ InputProps: {
246
+ readOnly: action === 'read'
247
+ },
248
+ error: !!fieldState.error,
249
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
250
+ value: (_state_description = state.description) !== null && _state_description !== void 0 ? _state_description : '',
251
+ onChange: (event)=>{
252
+ field.onChange(event);
253
+ setState((draft)=>{
254
+ draft.description = event.target.value;
255
+ });
256
+ }
188
257
  });
189
258
  }
190
259
  })
@@ -192,30 +261,36 @@ export function VariableEditForm(props) {
192
261
  /*#__PURE__*/ _jsx(Grid, {
193
262
  item: true,
194
263
  xs: 4,
195
- children: /*#__PURE__*/ _jsxs(FormControl, {
196
- fullWidth: true,
197
- children: [
198
- /*#__PURE__*/ _jsx(InputLabel, {
199
- id: "variable-type-select-label",
200
- children: "Type"
201
- }),
202
- /*#__PURE__*/ _jsx(Select, {
203
- labelId: "variable-type-select-label",
204
- id: "variable-type-select",
264
+ children: /*#__PURE__*/ _jsx(Controller, {
265
+ name: "kind",
266
+ render: ({ field , fieldState })=>{
267
+ var _fieldState_error;
268
+ /*#__PURE__*/ return _jsx(TextField, {
269
+ select: true,
270
+ ...field,
271
+ fullWidth: true,
205
272
  label: "Type",
273
+ InputLabelProps: {
274
+ shrink: action === 'read' ? true : undefined
275
+ },
276
+ InputProps: {
277
+ readOnly: action === 'read'
278
+ },
279
+ error: !!fieldState.error,
280
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
206
281
  value: state.kind,
207
- readOnly: action === 'read',
208
- onChange: (v)=>{
282
+ onChange: (event)=>{
283
+ field.onChange(event);
209
284
  setState((draft)=>{
210
- draft.kind = v.target.value;
285
+ draft.kind = event.target.value;
211
286
  });
212
287
  },
213
288
  children: VARIABLE_TYPES.map((v)=>/*#__PURE__*/ _jsx(MenuItem, {
214
289
  value: v.kind,
215
290
  children: v.label
216
291
  }, v.kind))
217
- })
218
- ]
292
+ });
293
+ }
219
294
  })
220
295
  })
221
296
  ]
@@ -238,17 +313,49 @@ export function VariableEditForm(props) {
238
313
  ]
239
314
  })
240
315
  }),
241
- /*#__PURE__*/ _jsx(TextField, {
242
- label: "Value",
243
- value: state.textVariableFields.value,
244
- InputProps: {
245
- readOnly: action === 'read'
246
- },
247
- onChange: (v)=>{
248
- setState((draft)=>{
249
- draft.textVariableFields.value = v.target.value;
316
+ /*#__PURE__*/ _jsx(Controller, {
317
+ name: "textVariableFields.value",
318
+ render: ({ field , fieldState })=>{
319
+ var _fieldState_error;
320
+ /*#__PURE__*/ return _jsx(TextField, {
321
+ ...field,
322
+ label: "Value",
323
+ InputLabelProps: {
324
+ shrink: action === 'read' ? true : undefined
325
+ },
326
+ InputProps: {
327
+ readOnly: action === 'read'
328
+ },
329
+ error: !!fieldState.error,
330
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
331
+ value: state.textVariableFields.value,
332
+ onChange: (event)=>{
333
+ field.onChange(event);
334
+ setState((draft)=>{
335
+ draft.textVariableFields.value = event.target.value;
336
+ });
337
+ }
250
338
  });
251
339
  }
340
+ }),
341
+ /*#__PURE__*/ _jsx(Controller, {
342
+ name: "textVariableFields.constant",
343
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
344
+ label: "Constant",
345
+ control: /*#__PURE__*/ _jsx(Switch, {
346
+ ...field,
347
+ checked: !!field.value,
348
+ readOnly: action === 'read',
349
+ value: state.textVariableFields.constant,
350
+ onChange: (event)=>{
351
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
352
+ field.onChange(event);
353
+ setState((draft)=>{
354
+ draft.textVariableFields.constant = event.target.checked;
355
+ });
356
+ }
357
+ })
358
+ })
252
359
  })
253
360
  ]
254
361
  })
@@ -285,38 +392,113 @@ export function VariableEditForm(props) {
285
392
  onClickAway: ()=>refreshPreview(),
286
393
  children: /*#__PURE__*/ _jsx(Box, {})
287
394
  }),
288
- /*#__PURE__*/ _jsx(PluginEditor, {
289
- width: "100%",
290
- pluginType: "Variable",
291
- pluginKindLabel: "Source",
292
- value: state.listVariableFields.plugin,
293
- isReadonly: action === 'read',
294
- onChange: (val)=>{
295
- setState((draft)=>{
296
- draft.listVariableFields.plugin = val;
297
- });
298
- }
395
+ /*#__PURE__*/ _jsx(Controller, {
396
+ name: "listVariableFields.plugin",
397
+ render: ({ field })=>/*#__PURE__*/ _jsx(PluginEditor, {
398
+ width: "100%",
399
+ pluginType: "Variable",
400
+ pluginKindLabel: "Source",
401
+ isReadonly: action === 'read',
402
+ value: state.listVariableFields.plugin,
403
+ onChange: (val)=>{
404
+ field.onChange(val);
405
+ setState((draft)=>{
406
+ draft.listVariableFields.plugin = val;
407
+ });
408
+ }
409
+ })
299
410
  })
300
411
  ]
301
412
  }),
302
413
  /*#__PURE__*/ _jsx(Stack, {
303
- children: /*#__PURE__*/ _jsx(TextField, {
304
- label: "Capturing Regexp Filter",
305
- value: state.listVariableFields.capturing_regexp || '',
306
- InputProps: {
307
- readOnly: action === 'read'
308
- },
309
- onChange: (e)=>{
310
- setState((draft)=>{
311
- if (e.target.value) {
312
- // TODO: do a better fix, if empty string => it should skip the filter
313
- draft.listVariableFields.capturing_regexp = e.target.value;
314
- } else {
315
- draft.listVariableFields.capturing_regexp = undefined;
316
- }
414
+ children: /*#__PURE__*/ _jsx(Controller, {
415
+ name: "listVariableFields.capturingRegexp",
416
+ render: ({ field , fieldState })=>{
417
+ var _fieldState_error;
418
+ /*#__PURE__*/ return _jsx(TextField, {
419
+ ...field,
420
+ label: "Capturing Regexp Filter",
421
+ InputLabelProps: {
422
+ shrink: action === 'read' ? true : undefined
423
+ },
424
+ InputProps: {
425
+ readOnly: action === 'read'
426
+ },
427
+ error: !!fieldState.error,
428
+ value: (_state_listVariableFields_capturingRegexp = state.listVariableFields.capturingRegexp) !== null && _state_listVariableFields_capturingRegexp !== void 0 ? _state_listVariableFields_capturingRegexp : '',
429
+ onChange: (event)=>{
430
+ field.onChange(event);
431
+ setState((draft)=>{
432
+ if (event.target.value) {
433
+ // TODO: do a better fix, if empty string => it should skip the filter
434
+ draft.listVariableFields.capturingRegexp = event.target.value;
435
+ } else {
436
+ draft.listVariableFields.capturingRegexp = undefined;
437
+ }
438
+ });
439
+ },
440
+ helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'Optional, if you want to filter on captured result.'
317
441
  });
318
- },
319
- helperText: "Optional, if you want to filter on captured result."
442
+ }
443
+ })
444
+ }),
445
+ /*#__PURE__*/ _jsx(Stack, {
446
+ children: /*#__PURE__*/ _jsx(Controller, {
447
+ name: "listVariableFields.sort",
448
+ render: ({ field , fieldState })=>{
449
+ var _fieldState_error;
450
+ /*#__PURE__*/ return _jsxs(TextField, {
451
+ select: true,
452
+ ...field,
453
+ fullWidth: true,
454
+ label: "Sort",
455
+ InputLabelProps: {
456
+ shrink: action === 'read' ? true : undefined
457
+ },
458
+ InputProps: {
459
+ readOnly: action === 'read'
460
+ },
461
+ error: !!fieldState.error,
462
+ helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
463
+ value: (_state_listVariableFields_sort = state.listVariableFields.sort) !== null && _state_listVariableFields_sort !== void 0 ? _state_listVariableFields_sort : 'none',
464
+ onChange: (event)=>{
465
+ field.onChange(event);
466
+ setState((draft)=>{
467
+ draft.listVariableFields.sort = event.target.value;
468
+ });
469
+ },
470
+ children: [
471
+ /*#__PURE__*/ _jsx(MenuItem, {
472
+ value: "none",
473
+ children: "None"
474
+ }),
475
+ /*#__PURE__*/ _jsx(MenuItem, {
476
+ value: "alphabetical-asc",
477
+ children: "Alphabetical, asc"
478
+ }),
479
+ /*#__PURE__*/ _jsx(MenuItem, {
480
+ value: "alphabetical-desc",
481
+ children: "Alphabetical, desc"
482
+ }),
483
+ /*#__PURE__*/ _jsx(MenuItem, {
484
+ value: "numerical-asc",
485
+ children: "Numerical, asc"
486
+ }),
487
+ /*#__PURE__*/ _jsx(MenuItem, {
488
+ value: "numerical-desc",
489
+ children: "Numerical, desc"
490
+ }),
491
+ /*#__PURE__*/ _jsx(MenuItem, {
492
+ value: "alphabetical-ci-asc",
493
+ children: "Alphabetical, case-insensitive, asc"
494
+ }),
495
+ /*#__PURE__*/ _jsx(MenuItem, {
496
+ value: "alphabetical-ci-desc",
497
+ children: "Alphabetical, case-insensitive, desc"
498
+ })
499
+ ]
500
+ });
501
+ }
320
502
  })
321
503
  })
322
504
  ]
@@ -332,18 +514,24 @@ export function VariableEditForm(props) {
332
514
  children: [
333
515
  /*#__PURE__*/ _jsxs(Stack, {
334
516
  children: [
335
- /*#__PURE__*/ _jsx(FormControlLabel, {
336
- control: /*#__PURE__*/ _jsx(Switch, {
337
- checked: state.listVariableFields.allowMultiple,
338
- readOnly: action === 'read',
339
- onChange: (e)=>{
340
- if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
341
- setState((draft)=>{
342
- draft.listVariableFields.allowMultiple = e.target.checked;
343
- });
344
- }
345
- }),
346
- label: "Allow Multiple Values"
517
+ /*#__PURE__*/ _jsx(Controller, {
518
+ name: "listVariableFields.allowMultiple",
519
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
520
+ label: "Allow Multiple Values",
521
+ control: /*#__PURE__*/ _jsx(Switch, {
522
+ ...field,
523
+ checked: !!field.value,
524
+ readOnly: action === 'read',
525
+ value: state.listVariableFields.allowMultiple,
526
+ onChange: (event)=>{
527
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
528
+ field.onChange(event);
529
+ setState((draft)=>{
530
+ draft.listVariableFields.allowMultiple = event.target.checked;
531
+ });
532
+ }
533
+ })
534
+ })
347
535
  }),
348
536
  /*#__PURE__*/ _jsx(Typography, {
349
537
  variant: "caption",
@@ -353,40 +541,59 @@ export function VariableEditForm(props) {
353
541
  }),
354
542
  /*#__PURE__*/ _jsxs(Stack, {
355
543
  children: [
356
- /*#__PURE__*/ _jsx(FormControlLabel, {
357
- control: /*#__PURE__*/ _jsx(Switch, {
358
- checked: state.listVariableFields.allowAll,
359
- readOnly: action === 'read',
360
- onChange: (e)=>{
361
- if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
362
- setState((draft)=>{
363
- draft.listVariableFields.allowAll = e.target.checked;
364
- });
365
- }
366
- }),
367
- label: "Allow All option"
544
+ /*#__PURE__*/ _jsx(Controller, {
545
+ name: "listVariableFields.allowAllValue",
546
+ render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
547
+ label: "Allow All option",
548
+ control: /*#__PURE__*/ _jsx(Switch, {
549
+ ...field,
550
+ checked: !!field.value,
551
+ readOnly: action === 'read',
552
+ value: state.listVariableFields.allowAllValue,
553
+ onChange: (event)=>{
554
+ if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
555
+ field.onChange(event);
556
+ setState((draft)=>{
557
+ draft.listVariableFields.allowAllValue = event.target.checked;
558
+ });
559
+ }
560
+ })
561
+ })
368
562
  }),
369
563
  /*#__PURE__*/ _jsx(Typography, {
370
564
  mb: 1,
371
565
  variant: "caption",
372
566
  children: "Enables an option to include all variable values"
373
567
  }),
374
- state.listVariableFields.allowAll && /*#__PURE__*/ _jsx(TextField, {
375
- label: "Custom All Value",
376
- value: state.listVariableFields.customAllValue,
377
- InputProps: {
378
- readOnly: action === 'read'
379
- },
380
- onChange: (e)=>{
381
- setState((draft)=>{
382
- if (e.target.value) {
383
- draft.listVariableFields.customAllValue = e.target.value;
384
- } else {
385
- draft.listVariableFields.customAllValue = undefined;
568
+ state.listVariableFields.allowAllValue && /*#__PURE__*/ _jsx(Controller, {
569
+ name: "listVariableFields.customAllValue",
570
+ render: ({ field , fieldState })=>{
571
+ var _fieldState_error;
572
+ /*#__PURE__*/ return _jsx(TextField, {
573
+ ...field,
574
+ fullWidth: true,
575
+ label: "Custom All Value",
576
+ InputLabelProps: {
577
+ shrink: action === 'read' ? true : undefined
578
+ },
579
+ InputProps: {
580
+ readOnly: action === 'read'
581
+ },
582
+ error: !!fieldState.error,
583
+ helperText: ((_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message) ? fieldState.error.message : 'When All is selected, this value will be used',
584
+ value: (_state_listVariableFields_customAllValue = state.listVariableFields.customAllValue) !== null && _state_listVariableFields_customAllValue !== void 0 ? _state_listVariableFields_customAllValue : '',
585
+ onChange: (event)=>{
586
+ field.onChange(event);
587
+ setState((draft)=>{
588
+ if (event.target.value) {
589
+ draft.listVariableFields.customAllValue = event.target.value;
590
+ } else {
591
+ draft.listVariableFields.customAllValue = undefined;
592
+ }
593
+ });
386
594
  }
387
595
  });
388
- },
389
- helperText: "When All is selected, this value will be used"
596
+ }
390
597
  })
391
598
  ]
392
599
  })
@@ -398,13 +605,13 @@ export function VariableEditForm(props) {
398
605
  }),
399
606
  /*#__PURE__*/ _jsx(DiscardChangesConfirmationDialog, {
400
607
  description: "Are you sure you want to discard these changes? Changes cannot be recovered.",
401
- isOpen: isDiscardDialogStateOpened,
608
+ isOpen: isDiscardDialogOpened,
402
609
  onCancel: ()=>{
403
- setDiscardDialogStateOpened(false);
610
+ setDiscardDialogOpened(false);
404
611
  },
405
612
  onDiscardChanges: ()=>{
406
- setDiscardDialogStateOpened(false);
407
- onCancel();
613
+ setDiscardDialogOpened(false);
614
+ onClose();
408
615
  }
409
616
  })
410
617
  ]