@jbrowse/plugin-variants 2.18.0 → 3.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 (272) hide show
  1. package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +1 -1
  2. package/dist/LinearVariantDisplay/model.d.ts +5 -5
  3. package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +7 -0
  4. package/dist/MultiLinearVariantDisplay/components/Crosshair.js +35 -0
  5. package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +1 -2
  6. package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +5 -49
  7. package/dist/MultiLinearVariantDisplay/index.js +18 -8
  8. package/dist/MultiLinearVariantDisplay/model.d.ts +113 -40
  9. package/dist/MultiLinearVariantDisplay/model.js +24 -176
  10. package/dist/MultiLinearVariantDisplay/renderSvg.d.ts +1 -2
  11. package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -5
  12. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +7 -0
  13. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +28 -0
  14. package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +1 -2
  15. package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +13 -16
  16. package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +1 -2
  17. package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +6 -56
  18. package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +109 -27
  19. package/dist/MultiLinearVariantMatrixDisplay/model.js +31 -136
  20. package/dist/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +1 -2
  21. package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +3 -7
  22. package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +4 -32
  23. package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +44 -63
  24. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +3 -2
  25. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +31 -5
  26. package/dist/MultiLinearVariantMatrixRenderer/index.js +2 -2
  27. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +10 -0
  28. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +100 -0
  29. package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +15 -0
  30. package/dist/MultiLinearVariantMatrixRenderer/types.js +2 -0
  31. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +4 -21
  32. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +38 -25
  33. package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +7 -3
  34. package/dist/MultiLinearVariantRenderer/MultiVariantRendering.js +36 -27
  35. package/dist/MultiLinearVariantRenderer/configSchema.d.ts +1 -33
  36. package/dist/MultiLinearVariantRenderer/configSchema.js +0 -5
  37. package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +4 -0
  38. package/dist/MultiLinearVariantRenderer/makeImageData.js +67 -0
  39. package/dist/MultiLinearVariantRenderer/types.d.ts +19 -0
  40. package/dist/MultiLinearVariantRenderer/types.js +2 -0
  41. package/dist/MultiVariantBaseRenderer.d.ts +4 -4
  42. package/dist/StructuralVariantChordRenderer/Chord.d.ts +2 -19
  43. package/dist/StructuralVariantChordRenderer/Chord.js +3 -25
  44. package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -3
  45. package/dist/StructuralVariantChordRenderer/ReactComponent.js +7 -29
  46. package/dist/StructuralVariantChordRenderer/types.d.ts +17 -0
  47. package/dist/StructuralVariantChordRenderer/types.js +2 -0
  48. package/dist/Tooltip.d.ts +2 -2
  49. package/dist/Tooltip.js +6 -32
  50. package/dist/VariantFeatureWidget/Checkbox2.d.ts +1 -2
  51. package/dist/VariantFeatureWidget/Checkbox2.js +2 -5
  52. package/dist/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -3
  53. package/dist/VariantFeatureWidget/LaunchBreakendPanel.js +66 -69
  54. package/dist/VariantFeatureWidget/LaunchBreakendWidgetArea.d.ts +4 -0
  55. package/dist/VariantFeatureWidget/LaunchBreakendWidgetArea.js +60 -0
  56. package/dist/VariantFeatureWidget/VariantConsequenceDataGrid.d.ts +5 -0
  57. package/dist/VariantFeatureWidget/VariantConsequenceDataGrid.js +15 -0
  58. package/dist/VariantFeatureWidget/VariantConsequenceDataGridWrapper.d.ts +5 -0
  59. package/dist/VariantFeatureWidget/VariantConsequenceDataGridWrapper.js +20 -0
  60. package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +5 -0
  61. package/dist/VariantFeatureWidget/VariantConsequencePanel.js +15 -0
  62. package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -2
  63. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +47 -36
  64. package/dist/VariantFeatureWidget/VariantSampleFilters.d.ts +9 -0
  65. package/dist/VariantFeatureWidget/VariantSampleFilters.js +10 -0
  66. package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -7
  67. package/dist/VariantFeatureWidget/VariantSampleGrid.js +14 -44
  68. package/dist/VariantFeatureWidget/index.js +17 -7
  69. package/dist/VariantFeatureWidget/types.d.ts +16 -0
  70. package/dist/VariantFeatureWidget/types.js +2 -0
  71. package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +10 -27
  72. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +12 -7
  73. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +27 -37
  74. package/dist/VcfAdapter/VcfAdapter.d.ts +7 -0
  75. package/dist/VcfAdapter/VcfAdapter.js +29 -3
  76. package/dist/VcfAdapter/configSchema.d.ts +8 -0
  77. package/dist/VcfAdapter/configSchema.js +12 -1
  78. package/dist/VcfAdapter/index.js +17 -7
  79. package/dist/VcfFeature/index.js +2 -1
  80. package/dist/VcfFeature/util.js +3 -4
  81. package/dist/VcfTabixAdapter/VcfTabixAdapter.js +38 -12
  82. package/dist/VcfTabixAdapter/configSchema.d.ts +8 -0
  83. package/dist/VcfTabixAdapter/configSchema.js +8 -0
  84. package/dist/VcfTabixAdapter/index.js +17 -7
  85. package/dist/extensionPoints.js +21 -33
  86. package/dist/getMultiVariantFeaturesAutorun.d.ts +4 -7
  87. package/dist/getMultiVariantFeaturesAutorun.js +16 -15
  88. package/dist/getMultiVariantSourcesAutorun.d.ts +1 -6
  89. package/dist/shared/BulkEditPanel.d.ts +4 -5
  90. package/dist/shared/BulkEditPanel.js +69 -88
  91. package/dist/shared/ClusterDialog.d.ts +4 -5
  92. package/dist/shared/ClusterDialog.js +45 -86
  93. package/dist/shared/ColorLegend.d.ts +2 -3
  94. package/dist/shared/ColorLegend.js +8 -10
  95. package/dist/shared/HelpfulTips.d.ts +1 -0
  96. package/dist/shared/HelpfulTips.js +7 -0
  97. package/dist/shared/LegendBar.d.ts +3 -3
  98. package/dist/shared/LegendBar.js +6 -12
  99. package/dist/shared/MAFFilterDialog.d.ts +2 -3
  100. package/dist/shared/MAFFilterDialog.js +14 -42
  101. package/dist/shared/MultiVariantBaseModel.d.ts +341 -0
  102. package/dist/shared/MultiVariantBaseModel.js +316 -0
  103. package/dist/shared/MultiVariantTooltip.d.ts +6 -0
  104. package/dist/shared/MultiVariantTooltip.js +23 -0
  105. package/dist/shared/RectBg.d.ts +2 -3
  106. package/dist/shared/RectBg.js +3 -7
  107. package/dist/shared/RowPalettizer.d.ts +2 -3
  108. package/dist/shared/RowPalettizer.js +30 -28
  109. package/dist/shared/SetColorDialog.d.ts +2 -3
  110. package/dist/shared/SetColorDialog.js +26 -65
  111. package/dist/shared/SetMinMaxDialog.d.ts +1 -2
  112. package/dist/shared/SetMinMaxDialog.js +11 -41
  113. package/dist/shared/SetRowHeightDialog.d.ts +8 -0
  114. package/dist/shared/SetRowHeightDialog.js +18 -0
  115. package/dist/shared/SharedVariantMixin.d.ts +7 -7
  116. package/dist/shared/SourcesDataGrid.d.ts +6 -0
  117. package/dist/shared/SourcesDataGrid.js +68 -0
  118. package/dist/shared/SourcesGrid.d.ts +2 -3
  119. package/dist/shared/SourcesGrid.js +5 -134
  120. package/dist/shared/SourcesGridHeader.d.ts +7 -0
  121. package/dist/shared/SourcesGridHeader.js +41 -0
  122. package/dist/shared/multiVariantColor.d.ts +3 -0
  123. package/dist/shared/multiVariantColor.js +50 -0
  124. package/dist/types.d.ts +14 -0
  125. package/dist/types.js +2 -0
  126. package/dist/util.d.ts +6 -9
  127. package/dist/util.js +47 -14
  128. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +1 -1
  129. package/esm/LinearVariantDisplay/model.d.ts +5 -5
  130. package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +7 -0
  131. package/esm/MultiLinearVariantDisplay/components/Crosshair.js +30 -0
  132. package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +1 -2
  133. package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +5 -26
  134. package/esm/MultiLinearVariantDisplay/index.js +1 -1
  135. package/esm/MultiLinearVariantDisplay/model.d.ts +113 -40
  136. package/esm/MultiLinearVariantDisplay/model.js +7 -169
  137. package/esm/MultiLinearVariantDisplay/renderSvg.d.ts +1 -2
  138. package/esm/MultiLinearVariantDisplay/renderSvg.js +2 -5
  139. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +7 -0
  140. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +23 -0
  141. package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +1 -2
  142. package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +13 -13
  143. package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +1 -2
  144. package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +6 -33
  145. package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +109 -27
  146. package/esm/MultiLinearVariantMatrixDisplay/model.js +14 -129
  147. package/esm/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +1 -2
  148. package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +3 -7
  149. package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +4 -32
  150. package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +11 -63
  151. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +3 -2
  152. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +31 -2
  153. package/esm/MultiLinearVariantMatrixRenderer/index.js +1 -1
  154. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +10 -0
  155. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +97 -0
  156. package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +15 -0
  157. package/esm/MultiLinearVariantMatrixRenderer/types.js +1 -0
  158. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +4 -21
  159. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +6 -26
  160. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +7 -3
  161. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +34 -5
  162. package/esm/MultiLinearVariantRenderer/configSchema.d.ts +1 -33
  163. package/esm/MultiLinearVariantRenderer/configSchema.js +0 -2
  164. package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +4 -0
  165. package/esm/MultiLinearVariantRenderer/makeImageData.js +61 -0
  166. package/esm/MultiLinearVariantRenderer/types.d.ts +19 -0
  167. package/esm/MultiLinearVariantRenderer/types.js +1 -0
  168. package/esm/MultiVariantBaseRenderer.d.ts +4 -4
  169. package/esm/StructuralVariantChordRenderer/Chord.d.ts +2 -19
  170. package/esm/StructuralVariantChordRenderer/Chord.js +3 -2
  171. package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -3
  172. package/esm/StructuralVariantChordRenderer/ReactComponent.js +7 -6
  173. package/esm/StructuralVariantChordRenderer/types.d.ts +17 -0
  174. package/esm/StructuralVariantChordRenderer/types.js +1 -0
  175. package/esm/Tooltip.d.ts +2 -2
  176. package/esm/Tooltip.js +6 -9
  177. package/esm/VariantFeatureWidget/Checkbox2.d.ts +1 -2
  178. package/esm/VariantFeatureWidget/Checkbox2.js +2 -2
  179. package/esm/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -3
  180. package/esm/VariantFeatureWidget/LaunchBreakendPanel.js +48 -61
  181. package/esm/VariantFeatureWidget/LaunchBreakendWidgetArea.d.ts +4 -0
  182. package/esm/VariantFeatureWidget/LaunchBreakendWidgetArea.js +24 -0
  183. package/esm/VariantFeatureWidget/VariantConsequenceDataGrid.d.ts +5 -0
  184. package/esm/VariantFeatureWidget/VariantConsequenceDataGrid.js +9 -0
  185. package/esm/VariantFeatureWidget/VariantConsequenceDataGridWrapper.d.ts +5 -0
  186. package/esm/VariantFeatureWidget/VariantConsequenceDataGridWrapper.js +17 -0
  187. package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +5 -0
  188. package/esm/VariantFeatureWidget/VariantConsequencePanel.js +9 -0
  189. package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -2
  190. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +30 -29
  191. package/esm/VariantFeatureWidget/VariantSampleFilters.d.ts +9 -0
  192. package/esm/VariantFeatureWidget/VariantSampleFilters.js +7 -0
  193. package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -7
  194. package/esm/VariantFeatureWidget/VariantSampleGrid.js +15 -22
  195. package/esm/VariantFeatureWidget/types.d.ts +16 -0
  196. package/esm/VariantFeatureWidget/types.js +1 -0
  197. package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +10 -27
  198. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +12 -7
  199. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +27 -37
  200. package/esm/VcfAdapter/VcfAdapter.d.ts +7 -0
  201. package/esm/VcfAdapter/VcfAdapter.js +31 -5
  202. package/esm/VcfAdapter/configSchema.d.ts +8 -0
  203. package/esm/VcfAdapter/configSchema.js +12 -1
  204. package/esm/VcfFeature/index.js +2 -1
  205. package/esm/VcfFeature/util.js +3 -4
  206. package/esm/VcfTabixAdapter/VcfTabixAdapter.js +38 -12
  207. package/esm/VcfTabixAdapter/configSchema.d.ts +8 -0
  208. package/esm/VcfTabixAdapter/configSchema.js +8 -0
  209. package/esm/extensionPoints.js +21 -33
  210. package/esm/getMultiVariantFeaturesAutorun.d.ts +4 -7
  211. package/esm/getMultiVariantFeaturesAutorun.js +16 -15
  212. package/esm/getMultiVariantSourcesAutorun.d.ts +1 -6
  213. package/esm/shared/BulkEditPanel.d.ts +4 -5
  214. package/esm/shared/BulkEditPanel.js +70 -66
  215. package/esm/shared/ClusterDialog.d.ts +4 -5
  216. package/esm/shared/ClusterDialog.js +44 -62
  217. package/esm/shared/ColorLegend.d.ts +2 -3
  218. package/esm/shared/ColorLegend.js +8 -10
  219. package/esm/shared/HelpfulTips.d.ts +1 -0
  220. package/esm/shared/HelpfulTips.js +4 -0
  221. package/esm/shared/LegendBar.d.ts +3 -3
  222. package/esm/shared/LegendBar.js +7 -13
  223. package/esm/shared/MAFFilterDialog.d.ts +2 -3
  224. package/esm/shared/MAFFilterDialog.js +14 -19
  225. package/esm/shared/MultiVariantBaseModel.d.ts +341 -0
  226. package/esm/shared/MultiVariantBaseModel.js +277 -0
  227. package/esm/shared/MultiVariantTooltip.d.ts +6 -0
  228. package/esm/shared/MultiVariantTooltip.js +17 -0
  229. package/esm/shared/RectBg.d.ts +2 -3
  230. package/esm/shared/RectBg.js +3 -4
  231. package/esm/shared/RowPalettizer.d.ts +2 -3
  232. package/esm/shared/RowPalettizer.js +30 -25
  233. package/esm/shared/SetColorDialog.d.ts +2 -3
  234. package/esm/shared/SetColorDialog.js +26 -42
  235. package/esm/shared/SetMinMaxDialog.d.ts +1 -2
  236. package/esm/shared/SetMinMaxDialog.js +11 -18
  237. package/esm/shared/SetRowHeightDialog.d.ts +8 -0
  238. package/esm/shared/SetRowHeightDialog.js +15 -0
  239. package/esm/shared/SharedVariantMixin.d.ts +7 -7
  240. package/esm/shared/SourcesDataGrid.d.ts +6 -0
  241. package/esm/shared/SourcesDataGrid.js +62 -0
  242. package/esm/shared/SourcesGrid.d.ts +2 -3
  243. package/esm/shared/SourcesGrid.js +5 -111
  244. package/esm/shared/SourcesGridHeader.d.ts +7 -0
  245. package/esm/shared/SourcesGridHeader.js +35 -0
  246. package/esm/shared/multiVariantColor.d.ts +3 -0
  247. package/esm/shared/multiVariantColor.js +45 -0
  248. package/esm/types.d.ts +14 -0
  249. package/esm/types.js +1 -0
  250. package/esm/util.d.ts +6 -9
  251. package/esm/util.js +43 -13
  252. package/package.json +6 -7
  253. package/dist/VariantFeatureWidget/AnnotGrid.d.ts +0 -6
  254. package/dist/VariantFeatureWidget/AnnotGrid.js +0 -39
  255. package/dist/VariantFeatureWidget/VariantAnnotationTable.d.ts +0 -6
  256. package/dist/VariantFeatureWidget/VariantAnnotationTable.js +0 -16
  257. package/dist/configSchema.d.ts +0 -34
  258. package/dist/configSchema.js +0 -44
  259. package/dist/shared/DraggableDialog.d.ts +0 -6
  260. package/dist/shared/DraggableDialog.js +0 -62
  261. package/dist/shared/Tooltip.d.ts +0 -18
  262. package/dist/shared/Tooltip.js +0 -38
  263. package/esm/VariantFeatureWidget/AnnotGrid.d.ts +0 -6
  264. package/esm/VariantFeatureWidget/AnnotGrid.js +0 -13
  265. package/esm/VariantFeatureWidget/VariantAnnotationTable.d.ts +0 -6
  266. package/esm/VariantFeatureWidget/VariantAnnotationTable.js +0 -10
  267. package/esm/configSchema.d.ts +0 -34
  268. package/esm/configSchema.js +0 -42
  269. package/esm/shared/DraggableDialog.d.ts +0 -6
  270. package/esm/shared/DraggableDialog.js +0 -34
  271. package/esm/shared/Tooltip.d.ts +0 -18
  272. package/esm/shared/Tooltip.js +0 -33
