@jbrowse/plugin-linear-genome-view 2.1.7 → 2.2.1

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 (147) 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/components/Tooltip.d.ts +1 -1
  5. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +149 -4
  6. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  7. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  8. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  9. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  10. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  11. package/dist/BasicTrack/configSchema.d.ts +3 -0
  12. package/dist/BasicTrack/configSchema.js +18 -0
  13. package/dist/BasicTrack/configSchema.js.map +1 -0
  14. package/dist/BasicTrack/index.d.ts +3 -0
  15. package/dist/BasicTrack/index.js +18 -0
  16. package/dist/BasicTrack/index.js.map +1 -0
  17. package/dist/FeatureTrack/configSchema.d.ts +3 -0
  18. package/dist/FeatureTrack/configSchema.js +21 -0
  19. package/dist/FeatureTrack/configSchema.js.map +1 -0
  20. package/dist/FeatureTrack/index.d.ts +3 -0
  21. package/dist/FeatureTrack/index.js +18 -0
  22. package/dist/FeatureTrack/index.js.map +1 -0
  23. package/dist/LinearBareDisplay/configSchema.d.ts +5 -1
  24. package/dist/LinearBareDisplay/configSchema.js +12 -1
  25. package/dist/LinearBareDisplay/configSchema.js.map +1 -1
  26. package/dist/LinearBareDisplay/model.d.ts +16 -0
  27. package/dist/LinearBareDisplay/model.js +16 -0
  28. package/dist/LinearBareDisplay/model.js.map +1 -1
  29. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -1
  30. package/dist/LinearBasicDisplay/configSchema.js +16 -1
  31. package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
  32. package/dist/LinearBasicDisplay/model.d.ts +79 -8
  33. package/dist/LinearBasicDisplay/model.js +167 -111
  34. package/dist/LinearBasicDisplay/model.js.map +1 -1
  35. package/dist/LinearGenomeView/components/CenterLine.d.ts +1 -1
  36. package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  37. package/dist/LinearGenomeView/components/Gridlines.d.ts +1 -1
  38. package/dist/LinearGenomeView/components/Header.d.ts +1 -1
  39. package/dist/LinearGenomeView/components/ImportForm.d.ts +1 -1
  40. package/dist/LinearGenomeView/components/ImportForm.js +38 -31
  41. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
  42. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  43. package/dist/LinearGenomeView/components/LinearGenomeView.js +2 -24
  44. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  45. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  46. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  47. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  48. package/dist/LinearGenomeView/components/OverviewRubberBand.d.ts +1 -1
  49. package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +27 -35
  50. package/dist/LinearGenomeView/components/RubberBand.d.ts +1 -1
  51. package/dist/LinearGenomeView/components/ScaleBar.d.ts +1 -1
  52. package/dist/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  53. package/dist/LinearGenomeView/components/TrackContainer.js +12 -9
  54. package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
  55. package/dist/LinearGenomeView/components/TrackLabel.js +9 -1
  56. package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
  57. package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  58. package/dist/LinearGenomeView/index.d.ts +273 -18
  59. package/dist/LinearGenomeView/index.js +409 -90
  60. package/dist/LinearGenomeView/index.js.map +1 -1
  61. package/dist/index.d.ts +30 -90
  62. package/dist/index.js +4 -25
  63. package/dist/index.js.map +1 -1
  64. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +2 -2
  65. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +2 -22
  66. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
  67. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +1 -1
  68. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +149 -4
  69. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +600 -464
  70. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
  71. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +19 -1
  72. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
  73. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  74. package/esm/BasicTrack/configSchema.d.ts +3 -0
  75. package/esm/BasicTrack/configSchema.js +16 -0
  76. package/esm/BasicTrack/configSchema.js.map +1 -0
  77. package/esm/BasicTrack/index.d.ts +3 -0
  78. package/esm/BasicTrack/index.js +13 -0
  79. package/esm/BasicTrack/index.js.map +1 -0
  80. package/esm/FeatureTrack/configSchema.d.ts +3 -0
  81. package/esm/FeatureTrack/configSchema.js +19 -0
  82. package/esm/FeatureTrack/configSchema.js.map +1 -0
  83. package/esm/FeatureTrack/index.d.ts +3 -0
  84. package/esm/FeatureTrack/index.js +13 -0
  85. package/esm/FeatureTrack/index.js.map +1 -0
  86. package/esm/LinearBareDisplay/configSchema.d.ts +5 -1
  87. package/esm/LinearBareDisplay/configSchema.js +14 -2
  88. package/esm/LinearBareDisplay/configSchema.js.map +1 -1
  89. package/esm/LinearBareDisplay/model.d.ts +16 -0
  90. package/esm/LinearBareDisplay/model.js +16 -0
  91. package/esm/LinearBareDisplay/model.js.map +1 -1
  92. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -1
  93. package/esm/LinearBasicDisplay/configSchema.js +18 -2
  94. package/esm/LinearBasicDisplay/configSchema.js.map +1 -1
  95. package/esm/LinearBasicDisplay/model.d.ts +79 -8
  96. package/esm/LinearBasicDisplay/model.js +167 -111
  97. package/esm/LinearBasicDisplay/model.js.map +1 -1
  98. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  99. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +1 -1
  100. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  101. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  102. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  103. package/esm/LinearGenomeView/components/ImportForm.js +40 -33
  104. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
  105. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  106. package/esm/LinearGenomeView/components/LinearGenomeView.js +3 -25
  107. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
  108. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +1 -1
  109. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +7 -5
  110. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
  111. package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +1 -1
  112. package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +27 -35
  113. package/esm/LinearGenomeView/components/RubberBand.d.ts +1 -1
  114. package/esm/LinearGenomeView/components/ScaleBar.d.ts +1 -1
  115. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  116. package/esm/LinearGenomeView/components/TrackContainer.js +13 -10
  117. package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
  118. package/esm/LinearGenomeView/components/TrackLabel.js +9 -1
  119. package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
  120. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  121. package/esm/LinearGenomeView/index.d.ts +273 -18
  122. package/esm/LinearGenomeView/index.js +409 -90
  123. package/esm/LinearGenomeView/index.js.map +1 -1
  124. package/esm/index.d.ts +30 -90
  125. package/esm/index.js +4 -25
  126. package/esm/index.js.map +1 -1
  127. package/package.json +2 -2
  128. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +2 -24
  129. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +695 -555
  130. package/src/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.ts +20 -1
  131. package/src/BasicTrack/configSchema.ts +23 -0
  132. package/src/BasicTrack/index.ts +18 -0
  133. package/src/FeatureTrack/configSchema.ts +27 -0
  134. package/src/FeatureTrack/index.ts +21 -0
  135. package/src/LinearBareDisplay/configSchema.ts +15 -2
  136. package/src/LinearBareDisplay/model.ts +16 -0
  137. package/src/LinearBasicDisplay/configSchema.ts +19 -2
  138. package/src/LinearBasicDisplay/model.ts +63 -11
  139. package/src/LinearGenomeView/components/ImportForm.tsx +85 -67
  140. package/src/LinearGenomeView/components/LinearGenomeView.tsx +3 -33
  141. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +21 -18
  142. package/src/LinearGenomeView/components/TrackContainer.tsx +38 -27
  143. package/src/LinearGenomeView/components/TrackLabel.tsx +10 -1
  144. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +204 -204
  145. package/src/LinearGenomeView/index.test.ts +33 -26
  146. package/src/LinearGenomeView/index.tsx +471 -133
  147. 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,18 @@
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 (pm: PluginManager) => {
9
+ pm.addTrackType(() => {
10
+ const configSchema = configSchemaF(pm)
11
+
12
+ return new TrackType({
13
+ name: 'BasicTrack',
14
+ configSchema,
15
+ stateModel: createBaseTrackModel(pm, 'BasicTrack', configSchema),
16
+ })
17
+ })
18
+ }
@@ -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,16 +1,24 @@
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'
14
+
15
+ // icons
8
16
  import CloseIcon from '@mui/icons-material/Close'
