@datagrok/helm 2.1.10 → 2.1.11

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@datagrok/helm",
3
3
  "friendlyName": "Helm",
4
- "version": "2.1.10",
4
+ "version": "2.1.11",
5
5
  "author": {
6
6
  "name": "Oleksandra Serhiienko",
7
7
  "email": "oserhiienko@datagrok.ai"
8
8
  },
9
9
  "description": "Provides support for HELM notation (importing, detecting, rendering, conversion).",
10
10
  "dependencies": {
11
- "@datagrok-libraries/bio": "^5.31.0",
11
+ "@datagrok-libraries/bio": "^5.32.3",
12
12
  "@datagrok-libraries/utils": "^1.19.1",
13
13
  "cash-dom": "^8.1.1",
14
14
  "datagrok-api": "^1.10.2",
@@ -6,6 +6,10 @@ import {findMonomers, parseHelm, getParts} from './utils';
6
6
  import {printLeftOrCentered} from '@datagrok-libraries/bio/src/utils/cell-renderer';
7
7
  import {errorToConsole} from '@datagrok-libraries/utils/src/to-console';
8
8
 
9
+ // Global flag is for replaceAll
10
+ const helmGapStartRe = /\{(\*\.)+/g;
11
+ const helmGapIntRe = /\.(\*\.)+/g;
12
+ const helmGapEndRe = /(\.\*)+\}/g;
9
13
 
10
14
  export class HelmCellRenderer extends DG.GridCellRenderer {
11
15
  get name() { return 'helm'; }
@@ -70,13 +74,15 @@ export class HelmCellRenderer extends DG.GridCellRenderer {
70
74
  const grid = gridCell.gridRow !== -1 ? gridCell.grid : undefined;
71
75
  const undefinedColor = 'rgb(100,100,100)';
72
76
  const grayColor = '#808080';
73
- const monomers = findMonomers(gridCell.cell.value);
74
- const s: string = gridCell.cell.value ?? '';
77
+
78
+ const s: string = !gridCell.cell.value ? '' : gridCell.cell.value
79
+ .replaceAll(helmGapStartRe, '{').replaceAll(helmGapIntRe, '.').replaceAll(helmGapEndRe, '}');
80
+ const monomers = findMonomers(s);
75
81
  const subParts: string[] = parseHelm(s);
76
82
  if (monomers.size == 0 && grid) {
77
83
  const host = ui.div([], {style: {width: `${w}px`, height: `${h}px`}});
78
84
  host.setAttribute('dataformat', 'helm');
79
- host.setAttribute('data', gridCell.cell.value);
85
+ host.setAttribute('data', s);
80
86
  gridCell.element = host;
81
87
  //@ts-ignore
82
88
  const canvas = new JSDraw2.Editor(host, {width: w, height: h, skin: 'w8', viewonly: true});