@@ -1,32 +1,37 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { set1 } from '@jbrowse/core/ui/colors';
3
3
  import { Button } from '@mui/material';
4
4
  import { randomColor } from '../util';
5
5
  export default function RowPalettizer({ setCurrLayout, currLayout, }) {
6
6
  var _a;
7
- return (React.createElement("div", null, Object.keys((_a = currLayout[0]) !== null && _a !== void 0 ? _a : [])
8
- .filter(f => f !== 'name' && f !== 'color')
9
- .map(r => {
10
- return (React.createElement(Button, { key: r, onClick: () => {
11
- const map = new Map();
12
- for (const row of currLayout) {
13
- const val = map.get(row[r]);
14
- if (!val) {
15
- map.set(row[r], 1);
7
+ return (_jsxs("div", { children: ["Create color palette based on...", Object.keys((_a = currLayout[0]) !== null && _a !== void 0 ? _a : [])
8
+ .filter(f => f !== 'name' &&
9
+ f !== 'color' &&
10
+ f !== 'label' &&
11
+ f !== 'id' &&
12
+ f !== 'HP')
13
+ .map(r => (_jsx(Button, { variant: "contained", color: "inherit", onClick: () => {
14
+ const map = new Map();
15
+ for (const row of currLayout) {
16
+ const val = map.get(row[r]);
17
+ if (!val) {
18
+ map.set(row[r], 1);
19
+ }
20
+ else {
21
+ map.set(row[r], val + 1);
22
+ }
16
23
  }
17
- else {
18
- map.set(row[r], val + 1);
19
- }
20
- }
21
- const ret = Object.fromEntries([...map.entries()]
22
- .sort((a, b) => a[1] - b[1])
23
- .map((r, idx) => [r[0], set1[idx] || randomColor(r[0])]));
24
- setCurrLayout(currLayout.map(row => ({
25
- ...row,
26
- color: ret[row[r]],
27
- })));
28
- } },
29
- "Palettize ",
30
- r));
31
- })));
24
+ const ret = Object.fromEntries([...map.entries()]
25
+ .sort((a, b) => a[1] - b[1])
26
+ .map((r, idx) => [r[0], set1[idx] || randomColor(r[0])]));
27
+ setCurrLayout(currLayout.map(row => ({
28
+ ...row,
29
+ color: ret[row[r]],
30
+ })));
31
+ }, children: r }, r))), _jsx(Button, { onClick: () => {
32
+ setCurrLayout(currLayout.map(row => ({
33
+ ...row,
34
+ color: undefined,
35
+ })));
36
+ }, children: "Clear colors" })] }));
32
37
  }
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { type Source } from '../util';
1
+ import type { Source } from '../types';
3
2
  interface ReducedModel {
4
3
  sources?: Source[];
5
4
  setLayout: (s: Source[]) => void;
@@ -8,5 +7,5 @@ interface ReducedModel {
8
7
  export default function SetColorDialog({ model, handleClose, }: {
9
8
  model: ReducedModel;
10
9
  handleClose: () => void;
11
- }): React.JSX.Element;
10
+ }): import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -1,17 +1,21 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import DraggableDialog from '@jbrowse/core/ui/DraggableDialog';
2
4
  import { useLocalStorage } from '@jbrowse/core/util';
3
5
  import { Button, DialogActions, DialogContent } from '@mui/material';
4
6
  import { makeStyles } from 'tss-react/mui';
5
- import DraggableDialog from './DraggableDialog';
6
- import SourcesGrid from './SourcesGrid';
7
7
  import BulkEditPanel from './BulkEditPanel';
8
+ import HelpfulTips from './HelpfulTips';
8
9
  import RowPalettizer from './RowPalettizer';
10
+ import SourcesGrid from './SourcesGrid';
9
11
  const useStyles = makeStyles()({
10
12
  content: {
11
13
  minWidth: 800,
12
14
  },
13
15
  fr: {
14
16
  float: 'right',
17
+ display: 'flex',
18
+ gap: 8,
15
19
  },
16
20
  textAreaFont: {
17
21
  fontFamily: 'Courier New',
@@ -23,43 +27,23 @@ export default function SetColorDialog({ model, handleClose, }) {
23
27
  const [showBulkEditor, setShowBulkEditor] = useState(false);
24
28
  const [currLayout, setCurrLayout] = useState(sources || []);
25
29
  const [showTips, setShowTips] = useLocalStorage('multivariant-showTips', false);
26
- return (React.createElement(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-variant color/arrangement editor" },
27
- React.createElement(DialogContent, { className: classes.content },
28
- React.createElement("div", { className: classes.fr },
29
- React.createElement(Button, { variant: "contained", onClick: () => {
30
- setShowTips(!showTips);
31
- } }, showTips ? 'Hide tips' : 'Show tips'),
32
- React.createElement(Button, { color: "secondary", variant: "contained", onClick: () => {
33
- setShowBulkEditor(!showBulkEditor);
34
- } }, showBulkEditor ? 'Hide bulk row editor' : 'Show Bulk row editor')),
35
- React.createElement("br", null),
36
- showTips ? React.createElement(HelpfulTips, null) : null,
37
- showBulkEditor ? (React.createElement(BulkEditPanel, { currLayout: currLayout, setCurrLayout: setCurrLayout })) : null,
38
- React.createElement(RowPalettizer, { currLayout: currLayout, setCurrLayout: setCurrLayout }),
39
- React.createElement(SourcesGrid, { rows: currLayout, onChange: setCurrLayout, showTips: showTips })),
40
- React.createElement(DialogActions, null,
41
- React.createElement(Button, { variant: "contained", type: "submit", color: "inherit", onClick: () => {
42
- model.clearLayout();
43
- setCurrLayout(model.sources || []);
44
- } }, "Clear custom settings"),
45
- React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
46
- handleClose();
47
- setCurrLayout([...(model.sources || [])]);
48
- } }, "Cancel"),
49
- React.createElement(Button, { variant: "contained", color: "primary", type: "submit", onClick: () => {
50
- model.setLayout(currLayout);
51
- handleClose();
52
- } }, "Submit"))));
53
- }
54
- function HelpfulTips() {
55
- return (React.createElement(React.Fragment, null,
56
- "Helpful tips",
57
- React.createElement("ul", null,
58
- React.createElement("li", null, "You can select rows in the table with the checkboxes"),
59
- React.createElement("li", null, "Multi-select is enabled with shift-click and control-click"),
60
- React.createElement("li", null, "The \"Move selected items up/down\" can re-arrange subtracks"),
61
- React.createElement("li", null, "Sorting the data grid itself can also re-arrange subtracks"),
62
- React.createElement("li", null, "Changes are applied when you hit Submit"),
63
- React.createElement("li", null, "You can click and drag the dialog box to move it on the screen"),
64
- React.createElement("li", null, "Columns in the table can be hidden using a vertical '...' menu on the right side of each column"))));
30
+ return (_jsx(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-variant color/arrangement editor", children: showBulkEditor ? (_jsx(BulkEditPanel, { currLayout: currLayout, onClose: arg => {
31
+ if (arg) {
32
+ setCurrLayout(arg);
33
+ }
34
+ setShowBulkEditor(false);
35
+ } })) : (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { className: classes.content, children: [_jsxs("div", { className: classes.fr, children: [_jsx(Button, { variant: "contained", onClick: () => {
36
+ setShowTips(!showTips);
37
+ }, children: showTips ? 'Hide tips' : 'Show tips' }), _jsx(Button, { color: "secondary", variant: "contained", onClick: () => {
38
+ setShowBulkEditor(!showBulkEditor);
39
+ }, children: "Show Bulk row editor" })] }), showTips ? _jsx(HelpfulTips, {}) : null, _jsx("br", {}), _jsx(RowPalettizer, { currLayout: currLayout, setCurrLayout: setCurrLayout }), _jsx(SourcesGrid, { rows: currLayout, onChange: setCurrLayout, showTips: showTips })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", type: "submit", color: "inherit", onClick: () => {
40
+ model.clearLayout();
41
+ setCurrLayout(model.sources || []);
42
+ }, children: "Clear custom settings" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
43
+ handleClose();
44
+ setCurrLayout([...(model.sources || [])]);
45
+ }, children: "Cancel" }), _jsx(Button, { variant: "contained", color: "primary", type: "submit", onClick: () => {
46
+ model.setLayout(currLayout);
47
+ handleClose();
48
+ }, children: "Submit" })] })] })) }));
65
49
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  export default function SetMinMaxDialog(props: {
3
2
  model: {
4
3
  minScore: number;
@@ -8,4 +7,4 @@ export default function SetMinMaxDialog(props: {
8
7
  setMaxScore: (arg?: number) => void;
9
8
  };
10
9
  handleClose: () => void;
11
- }): React.JSX.Element;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { Dialog } from '@jbrowse/core/ui';
3
4
  import { Button, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
4
5
  export default function SetMinMaxDialog(props) {
@@ -10,21 +11,13 @@ export default function SetMinMaxDialog(props) {
10
11
  ? +max > +min
11
12
  : true;
12
13
  const logOk = scaleType === 'log' && min !== '' && !Number.isNaN(+min) ? +min > 0 : true;
13
- return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Set min/max score for track" },
14
- React.createElement(DialogContent, null,
15
- React.createElement(Typography, null, "Enter min/max score: "),
16
- !ok ? (React.createElement(Typography, { color: "error" }, "Max is greater than or equal to min")) : null,
17
- !logOk ? (React.createElement(Typography, { color: "error" }, "Min score should be greater than 0 for log scale")) : null,
18
- React.createElement(TextField, { value: min, onChange: event => {
19
- setMin(event.target.value);
20
- }, placeholder: "Enter min score" }),
21
- React.createElement(TextField, { value: max, onChange: event => {
22
- setMax(event.target.value);
23
- }, placeholder: "Enter max score" })),
24
- React.createElement(DialogActions, null,
25
- React.createElement(Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
26
- model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
27
- model.setMaxScore(max !== '' && !Number.isNaN(+max) ? +max : undefined);
28
- handleClose();
29
- } }, "Submit"))));
14
+ return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Set min/max score for track", children: [_jsxs(DialogContent, { children: [_jsx(Typography, { children: "Enter min/max score: " }), !ok ? (_jsx(Typography, { color: "error", children: "Max is greater than or equal to min" })) : null, !logOk ? (_jsx(Typography, { color: "error", children: "Min score should be greater than 0 for log scale" })) : null, _jsx(TextField, { value: min, onChange: event => {
15
+ setMin(event.target.value);
16
+ }, placeholder: "Enter min score" }), _jsx(TextField, { value: max, onChange: event => {
17
+ setMax(event.target.value);
18
+ }, placeholder: "Enter max score" })] }), _jsx(DialogActions, { children: _jsx(Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
19
+ model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
20
+ model.setMaxScore(max !== '' && !Number.isNaN(+max) ? +max : undefined);
21
+ handleClose();
22
+ }, children: "Submit" }) })] }));
30
23
  }
