@datagrok/bio 2.0.22 → 2.0.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 +50 -25
- package/dist/package.js +32 -13
- package/package.json +2 -2
- package/src/package-test.ts +3 -2
- package/src/widgets/bio-substructure-filter.ts +31 -9
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "Leonid Stolbov",
|
|
6
6
|
"email": "lstolbov@datagrok.ai"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.23",
|
|
9
9
|
"description": "Bio is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@datagrok-libraries/bio": "^5.1.1",
|
|
18
18
|
"@datagrok-libraries/chem-meta": "1.0.1",
|
|
19
19
|
"@datagrok-libraries/ml": "^6.2.0",
|
|
20
|
-
"@datagrok-libraries/utils": "^1.
|
|
20
|
+
"@datagrok-libraries/utils": "^1.11.0",
|
|
21
21
|
"@deck.gl/core": "^8.7.5",
|
|
22
22
|
"@deck.gl/layers": "^8.7.5",
|
|
23
23
|
"@luma.gl/constants": "^8.5.10",
|
package/src/package-test.ts
CHANGED
|
@@ -24,8 +24,9 @@ export {tests};
|
|
|
24
24
|
//name: test
|
|
25
25
|
//input: string category {optional: true}
|
|
26
26
|
//input: string test {optional: true}
|
|
27
|
+
//input: bool catchUnhandled {optional: true}
|
|
27
28
|
//output: dataframe result
|
|
28
|
-
export async function test(category: string, test: string): Promise<DG.DataFrame> {
|
|
29
|
-
const data = await runTests({category, test});
|
|
29
|
+
export async function test(category: string, test: string, catchUnhandled: boolean): Promise<DG.DataFrame> {
|
|
30
|
+
const data = await runTests({category, test, catchUnhandled});
|
|
30
31
|
return DG.DataFrame.fromObjects(data)!;
|
|
31
32
|
}
|
|
@@ -183,20 +183,18 @@ class SeparatorFilter extends FastaFilter {
|
|
|
183
183
|
|
|
184
184
|
class HelmFilter extends BioFilterBase {
|
|
185
185
|
helmEditor: any;
|
|
186
|
-
_filterPanel = ui.div('', {style: {
|
|
186
|
+
_filterPanel = ui.div('', {style: {cursor: 'pointer'}});
|
|
187
187
|
helmSubstructure = '';
|
|
188
|
-
editDiv = ui.divText('Click to edit', {style: {cursor: 'pointer'}});
|
|
189
188
|
|
|
190
189
|
constructor() {
|
|
191
190
|
super();
|
|
192
191
|
this.init();
|
|
193
|
-
ui.setUpdateIndicator(this._filterPanel, true);
|
|
194
192
|
}
|
|
195
193
|
|
|
196
194
|
async init() {
|
|
197
195
|
this.helmEditor = await grok.functions.call('HELM:helmWebEditor');
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
await ui.tools.waitForElementInDom(this._filterPanel);
|
|
197
|
+
this.updateFilterPanel();
|
|
200
198
|
this._filterPanel.addEventListener('click', (event: MouseEvent) => {
|
|
201
199
|
//@ts-ignore
|
|
202
200
|
ui.dialog({showHeader: false, showFooter: true})
|
|
@@ -204,14 +202,16 @@ class HelmFilter extends BioFilterBase {
|
|
|
204
202
|
.onOK(() => {
|
|
205
203
|
const helmString = this.helmEditor
|
|
206
204
|
.webEditor.canvas.getHelm(true).replace(/<\/span>/g, '').replace(/<span style='background:#bbf;'>/g, '');
|
|
207
|
-
|
|
208
|
-
updateDivInnerHTML(this._filterPanel, this.helmEditor.host);
|
|
209
|
-
this.helmEditor.editor.setHelm(helmString);
|
|
210
|
-
} else { updateDivInnerHTML(this._filterPanel, this.editDiv); }
|
|
205
|
+
this.updateFilterPanel(helmString);
|
|
211
206
|
this.helmSubstructure = helmString;
|
|
212
207
|
this.onChanged.next();
|
|
213
208
|
}).show({modal: true, fullScreen: true});
|
|
214
209
|
});
|
|
210
|
+
ui.onSizeChanged(this._filterPanel).subscribe((_) => {
|
|
211
|
+
const helmString = this.helmEditor
|
|
212
|
+
.webEditor.canvas.getHelm(true).replace(/<\/span>/g, '').replace(/<span style='background:#bbf;'>/g, '');
|
|
213
|
+
this.updateFilterPanel(helmString);
|
|
214
|
+
});
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
get filterPanel() {
|
|
@@ -225,4 +225,26 @@ class HelmFilter extends BioFilterBase {
|
|
|
225
225
|
set substructure(s: string) {
|
|
226
226
|
this.helmEditor.editor.setHelm(s);
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
updateFilterPanel(helmString?: string) {
|
|
230
|
+
const width = this._filterPanel.parentElement!.clientWidth < 100 ? 100 :
|
|
231
|
+
this._filterPanel.parentElement!.clientWidth;
|
|
232
|
+
const height = width / 2;
|
|
233
|
+
if (!helmString) {
|
|
234
|
+
const editDivStyle = {style: {
|
|
235
|
+
width: `${width}px`,
|
|
236
|
+
height: `${height/2}px`,
|
|
237
|
+
textAlign: 'center',
|
|
238
|
+
verticalAlign: 'middle',
|
|
239
|
+
lineHeight: `${height/2}px`,
|
|
240
|
+
border: '1px solid #dbdcdf'
|
|
241
|
+
}};
|
|
242
|
+
const editDiv = ui.divText('Click to edit', editDivStyle);
|
|
243
|
+
updateDivInnerHTML(this._filterPanel, editDiv);
|
|
244
|
+
} else {
|
|
245
|
+
updateDivInnerHTML(this._filterPanel, this.helmEditor.host);
|
|
246
|
+
this.helmEditor.editor.setHelm(helmString);
|
|
247
|
+
this.helmEditor.resizeEditor(width, height);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
228
250
|
}
|