@jbrowse/plugin-linear-genome-view 1.7.9 → 2.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.
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -5
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +118 -226
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Block.js +53 -74
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +11 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +64 -103
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +145 -175
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js +118 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/dist/BaseLinearDisplay/index.js +13 -40
- package/dist/BaseLinearDisplay/index.js.map +1 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +20 -15
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +605 -683
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +15 -22
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +7 -8
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +266 -312
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/dist/LinearBareDisplay/configSchema.js +11 -17
- package/dist/LinearBareDisplay/configSchema.js.map +1 -0
- package/dist/LinearBareDisplay/index.js +7 -20
- package/dist/LinearBareDisplay/index.js.map +1 -0
- package/dist/LinearBareDisplay/model.d.ts +16 -14
- package/dist/LinearBareDisplay/model.js +36 -42
- package/dist/LinearBareDisplay/model.js.map +1 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +76 -85
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/dist/LinearBasicDisplay/configSchema.js +15 -23
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -0
- package/dist/LinearBasicDisplay/index.js +10 -22
- package/dist/LinearBasicDisplay/index.js.map +1 -0
- package/dist/LinearBasicDisplay/model.d.ts +20 -15
- package/dist/LinearBasicDisplay/model.js +180 -159
- package/dist/LinearBasicDisplay/model.js.map +1 -0
- package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -8
- package/dist/LinearGenomeView/components/CenterLine.js +60 -74
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +141 -141
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/Header.js +70 -123
- package/dist/LinearGenomeView/components/Header.js.map +1 -0
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/HelpDialog.js +62 -45
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/ImportForm.js +223 -320
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +64 -120
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +198 -337
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/dist/LinearGenomeView/components/MiniControls.js +64 -78
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +226 -293
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +24 -8
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +277 -365
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +237 -324
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/dist/LinearGenomeView/components/RubberBand.js +229 -296
- package/dist/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/Ruler.js +45 -90
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -0
- package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -399
- package/dist/LinearGenomeView/components/ScaleBar.js +121 -167
- package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchBox.js +158 -205
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +105 -150
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +219 -272
- package/dist/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +116 -156
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +6 -42
- package/dist/LinearGenomeView/components/TrackLabel.js +115 -150
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +172 -199
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/VerticalGuides.d.ts +2 -3
- package/dist/LinearGenomeView/components/VerticalGuides.js +66 -104
- package/dist/LinearGenomeView/components/VerticalGuides.js.map +1 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +72 -87
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/dist/LinearGenomeView/components/util.d.ts +12 -0
- package/dist/LinearGenomeView/components/util.js +95 -13
- package/dist/LinearGenomeView/components/util.js.map +1 -0
- package/dist/LinearGenomeView/index.d.ts +6 -11
- package/dist/LinearGenomeView/index.js +1163 -1387
- package/dist/LinearGenomeView/index.js.map +1 -0
- package/dist/LinearGenomeView/util.js +76 -83
- package/dist/LinearGenomeView/util.js.map +1 -0
- package/dist/index.d.ts +101 -51
- package/dist/index.js +225 -284
- package/dist/index.js.map +1 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +9 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +68 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Block.d.ts +15 -0
- package/esm/BaseLinearDisplay/components/Block.js +46 -0
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +22 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +62 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +113 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js +64 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +5 -0
- package/esm/BaseLinearDisplay/index.js +4 -0
- package/esm/BaseLinearDisplay/index.js.map +1 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +232 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +541 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +14 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +225 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/esm/LinearBareDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBareDisplay/configSchema.js +9 -0
- package/esm/LinearBareDisplay/configSchema.js.map +1 -0
- package/esm/LinearBareDisplay/index.d.ts +2 -0
- package/esm/LinearBareDisplay/index.js +3 -0
- package/esm/LinearBareDisplay/index.js.map +1 -0
- package/esm/LinearBareDisplay/model.d.ts +194 -0
- package/esm/LinearBareDisplay/model.js +28 -0
- package/esm/LinearBareDisplay/model.js.map +1 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +40 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/esm/LinearBasicDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBasicDisplay/configSchema.js +14 -0
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -0
- package/esm/LinearBasicDisplay/index.d.ts +2 -0
- package/esm/LinearBasicDisplay/index.js +3 -0
- package/esm/LinearBasicDisplay/index.js.map +1 -0
- package/esm/LinearBasicDisplay/model.d.ts +218 -0
- package/esm/LinearBasicDisplay/model.js +127 -0
- package/esm/LinearBasicDisplay/model.js.map +1 -0
- package/esm/LinearGenomeView/components/CenterLine.d.ts +8 -0
- package/esm/LinearGenomeView/components/CenterLine.js +40 -0
- package/esm/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +52 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/Header.d.ts +7 -0
- package/esm/LinearGenomeView/components/Header.js +81 -0
- package/esm/LinearGenomeView/components/Header.js.map +1 -0
- package/esm/LinearGenomeView/components/HelpDialog.d.ts +4 -0
- package/esm/LinearGenomeView/components/HelpDialog.js +58 -0
- package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/ImportForm.d.ts +7 -0
- package/esm/LinearGenomeView/components/ImportForm.js +141 -0
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +7 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js +67 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +132 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/esm/LinearGenomeView/components/MiniControls.d.ts +6 -0
- package/esm/LinearGenomeView/components/MiniControls.js +25 -0
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js +194 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +148 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js +287 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +22 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +136 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/esm/LinearGenomeView/components/RubberBand.d.ts +9 -0
- package/esm/LinearGenomeView/components/RubberBand.js +198 -0
- package/esm/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/Ruler.d.ts +27 -0
- package/esm/LinearGenomeView/components/Ruler.js +50 -0
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -0
- package/esm/LinearGenomeView/components/ScaleBar.d.ts +10 -0
- package/esm/LinearGenomeView/components/ScaleBar.js +112 -0
- package/esm/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchBox.d.ts +8 -0
- package/esm/LinearGenomeView/components/SearchBox.js +94 -0
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +7 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +107 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/SequenceDialog.d.ts +8 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js +147 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +9 -0
- package/esm/LinearGenomeView/components/TrackContainer.js +109 -0
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +8 -0
- package/esm/LinearGenomeView/components/TrackLabel.js +89 -0
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +10 -0
- package/esm/LinearGenomeView/components/TracksContainer.js +142 -0
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/VerticalGuides.d.ts +8 -0
- package/esm/LinearGenomeView/components/VerticalGuides.js +71 -0
- package/esm/LinearGenomeView/components/VerticalGuides.js.map +1 -0
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +7 -0
- package/esm/LinearGenomeView/components/ZoomControls.js +32 -0
- package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/esm/LinearGenomeView/components/util.d.ts +14 -0
- package/esm/LinearGenomeView/components/util.js +17 -0
- package/esm/LinearGenomeView/components/util.js.map +1 -0
- package/esm/LinearGenomeView/index.d.ts +288 -0
- package/esm/LinearGenomeView/index.js +1124 -0
- package/esm/LinearGenomeView/index.js.map +1 -0
- package/esm/LinearGenomeView/util.d.ts +14 -0
- package/esm/LinearGenomeView/util.js +62 -0
- package/esm/LinearGenomeView/util.js.map +1 -0
- package/esm/index.d.ts +615 -0
- package/esm/index.js +127 -0
- package/esm/index.js.map +1 -0
- package/package.json +21 -13
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +6 -90
- package/src/BaseLinearDisplay/components/Block.tsx +5 -5
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +4 -4
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +7 -8
- package/src/BaseLinearDisplay/components/Tooltip.tsx +107 -0
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +16 -8
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +10 -7
- package/src/LinearBasicDisplay/model.ts +21 -15
- package/src/LinearGenomeView/components/CenterLine.tsx +6 -11
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +5 -5
- package/src/LinearGenomeView/components/Header.tsx +12 -16
- package/src/LinearGenomeView/components/HelpDialog.tsx +10 -9
- package/src/LinearGenomeView/components/ImportForm.tsx +24 -37
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +18 -8
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +20 -13
- package/src/LinearGenomeView/components/MiniControls.tsx +29 -40
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +6 -10
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +103 -93
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +13 -44
- package/src/LinearGenomeView/components/RubberBand.tsx +12 -17
- package/src/LinearGenomeView/components/Ruler.tsx +5 -11
- package/src/LinearGenomeView/components/ScaleBar.tsx +27 -34
- package/src/LinearGenomeView/components/SearchBox.tsx +22 -32
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +7 -7
- package/src/LinearGenomeView/components/SequenceDialog.tsx +9 -9
- package/src/LinearGenomeView/components/TrackContainer.tsx +12 -12
- package/src/LinearGenomeView/components/TrackLabel.tsx +37 -50
- package/src/LinearGenomeView/components/TracksContainer.tsx +8 -13
- package/src/LinearGenomeView/components/VerticalGuides.tsx +9 -11
- package/src/LinearGenomeView/components/ZoomControls.tsx +12 -13
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +504 -568
- package/src/LinearGenomeView/components/util.ts +43 -0
- package/src/LinearGenomeView/index.test.ts +21 -5
- package/src/LinearGenomeView/index.tsx +101 -88
- package/src/index.ts +36 -31
- package/dist/LinearBareDisplay/index.test.js +0 -33
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +0 -234
- package/dist/LinearGenomeView/components/ScaleBar.test.js +0 -180
- package/dist/LinearGenomeView/index.test.js +0 -1170
- package/dist/LinearGenomeView/util.test.js +0 -78
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
|
|
2
|
+
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
1
3
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
4
|
+
import { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'
|
|
5
|
+
import { TextSearchManager } from '@jbrowse/core/util'
|
|
2
6
|
|
|
3
7
|
export function dedupe(
|
|
4
8
|
results: BaseResult[] = [],
|
|
@@ -8,3 +12,42 @@ export function dedupe(
|
|
|
8
12
|
(elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)),
|
|
9
13
|
)
|
|
10
14
|
}
|
|
15
|
+
|
|
16
|
+
export async function fetchResults({
|
|
17
|
+
queryString,
|
|
18
|
+
searchType,
|
|
19
|
+
searchScope,
|
|
20
|
+
rankSearchResults,
|
|
21
|
+
textSearchManager,
|
|
22
|
+
assembly,
|
|
23
|
+
}: {
|
|
24
|
+
queryString: string
|
|
25
|
+
searchScope: SearchScope
|
|
26
|
+
rankSearchResults: (results: BaseResult[]) => BaseResult[]
|
|
27
|
+
searchType?: SearchType
|
|
28
|
+
textSearchManager?: TextSearchManager
|
|
29
|
+
assembly?: Assembly
|
|
30
|
+
}) {
|
|
31
|
+
if (!textSearchManager) {
|
|
32
|
+
console.warn('No text search manager')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const textSearchResults = await textSearchManager?.search(
|
|
36
|
+
{
|
|
37
|
+
queryString,
|
|
38
|
+
searchType,
|
|
39
|
+
},
|
|
40
|
+
searchScope,
|
|
41
|
+
rankSearchResults,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const refNameResults = assembly?.allRefNames
|
|
45
|
+
?.filter(ref => ref.toLowerCase().startsWith(queryString.toLowerCase()))
|
|
46
|
+
.slice(0, 10)
|
|
47
|
+
.map(r => new BaseResult({ label: r }))
|
|
48
|
+
|
|
49
|
+
return dedupe(
|
|
50
|
+
[...(refNameResults || []), ...(textSearchResults || [])],
|
|
51
|
+
elt => elt.getId(),
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -72,7 +72,7 @@ function initialize() {
|
|
|
72
72
|
})
|
|
73
73
|
.actions(self => ({
|
|
74
74
|
isValidRefName(str: string) {
|
|
75
|
-
return
|
|
75
|
+
return str === 'ctgA' || str === 'ctgB'
|
|
76
76
|
},
|
|
77
77
|
get(str: string) {
|
|
78
78
|
return self.assemblies.get(str)
|
|
@@ -88,6 +88,7 @@ function initialize() {
|
|
|
88
88
|
assemblyManager: types.optional(AssemblyManager, {
|
|
89
89
|
assemblies: {
|
|
90
90
|
volvox: {
|
|
91
|
+
// @ts-ignore
|
|
91
92
|
regions: volvoxDisplayedRegions,
|
|
92
93
|
},
|
|
93
94
|
},
|
|
@@ -989,8 +990,23 @@ test('multi region', () => {
|
|
|
989
990
|
model.navToLocString('ctgA ctgB')
|
|
990
991
|
expect(model.displayedRegions[0].refName).toBe('ctgA')
|
|
991
992
|
expect(model.displayedRegions[1].refName).toBe('ctgB')
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
993
|
+
})
|
|
994
|
+
|
|
995
|
+
test('space separated locstring', () => {
|
|
996
|
+
const { Session, LinearGenomeModel } = initialize()
|
|
997
|
+
const model = Session.create({
|
|
998
|
+
configuration: {},
|
|
999
|
+
}).setView(
|
|
1000
|
+
LinearGenomeModel.create({
|
|
1001
|
+
type: 'LinearGenomeView',
|
|
1002
|
+
tracks: [{ name: 'foo track', type: 'BasicTrack' }],
|
|
1003
|
+
}),
|
|
1004
|
+
)
|
|
1005
|
+
model.setWidth(800)
|
|
1006
|
+
model.setDisplayedRegions(volvoxDisplayedRegions.slice(0, 1))
|
|
1007
|
+
|
|
1008
|
+
model.navToLocString('ctgA 0 100')
|
|
1009
|
+
|
|
1010
|
+
expect(model.offsetPx).toBe(0)
|
|
1011
|
+
expect(model.bpPerPx).toBe(0.125)
|
|
996
1012
|
})
|
|
@@ -39,13 +39,13 @@ import { saveAs } from 'file-saver'
|
|
|
39
39
|
|
|
40
40
|
// icons
|
|
41
41
|
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
|
|
42
|
-
import SyncAltIcon from '@
|
|
43
|
-
import VisibilityIcon from '@
|
|
44
|
-
import LabelIcon from '@
|
|
45
|
-
import FolderOpenIcon from '@
|
|
46
|
-
import PhotoCameraIcon from '@
|
|
47
|
-
import ZoomInIcon from '@
|
|
48
|
-
import MenuOpenIcon from '@
|
|
42
|
+
import SyncAltIcon from '@mui/icons-material/SyncAlt'
|
|
43
|
+
import VisibilityIcon from '@mui/icons-material/Visibility'
|
|
44
|
+
import LabelIcon from '@mui/icons-material/Label'
|
|
45
|
+
import FolderOpenIcon from '@mui/icons-material/FolderOpen'
|
|
46
|
+
import PhotoCameraIcon from '@mui/icons-material/PhotoCamera'
|
|
47
|
+
import ZoomInIcon from '@mui/icons-material/ZoomIn'
|
|
48
|
+
import MenuOpenIcon from '@mui/icons-material/MenuOpen'
|
|
49
49
|
|
|
50
50
|
// locals
|
|
51
51
|
import { renderToSvg } from './components/LinearGenomeViewSvg'
|
|
@@ -127,6 +127,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
127
127
|
),
|
|
128
128
|
hideHeader: false,
|
|
129
129
|
hideHeaderOverview: false,
|
|
130
|
+
hideNoTracksActive: false,
|
|
130
131
|
trackSelectorType: types.optional(
|
|
131
132
|
types.enumeration(['hierarchical']),
|
|
132
133
|
'hierarchical',
|
|
@@ -177,11 +178,18 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
177
178
|
get interRegionPaddingWidth() {
|
|
178
179
|
return INTER_REGION_PADDING_WIDTH
|
|
179
180
|
},
|
|
181
|
+
|
|
182
|
+
get assemblyNames() {
|
|
183
|
+
return [
|
|
184
|
+
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
185
|
+
]
|
|
186
|
+
},
|
|
180
187
|
}))
|
|
181
188
|
.views(self => ({
|
|
182
189
|
get assemblyErrors() {
|
|
183
190
|
const { assemblyManager } = getSession(self)
|
|
184
|
-
|
|
191
|
+
const { assemblyNames } = self
|
|
192
|
+
return assemblyNames
|
|
185
193
|
.map(a => assemblyManager.get(a)?.error)
|
|
186
194
|
.filter(f => !!f)
|
|
187
195
|
.join(', ')
|
|
@@ -189,9 +197,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
189
197
|
|
|
190
198
|
get assembliesInitialized() {
|
|
191
199
|
const { assemblyManager } = getSession(self)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
)
|
|
200
|
+
const { assemblyNames } = self
|
|
201
|
+
return assemblyNames.every(a => assemblyManager.get(a)?.initialized)
|
|
195
202
|
},
|
|
196
203
|
get initialized() {
|
|
197
204
|
return self.volatileWidth !== undefined && this.assembliesInitialized
|
|
@@ -273,11 +280,6 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
273
280
|
}
|
|
274
281
|
},
|
|
275
282
|
|
|
276
|
-
get assemblyNames() {
|
|
277
|
-
return [
|
|
278
|
-
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
279
|
-
]
|
|
280
|
-
},
|
|
281
283
|
searchScope(assemblyName: string) {
|
|
282
284
|
return {
|
|
283
285
|
assemblyName,
|
|
@@ -286,13 +288,6 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
286
288
|
}
|
|
287
289
|
},
|
|
288
290
|
|
|
289
|
-
/**
|
|
290
|
-
* @param refName - refName of the displayedRegion
|
|
291
|
-
* @param coord - coordinate at the displayed Region
|
|
292
|
-
* @param regionNumber - optional param used as identifier when
|
|
293
|
-
* there are multiple displayedRegions with the same refName
|
|
294
|
-
* @returns offsetPx of the displayed region that it lands in
|
|
295
|
-
*/
|
|
296
291
|
bpToPx({
|
|
297
292
|
refName,
|
|
298
293
|
coord,
|
|
@@ -316,8 +311,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
316
311
|
if (bp < 0) {
|
|
317
312
|
const region = self.displayedRegions[0]
|
|
318
313
|
const offset = bp
|
|
314
|
+
const snap = getSnapshot(region)
|
|
319
315
|
return {
|
|
320
|
-
|
|
316
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
317
|
+
...(snap as Omit<typeof snap, symbol>),
|
|
321
318
|
oob: true,
|
|
322
319
|
coord: region.reversed
|
|
323
320
|
? Math.floor(region.end - offset) + 1
|
|
@@ -335,8 +332,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
335
332
|
const len = region.end - region.start
|
|
336
333
|
const offset = bp - bpSoFar
|
|
337
334
|
if (len + bpSoFar > bp && bpSoFar <= bp) {
|
|
335
|
+
const snap = getSnapshot(region)
|
|
338
336
|
return {
|
|
339
|
-
|
|
337
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
338
|
+
...(snap as Omit<typeof snap, symbol>),
|
|
340
339
|
oob: false,
|
|
341
340
|
offset,
|
|
342
341
|
coord: region.reversed
|
|
@@ -363,8 +362,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
363
362
|
const region = self.displayedRegions[n - 1]
|
|
364
363
|
const len = region.end - region.start
|
|
365
364
|
const offset = bp - bpSoFar + len
|
|
365
|
+
const snap = getSnapshot(region)
|
|
366
366
|
return {
|
|
367
|
-
|
|
367
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
368
|
+
...(snap as Omit<typeof snap, symbol>),
|
|
368
369
|
oob: true,
|
|
369
370
|
offset,
|
|
370
371
|
coord: region.reversed
|
|
@@ -396,10 +397,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
396
397
|
track => track.configuration.trackId,
|
|
397
398
|
)
|
|
398
399
|
results.forEach(result => {
|
|
399
|
-
if (openTrackIds
|
|
400
|
-
|
|
401
|
-
result.updateScore(result.getScore() + 1)
|
|
402
|
-
}
|
|
400
|
+
if (openTrackIds.includes(result.trackId)) {
|
|
401
|
+
result.updateScore(result.getScore() + 1)
|
|
403
402
|
}
|
|
404
403
|
})
|
|
405
404
|
return results
|
|
@@ -407,7 +406,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
407
406
|
|
|
408
407
|
// modifies view menu action onClick to apply to all tracks of same type
|
|
409
408
|
rewriteOnClicks(trackType: string, viewMenuActions: MenuItem[]) {
|
|
410
|
-
viewMenuActions.forEach(
|
|
409
|
+
viewMenuActions.forEach(action => {
|
|
411
410
|
// go to lowest level menu
|
|
412
411
|
if ('subMenu' in action) {
|
|
413
412
|
this.rewriteOnClicks(trackType, action.subMenu)
|
|
@@ -464,6 +463,9 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
464
463
|
toggleHeaderOverview() {
|
|
465
464
|
self.hideHeaderOverview = !self.hideHeaderOverview
|
|
466
465
|
},
|
|
466
|
+
toggleNoTracksActive() {
|
|
467
|
+
self.hideNoTracksActive = !self.hideNoTracksActive
|
|
468
|
+
},
|
|
467
469
|
|
|
468
470
|
scrollTo(offsetPx: number) {
|
|
469
471
|
const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset)
|
|
@@ -533,26 +535,19 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
533
535
|
initialSnapshot = {},
|
|
534
536
|
displayInitialSnapshot = {},
|
|
535
537
|
) {
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
trackConfigSchema,
|
|
540
|
-
getRoot(self),
|
|
541
|
-
trackId,
|
|
542
|
-
)
|
|
543
|
-
if (!configuration) {
|
|
538
|
+
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
539
|
+
const conf = resolveIdentifier(schema, getRoot(self), trackId)
|
|
540
|
+
if (!conf) {
|
|
544
541
|
throw new Error(`Could not resolve identifier "${trackId}"`)
|
|
545
542
|
}
|
|
546
|
-
const trackType = pluginManager.getTrackType(
|
|
543
|
+
const trackType = pluginManager.getTrackType(conf?.type)
|
|
547
544
|
if (!trackType) {
|
|
548
|
-
throw new Error(`Unknown track type ${
|
|
545
|
+
throw new Error(`Unknown track type ${conf.type}`)
|
|
549
546
|
}
|
|
550
547
|
const viewType = pluginManager.getViewType(self.type)
|
|
551
|
-
const supportedDisplays = viewType.displayTypes.map(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
const displayConf = configuration.displays.find(
|
|
555
|
-
(d: AnyConfigurationModel) => supportedDisplays.includes(d.type),
|
|
548
|
+
const supportedDisplays = viewType.displayTypes.map(d => d.name)
|
|
549
|
+
const displayConf = conf.displays.find((d: AnyConfigurationModel) =>
|
|
550
|
+
supportedDisplays.includes(d.type),
|
|
556
551
|
)
|
|
557
552
|
if (!displayConf) {
|
|
558
553
|
throw new Error(
|
|
@@ -560,14 +555,12 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
560
555
|
)
|
|
561
556
|
}
|
|
562
557
|
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
)
|
|
566
|
-
if (shownTracks.length === 0) {
|
|
558
|
+
const t = self.tracks.filter(t => t.configuration === conf)
|
|
559
|
+
if (t.length === 0) {
|
|
567
560
|
const track = trackType.stateModel.create({
|
|
568
561
|
...initialSnapshot,
|
|
569
|
-
type:
|
|
570
|
-
configuration,
|
|
562
|
+
type: conf.type,
|
|
563
|
+
configuration: conf,
|
|
571
564
|
displays: [
|
|
572
565
|
{
|
|
573
566
|
type: displayConf.type,
|
|
@@ -579,38 +572,26 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
579
572
|
self.tracks.push(track)
|
|
580
573
|
return track
|
|
581
574
|
}
|
|
582
|
-
return
|
|
575
|
+
return t[0]
|
|
583
576
|
},
|
|
584
577
|
|
|
585
578
|
hideTrack(trackId: string) {
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
trackId,
|
|
592
|
-
)
|
|
593
|
-
// if we have any tracks with that configuration, turn them off
|
|
594
|
-
const shownTracks = self.tracks.filter(
|
|
595
|
-
t => t.configuration === configuration,
|
|
596
|
-
)
|
|
597
|
-
transaction(() => shownTracks.forEach(t => self.tracks.remove(t)))
|
|
598
|
-
return shownTracks.length
|
|
579
|
+
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
580
|
+
const conf = resolveIdentifier(schema, getRoot(self), trackId)
|
|
581
|
+
const t = self.tracks.filter(t => t.configuration === conf)
|
|
582
|
+
transaction(() => t.forEach(t => self.tracks.remove(t)))
|
|
583
|
+
return t.length
|
|
599
584
|
},
|
|
600
585
|
}))
|
|
601
586
|
.actions(self => ({
|
|
602
|
-
moveTrack(
|
|
603
|
-
const oldIndex = self.tracks.findIndex(
|
|
604
|
-
track => track.id === movingTrackId,
|
|
605
|
-
)
|
|
587
|
+
moveTrack(movingId: string, targetId: string) {
|
|
588
|
+
const oldIndex = self.tracks.findIndex(track => track.id === movingId)
|
|
606
589
|
if (oldIndex === -1) {
|
|
607
|
-
throw new Error(`Track ID ${
|
|
590
|
+
throw new Error(`Track ID ${movingId} not found`)
|
|
608
591
|
}
|
|
609
|
-
const newIndex = self.tracks.findIndex(
|
|
610
|
-
track => track.id === targetTrackId,
|
|
611
|
-
)
|
|
592
|
+
const newIndex = self.tracks.findIndex(track => track.id === targetId)
|
|
612
593
|
if (newIndex === -1) {
|
|
613
|
-
throw new Error(`Track ID ${
|
|
594
|
+
throw new Error(`Track ID ${targetId} not found`)
|
|
614
595
|
}
|
|
615
596
|
const track = getSnapshot(self.tracks[oldIndex])
|
|
616
597
|
self.tracks.splice(oldIndex, 1)
|
|
@@ -675,13 +656,38 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
675
656
|
const { assemblyManager } = getSession(self)
|
|
676
657
|
const { isValidRefName } = assemblyManager
|
|
677
658
|
const assemblyName = optAssemblyName || assemblyNames[0]
|
|
659
|
+
let parsedLocStrings
|
|
660
|
+
const inputs = locString
|
|
661
|
+
.split(/(\s+)/)
|
|
662
|
+
.map(f => f.trim())
|
|
663
|
+
.filter(f => !!f)
|
|
678
664
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
.map(l =>
|
|
665
|
+
// first try interpreting as a whitespace-separated sequence of
|
|
666
|
+
// multiple locstrings
|
|
667
|
+
try {
|
|
668
|
+
parsedLocStrings = inputs.map(l =>
|
|
669
|
+
parseLocString(l, ref => isValidRefName(ref, assemblyName)),
|
|
670
|
+
)
|
|
671
|
+
} catch (e) {
|
|
672
|
+
// if this fails, try interpreting as a whitespace-separated refname,
|
|
673
|
+
// start, end if start and end are integer inputs
|
|
674
|
+
const [refName, start, end] = inputs
|
|
675
|
+
if (
|
|
676
|
+
`${e}`.match(/Unknown reference sequence/) &&
|
|
677
|
+
Number.isInteger(+start) &&
|
|
678
|
+
Number.isInteger(+end)
|
|
679
|
+
) {
|
|
680
|
+
parsedLocStrings = [
|
|
681
|
+
parseLocString(refName + ':' + start + '..' + end, ref =>
|
|
682
|
+
isValidRefName(ref, assemblyName),
|
|
683
|
+
),
|
|
684
|
+
]
|
|
685
|
+
} else {
|
|
686
|
+
throw e
|
|
687
|
+
}
|
|
688
|
+
}
|
|
683
689
|
|
|
684
|
-
const locations = parsedLocStrings
|
|
690
|
+
const locations = parsedLocStrings?.map(region => {
|
|
685
691
|
const asmName = region.assemblyName || assemblyName
|
|
686
692
|
const asm = assemblyManager.get(asmName)
|
|
687
693
|
const { refName } = region
|
|
@@ -932,21 +938,21 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
932
938
|
leftOffset: BpOffset | undefined,
|
|
933
939
|
rightOffset: BpOffset | undefined,
|
|
934
940
|
) {
|
|
941
|
+
const snap = getSnapshot(self)
|
|
935
942
|
const simView = Base1DView.create({
|
|
936
|
-
|
|
943
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
944
|
+
...(snap as Omit<typeof self, symbol>),
|
|
937
945
|
interRegionPaddingWidth: self.interRegionPaddingWidth,
|
|
938
946
|
})
|
|
939
947
|
|
|
940
948
|
simView.setVolatileWidth(self.width)
|
|
941
949
|
simView.zoomToDisplayedRegions(leftOffset, rightOffset)
|
|
942
950
|
|
|
943
|
-
return simView.dynamicBlocks.contentBlocks.map(region => {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
})
|
|
951
|
+
return simView.dynamicBlocks.contentBlocks.map(region => ({
|
|
952
|
+
...region,
|
|
953
|
+
start: Math.floor(region.start),
|
|
954
|
+
end: Math.ceil(region.end),
|
|
955
|
+
}))
|
|
950
956
|
},
|
|
951
957
|
|
|
952
958
|
// schedule something to be run after the next time displayedRegions is set
|
|
@@ -1207,6 +1213,13 @@ export function stateModelFactory(pluginManager: PluginManager) {
|
|
|
1207
1213
|
onClick: self.toggleHeaderOverview,
|
|
1208
1214
|
disabled: self.hideHeader,
|
|
1209
1215
|
},
|
|
1216
|
+
{
|
|
1217
|
+
label: 'Show no tracks active button',
|
|
1218
|
+
icon: VisibilityIcon,
|
|
1219
|
+
type: 'checkbox',
|
|
1220
|
+
checked: !self.hideNoTracksActive,
|
|
1221
|
+
onClick: self.toggleNoTracksActive,
|
|
1222
|
+
},
|
|
1210
1223
|
{
|
|
1211
1224
|
label: 'Track labels',
|
|
1212
1225
|
icon: LabelIcon,
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
|
|
|
11
11
|
import Plugin from '@jbrowse/core/Plugin'
|
|
12
12
|
import PluginManager from '@jbrowse/core/PluginManager'
|
|
13
13
|
import { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'
|
|
14
|
-
import LineStyleIcon from '@
|
|
14
|
+
import LineStyleIcon from '@mui/icons-material/LineStyle'
|
|
15
15
|
import {
|
|
16
16
|
BaseLinearDisplay,
|
|
17
17
|
BaseLinearDisplayComponent,
|
|
@@ -137,42 +137,47 @@ export default class LinearGenomeViewPlugin extends Plugin {
|
|
|
137
137
|
loc: string
|
|
138
138
|
tracks?: string[]
|
|
139
139
|
}) => {
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
try {
|
|
141
|
+
const { assemblyManager } = session
|
|
142
|
+
const view = session.addView('LinearGenomeView', {}) as LGV
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
await when(() => !!view.volatileWidth)
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
if (!assembly) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
'No assembly provided when launching linear genome view',
|
|
149
|
+
)
|
|
150
|
+
}
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
const asm = await assemblyManager.waitForAssembly(assembly)
|
|
153
|
+
if (!asm) {
|
|
154
|
+
throw new Error(
|
|
155
|
+
`Assembly "${assembly}" not found when launching linear genome view`,
|
|
156
|
+
)
|
|
157
|
+
}
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
view.navToLocString(loc, assembly)
|
|
160
|
+
|
|
161
|
+
const idsNotFound = [] as string[]
|
|
162
|
+
tracks.forEach(track => {
|
|
163
|
+
try {
|
|
164
|
+
view.showTrack(track)
|
|
165
|
+
} catch (e) {
|
|
166
|
+
if (`${e}`.match('Could not resolve identifier')) {
|
|
167
|
+
idsNotFound.push(track)
|
|
168
|
+
} else {
|
|
169
|
+
throw e
|
|
170
|
+
}
|
|
169
171
|
}
|
|
172
|
+
})
|
|
173
|
+
if (idsNotFound.length) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
`Could not resolve identifiers: ${idsNotFound.join(',')}`,
|
|
176
|
+
)
|
|
170
177
|
}
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
throw
|
|
174
|
-
`Could not resolve identifiers: ${idsNotFound.join(',')}`,
|
|
175
|
-
)
|
|
178
|
+
} catch (e) {
|
|
179
|
+
session.notify(`${e}`, 'error')
|
|
180
|
+
throw e
|
|
176
181
|
}
|
|
177
182
|
},
|
|
178
183
|
)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
4
|
-
|
|
5
|
-
var _configuration = require("@jbrowse/core/configuration");
|
|
6
|
-
|
|
7
|
-
var _ = require(".");
|
|
8
|
-
|
|
9
|
-
test('config schema renderer type', function () {
|
|
10
|
-
var stubPluginManager = {
|
|
11
|
-
pluggableConfigSchemaType: function pluggableConfigSchemaType(type) {
|
|
12
|
-
var one = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeOne"), {}, {
|
|
13
|
-
explicitlyTyped: true
|
|
14
|
-
});
|
|
15
|
-
var two = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeTwo"), {}, {
|
|
16
|
-
explicitlyTyped: true
|
|
17
|
-
});
|
|
18
|
-
var three = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeThree"), {}, {
|
|
19
|
-
explicitlyTyped: true
|
|
20
|
-
});
|
|
21
|
-
return _mobxStateTree.types.union(one, two, three);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var configSchema = (0, _.configSchemaFactory)(stubPluginManager);
|
|
25
|
-
var instance = configSchema.create({
|
|
26
|
-
type: 'LinearBareDisplay',
|
|
27
|
-
displayId: 'displayId0',
|
|
28
|
-
renderer: {
|
|
29
|
-
type: 'renderer_TypeTwo'
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
expect(instance.renderer.type).toBe('renderer_TypeTwo');
|
|
33
|
-
});
|