@@ -0,0 +1,8 @@
1
+ import type { Source } from '../types';
2
+ export default function SetRowHeight({ model, handleClose, }: {
3
+ model: {
4
+ rowHeight?: Source[];
5
+ setRowHeight: (arg: number) => void;
6
+ };
7
+ handleClose: () => void;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Dialog } from '@jbrowse/core/ui';
4
+ import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
5
+ export default function SetRowHeight({ model, handleClose, }) {
6
+ const [value, setValue] = useState(`${model.rowHeight}`);
7
+ return (_jsxs(Dialog, { open: true, title: "Set row height", onClose: handleClose, children: [_jsx(DialogContent, { children: _jsx(TextField, { value: value, onChange: event => {
8
+ setValue(event.target.value);
9
+ } }) }), _jsxs(DialogActions, { children: [_jsx(Button, { disabled: Number.isNaN(+value), variant: "contained", onClick: () => {
10
+ model.setRowHeight(+value);
11
+ handleClose();
12
+ }, children: "Submit" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
13
+ handleClose();
14
+ }, children: "Cancel" })] })] }));
15
+ }
@@ -35,7 +35,7 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
35
35
  status?: string;
36
36
  reactElement?: React.ReactElement;
37
37
  };
38
- }) => import("react").JSX.Element | undefined;
38
+ }) => import("react/jsx-runtime").JSX.Element | undefined;
39
39
  renderProps: any;
