@jbrowse/plugin-linear-genome-view 2.1.6 → 2.2.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 (109) hide show
  1. package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +2 -2
  2. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +2 -22
  3. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  4. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +146 -1
  5. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  6. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  7. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  8. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  9. package/dist/BasicTrack/configSchema.d.ts +3 -0
  10. package/dist/BasicTrack/configSchema.js +18 -0
  11. package/dist/BasicTrack/configSchema.js.map +1 -0
  12. package/dist/BasicTrack/index.d.ts +3 -0
  13. package/dist/BasicTrack/index.js +18 -0
  14. package/dist/BasicTrack/index.js.map +1 -0
  15. package/dist/FeatureTrack/configSchema.d.ts +3 -0
  16. package/dist/FeatureTrack/configSchema.js +21 -0
  17. package/dist/FeatureTrack/configSchema.js.map +1 -0
  18. package/dist/FeatureTrack/index.d.ts +3 -0
  19. package/dist/FeatureTrack/index.js +18 -0
  20. package/dist/FeatureTrack/index.js.map +1 -0
  21. package/dist/LinearBareDisplay/configSchema.d.ts +5 -1
  22. package/dist/LinearBareDisplay/configSchema.js +12 -1
  23. package/dist/LinearBareDisplay/configSchema.js.map +1 -1
  24. package/dist/LinearBareDisplay/model.d.ts +16 -0
  25. package/dist/LinearBareDisplay/model.js +16 -0
  26. package/dist/LinearBareDisplay/model.js.map +1 -1
  27. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -1
  28. package/dist/LinearBasicDisplay/configSchema.js +16 -1
  29. package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
  30. package/dist/LinearBasicDisplay/model.d.ts +77 -6
  31. package/dist/LinearBasicDisplay/model.js +167 -111
  32. package/dist/LinearBasicDisplay/model.js.map +1 -1
  33. package/dist/LinearGenomeView/components/ImportForm.js +34 -28
  34. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
  35. package/dist/LinearGenomeView/components/LinearGenomeView.js +1 -21
  36. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  37. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  38. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  39. package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +26 -34
  40. package/dist/LinearGenomeView/index.d.ts +189 -15
  41. package/dist/LinearGenomeView/index.js +266 -27
  42. package/dist/LinearGenomeView/index.js.map +1 -1
  43. package/dist/index.d.ts +12 -84
  44. package/dist/index.js +4 -25
  45. package/dist/index.js.map +1 -1
  46. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +2 -2
  47. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +2 -22
  48. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  49. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +146 -1
  50. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  51. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  52. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  53. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  54. package/esm/BasicTrack/configSchema.d.ts +3 -0
  55. package/esm/BasicTrack/configSchema.js +16 -0
  56. package/esm/BasicTrack/configSchema.js.map +1 -0
  57. package/esm/BasicTrack/index.d.ts +3 -0
  58. package/esm/BasicTrack/index.js +13 -0
  59. package/esm/BasicTrack/index.js.map +1 -0
  60. package/esm/FeatureTrack/configSchema.d.ts +3 -0
  61. package/esm/FeatureTrack/configSchema.js +19 -0
  62. package/esm/FeatureTrack/configSchema.js.map +1 -0
  63. package/esm/FeatureTrack/index.d.ts +3 -0
  64. package/esm/FeatureTrack/index.js +13 -0
  65. package/esm/FeatureTrack/index.js.map +1 -0
  66. package/esm/LinearBareDisplay/configSchema.d.ts +5 -1
  67. package/esm/LinearBareDisplay/configSchema.js +14 -2
  68. package/esm/LinearBareDisplay/configSchema.js.map +1 -1
  69. package/esm/LinearBareDisplay/model.d.ts +16 -0
  70. package/esm/LinearBareDisplay/model.js +16 -0
  71. package/esm/LinearBareDisplay/model.js.map +1 -1
  72. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -1
  73. package/esm/LinearBasicDisplay/configSchema.js +18 -2
  74. package/esm/LinearBasicDisplay/configSchema.js.map +1 -1
  75. package/esm/LinearBasicDisplay/model.d.ts +77 -6
  76. package/esm/LinearBasicDisplay/model.js +167 -111
  77. package/esm/LinearBasicDisplay/model.js.map +1 -1
  78. package/esm/LinearGenomeView/components/ImportForm.js +36 -30
  79. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
  80. package/esm/LinearGenomeView/components/LinearGenomeView.js +2 -22
  81. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  82. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  83. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  84. package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +26 -34
  85. package/esm/LinearGenomeView/index.d.ts +189 -15
  86. package/esm/LinearGenomeView/index.js +266 -27
  87. package/esm/LinearGenomeView/index.js.map +1 -1
  88. package/esm/index.d.ts +12 -84
  89. package/esm/index.js +4 -25
  90. package/esm/index.js.map +1 -1
  91. package/package.json +2 -2
  92. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +2 -24
  93. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +695 -555
  94. package/src/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.ts +20 -1
  95. package/src/BasicTrack/configSchema.ts +23 -0
  96. package/src/BasicTrack/index.ts +22 -0
  97. package/src/FeatureTrack/configSchema.ts +27 -0
  98. package/src/FeatureTrack/index.ts +21 -0
  99. package/src/LinearBareDisplay/configSchema.ts +15 -2
  100. package/src/LinearBareDisplay/model.ts +16 -0
  101. package/src/LinearBasicDisplay/configSchema.ts +19 -2
  102. package/src/LinearBasicDisplay/model.ts +63 -11
  103. package/src/LinearGenomeView/components/ImportForm.tsx +79 -63
  104. package/src/LinearGenomeView/components/LinearGenomeView.tsx +2 -26
  105. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +21 -18
  106. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +204 -204
  107. package/src/LinearGenomeView/index.test.ts +33 -26
  108. package/src/LinearGenomeView/index.tsx +317 -60
  109. package/src/index.ts +6 -46
