@datagrok/helm 2.4.2 → 2.4.4
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/CHANGELOG.md +11 -0
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +5 -5
- package/src/helm-helper.ts +19 -0
- package/src/package.ts +6 -19
- package/src/utils/helm-grid-cell-renderer.ts +1 -1
- package/src/utils/helm-service.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/helm",
|
|
3
3
|
"friendlyName": "Helm",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Oleksandra Serhiienko",
|
|
7
7
|
"email": "oserhiienko@datagrok.ai"
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"css/helm.css"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@datagrok-libraries/bio": "^5.42.
|
|
19
|
+
"@datagrok-libraries/bio": "^5.42.11",
|
|
20
20
|
"@datagrok-libraries/chem-meta": "^1.2.5",
|
|
21
|
-
"@datagrok-libraries/utils": "^4.2.
|
|
21
|
+
"@datagrok-libraries/utils": "^4.2.29",
|
|
22
22
|
"cash-dom": "^8.1.1",
|
|
23
23
|
"datagrok-api": "^1.20.0",
|
|
24
24
|
"dayjs": "^1.10.6",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"wu": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@datagrok-libraries/helm-web-editor": "^1.1.
|
|
30
|
-
"@datagrok-libraries/js-draw-lite": "^0.0.
|
|
29
|
+
"@datagrok-libraries/helm-web-editor": "^1.1.10",
|
|
30
|
+
"@datagrok-libraries/js-draw-lite": "^0.0.8",
|
|
31
31
|
"@datagrok/bio": "^2.14.1",
|
|
32
32
|
"@datagrok/chem": "^1.9.2",
|
|
33
33
|
"@types/node": "17.0.45",
|
package/src/helm-helper.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as grok from 'datagrok-api/grok';
|
|
|
2
2
|
import * as ui from 'datagrok-api/ui';
|
|
3
3
|
import * as DG from 'datagrok-api/dg';
|
|
4
4
|
|
|
5
|
+
import $ from 'cash-dom';
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
App, Atom, HelmType, GetMonomerFunc, GetMonomerResType, HelmString, HelmMol,
|
|
7
9
|
MonomerExplorer, TabDescType, MonomersFuncs, MonomerSetType, HelmAtom, ISeqMonomer, PolymerType, MonomerType, type DojoType
|
|
@@ -313,4 +315,21 @@ export class HelmHelper implements IHelmHelper {
|
|
|
313
315
|
public getHoveredAtom(x: number, y: number, mol: HelmMol, height: number): HelmAtom | null {
|
|
314
316
|
return getHoveredMonomerFromEditorMol(x, y, mol, height);
|
|
315
317
|
}
|
|
318
|
+
|
|
319
|
+
public getMolfiles(helmStrList: string[]): string[] {
|
|
320
|
+
const host = ui.div([], {style: {width: '0', height: '0'}});
|
|
321
|
+
document.documentElement.appendChild(host);
|
|
322
|
+
try {
|
|
323
|
+
const editor = new JSDraw2.Editor(host, {viewonly: true});
|
|
324
|
+
const resList = helmStrList.map((helmStr, i) => {
|
|
325
|
+
editor.setHelm(helmStr);
|
|
326
|
+
const mol = editor.getMolfile();
|
|
327
|
+
return mol;
|
|
328
|
+
});
|
|
329
|
+
return resList;
|
|
330
|
+
} finally {
|
|
331
|
+
$(host).empty();
|
|
332
|
+
host.remove();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
316
335
|
}
|
package/src/package.ts
CHANGED
|
@@ -4,7 +4,6 @@ import * as ui from 'datagrok-api/ui';
|
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
5
|
|
|
6
6
|
import $ from 'cash-dom';
|
|
7
|
-
import {Unsubscribable} from 'rxjs';
|
|
8
7
|
|
|
9
8
|
import {testEvent} from '@datagrok-libraries/utils/src/test';
|
|
10
9
|
import {errorToConsole} from '@datagrok-libraries/utils/src/to-console';
|
|
@@ -28,7 +27,7 @@ import {getRS} from './utils/get-monomer-dummy';
|
|
|
28
27
|
// Do not import anything than types from @datagrok/helm-web-editor/src/types
|
|
29
28
|
import type {JSDraw2Module, OrgHelmModule, ScilModule} from './types';
|
|
30
29
|
|
|
31
|
-
export const _package = new HelmPackage({debug: true});
|
|
30
|
+
export const _package = new HelmPackage(/*{debug: true}/**/);
|
|
32
31
|
|
|
33
32
|
/*
|
|
34
33
|
Loading modules:
|
|
@@ -154,23 +153,11 @@ function openWebEditor(cell: DG.Cell, value?: string, units?: string) {
|
|
|
154
153
|
//name: getMolfiles
|
|
155
154
|
//input: column col {semType: Macromolecule}
|
|
156
155
|
//output: column res
|
|
157
|
-
export function getMolfiles(col: DG.Column): DG.Column {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
try {
|
|
163
|
-
const editor = new JSDraw2.Editor(host, {viewonly: true});
|
|
164
|
-
res.init((i) => {
|
|
165
|
-
editor.setHelm(col.get(i));
|
|
166
|
-
const mol = editor.getMolfile();
|
|
167
|
-
return mol;
|
|
168
|
-
});
|
|
169
|
-
return res;
|
|
170
|
-
} finally {
|
|
171
|
-
$(host).empty();
|
|
172
|
-
host.remove();
|
|
173
|
-
}
|
|
156
|
+
export function getMolfiles(col: DG.Column<string>): DG.Column<string> {
|
|
157
|
+
const helmStrList = col.toList();
|
|
158
|
+
const molfileList = _package.helmHelper.getMolfiles(helmStrList);
|
|
159
|
+
const molfileCol = DG.Column.fromStrings('mols', molfileList);
|
|
160
|
+
return molfileCol;
|
|
174
161
|
}
|
|
175
162
|
|
|
176
163
|
// -- Inputs --
|
|
@@ -111,7 +111,7 @@ export class HelmGridCellRendererBack extends CellRendererBackAsyncBase<HelmProp
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
onMouseMove(gridCell: DG.GridCell, e: MouseEvent): void {
|
|
114
|
-
if (gridCell.tableRowIndex === null) return;
|
|
114
|
+
if (gridCell.tableRowIndex === null || !this._auxList) return;
|
|
115
115
|
const aux = this._auxList[gridCell.tableRowIndex];
|
|
116
116
|
if (!aux) return;
|
|
117
117
|
|
|
@@ -5,7 +5,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
5
5
|
import $ from 'cash-dom';
|
|
6
6
|
import {Subject, Unsubscribable} from 'rxjs';
|
|
7
7
|
|
|
8
|
-
import {HelmEditor} from '@datagrok-libraries/bio/src/helm/types';
|
|
8
|
+
import {HelmEditor, HelmType, IHelmDrawOptions} from '@datagrok-libraries/bio/src/helm/types';
|
|
9
9
|
import {RenderTask} from '@datagrok-libraries/bio/src/utils/cell-renderer-async-base';
|
|
10
10
|
import {HelmAux, HelmProps, HelmServiceBase} from '@datagrok-libraries/bio/src/viewers/helm-service';
|
|
11
11
|
import {svgToImage} from '@datagrok-libraries/utils/src/svg';
|
|
@@ -48,7 +48,7 @@ export class HelmService extends HelmServiceBase {
|
|
|
48
48
|
const emptyCanvasHash: number = 0;
|
|
49
49
|
|
|
50
50
|
if (!this.editor) {
|
|
51
|
-
this.editor = new JSDraw2.Editor(this.hostDiv,
|
|
51
|
+
this.editor = new JSDraw2.Editor<HelmType, IHelmDrawOptions>(this.hostDiv,
|
|
52
52
|
{width: task.props.width, height: task.props.height, skin: 'w8', viewonly: true});
|
|
53
53
|
}
|
|
54
54
|
const lST = window.performance.now();
|