40
40
  } & {
41
41
  doReload(): void;
@@ -172,13 +172,13 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
172
172
  } & {
173
173
  readonly statsReadyAndRegionNotTooLarge: boolean;
174
174
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
175
- regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
175
+ regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
176
176
  } & {
177
177
  featureIdUnderMouse: undefined | string;
178
178
  contextMenuFeature: undefined | Feature;
179
179
  } & {
180
- readonly DisplayMessageComponent: import("react").FC<any> | undefined;
181
- readonly blockType: "dynamicBlocks" | "staticBlocks";
180
+ readonly DisplayMessageComponent: undefined | React.FC<any>;
181
+ readonly blockType: "staticBlocks" | "dynamicBlocks";
182
182
  readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
183
183
  } & {
184
184
  readonly renderDelay: number;
@@ -205,7 +205,7 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
205
205
  contextMenuItems(): import("@jbrowse/core/ui").MenuItem[];
206
206
  renderProps(): any;
207
207
  } & {
208
- renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
208
+ renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react/jsx-runtime").JSX.Element>;
209
209
  afterAttach(): void;
210
210
  } & {
211
211
  message: undefined | string;
@@ -257,7 +257,7 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
257
257
  status?: string;
258
258
  reactElement?: React.ReactElement;
259
259
  };