@@ -1,14 +1,28 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
2
 
3
+ /**
4
+ * #config BaseLinearDisplay
5
+ * BaseLinearDisplay is a "base" config that is extended by classes like
6
+ * "LinearBasicDisplay" (used for feature tracks, etc) and "LinearBareDisplay"
7
+ * (more stripped down than even the basic display, not commonly used)
8
+ */
9
+ function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
10
+
3
11
  export const baseLinearDisplayConfigSchema = ConfigurationSchema(
4
12
  'BaseLinearDisplay',
5
13
  {
14
+ /**
15
+ * #slot
16
+ */
6
17
  maxFeatureScreenDensity: {
7
18
  type: 'number',
8
19
  description:
9
20
  'maximum features per pixel that is displayed in the view, used if byte size estimates not available',
10
21
  defaultValue: 0.3,
11
22
  },
23
+ /**
24
+ * #slot
25
+ */
12
26
  fetchSizeLimit: {
13
27
  type: 'number',
14
28
  defaultValue: 1_000_000,
@@ -16,5 +30,10 @@ export const baseLinearDisplayConfigSchema = ConfigurationSchema(
16
30
  "maximum data to attempt to download for a given track, used if adapter doesn't specify one",
17
31
  },
18
32
  },
19
- { explicitIdentifier: 'displayId' },
33
+ {
34
+ /**
35
+ * #identifier
36
+ */
37
+ explicitIdentifier: 'displayId',
38
+ },
20
39
  )
@@ -0,0 +1,23 @@
1
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+
5
+ /**
6
+ * #config BasicTrack
7
+ * synonym for FeatureTrack
8
+ */
9
+ function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
10
+
11
+ const configSchema = (pluginManager: PluginManager) =>
12
+ ConfigurationSchema(
13
+ 'BasicTrack',
14
+ {},
15
+ {
16
+ /**
17
+ * #baseConfiguration
18
+ */
19
+ baseConfiguration: createBaseTrackConfig(pluginManager),
20
+ explicitIdentifier: 'trackId',
21
+ },
22
+ )
23
+ export default configSchema
@@ -0,0 +1,22 @@
1
+ import {
2
+ createBaseTrackModel,
3
+ TrackType,
4
+ } from '@jbrowse/core/pluggableElementTypes'
5
+ import PluginManager from '@jbrowse/core/PluginManager'
6
+ import configSchemaF from './configSchema'
7
+
8
+ export default (pluginManager: PluginManager) => {
9
+ pluginManager.addTrackType(() => {
10
+ const configSchema = configSchemaF(pluginManager)
11
+
12
+ return new TrackType({
13
+ name: 'BasicTrack',
14
+ configSchema,
15
+ stateModel: createBaseTrackModel(
16
+ pluginManager,
17
+ 'BasicTrack',
18
+ configSchema,
19
+ ),
20
+ })
21
+ })
22
+ }
@@ -0,0 +1,27 @@
1
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+
5
+ /**
6
+ * #config FeatureTrack
7
+ * used for basic gene and feature tracks, generally used with LinearBasicDisplay
8
+ */
9
+ function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
10
+
11
+ const configSchema = (pluginManager: PluginManager) =>
12
+ ConfigurationSchema(
13
+ 'FeatureTrack',
14
+ {},
15
+ {
16
+ /**
17
+ * #baseConfiguration
18
+ */
19
+ baseConfiguration: createBaseTrackConfig(pluginManager),
20
+ /**
21
+ * #identifier
22
+ */
23
+ explicitIdentifier: 'trackId',
24
+ },
25
+ )
26
+
27
+ export default configSchema
@@ -0,0 +1,21 @@
1
+ import {
2
+ createBaseTrackModel,
3
+ TrackType,
4
+ } from '@jbrowse/core/pluggableElementTypes'
5
+ import PluginManager from '@jbrowse/core/PluginManager'
6
+ import configSchemaF from './configSchema'
7
+
8
+ export default (pluginManager: PluginManager) => {
9
+ pluginManager.addTrackType(() => {
10
+ const configSchema = configSchemaF(pluginManager)
11
+ return new TrackType({
12
+ name: 'FeatureTrack',
13
+ configSchema,
14
+ stateModel: createBaseTrackModel(
15
+ pluginManager,
16
+ 'FeatureTrack',
17
+ configSchema,
18
+ ),
19
+ })
20
+ })
21
+ }
@@ -2,13 +2,26 @@ import PluginManager from '@jbrowse/core/PluginManager'
2
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
3
3
  import { baseLinearDisplayConfigSchema } from '../BaseLinearDisplay'
4
4
 
5
- export function configSchemaFactory(pluginManager: PluginManager) {
5
+ /**
6
+ * #config LinearBareDisplay
7
+ */
8
+ function configSchemaFactory(pluginManager: PluginManager) {
6
9
  return ConfigurationSchema(
7
10
  'LinearBareDisplay',
8
- { renderer: pluginManager.pluggableConfigSchemaType('renderer') },
9
11
  {
12
+ /**
13
+ * #slot
14
+ */
15
+ renderer: pluginManager.pluggableConfigSchemaType('renderer'),
16
+ },
17
+ {
18
+ /**
19
+ * #baseConfiguration
20
+ */
10
21
  baseConfiguration: baseLinearDisplayConfigSchema,
11
22
  explicitlyTyped: true,
12
23
  },
13
24
  )
14
25
  }
26
+
27
+ export { configSchemaFactory }
@@ -6,13 +6,23 @@ import { getParentRenderProps } from '@jbrowse/core/util/tracks'
6
6
  import { types } from 'mobx-state-tree'
7
7
  import { BaseLinearDisplay } from '../BaseLinearDisplay'
8
8
 
9
+ /**
10
+ * #stateModel LinearBareDisplay
11
+ * extends `BaseLinearDisplay`
12
+ */
9
13
  export function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
10
14
  return types
11
15
  .compose(
12
16
  'LinearBareDisplay',
13
17
  BaseLinearDisplay,
14
18
  types.model({
19
+ /**
20
+ * #property
21
+ */
15
22
  type: types.literal('LinearBareDisplay'),
23
+ /**
24
+ * #property
25
+ */
16
26
  configuration: ConfigurationReference(configSchema),
17
27
  }),
18
28
  )
@@ -20,6 +30,9 @@ export function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
20
30
  .views(self => {
21
31
  const { renderProps: superRenderProps } = self
22
32
  return {
33
+ /**
34
+ * #method
35
+ */
23
36
  renderProps() {
24
37
  return {
25
38
  ...superRenderProps(),
@@ -29,6 +42,9 @@ export function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
29
42
  }
30
43
  },
31
44
 
45
+ /**
46
+ * #getter
47
+ */
32
48
  get rendererTypeName() {
33
49
  return self.configuration.renderer.type
34
50
  },
@@ -2,10 +2,16 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
2
  import PluginManager from '@jbrowse/core/PluginManager'
3
3
  import { baseLinearDisplayConfigSchema } from '../BaseLinearDisplay'
4
4
 
5
- export default function configSchemaFactory(pluginManager: PluginManager) {
5
+ /**
6
+ * #config LinearBasicDisplay
7
+ */
8
+ function configSchemaFactory(pluginManager: PluginManager) {
6
9
  return ConfigurationSchema(
7
10
  'LinearBasicDisplay',
8
11
  {
12
+ /**
13
+ * #slot
14
+ */
9
15
  mouseover: {
10
16
  type: 'string',
11
17
  description: 'what to display in a given mouseover',
@@ -13,8 +19,19 @@ export default function configSchemaFactory(pluginManager: PluginManager) {
13
19
 
14
20
  contextVariable: ['feature'],
15
21
  },
22
+ /**
23
+ * #slot
24
+ */
16
25
  renderer: pluginManager.pluggableConfigSchemaType('renderer'),
17
26
  },
18
- { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },
27
+ {
28
+ /**
29
+ * #baseConfiguration
30
+ */
31
+ baseConfiguration: baseLinearDisplayConfigSchema,
32
+ explicitlyTyped: true,
33
+ },
19
34
  )
20
35
  }
36
+
37
+ export default configSchemaFactory
@@ -16,29 +16,60 @@ import { BaseLinearDisplay } from '../BaseLinearDisplay'
16
16
 
17
17
  const SetMaxHeightDlg = lazy(() => import('./components/SetMaxHeight'))
18
18
 
19
- const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
20
- types
19
+ /**
20
+ * #stateModel LinearBasicDisplay
21
+ * used by `FeatureTrack`, has simple settings like "show/hide feature labels", etc.
22
+ */
23
+ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
24
+ return types
21
25
  .compose(
22
26
  'LinearBasicDisplay',
23
27
  BaseLinearDisplay,
24
28
  types.model({
29
+ /**
30
+ * #property
31
+ */
25
32
  type: types.literal('LinearBasicDisplay'),
33
+ /**
34
+ * #property
35
+ */
26
36
  trackShowLabels: types.maybe(types.boolean),
37
+ /**
38
+ * #property
39
+ */
27
40
  trackShowDescriptions: types.maybe(types.boolean),
41
+ /**
42
+ * #property
43
+ */
28
44
  trackDisplayMode: types.maybe(types.string),
45
+ /**
46
+ * #property
47
+ */
29
48
  trackMaxHeight: types.maybe(types.number),
49
+ /**
50
+ * #property
51
+ */
30
52
  configuration: ConfigurationReference(configSchema),
31
53
  }),
32
54
  )
33
55
  .views(self => ({
56
+ /**
57
+ * #getter
58
+ */
34
59
  get rendererTypeName() {
35
60
  return getConf(self, ['renderer', 'type'])
36
61
  },
37
62
 
63
+ /**
64
+ * #getter
65
+ */
38
66
  get showLabels() {
39
67
  return self.trackShowLabels ?? getConf(self, ['renderer', 'showLabels'])
40
68
  },
41
69
 
70
+ /**
71
+ * #getter
72
+ */
42
73
  get showDescriptions() {
43
74
  return (
44
75
  self.trackShowDescriptions ??
@@ -46,10 +77,16 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
46
77
  )
47
78
  },
48
79
 
80
+ /**
81
+ * #getter
82
+ */
49
83
  get maxHeight() {
50
84
  return self.trackMaxHeight ?? getConf(self, ['renderer', 'maxHeight'])
51
85
  },
52
86
 
87
+ /**
88
+ * #getter
89
+ */
53
90
  get displayMode() {
54
91
  return (
55
92
  self.trackDisplayMode ?? getConf(self, ['renderer', 'displayMode'])
@@ -57,6 +94,9 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
57
94
  },
58
95
  }))
59
96
  .views(self => ({
97
+ /**
98
+ * #getter
99
+ */
60
100
  get rendererConfig() {
61
101
  const configBlob = getConf(self, ['renderer']) || {}
62
102
  const config = configBlob as Omit<typeof configBlob, symbol>
@@ -75,15 +115,27 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
75
115
  }))
76
116
 
77
117
  .actions(self => ({
118
+ /**
119
+ * #action
120
+ */
78
121
  toggleShowLabels() {
79
122
  self.trackShowLabels = !self.showLabels
80
123
  },
124
+ /**
125
+ * #action
126
+ */
81
127
  toggleShowDescriptions() {
82
128
  self.trackShowDescriptions = !self.showDescriptions
83
129
  },
130
+ /**
131
+ * #action
132
+ */
84
133
  setDisplayMode(val: string) {
85
134
  self.trackDisplayMode = val
86
135
  },
136
+ /**
137
+ * #action
138
+ */
87
139
  setMaxHeight(val: number) {
88
140
  self.trackMaxHeight = val
89
141
  },
@@ -94,19 +146,22 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
94
146
  renderProps: superRenderProps,
95
147
  } = self
96
148
  return {
149
+ /**
150
+ * #method
151
+ */
97
152
  renderProps() {
98
153
  const config = self.rendererConfig
99
154
  const superProps = superRenderProps()
100
-
101
155
  const superPropsOmit = superProps as Omit<typeof superProps, symbol>
102
-
103
156
  return {
104
157
  ...superPropsOmit,
105
-
106
158
  config,
107
159
  }
108
160
  },
109
161
 
162
+ /**
163
+ * #method
164
+ */
110
165
  trackMenuItems(): MenuItem[] {
111
166
  return [
112
167
  ...superTrackMenuItems(),
@@ -115,9 +170,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
115
170
  icon: VisibilityIcon,
116
171
  type: 'checkbox',
117
172
  checked: self.showLabels,
118
- onClick: () => {
119
- self.toggleShowLabels()
120
- },
173
+ onClick: () => self.toggleShowLabels(),
121
174
  },
122
175
  {
123
176
  label: 'Show descriptions',
@@ -136,9 +189,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
136
189
  'collapse',
137
190
  ].map(val => ({
138
191
  label: val,
139
- onClick: () => {
140
- self.setDisplayMode(val)
141
- },
192
+ onClick: () => self.setDisplayMode(val),
142
193
  })),
143
194
  },
144
195
  {
@@ -154,6 +205,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
154
205
  },
155
206
  }
156
207
  })
208
+ }
157
209
 
158
210
  export type FeatureTrackStateModel = ReturnType<typeof stateModelFactory>
159
211
  export type FeatureTrackModel = Instance<FeatureTrackStateModel>
@@ -1,8 +1,14 @@
1
- import React, { useState, lazy } from 'react'
1
+ import React, { useState, useEffect, lazy } from 'react'
2
2
  import { makeStyles } from 'tss-react/mui'
3
3
  import { observer } from 'mobx-react'
4
4
  import { getSession } from '@jbrowse/core/util'
5
- import { Button, CircularProgress, Container, Grid } from '@mui/material'
5
+ import {
6
+ Button,
7
+ CircularProgress,
8
+ FormControl,
9
+ Container,
10
+ Grid,
11
+ } from '@mui/material'
6
12
  import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui'
7
13
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
8
14
  import CloseIcon from '@mui/icons-material/Close'
@@ -10,7 +16,7 @@ import CloseIcon from '@mui/icons-material/Close'
10
16
  // locals
11
17
  import RefNameAutocomplete from './RefNameAutocomplete'
12
18
  import { fetchResults, splitLast } from './util'
13
- import { LinearGenomeViewModel, WIDGET_HEIGHT } from '..'
19
+ import { LinearGenomeViewModel } from '..'
14
20
  const SearchResultsDialog = lazy(() => import('./SearchResultsDialog'))
15
21
 
16
22
  const useStyles = makeStyles()(theme => ({
@@ -44,8 +50,14 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
44
50
  : 'No configured assemblies'
45
51
  const regions = assembly?.regions || []
46
52
  const err = assemblyError || importError
47
- const [myVal, setValue] = useState('')
48
- const value = myVal || regions[0]?.refName
53
+ const [value, setValue] = useState('')
54
+ const r0 = regions[0]?.refName
55
+
56
+ // useEffect resets to an "initial state" of displaying first region from assembly
57
+ // after assembly change
58
+ useEffect(() => {
59
+ setValue(r0)
60
+ }, [r0])
49
61
 
50
62
  function navToOption(option: BaseResult) {
51
63
  const location = option.getLocation()
@@ -100,8 +112,6 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
100
112
  }
101
113
  }
102
114
 
103
- const height = WIDGET_HEIGHT + 5
104
-
105
115
  // implementation notes:
106
116
  // having this wrapped in a form allows intuitive use of enter key to submit
107
117
  return (
@@ -124,47 +134,49 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
124
134
  alignItems="center"
125
135
  >
126
136
  <Grid item>
127
- <AssemblySelector
128
- onChange={val => {
129
- setImportError('')
130
- setSelectedAsm(val)
131
- setValue('')
132
- }}
133
- session={session}
134
- selected={selectedAsm}
135
- InputProps={{ style: { height } }}
136
- />
137
+ <FormControl>
138
+ <AssemblySelector
139
+ onChange={val => {
140
+ setImportError('')
141
+ setSelectedAsm(val)
142
+ setValue('')
143
+ }}
144
+ session={session}
145
+ selected={selectedAsm}
146
+ />
147
+ </FormControl>
137
148
  </Grid>
138
149
  <Grid item>
139
150
  {selectedAsm ? (
140
151
  err ? (
141
152
  <CloseIcon style={{ color: 'red' }} />
142
153
  ) : value ? (
143
- <RefNameAutocomplete
144
- fetchResults={queryString =>
145
- fetchResults({
146
- queryString,
147
- assembly,
148
- textSearchManager,
149
- rankSearchResults,
150
- searchScope,
151
- })
152
- }
153
- model={model}
154
- assemblyName={assemblyError ? undefined : selectedAsm}
155
- value={value}
156
- // note: minWidth 270 accomodates full width of helperText
157
- minWidth={270}
158
- onChange={str => setValue(str)}
159
- onSelect={val => setOption(val)}
160
- TextFieldProps={{
161
- variant: 'outlined',
162
- helperText:
163
- 'Enter sequence name, feature name, or location',
164
- style: { minWidth: '175px' },
165
- InputProps: { style: { height } },
166
- }}
167
- />
154
+ <FormControl>
155
+ <RefNameAutocomplete
156
+ fetchResults={queryString =>
157
+ fetchResults({
158
+ queryString,
159
+ assembly,
160
+ textSearchManager,
161
+ rankSearchResults,
162
+ searchScope,
163
+ })
164
+ }
165
+ model={model}
166
+ assemblyName={assemblyError ? undefined : selectedAsm}
167
+ value={value}
168
+ // note: minWidth 270 accomodates full width of helperText
169
+ minWidth={270}
170
+ onChange={str => setValue(str)}
171
+ onSelect={val => setOption(val)}
172
+ TextFieldProps={{
173
+ variant: 'outlined',
174
+ helperText:
175
+ 'Enter sequence name, feature name, or location',
176
+ style: { minWidth: '175px' },
177
+ }}
178
+ />
179
+ </FormControl>
168
180
  ) : (
169
181
  <CircularProgress
170
182
  role="progressbar"
@@ -175,27 +187,31 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
175
187
  ) : null}
176
188
  </Grid>
177
189
  <Grid item>
178
- <Button
179
- type="submit"
180
- disabled={!value}
181
- className={classes.button}
182
- variant="contained"
183
- color="primary"
184
- >
185
- Open
186
- </Button>
187
- <Button
188
- disabled={!value}
189
- className={classes.button}
190
- onClick={() => {
191
- model.setError(undefined)
192
- model.showAllRegionsInAssembly(selectedAsm)
193
- }}
194
- variant="contained"
195
- color="secondary"
196
- >
197
- Show all regions in assembly
198
- </Button>
190
+ <FormControl>
191
+ <Button
192
+ type="submit"
193
+ disabled={!value}
194
+ className={classes.button}
195
+ variant="contained"
196
+ color="primary"
197
+ >
198
+ Open
199
+ </Button>
200
+ </FormControl>
201
+ <FormControl>
202
+ <Button
203
+ disabled={!value}
204
+ className={classes.button}
205
+ onClick={() => {
206
+ model.setError(undefined)
207
+ model.showAllRegionsInAssembly(selectedAsm)
208
+ }}
209
+ variant="contained"
210
+ color="secondary"
211
+ >
212
+ Show all regions in assembly
213
+ </Button>
214
+ </FormControl>
199
215
  </Grid>
200
216
  </Grid>
201
217
  </form>
@@ -3,7 +3,7 @@ import { Button, Paper, Typography } from '@mui/material'
3
3
  import { makeStyles } from 'tss-react/mui'
4
4
  import { ErrorBoundary } from 'react-error-boundary'
5
5
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
6
- import { ErrorMessage } from '@jbrowse/core/ui'
6
+ import { LoadingEllipses, ErrorMessage } from '@jbrowse/core/ui'
7
7
  import { observer } from 'mobx-react'
8
8
 
9
9
  // locals
@@ -22,26 +22,6 @@ const useStyles = makeStyles()(theme => ({
22
22
  paddingTop: theme.spacing(1),
23
23
  paddingBottom: theme.spacing(1),
24
24
  },
25
- dots: {
26
- '&::after': {
27
- display: 'inline-block',
28
- animation: '$ellipsis 1.5s infinite',
29
- content: '"."',
30
- width: '1em',
31
- textAlign: 'left',
32
- },
33
- },
34
- '@keyframes ellipsis': {
35
- '0%': {
36
- content: '"."',
37
- },
38
- '33%': {
39
- content: '".."',
40
- },
41
- '66%': {
42
- content: '"..."',
43
- },
44
- },
45
25
  }))
46
26
 
47
27
  const LinearGenomeView = observer(({ model }: { model: LGV }) => {
@@ -49,11 +29,7 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
49
29
  const { classes } = useStyles()
50
30
 
51
31
  if (!initialized && !error) {
52
- return (
53
- <Typography className={classes.dots} variant="h5">
54
- Loading
55
- </Typography>
56
- )
32
+ return <LoadingEllipses variant="h5" />
57
33
  }
58
34
  if (!hasDisplayedRegions || error) {
59
35
  return <ImportForm model={model} />