@datagrok/helm 2.4.1 → 2.4.3
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 +20 -1
- package/src/package-utils.ts +2 -0
- package/src/package.ts +5 -17
- 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.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Oleksandra Serhiienko",
|
|
7
7
|
"email": "oserhiienko@datagrok.ai"
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
"css/helm.css"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@datagrok-libraries/bio": "^5.42.
|
|
19
|
+
"@datagrok-libraries/bio": "^5.42.10",
|
|
20
20
|
"@datagrok-libraries/chem-meta": "^1.2.5",
|
|
21
21
|
"@datagrok-libraries/utils": "^4.2.19",
|
|
22
22
|
"cash-dom": "^8.1.1",
|
|
23
|
-
"datagrok-api": "^1.20.
|
|
23
|
+
"datagrok-api": "^1.20.1",
|
|
24
24
|
"dayjs": "^1.10.6",
|
|
25
25
|
"rxjs": "^6.5.5",
|
|
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.9",
|
|
30
|
+
"@datagrok-libraries/js-draw-lite": "^0.0.7",
|
|
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
|
|
@@ -63,7 +65,7 @@ export class HelmHelper implements IHelmHelper {
|
|
|
63
65
|
sequenceviewonly: false,
|
|
64
66
|
mexfavoritefirst: true,
|
|
65
67
|
mexfilter: true,
|
|
66
|
-
|
|
68
|
+
currentTabKey: HelmTabKeys.Helm,
|
|
67
69
|
overrideTabs: (tabs: Partial<TabDescType>[]): Partial<TabDescType>[] => {
|
|
68
70
|
const res: Partial<TabDescType>[] = [...tabs,
|
|
69
71
|
{caption: 'Placeholders', tabkey: 'placeholders'},
|
|
@@ -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-utils.ts
CHANGED
|
@@ -203,6 +203,8 @@ export class HelmPackage extends DG.Package {
|
|
|
203
203
|
|
|
204
204
|
// Alternatively load old bundles by package.json/sources
|
|
205
205
|
_package.logger.debug(`${logPrefix}, HelmWebEditor awaiting …`);
|
|
206
|
+
// require('../helm/JSDraw/Scilligence.JSDraw2.Lite-uncompressed');
|
|
207
|
+
// require('../helm/JSDraw/Pistoia.HELM-uncompressed');
|
|
206
208
|
require('../node_modules/@datagrok-libraries/helm-web-editor/dist/package.js');
|
|
207
209
|
await window.helmWebEditor$.initPromise;
|
|
208
210
|
_package.logger.debug(`${logPrefix}, HelmWebEditor loaded`);
|
package/src/package.ts
CHANGED
|
@@ -154,23 +154,11 @@ function openWebEditor(cell: DG.Cell, value?: string, units?: string) {
|
|
|
154
154
|
//name: getMolfiles
|
|
155
155
|
//input: column col {semType: Macromolecule}
|
|
156
156
|
//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
|
-
}
|
|
157
|
+
export function getMolfiles(col: DG.Column<string>): DG.Column<string> {
|
|
158
|
+
const helmStrList = col.toList();
|
|
159
|
+
const molfileList = _package.helmHelper.getMolfiles(helmStrList);
|
|
160
|
+
const molfileCol = DG.Column.fromStrings('mols', molfileList);
|
|
161
|
+
return molfileCol;
|
|
174
162
|
}
|
|
175
163
|
|
|
176
164
|
// -- Inputs --
|
|
@@ -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();
|