@datagrok/helm 2.1.26 → 2.1.28
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 +8 -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 +1 -1
- package/src/cell-renderer.ts +0 -30
- package/src/package.ts +52 -15
- package/src/widgets/properties-widget.ts +1 -1
- package/tsconfig.json +1 -1
- package/webpack.config.js +3 -0
package/package.json
CHANGED
package/src/cell-renderer.ts
CHANGED
|
@@ -144,36 +144,6 @@ function getHoveredMonomerFallback(
|
|
|
144
144
|
return hoveredSeqMonomer;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
// patch window.dojox.gfx.svg.Text.prototype.getTextWidth hangs
|
|
148
|
-
/** get the text width in pixels */
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
window.dojox.gfx.svg.Text.prototype.getTextWidth = function() {
|
|
151
|
-
const rawNode = this.rawNode;
|
|
152
|
-
const oldParent = rawNode.parentNode;
|
|
153
|
-
const _measurementNode = rawNode.cloneNode(true);
|
|
154
|
-
_measurementNode.style.visibility = 'hidden';
|
|
155
|
-
|
|
156
|
-
// solution to the "orphan issue" in FF
|
|
157
|
-
let _width = 0;
|
|
158
|
-
const _text = _measurementNode.firstChild.nodeValue;
|
|
159
|
-
oldParent.appendChild(_measurementNode);
|
|
160
|
-
|
|
161
|
-
// solution to the "orphan issue" in Opera
|
|
162
|
-
// (nodeValue == "" hangs firefox)
|
|
163
|
-
if (_text != '') {
|
|
164
|
-
let watchdogCounter = 100;
|
|
165
|
-
while (!_width && --watchdogCounter > 0) { // <-- hangs
|
|
166
|
-
//Yang: work around svgweb bug 417 -- http://code.google.com/p/svgweb/issues/detail?id=417
|
|
167
|
-
if (_measurementNode.getBBox)
|
|
168
|
-
_width = parseInt(_measurementNode.getBBox().width);
|
|
169
|
-
else
|
|
170
|
-
_width = 68;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
oldParent.removeChild(_measurementNode);
|
|
174
|
-
return _width;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
147
|
/** Helm cell renderer in case of no missed monomer draws with JSDraw2.Editor (webeditor),
|
|
178
148
|
* in case of missed monomers presented, draws linear sequences aligned in width per monomer.
|
|
179
149
|
*/
|
package/src/package.ts
CHANGED
|
@@ -3,6 +3,8 @@ import * as grok from 'datagrok-api/grok';
|
|
|
3
3
|
import * as ui from 'datagrok-api/ui';
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
5
|
|
|
6
|
+
import $ from 'cash-dom';
|
|
7
|
+
|
|
6
8
|
import {errorToConsole} from '@datagrok-libraries/utils/src/to-console';
|
|
7
9
|
import {NOTATION} from '@datagrok-libraries/bio/src/utils/macromolecule';
|
|
8
10
|
import {GapSymbols, UnitsHandler} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
@@ -20,6 +22,38 @@ import {WebEditorMonomer, RGROUP_CAP_GROUP_NAME, RGROUP_LABEL, SMILES} from './c
|
|
|
20
22
|
|
|
21
23
|
export const _package = new DG.Package();
|
|
22
24
|
|
|
25
|
+
function initHelmPatchDojo(): void {
|
|
26
|
+
// patch window.dojox.gfx.svg.Text.prototype.getTextWidth hangs
|
|
27
|
+
/** get the text width in pixels */
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
window.dojox.gfx.svg.Text.prototype.getTextWidth = function() {
|
|
30
|
+
const rawNode = this.rawNode;
|
|
31
|
+
const oldParent = rawNode.parentNode;
|
|
32
|
+
const _measurementNode = rawNode.cloneNode(true);
|
|
33
|
+
_measurementNode.style.visibility = 'hidden';
|
|
34
|
+
|
|
35
|
+
// solution to the "orphan issue" in FF
|
|
36
|
+
let _width = 0;
|
|
37
|
+
const _text = _measurementNode.firstChild.nodeValue;
|
|
38
|
+
oldParent.appendChild(_measurementNode);
|
|
39
|
+
|
|
40
|
+
// solution to the "orphan issue" in Opera
|
|
41
|
+
// (nodeValue == "" hangs firefox)
|
|
42
|
+
if (_text != '') {
|
|
43
|
+
let watchdogCounter = 100;
|
|
44
|
+
while (!_width && --watchdogCounter > 0) { // <-- hangs
|
|
45
|
+
//Yang: work around svgweb bug 417 -- http://code.google.com/p/svgweb/issues/detail?id=417
|
|
46
|
+
if (_measurementNode.getBBox)
|
|
47
|
+
_width = parseInt(_measurementNode.getBBox().width);
|
|
48
|
+
else
|
|
49
|
+
_width = 68;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
oldParent.removeChild(_measurementNode);
|
|
53
|
+
return _width;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
23
57
|
//tags: init
|
|
24
58
|
export async function initHelm(): Promise<void> {
|
|
25
59
|
//@ts-ignore
|
|
@@ -29,6 +63,8 @@ export async function initHelm(): Promise<void> {
|
|
|
29
63
|
new Promise((resolve, reject) => {
|
|
30
64
|
// @ts-ignore
|
|
31
65
|
dojo.ready(function() { resolve(null); });
|
|
66
|
+
}).then(() => {
|
|
67
|
+
initHelmPatchDojo();
|
|
32
68
|
}),
|
|
33
69
|
grok.functions.call('Bio:getBioLib'),
|
|
34
70
|
])
|
|
@@ -107,7 +143,7 @@ function rewriteLibraries() {
|
|
|
107
143
|
});
|
|
108
144
|
|
|
109
145
|
// Obsolete
|
|
110
|
-
const grid: DG.Grid = grok.shell.tv
|
|
146
|
+
const grid: DG.Grid = grok.shell.tv?.grid;
|
|
111
147
|
if (grid) grid.invalidate();
|
|
112
148
|
}
|
|
113
149
|
|
|
@@ -249,21 +285,22 @@ function getRS(smiles: string) {
|
|
|
249
285
|
//input: column col {semType: Macromolecule}
|
|
250
286
|
//output: column res
|
|
251
287
|
export function getMolfiles(col: DG.Column): DG.Column {
|
|
252
|
-
const grid = grok.shell.tv.grid;
|
|
253
|
-
const parent = grid.root.parentElement!;
|
|
254
288
|
const res = DG.Column.string('mols', col.length);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
289
|
+
|
|
290
|
+
const host = ui.div([], {style: {width: '0', height: '0'}});
|
|
291
|
+
document.documentElement.appendChild(host);
|
|
292
|
+
try {
|
|
293
|
+
const editor = new JSDraw2.Editor(host, {viewonly: true});
|
|
294
|
+
res.init((i) => {
|
|
295
|
+
editor.setHelm(col.get(i));
|
|
296
|
+
const mol = editor.getMolfile();
|
|
297
|
+
return mol;
|
|
298
|
+
});
|
|
299
|
+
return res;
|
|
300
|
+
} finally {
|
|
301
|
+
$(host).empty();
|
|
302
|
+
host.remove();
|
|
303
|
+
}
|
|
267
304
|
}
|
|
268
305
|
|
|
269
306
|
// -- Utils --
|
|
@@ -14,8 +14,8 @@ export function getPropertiesDict(seq: string, uh: UnitsHandler): {} {
|
|
|
14
14
|
.replaceAll(/\{(\*\.)+/g, '{').replaceAll(/(\.\*)+}/g, '}');
|
|
15
15
|
|
|
16
16
|
const host = ui.div([], {style: {width: '0', height: '0'}});
|
|
17
|
+
document.documentElement.appendChild(host);
|
|
17
18
|
try {
|
|
18
|
-
document.documentElement.appendChild(host);
|
|
19
19
|
const editor = new JSDraw2.Editor(host, {viewonly: true});
|
|
20
20
|
editor.setHelm(helmString2);
|
|
21
21
|
|
package/tsconfig.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
15
|
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
16
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
|
|
17
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
18
18
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
19
|
// "composite": true, /* Enable project compilation */
|
|
20
20
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
package/webpack.config.js
CHANGED
|
@@ -15,6 +15,9 @@ module.exports = {
|
|
|
15
15
|
fallback: {'url': false},
|
|
16
16
|
extensions: ['.ts', '.tsx', '.js', '.wasm', '.mjs', '.json'],
|
|
17
17
|
},
|
|
18
|
+
devServer: {
|
|
19
|
+
contentBase: './dist',
|
|
20
|
+
},
|
|
18
21
|
module: {
|
|
19
22
|
rules: [
|
|
20
23
|
{test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], exclude: /node_modules/},
|