@jbrowse/plugin-wiggle 2.11.2 → 2.12.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.
@@ -1,9 +1,32 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
29
+ const react_1 = __importStar(require("react"));
7
30
  const material_1 = require("@mui/material");
8
31
  const mobx_react_1 = require("mobx-react");
9
32
  const mui_1 = require("tss-react/mui");
@@ -18,18 +41,19 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
18
41
  color: theme.palette.grey[500],
19
42
  },
20
43
  }));
21
- // draggable dialog demo https://mui.com/material-ui/react-dialog/#draggable-dialog
22
44
  function PaperComponent(props) {
23
- return (react_1.default.createElement(react_draggable_1.default, { handle: "#draggable-dialog-title", cancel: '[class*="MuiDialogContent-root"]' },
24
- react_1.default.createElement(material_1.Paper, { ...props })));
45
+ const ref = (0, react_1.useRef)(null);
46
+ return (react_1.default.createElement(react_draggable_1.default, { nodeRef: ref, cancel: '[class*="MuiDialogContent-root"]',
47
+ // @ts-expect-error
48
+ onStart: arg => { var _a, _b; return (_b = (_a = arg.target) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.includes('MuiDialogTitle'); } },
49
+ react_1.default.createElement(material_1.Paper, { ref: ref, ...props })));
25
50
  }
26
51
  const DraggableDialog = (0, mobx_react_1.observer)(function DraggableDialog(props) {
27
52
  const { classes } = useStyles();
28
53
  const { title, children, onClose } = props;
29
- return (react_1.default.createElement(material_1.Dialog, { ...props, PaperComponent: PaperComponent, "aria-labelledby": "draggable-dialog-title" // this area is important for the draggable functionality
30
- },
54
+ return (react_1.default.createElement(material_1.Dialog, { ...props, PaperComponent: PaperComponent },
31
55
  react_1.default.createElement(material_1.ScopedCssBaseline, null,
32
- react_1.default.createElement(material_1.DialogTitle, { style: { cursor: 'move' }, id: "draggable-dialog-title" },
56
+ react_1.default.createElement(material_1.DialogTitle, { style: { cursor: 'move' } },
33
57
  title,
34
58
  onClose ? (react_1.default.createElement(material_1.IconButton, { className: classes.closeButton, onClick: () => {
35
59
  // @ts-expect-error
@@ -31,15 +31,15 @@ const material_1 = require("@mui/material");
31
31
  const util_1 = require("@jbrowse/core/util");
32
32
  const x_data_grid_1 = require("@mui/x-data-grid");
33
33
  const mui_1 = require("tss-react/mui");
34
- // locals
35
34
  const ColorPicker_1 = __importStar(require("@jbrowse/core/ui/ColorPicker"));
35
+ const ui_1 = require("@jbrowse/core/ui");
36
+ // locals
36
37
  const util_2 = require("./util");
37
38
  // icons
38
39
  const KeyboardDoubleArrowUp_1 = __importDefault(require("@mui/icons-material/KeyboardDoubleArrowUp"));
39
40
  const KeyboardDoubleArrowDown_1 = __importDefault(require("@mui/icons-material/KeyboardDoubleArrowDown"));
40
41
  const KeyboardArrowDown_1 = __importDefault(require("@mui/icons-material/KeyboardArrowDown"));
41
42
  const KeyboardArrowUp_1 = __importDefault(require("@mui/icons-material/KeyboardArrowUp"));
42
- const ui_1 = require("@jbrowse/core/ui");
43
43
  const useStyles = (0, mui_1.makeStyles)()({
44
44
  cell: {
45
45
  whiteSpace: 'nowrap',
@@ -51,7 +51,6 @@ function SourcesGrid({ rows, onChange, showTips, }) {
51
51
  const { classes } = useStyles();
52
52
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
53
53
  const [selected, setSelected] = (0, react_1.useState)([]);
54
- // @ts-expect-error
55
54
  const { name: _name, color: _color, baseUri: _baseUri, ...rest } = rows[0];
56
55
  const [widgetColor, setWidgetColor] = (0, react_1.useState)('blue');
57
56
  const [currSort, setCurrSort] = (0, react_1.useState)({
@@ -100,33 +99,29 @@ function SourcesGrid({ rows, onChange, showTips, }) {
100
99
  },
101
100
  {
102
101
  field: 'name',
103
- sortingOrder: [null],
104
102
  headerName: 'Name',
105
103
  width: (0, util_1.measureGridWidth)(rows.map(r => r.name)),
106
104
  },
107
105
  ...Object.keys(rest).map(val => ({
108
106
  field: val,
109
- sortingOrder: [null],
110
- renderCell: (params) => {
111
- const { value } = params;
112
- return (react_1.default.createElement("div", { className: classes.cell },
113
- react_1.default.createElement(ui_1.SanitizedHTML, { html: (0, util_1.getStr)(value) })));
114
- },
115
- // @ts-ignore
116
- width: (0, util_1.measureGridWidth)(rows.map(r => r[val])),
107
+ renderCell: ({ value }) => (react_1.default.createElement("div", { className: classes.cell },
108
+ react_1.default.createElement(ui_1.SanitizedHTML, { html: (0, util_1.getStr)(value) }))),
109
+ width: (0, util_1.measureGridWidth)(rows.map(r => `${r[val]}`)),
117
110
  })),
118
111
  ], sortModel: [
119
112
  /* we control the sort as a controlled component using onSortModelChange */
120
113
  ], onSortModelChange: args => {
121
114
  const sort = args[0];
115
+ // this idx%2 flip flops the sorting order, we could inspect args
116
+ // for sort direction asc or desc but this is just a simplified
117
+ // thing since we are controlling sort instead of the default data
118
+ // grid sort anyways
122
119
  const idx = (currSort.idx + 1) % 2;
123
120
  const field = (sort === null || sort === void 0 ? void 0 : sort.field) || currSort.field;
124
121
  setCurrSort({ idx, field });
125
122
  onChange(field
126
123
  ? [...rows].sort((a, b) => {
127
- // @ts-expect-error
128
124
  const aa = (0, util_1.getStr)(a[field]);
129
- // @ts-expect-error
130
125
  const bb = (0, util_1.getStr)(b[field]);
131
126
  return idx === 1
132
127
  ? aa.localeCompare(bb)
@@ -80,7 +80,10 @@ function MultiWiggleWidget({ model }) {
80
80
  bigWigs = JSON.parse(val);
81
81
  }
82
82
  catch (e) {
83
- bigWigs = val.split(/\n|\r\n|\r/);
83
+ bigWigs = val
84
+ .split(/\n|\r\n|\r/)
85
+ .map(f => f.trim())
86
+ .filter(f => !!f);
84
87
  }
85
88
  const obj = typeof bigWigs[0] === 'string'
86
89
  ? { bigWigs }
package/dist/util.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface ScaleOpts {
9
9
  inverted?: boolean;
10
10
  }
11
11
  export interface Source {
12
+ baseUri?: string;
12
13
  name: string;
13
14
  color?: string;
14
15
  group?: string;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useRef } from 'react';
2
2
  import { Dialog, DialogTitle, IconButton, Divider, Paper, ScopedCssBaseline, } from '@mui/material';
3
3
  import { observer } from 'mobx-react';
4
4
  import { makeStyles } from 'tss-react/mui';
@@ -13,18 +13,19 @@ const useStyles = makeStyles()(theme => ({
13
13
  color: theme.palette.grey[500],
14
14
  },
15
15
  }));
16
- // draggable dialog demo https://mui.com/material-ui/react-dialog/#draggable-dialog
17
16
  function PaperComponent(props) {
18
- return (React.createElement(Draggable, { handle: "#draggable-dialog-title", cancel: '[class*="MuiDialogContent-root"]' },
19
- React.createElement(Paper, { ...props })));
17
+ const ref = useRef(null);
18
+ return (React.createElement(Draggable, { nodeRef: ref, cancel: '[class*="MuiDialogContent-root"]',
19
+ // @ts-expect-error
20
+ onStart: arg => { var _a, _b; return (_b = (_a = arg.target) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.includes('MuiDialogTitle'); } },
21
+ React.createElement(Paper, { ref: ref, ...props })));
20
22
  }
21
23
  const DraggableDialog = observer(function DraggableDialog(props) {
22
24
  const { classes } = useStyles();
23
25
  const { title, children, onClose } = props;
24
- return (React.createElement(Dialog, { ...props, PaperComponent: PaperComponent, "aria-labelledby": "draggable-dialog-title" // this area is important for the draggable functionality
25
- },
26
+ return (React.createElement(Dialog, { ...props, PaperComponent: PaperComponent },
26
27
  React.createElement(ScopedCssBaseline, null,
27
- React.createElement(DialogTitle, { style: { cursor: 'move' }, id: "draggable-dialog-title" },
28
+ React.createElement(DialogTitle, { style: { cursor: 'move' } },
28
29
  title,
29
30
  onClose ? (React.createElement(IconButton, { className: classes.closeButton, onClick: () => {
30
31
  // @ts-expect-error
@@ -3,15 +3,15 @@ import { Button } from '@mui/material';
3
3
  import { getStr, measureGridWidth } from '@jbrowse/core/util';
4
4
  import { DataGrid } from '@mui/x-data-grid';
5
5
  import { makeStyles } from 'tss-react/mui';
6
- // locals
7
6
  import ColorPicker, { ColorPopover } from '@jbrowse/core/ui/ColorPicker';
7
+ import { SanitizedHTML } from '@jbrowse/core/ui';
8
+ // locals
8
9
  import { moveUp, moveDown } from './util';
9
10
  // icons
10
11
  import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp';
11
12
  import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
12
13
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
13
14
  import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
14
- import { SanitizedHTML } from '@jbrowse/core/ui';
15
15
  const useStyles = makeStyles()({
16
16
  cell: {
17
17
  whiteSpace: 'nowrap',
@@ -23,7 +23,6 @@ function SourcesGrid({ rows, onChange, showTips, }) {
23
23
  const { classes } = useStyles();
24
24
  const [anchorEl, setAnchorEl] = useState(null);
25
25
  const [selected, setSelected] = useState([]);
26
- // @ts-expect-error
27
26
  const { name: _name, color: _color, baseUri: _baseUri, ...rest } = rows[0];
28
27
  const [widgetColor, setWidgetColor] = useState('blue');
29
28
  const [currSort, setCurrSort] = useState({
@@ -72,33 +71,29 @@ function SourcesGrid({ rows, onChange, showTips, }) {
72
71
  },
73
72
  {
74
73
  field: 'name',
75
- sortingOrder: [null],
76
74
  headerName: 'Name',
77
75
  width: measureGridWidth(rows.map(r => r.name)),
78
76
  },
79
77
  ...Object.keys(rest).map(val => ({
80
78
  field: val,
81
- sortingOrder: [null],
82
- renderCell: (params) => {
83
- const { value } = params;
84
- return (React.createElement("div", { className: classes.cell },
85
- React.createElement(SanitizedHTML, { html: getStr(value) })));
86
- },
87
- // @ts-ignore
88
- width: measureGridWidth(rows.map(r => r[val])),
79
+ renderCell: ({ value }) => (React.createElement("div", { className: classes.cell },
80
+ React.createElement(SanitizedHTML, { html: getStr(value) }))),
81
+ width: measureGridWidth(rows.map(r => `${r[val]}`)),
89
82
  })),
90
83
  ], sortModel: [
91
84
  /* we control the sort as a controlled component using onSortModelChange */
92
85
  ], onSortModelChange: args => {
93
86
  const sort = args[0];
87
+ // this idx%2 flip flops the sorting order, we could inspect args
88
+ // for sort direction asc or desc but this is just a simplified
89
+ // thing since we are controlling sort instead of the default data
90
+ // grid sort anyways
94
91
  const idx = (currSort.idx + 1) % 2;
95
92
  const field = (sort === null || sort === void 0 ? void 0 : sort.field) || currSort.field;
96
93
  setCurrSort({ idx, field });
97
94
  onChange(field
98
95
  ? [...rows].sort((a, b) => {
99
- // @ts-expect-error
100
96
  const aa = getStr(a[field]);
101
- // @ts-expect-error
102
97
  const bb = getStr(b[field]);
103
98
  return idx === 1
104
99
  ? aa.localeCompare(bb)
@@ -55,7 +55,10 @@ export default function MultiWiggleWidget({ model }) {
55
55
  bigWigs = JSON.parse(val);
56
56
  }
57
57
  catch (e) {
58
- bigWigs = val.split(/\n|\r\n|\r/);
58
+ bigWigs = val
59
+ .split(/\n|\r\n|\r/)
60
+ .map(f => f.trim())
61
+ .filter(f => !!f);
59
62
  }
60
63
  const obj = typeof bigWigs[0] === 'string'
61
64
  ? { bigWigs }
package/esm/util.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface ScaleOpts {
9
9
  inverted?: boolean;
10
10
  }
11
11
  export interface Source {
12
+ baseUri?: string;
12
13
  name: string;
13
14
  color?: string;
14
15
  group?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-wiggle",
3
- "version": "2.11.2",
3
+ "version": "2.12.0",
4
4
  "description": "JBrowse 2 wiggle adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -66,5 +66,5 @@
66
66
  "distModule": "esm/index.js",
67
67
  "srcModule": "src/index.ts",
68
68
  "module": "esm/index.js",
69
- "gitHead": "511048cb6965f0bf624c96de244e7fd47fce17d6"
69
+ "gitHead": "935f2602d29abc737bb1f493a922b6218d023ae2"
70
70
  }