260
- }) => import("react").JSX.Element | undefined;
260
+ }) => import("react/jsx-runtime").JSX.Element | undefined;
261
261
  renderProps: any;
262
262
  } & {
263
263
  doReload(): void;
@@ -299,8 +299,8 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
299
299
  };
300
300
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
301
301
  }>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
302
- type: string;
303
302
  id: string;
303
+ type: string;
304
304
  configuration: import("mobx-state-tree").ModelSnapshotType<Record<string, any>>;
305
305
  rpcDriverName: string | undefined;
306
306
  heightPreConfig: number | undefined;
@@ -0,0 +1,6 @@
1
+ import type { Source } from '../types';
2
+ export default function SourcesDataGrid({ rows, onChange, setSelected, }: {
3
+ rows: Source[];
4
+ onChange: (arg: Source[]) => void;
5
+ setSelected: (arg: string[]) => void;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { SanitizedHTML } from '@jbrowse/core/ui';
4
+ import ColorPicker from '@jbrowse/core/ui/ColorPicker';
5
+ import { getStr, measureGridWidth } from '@jbrowse/core/util';
6
+ import { DataGrid } from '@mui/x-data-grid';
7
+ import { makeStyles } from 'tss-react/mui';
8
+ const useStyles = makeStyles()({
9
+ cell: {
10
+ whiteSpace: 'nowrap',
11
+ overflow: 'hidden',
12
+ textOverflow: 'ellipsis',
13
+ },
14
+ });
15
+ export default function SourcesDataGrid({ rows, onChange, setSelected, }) {
16
+ const { classes } = useStyles();
17
+ const { id: _id, name: _name, label: _label, color: _color, baseUri: _baseUri, HP: _HP, ...rest } = rows[0];
18
+ const [currSort, setCurrSort] = useState({
19
+ idx: 0,
20
+ field: null,
21
+ });
22
+ return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, disableRowSelectionOnClick: true, onRowSelectionModelChange: arg => {
23
+ setSelected(arg);
24
+ }, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
25
+ {
26
+ field: 'color',
27
+ headerName: 'Color',
28
+ renderCell: params => {
29
+ const { value, id } = params;
30
+ return (_jsx(ColorPicker, { color: value || 'blue', onChange: c => {
31
+ const elt = rows.find(f => f.name === id);
32
+ if (elt) {
33
+ elt.color = c;
34
+ }
35
+ onChange([...rows]);
36
+ } }));
37
+ },
38
+ },
39
+ {
40
+ field: 'label',
41
+ headerName: 'Name',
42
+ width: measureGridWidth(rows.map(r => r.label)),
43
+ },
44
+ ...Object.keys(rest).map(val => ({
45
+ field: val,
46
+ renderCell: ({ value }) => (_jsx("div", { className: classes.cell, children: _jsx(SanitizedHTML, { html: getStr(value) }) })),
47
+ width: measureGridWidth(rows.map(r => `${r[val]}`)),
48
+ })),
49
+ ], sortModel: [], onSortModelChange: args => {
50
+ const sort = args[0];
51
+ const idx = (currSort.idx + 1) % 2;
52
+ const field = sort.field || currSort.field;
53
+ setCurrSort({ idx, field });
54
+ onChange(field
55
+ ? [...rows].sort((a, b) => {
56
+ const aa = getStr(a[field]);
57
+ const bb = getStr(b[field]);
58
+ return idx === 1 ? aa.localeCompare(bb) : bb.localeCompare(aa);
59
+ })
60
+ : rows);
61
+ } }) }));
62
+ }
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import type { Source } from '../util';
1
+ import type { Source } from '../types';
3
2
  declare function SourcesGrid({ rows, onChange, showTips, }: {
4
3
  rows: Source[];
5
4
  onChange: (arg: Source[]) => void;
6
5
  showTips: boolean;
7
- }): React.JSX.Element;
6
+ }): import("react/jsx-runtime").JSX.Element;
8
7
  export default SourcesGrid;
