@datagrok/helm 2.1.22 → 2.1.23
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/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 +1 -1
- package/src/cell-renderer.ts +5 -0
- package/src/tests/get-molfiles.ts +13 -5
- package/src/tests/utils.ts +11 -0
package/package.json
CHANGED
package/src/cell-renderer.ts
CHANGED
|
@@ -288,6 +288,11 @@ export class HelmCellRenderer extends DG.GridCellRenderer {
|
|
|
288
288
|
{style: {width: `${w - 2}px`, height: `${h - 2}px`, margin: `${1}px`, backgroundColor: '#FFE0E0'}});
|
|
289
289
|
host.setAttribute('dataformat', 'helm');
|
|
290
290
|
host.setAttribute('data', seq /* gaps skipped */);
|
|
291
|
+
// if grid has neighbour to the left, then shift host to the left
|
|
292
|
+
if (host.parentElement && (gridCell.grid?.canvas?.offsetLeft ?? 0) > 0) {
|
|
293
|
+
host.parentElement.style.left =
|
|
294
|
+
`${(gridCell.grid?.canvas?.offsetLeft ?? 0) + host.parentElement.offsetLeft}px`;
|
|
295
|
+
}
|
|
291
296
|
|
|
292
297
|
// Recreate editor to avoid hanging in window.dojox.gfx.svg.Text.prototype.getTextWidth
|
|
293
298
|
const editor = new JSDraw2.Editor(host, {width: w, height: h, skin: 'w8', viewonly: true}) as IEditor;
|
|
@@ -10,6 +10,10 @@ import {getMonomerLibHelper, IMonomerLibHelper} from '@datagrok-libraries/bio/sr
|
|
|
10
10
|
import {MolfileHandler} from '@datagrok-libraries/chem-meta/src/parsing-utils/molfile-handler';
|
|
11
11
|
import {MolfileHandlerBase} from '@datagrok-libraries/chem-meta/src/parsing-utils/molfile-handler-base';
|
|
12
12
|
|
|
13
|
+
import {awaitGrid} from './utils';
|
|
14
|
+
|
|
15
|
+
import {_package} from '../package-test';
|
|
16
|
+
|
|
13
17
|
category('getMolfiles', () => {
|
|
14
18
|
let monomerLibHelper: IMonomerLibHelper;
|
|
15
19
|
let userLibSettings: LibSettings;
|
|
@@ -35,15 +39,19 @@ PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$,9,8`;
|
|
|
35
39
|
const df = DG.DataFrame.fromCsv(csv);
|
|
36
40
|
const helmCol = df.getCol('Helm');
|
|
37
41
|
const view = grok.shell.addTableView(df);
|
|
38
|
-
const resCol: DG.Column<string> = await grok.functions.call('Helm:getMolfiles', {col: helmCol});
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
await
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
_package.logger.debug('Helm/getMolfiles/linear1, grid awaiting 1');
|
|
44
|
+
await awaitGrid(view.grid, 5000);
|
|
45
|
+
_package.logger.debug('Helm/getMolfiles/linear1, grid awaited 1');
|
|
46
|
+
|
|
47
|
+
const resCol: DG.Column<string> = await grok.functions.call('Helm:getMolfiles', {col: helmCol});
|
|
44
48
|
expect(resCol.length, helmCol.length);
|
|
45
49
|
const resMolfileList: MolfileHandlerBase[] = resCol.toList().map((molfile) => MolfileHandler.getInstance(molfile));
|
|
46
50
|
expectArray(resMolfileList.map((mf) => mf.atomCount), df.getCol('atoms').toList());
|
|
47
51
|
expectArray(resMolfileList.map((mf) => mf.bondCount), df.getCol('bonds').toList());
|
|
52
|
+
|
|
53
|
+
_package.logger.debug('Helm/getMolfiles/linear1, grid awaiting 2');
|
|
54
|
+
await awaitGrid(view.grid, 5000);
|
|
55
|
+
_package.logger.debug('Helm/getMolfiles/linear1, grid awaited 2');
|
|
48
56
|
});
|
|
49
57
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
import {delay, testEvent} from '@datagrok-libraries/utils/src/test';
|
|
6
|
+
|
|
7
|
+
export async function awaitGrid(grid: DG.Grid, timeout: number = 5000): Promise<void> {
|
|
8
|
+
await delay(100);
|
|
9
|
+
await testEvent(grid.onAfterDrawContent, () => {},
|
|
10
|
+
() => { grid.invalidate(); }, timeout);
|
|
11
|
+
}
|