@jbrowse/plugin-data-management 4.1.3 → 4.1.5

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.
@@ -31,7 +31,9 @@ export function doSubmit({ model }) {
31
31
  else if (trackConfig && trackAdapter) {
32
32
  const { trackId } = trackConfig;
33
33
  session.addTrackConf(trackConfig);
34
- view?.showTrack?.(trackId);
34
+ if (view?.assemblyNames?.includes(model.assembly)) {
35
+ view.showTrack(trackId);
36
+ }
35
37
  if (isElectron &&
36
38
  textIndexTrack &&
37
39
  isSupportedIndexingAdapter(trackAdapter.type)) {
@@ -2,7 +2,7 @@ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
2
  declare const ShoppingCart: ({ model, }: {
3
3
  model: {
4
4
  clearSelection: () => void;
5
- selection: AnyConfigurationModel[];
5
+ selection: (AnyConfigurationModel | undefined)[];
6
6
  };
7
7
  }) => import("react/jsx-runtime").JSX.Element | null;
8
8
  export default ShoppingCart;
@@ -19,7 +19,9 @@ const ShoppingCart = observer(function ShoppingCart({ model, }) {
19
19
  model.clearSelection();
20
20
  },
21
21
  },
22
- ...(selection.every(elt => canEdit(elt.trackId))
22
+ ...(selection
23
+ .filter((elt) => !!elt)
24
+ .every(elt => canEdit(elt.trackId))
23
25
  ? [
24
26
  {
25
27
  label: 'Delete tracks',
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo, useState, useTransition } from 'react';
3
- import { getEnv } from '@jbrowse/core/util';
4
- import { getRoot, resolveIdentifier } from '@jbrowse/mobx-state-tree';
3
+ import { notEmpty } from '@jbrowse/core/util';
5
4
  import { DataGrid } from '@mui/x-data-grid';
6
5
  import { transaction } from 'mobx';
7
6
  import { observer } from 'mobx-react';
8
7
  import { computeInitialWidths } from "./computeInitialWidths.js";
9
8
  const FacetedDataGrid = observer(function FacetedDataGrid({ model, columns, shownTrackIds, selection, }) {
10
- const { pluginManager } = getEnv(model);
11
9
  const { view, faceted } = model;
12
10
  const { rows, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible, } = faceted;
13
11
  const [, startTransition] = useTransition();
@@ -44,9 +42,9 @@ const FacetedDataGrid = observer(function FacetedDataGrid({ model, columns, show
44
42
  });
45
43
  }
46
44
  else {
47
- const root = getRoot(model);
48
- const schema = pluginManager.pluggableConfigSchemaType('track');
49
- model.setSelection([...userSelectedIds.ids].map(id => resolveIdentifier(schema, root, id)));
45
+ model.setSelection([...userSelectedIds.ids]
46
+ .map(id => model.allTrackConfigurationTrackIdSet.get(id))
47
+ .filter(notEmpty));
50
48
  }
51
49
  });
52
50
  }, rowSelectionModel: rowSelectionModel, columns: columnsWithWidths }));
@@ -19,11 +19,33 @@ const useStyles = makeStyles()({
19
19
  width: 5,
20
20
  },
21
21
  });
22
+ function HighlightText({ text, query, className, }) {
23
+ if (!query || !text) {
24
+ return _jsx("span", { className: className, children: text });
25
+ }
26
+ const lowerText = text.toLowerCase();
27
+ const lowerQuery = query.toLowerCase();
28
+ const parts = [];
29
+ let lastIndex = 0;
30
+ let idx = lowerText.indexOf(lowerQuery, lastIndex);
31
+ while (idx !== -1) {
32
+ if (idx > lastIndex) {
33
+ parts.push(text.slice(lastIndex, idx));
34
+ }
35
+ parts.push(_jsx("mark", { style: { background: '#FFEB3B' }, children: text.slice(idx, idx + query.length) }, idx));
36
+ lastIndex = idx + query.length;
37
+ idx = lowerText.indexOf(lowerQuery, lastIndex);
38
+ }
39
+ if (lastIndex < text.length) {
40
+ parts.push(text.slice(lastIndex));
41
+ }
42
+ return _jsx("span", { className: className, children: parts });
43
+ }
22
44
  const frac = 0.75;
23
45
  const FacetedSelector = observer(function FacetedSelector({ model, }) {
24
46
  const { classes } = useStyles();
25
47
  const { selection, shownTrackIds, faceted } = model;
26
- const { rows, panelWidth, showFilters, filteredNonMetadataKeys, filteredMetadataKeys, } = faceted;
48
+ const { rows, panelWidth, showFilters, filterText, filteredNonMetadataKeys, filteredMetadataKeys, } = faceted;
27
49
  const columns = [
28
50
  {
29
51
  field: 'name',
@@ -39,7 +61,7 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
39
61
  field: e,
40
62
  renderCell: params => {
41
63
  const val = params.value;
42
- return val ? (_jsx(SanitizedHTML, { className: classes.cell, html: val })) : ('');
64
+ return val ? (_jsx(HighlightText, { className: classes.cell, text: val, query: filterText })) : ('');
43
65
  },
44
66
  };
45
67
  }),
@@ -52,7 +74,7 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
52
74
  valueGetter: (_, row) => `${row.metadata[e] ?? ''}`,
53
75
  renderCell: params => {
54
76
  const val = params.value;
55
- return val ? (_jsx(SanitizedHTML, { className: classes.cell, html: val })) : ('');
77
+ return val ? (_jsx(HighlightText, { className: classes.cell, text: val, query: filterText })) : ('');
56
78
  },
57
79
  };
58
80
  }),