@@ -1,115 +1,9 @@
1
- import React, { useState } from 'react';
2
- import { SanitizedHTML } from '@jbrowse/core/ui';
3
- import ColorPicker, { ColorPopover } from '@jbrowse/core/ui/ColorPicker';
4
- import { getStr, measureGridWidth } from '@jbrowse/core/util';
5
- import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
6
- import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
7
- import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
8
- import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
9
- import { Button } from '@mui/material';
10
- import { DataGrid } from '@mui/x-data-grid';
11
- import { makeStyles } from 'tss-react/mui';
12
- import { moveDown, moveUp } from './util';
13
- const useStyles = makeStyles()({
14
- cell: {
15
- whiteSpace: 'nowrap',
16
- overflow: 'hidden',
17
- textOverflow: 'ellipsis',
18
- },
19
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import SourcesDataGrid from './SourcesDataGrid';
4
+ import SourcesGridHeader from './SourcesGridHeader';
20
5
  function SourcesGrid({ rows, onChange, showTips, }) {
21
- const { classes } = useStyles();
22
6
  const [selected, setSelected] = useState([]);
23
- const { name: _name, color: _color, baseUri: _baseUri, ...rest } = rows[0];
24
- const [currSort, setCurrSort] = useState({
25
- idx: 0,
26
- field: null,
27
- });
28
- return (React.createElement("div", null,
29
- React.createElement(GridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }),
30
- React.createElement("div", { style: { height: 400, width: '100%' } },
31
- React.createElement(DataGrid, { getRowId: row => row.name, checkboxSelection: true, disableRowSelectionOnClick: true, onRowSelectionModelChange: arg => {
32
- setSelected(arg);
33
- }, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
34
- {
35
- field: 'color',
36
- headerName: 'Color',
37
- renderCell: params => {
38
- const { value, id } = params;
39
- return (React.createElement(ColorPicker, { color: value || 'blue', onChange: c => {
40
- const elt = rows.find(f => f.name === id);
41
- if (elt) {
42
- elt.color = c;
43
- }
44
- onChange([...rows]);
45
- } }));
46
- },
47
- },
48
- {
49
- field: 'name',
50
- headerName: 'Name',
51
- width: measureGridWidth(rows.map(r => r.name)),
52
- },
53
- ...Object.keys(rest).map(val => ({
54
- field: val,
55
- renderCell: ({ value }) => (React.createElement("div", { className: classes.cell },
56
- React.createElement(SanitizedHTML, { html: getStr(value) }))),
57
- width: measureGridWidth(rows.map(r => `${r[val]}`)),
58
- })),
59
- ], sortModel: [], onSortModelChange: args => {
60
- const sort = args[0];
61
- const idx = (currSort.idx + 1) % 2;
62
- const field = sort.field || currSort.field;
63
- setCurrSort({ idx, field });
64
- onChange(field
65
- ? [...rows].sort((a, b) => {
66
- const aa = getStr(a[field]);
67
- const bb = getStr(b[field]);
68
- return idx === 1
69
- ? aa.localeCompare(bb)
70
- : bb.localeCompare(aa);
71
- })
72
- : rows);
73
- } }))));
74
- }
75
- function GridHeader({ selected, onChange, rows, showTips, }) {
76
- const [anchorEl, setAnchorEl] = useState(null);
77
- const [widgetColor, setWidgetColor] = useState('blue');
78
- return (React.createElement(React.Fragment, null,
79
- React.createElement(Button, { disabled: !selected.length, onClick: event => {
80
- setAnchorEl(event.currentTarget);
81
- } }, "Change color of selected items"),
82
- React.createElement(Button, { onClick: () => {
83
- onChange(moveUp([...rows], selected));
84
- }, disabled: !selected.length },
85
- React.createElement(KeyboardArrowUpIcon, null),
86
- showTips ? 'Move selected items up' : null),
87
- React.createElement(Button, { onClick: () => {
88
- onChange(moveDown([...rows], selected));
89
- }, disabled: !selected.length },
90
- React.createElement(KeyboardArrowDownIcon, null),
91
- showTips ? 'Move selected items down' : null),
92
- React.createElement(Button, { onClick: () => {
93
- onChange(moveUp([...rows], selected, rows.length));
94
- }, disabled: !selected.length },
95
- React.createElement(KeyboardDoubleArrowUpIcon, null),
96
- showTips ? 'Move selected items to top' : null),
97
- React.createElement(Button, { onClick: () => {
98
- onChange(moveDown([...rows], selected, rows.length));
99
- }, disabled: !selected.length },
100
- React.createElement(KeyboardDoubleArrowDownIcon, null),
101
- showTips ? 'Move selected items to bottom' : null),
102
- React.createElement(ColorPopover, { anchorEl: anchorEl, color: widgetColor, onChange: c => {
103
- setWidgetColor(c);
104
- selected.forEach(id => {
105
- const elt = rows.find(f => f.name === id);
106
- if (elt) {
107
- elt.color = c;
108
- }
109
- });
110
- onChange([...rows]);
111
- }, onClose: () => {
112
- setAnchorEl(null);
113
- } })));
7
+ return (_jsxs("div", { children: [_jsx(SourcesGridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }), _jsx(SourcesDataGrid, { rows: rows, onChange: onChange, setSelected: setSelected })] }));
114
8
  }