9
17
 
10
18
  // locals
11
19
  import RefNameAutocomplete from './RefNameAutocomplete'
12
20
  import { fetchResults, splitLast } from './util'
13
- import { LinearGenomeViewModel, WIDGET_HEIGHT } from '..'
21
+ import { LinearGenomeViewModel } from '..'
14
22
  const SearchResultsDialog = lazy(() => import('./SearchResultsDialog'))
15
23
 
16
24
  const useStyles = makeStyles()(theme => ({
@@ -33,7 +41,6 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
33
41
  const { assemblyNames, assemblyManager, textSearchManager } = session
34
42
  const { rankSearchResults, isSearchDialogDisplayed, error } = model
35
43
  const [selectedAsm, setSelectedAsm] = useState(assemblyNames[0])
36
- const [importError, setImportError] = useState(error)
37
44
  const [option, setOption] = useState<BaseResult>()
38
45
 
39
46
  const searchScope = model.searchScope(selectedAsm)
@@ -43,9 +50,17 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
43
50
  ? assembly?.error
44
51
  : 'No configured assemblies'
45
52
  const regions = assembly?.regions || []
46
- const err = assemblyError || importError
47
- const [myVal, setValue] = useState('')
48
- const value = myVal || regions[0]?.refName
53
+ const displayError = assemblyError || error
54
+ const [value, setValue] = useState('')
55
+ const r0 = regions[0]?.refName
56
+
57
+ // useEffect resets to an "initial state" of displaying first region from assembly
58
+ // after assembly change. needs to react to selectedAsm as well as r0 because changing
59
+ // assembly will run setValue('') and then r0 may not change if assembly names are the
60
+ // same across assemblies, but it still needs to be reset
61
+ useEffect(() => {
62
+ setValue(r0)
63
+ }, [r0, selectedAsm])
49
64
 
50
65
  function navToOption(option: BaseResult) {
51
66
  const location = option.getLocation()
@@ -100,13 +115,11 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
100
115
  }
101
116
  }
102
117
 
103
- const height = WIDGET_HEIGHT + 5
104
-
105
118
  // implementation notes:
106
119
  // having this wrapped in a form allows intuitive use of enter key to submit
107
120
  return (
108
121
  <div className={classes.container}>
109
- {err ? <ErrorMessage error={err} /> : null}
122
+ {displayError ? <ErrorMessage error={displayError} /> : null}
110
123
  <Container className={classes.importFormContainer}>
111
124
  <form
112
125
  onSubmit={event => {
@@ -124,47 +137,48 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
124
137
  alignItems="center"
125
138
  >
126
139
  <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
- />
140
+ <FormControl>
141
+ <AssemblySelector
142
+ onChange={val => {
143
+ setSelectedAsm(val)
144
+ setValue('')
145
+ }}
146
+ session={session}
147
+ selected={selectedAsm}
148
+ />
149
+ </FormControl>
137
150
  </Grid>
138
151
  <Grid item>
139
152
  {selectedAsm ? (
140
- err ? (
153
+ assemblyError ? (
141
154
  <CloseIcon style={{ color: 'red' }} />
142
155
  ) : 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
- />
156
+ <FormControl>
157
+ <RefNameAutocomplete
158
+ fetchResults={queryString =>
159
+ fetchResults({
160
+ queryString,
161
+ assembly,
162
+ textSearchManager,
163
+ rankSearchResults,
164
+ searchScope,
165
+ })
166
+ }
167
+ model={model}
168
+ assemblyName={assemblyError ? undefined : selectedAsm}
169
+ value={value}
170
+ // note: minWidth 270 accomodates full width of helperText
171
+ minWidth={270}
172
+ onChange={str => setValue(str)}
173
+ onSelect={val => setOption(val)}
174
+ TextFieldProps={{
175
+ variant: 'outlined',
176
+ helperText:
177
+ 'Enter sequence name, feature name, or location',
178
+ style: { minWidth: '175px' },
179
+ }}
180
+ />
181
+ </FormControl>
168
182
  ) : (
169
183
  <CircularProgress
170
184
  role="progressbar"
@@ -175,27 +189,31 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
175
189
  ) : null}
176
190
  </Grid>
177
191
  <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>
192
+ <FormControl>
193
+ <Button
194
+ type="submit"
195
+ disabled={!value}
196
+ className={classes.button}
197
+ variant="contained"
198
+ color="primary"
199
+ >
200
+ Open
201
+ </Button>
202
+ </FormControl>
203
+ <FormControl>
204
+ <Button
205
+ disabled={!value}
206
+ className={classes.button}
207
+ onClick={() => {
208
+ model.setError(undefined)
209
+ model.showAllRegionsInAssembly(selectedAsm)
210
+ }}
211
+ variant="contained"
212
+ color="secondary"
213
+ >
214
+ Show all regions in assembly
215
+ </Button>
216
+ </FormControl>
199
217
  </Grid>
200
218
  </Grid>
201
219
  </form>