@@ -6,8 +6,8 @@ export declare const useSmallBadgeStyles: (_params?: unknown, muiStyleOverridesP
6
6
  } | undefined) => {
7
7
  classes: Record<"margin" | "smallBadge", string>;
8
8
  theme: import("@mui/material").Theme;
9
- css: import("node_modules/@jbrowse/core/src/util/tss-react/types").Css;
10
- cx: import("node_modules/@jbrowse/core/src/util/tss-react/types").Cx;
9
+ css: import("@jbrowse/core/util/tss-react/types").Css;
10
+ cx: import("@jbrowse/core/util/tss-react/types").Cx;
11
11
  };
12
12
  export declare const badgeAnchorOrigin: {
13
13
  readonly vertical: "bottom";
@@ -1,2 +1,2 @@
1
- declare const configSchema: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
1
+ declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
2
2
  export default configSchema;
@@ -5,7 +5,7 @@ import { addDisposer, getParent, types } from '@jbrowse/mobx-state-tree';
5
5
  import { autorun, observable } from 'mobx';
6
6
  import { getRowStr } from "./components/faceted/util.js";
7
7
  import { findNonSparseKeys, getRootKeys } from "./facetedUtil.js";
8
- import { matches } from "./util.js";
8
+ import { matches, matchesMetadata } from "./util.js";
9
9
  const nonMetadataKeys = ['category', 'adapter', 'description'];
10
10
  export function facetedStateTreeF() {
11
11
  return types
@@ -58,7 +58,8 @@ export function facetedStateTreeF() {
58
58
  const session = getSession(self);
59
59
  const { allTrackConfigurations, filterText } = self;
60
60
  return allTrackConfigurations
61
- .filter(conf => matches(filterText, conf, session))
61
+ .filter(conf => matches(filterText, conf, session) ||
62
+ matchesMetadata(filterText, conf))
62
63
  .map(track => ({
63
64
  id: track.trackId,
64
65
  conf: track,
@@ -3,6 +3,7 @@ import type { AbstractSessionModel } from '@jbrowse/core/util';
3
3
  export declare function hasAnyOverlap<T>(a1?: T[], a2?: T[]): boolean;
4
4
  export declare function hasAllOverlap<T>(a1?: T[], a2?: T[]): boolean;
5
5
  export declare function matches(query: string, conf: AnyConfigurationModel, session: AbstractSessionModel): boolean;
6
+ export declare function matchesMetadata(query: string, conf: AnyConfigurationModel): boolean;
6
7
  interface Node {
7
8
  children: Node[];
8
9
  id: string;
@@ -19,6 +19,13 @@ export function matches(query, conf, session) {
19
19
  return (getTrackName(conf, session).toLowerCase().includes(queryLower) ||
20
20
  categories.some(c => c.toLowerCase().includes(queryLower)));
21
21
  }
22
+ export function matchesMetadata(query, conf) {
23
+ const queryLower = query.toLowerCase();
24
+ const description = (readConfObject(conf, 'description') || '');
25
+ const metadata = (conf.metadata || {});
26
+ return (description.toLowerCase().includes(queryLower) ||
27
+ Object.values(metadata).some(v => typeof v === 'string' && v.toLowerCase().includes(queryLower)));
28
+ }
22
29
  export function findSubCategories(obj, paths, depth = 0) {
23
30
  let hasSubs = false;
24
31
  for (const elt of obj) {
@@ -1,4 +1,4 @@
1
- declare const JB2TrackHubConnection: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const JB2TrackHubConnection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  configJsonLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -12,7 +12,7 @@ declare const JB2TrackHubConnection: import("node_modules/@jbrowse/core/src/conf
12
12
  defaultValue: never[];
13
13
  description: string;
14
14
  };
15
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
15
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
16
16
  name: {
17
17
  type: string;
18
18
  defaultValue: string;
@@ -23,5 +23,5 @@ declare const JB2TrackHubConnection: import("node_modules/@jbrowse/core/src/conf
23
23
  defaultValue: never[];
24
24
  description: string;
25
25
  };
26
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
26
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
27
27
  export default JB2TrackHubConnection;
@@ -2,7 +2,7 @@ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function JB2TrackHubConnection(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
3
3
  name: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
4
4
  tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
5
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
5
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
6
  name: {
7
7
  type: string;
8
8
  defaultValue: string;
@@ -13,9 +13,9 @@ export default function JB2TrackHubConnection(pluginManager: PluginManager): imp
13
13
  defaultValue: never[];
14
14
  description: string;
15
15
  };
16
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>;
16
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
17
  } & {
18
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
18
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
19
  configJsonLocation: {
20
20
  type: string;
21
21
  defaultValue: {
@@ -29,7 +29,7 @@ export default function JB2TrackHubConnection(pluginManager: PluginManager): imp
29
29
  defaultValue: never[];
30
30
  description: string;
31
31
  };
32
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
33
  name: {
34
34
  type: string;
35
35
  defaultValue: string;
@@ -40,7 +40,7 @@ export default function JB2TrackHubConnection(pluginManager: PluginManager): imp
40
40
  defaultValue: never[];
41
41
  description: string;
42
42
  };
43
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
43
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
44
  type: import("@jbrowse/mobx-state-tree").ISimpleType<"JB2TrackHubConnection">;
45
45
  }, {
46
46
  connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
@@ -1,4 +1,4 @@
1
- declare const UCSCTrackHubConnection: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const UCSCTrackHubConnection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  hubTxtLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -12,7 +12,7 @@ declare const UCSCTrackHubConnection: import("node_modules/@jbrowse/core/src/con
12
12
  defaultValue: never[];
13
13
  description: string;
14
14
  };
15
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
15
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
16
16
  name: {
17
17
  type: string;
18
18
  defaultValue: string;
@@ -23,5 +23,5 @@ declare const UCSCTrackHubConnection: import("node_modules/@jbrowse/core/src/con
23
23
  defaultValue: never[];
24
24
  description: string;
25
25
  };
26
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
26
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
27
27
  export default UCSCTrackHubConnection;
@@ -2,7 +2,7 @@ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function UCSCTrackHubConnection(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
3
3
  name: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
4
4
  tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
5
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
5
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
6
  name: {
7
7
  type: string;
8
8
  defaultValue: string;
@@ -13,9 +13,9 @@ export default function UCSCTrackHubConnection(pluginManager: PluginManager): im
13
13
  defaultValue: never[];
14
14
  description: string;
15
15
  };
16
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>;
16
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
17
  } & {
18
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
18
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
19
  hubTxtLocation: {
20
20
  type: string;
21
21
  defaultValue: {
@@ -29,7 +29,7 @@ export default function UCSCTrackHubConnection(pluginManager: PluginManager): im
29
29
  defaultValue: never[];
30
30
  description: string;
31
31
  };
32
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
33
  name: {
34
34
  type: string;
35
35
  defaultValue: string;
@@ -40,7 +40,7 @@ export default function UCSCTrackHubConnection(pluginManager: PluginManager): im
40
40
  defaultValue: never[];
41
41
  description: string;
42
42
  };
43
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
43
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
44
  type: import("@jbrowse/mobx-state-tree").ISimpleType<"UCSCTrackHubConnection">;
45
45
  }, {
46
46
  connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 linear genome view",
6
6
  "keywords": [
@@ -23,15 +23,15 @@
23
23
  "dependencies": {
24
24
  "@gmod/ucsc-hub": "^2.0.3",
25
25
  "@jbrowse/mobx-state-tree": "^5.5.0",
26
- "@mui/icons-material": "^7.3.7",
27
- "@mui/material": "^7.3.7",
28
- "@mui/x-data-grid": "^8.26.0",
26
+ "@mui/icons-material": "^7.3.8",
27
+ "@mui/material": "^7.3.8",
28
+ "@mui/x-data-grid": "^8.27.1",
29
29
  "deepmerge": "^4.3.1",
30
30
  "mobx": "^6.15.0",
31
31
  "mobx-react": "^9.2.1",
32
- "@jbrowse/core": "^4.1.3",
33
- "@jbrowse/plugin-config": "^4.1.3",
34
- "@jbrowse/product-core": "^4.1.3"
32
+ "@jbrowse/plugin-config": "^4.1.5",
33
+ "@jbrowse/core": "^4.1.5",
34
+ "@jbrowse/product-core": "^4.1.5"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": ">=18.0.0"