115
9
  export default SourcesGrid;
@@ -0,0 +1,7 @@
1
+ import type { Source } from '../types';
2
+ export default function SourcesGridHeader({ selected, onChange, rows, showTips, }: {
3
+ onChange: (arg: Source[]) => void;
4
+ rows: Source[];
5
+ selected: string[];
6
+ showTips: boolean;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { ColorPopover } from '@jbrowse/core/ui/ColorPicker';
4
+ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
5
+ import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
6
+ import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
7
+ import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
8
+ import { Button } from '@mui/material';
9
+ import { moveDown, moveUp } from './util';
10
+ export default function SourcesGridHeader({ selected, onChange, rows, showTips, }) {
11
+ const [anchorEl, setAnchorEl] = useState(null);
12
+ const [widgetColor, setWidgetColor] = useState('blue');
13
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { disabled: !selected.length, onClick: event => {
14
+ setAnchorEl(event.currentTarget);
15
+ }, children: "Change color of selected items" }), _jsxs(Button, { onClick: () => {
16
+ onChange(moveUp([...rows], selected));
17
+ }, disabled: !selected.length, children: [_jsx(KeyboardArrowUpIcon, {}), showTips ? 'Move selected items up' : null] }), _jsxs(Button, { onClick: () => {
18
+ onChange(moveDown([...rows], selected));
19
+ }, disabled: !selected.length, children: [_jsx(KeyboardArrowDownIcon, {}), showTips ? 'Move selected items down' : null] }), _jsxs(Button, { onClick: () => {
20
+ onChange(moveUp([...rows], selected, rows.length));
21
+ }, disabled: !selected.length, children: [_jsx(KeyboardDoubleArrowUpIcon, {}), showTips ? 'Move selected items to top' : null] }), _jsxs(Button, { onClick: () => {
22
+ onChange(moveDown([...rows], selected, rows.length));
23
+ }, disabled: !selected.length, children: [_jsx(KeyboardDoubleArrowDownIcon, {}), showTips ? 'Move selected items to bottom' : null] }), _jsx(ColorPopover, { anchorEl: anchorEl, color: widgetColor, onChange: c => {
24
+ setWidgetColor(c);
25
+ selected.forEach(id => {
26
+ const elt = rows.find(f => f.name === id);
27
+ if (elt) {
28
+ elt.color = c;
29
+ }
30
+ });
31
+ onChange([...rows]);
32
+ }, onClose: () => {
33
+ setAnchorEl(null);
34
+ } })] }));
35
+ }
@@ -0,0 +1,3 @@
1
+ export declare function getColorAlleleCount(alleles: string[]): string;
2
+ export declare function getColorPhased(alleles: string[], HP: number): string;
3
+ export declare function getColorPhasedWithPhaseSet(alleles: string[], HP: number, PS: string): string;
@@ -0,0 +1,45 @@
1
+ import { set1 } from '@jbrowse/core/ui/colors';
2
+ import { colord } from '@jbrowse/core/util/colord';
3
+ import { colorify } from '../util';
4
+ export function getColorAlleleCount(alleles) {
5
+ const total = alleles.length;
6
+ let alt = 0;
7
+ let uncalled = 0;
8
+ let alt2 = 0;
9
+ let ref = 0;
10
+ for (const allele of alleles) {
11
+ if (allele === '1') {
12
+ alt++;
13
+ }
14
+ else if (allele === '0') {
15
+ ref++;
16
+ }
17
+ else if (allele === '.') {
18
+ uncalled++;
19
+ }
20
+ else {
21
+ alt2++;
22
+ }
23
+ }
24
+ if (ref === total) {
25
+ return `#ccc`;
26
+ }
27
+ else {
28
+ let a1 = colord(`hsl(200,50%,${80 - (alt / total) * 50}%)`);
29
+ if (alt2) {
30
+ a1 = a1.mix(`hsla(0,100%,20%,${alt2 / total})`);
31
+ }
32
+ if (uncalled) {
33
+ a1 = a1.mix(`hsla(50,50%,50%,${uncalled / total / 2})`);
34
+ }
35
+ return a1.toHex();
36
+ }
37
+ }
38
+ export function getColorPhased(alleles, HP) {
39
+ const c = +alleles[HP];
40
+ return c ? set1[c - 1] || 'black' : '#ccc';
41
+ }
42
+ export function getColorPhasedWithPhaseSet(alleles, HP, PS) {
43
+ const c = +alleles[HP];
44
+ return c ? colorify(+PS) || 'black' : '#ccc';
45
+ }
package/esm/types.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export interface Source {
2
+ baseUri?: string;
3
+ name: string;
4
+ label?: string;
5
+ color?: string;
6
+ group?: string;
7
+ HP?: number;
8
+ id?: string;
9
+ [key: string]: unknown;
10
+ }
11
+ export interface SampleInfo {
12
+ isPhased: boolean;
13
+ maxPloidy: number;
14
+ }
package/esm/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};