@datagrok/api-samples 1.0.2 → 1.0.4
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/README.md +2 -2
- package/dist/package-test.js +519 -0
- package/dist/package.js +30 -0
- package/package.json +39 -4
- package/package.png +0 -0
- package/scripts/dapi/projects-list.js +1 -1
- package/scripts/dapi/users.js +0 -1
- package/scripts/data-frame/advanced/qualified-numbers.js +1 -1
- package/scripts/data-frame/advanced/virtual-int-column.js +1 -1
- package/scripts/data-frame/bitset/and-or-xor.js +2 -2
- package/scripts/data-frame/bitset/select-rows-fast.js +1 -1
- package/scripts/data-frame/construction/create-from-columns.js +1 -1
- package/scripts/data-frame/construction/create-from-csv.js +1 -1
- package/scripts/data-frame/construction/create-image-column.js +9 -0
- package/scripts/data-frame/metadata/dataframe-meta.js +6 -0
- package/scripts/data-frame/row-matching/select-rows.js +1 -1
- package/scripts/demo/stock-broker.js +2 -3
- package/scripts/domains/chem/chem-benchmark.js +137 -0
- package/scripts/domains/chem/substructure-search-benchmark.js +45 -0
- package/scripts/domains/chem/substructure-search-smarts-molfile-als.js +33 -0
- package/scripts/domains/chem/substructure-search-smarts.js +12 -0
- package/scripts/domains/chem/substructure-search.js +8 -42
- package/scripts/events/tree-view-events.js +29 -0
- package/scripts/functions/calling.js +1 -1
- package/scripts/functions/progress.js +2 -0
- package/scripts/functions/register-function.js +2 -2
- package/scripts/grid/advanced/auto-size.js +7 -0
- package/scripts/grid/color-coding-conditional.js +8 -0
- package/scripts/grid/html-cells/html-markup-cells.js +1 -1
- package/scripts/shell/ui-parts.js +1 -0
- package/scripts/ui/components/file-browser.js +8 -0
- package/scripts/ui/dialogs/dialogs-advanced.js +1 -1
- package/scripts/ui/dialogs/modal.js +5 -7
- package/scripts/ui/elements/inputs/inputs-events.js +1 -1
- package/scripts/ui/elements/inputs/inputs.js +36 -9
- package/scripts/ui/inputs/custom-inputs.js +11 -0
- package/scripts/ui/inputs/input-events.js +22 -0
- package/scripts/ui/ui-events.js +0 -1
- package/scripts/ui/viewers/advanced/attached-properties.js +20 -0
- package/scripts/ui/viewers/advanced/default-properties.js +17 -0
- package/scripts/ui/viewers/custom-viewer-properties.js +1 -1
- package/scripts/ui/viewers/filter-select-highlight.js +19 -0
- package/scripts/ui/viewers/filters/add-single-filter.js +9 -0
- package/scripts/ui/viewers/types/surface-plot.js +24 -0
- package/scripts/ui/views/files-view.js +6 -0
- package/scripts/ui/views/views.js +2 -0
- package/scripts/ux/Interactivity/hints.js +22 -0
- package/src/package-test.ts +17 -0
- package/src/package.ts +4 -0
- package/src/tests/test.ts +11 -0
- package/tsconfig.json +71 -0
- package/webpack.config.js +37 -0
- package/package.js +0 -3
- package/scripts/domains/chem/substructure-search-graph.js +0 -11
- package/scripts/domains/chem/substructure-search-library.js +0 -11
|
@@ -1,19 +1,46 @@
|
|
|
1
|
+
// Different input types
|
|
2
|
+
|
|
3
|
+
// Adding an icon to each input that lets you inspect the value
|
|
4
|
+
// grok.events.onInputCreated.subscribe(
|
|
5
|
+
// (i) => i.root.appendChild(ui.iconFA('eye', () => grok.shell.o = i.value)));
|
|
6
|
+
|
|
7
|
+
// Different input types
|
|
8
|
+
|
|
9
|
+
// Adding an icon to each input that lets you inspect the value
|
|
10
|
+
// grok.events.onInputCreated.subscribe(
|
|
11
|
+
// (i) => i.root.appendChild(ui.iconFA('eye', () => grok.shell.o = i.value)));
|
|
12
|
+
|
|
1
13
|
let v = grok.shell.newView('demo: inputs');
|
|
2
14
|
|
|
15
|
+
let type = ui.choiceInput('Form type', 'Default', ['Default', 'Left', 'Wide', 'Condensed'], (x)=>{
|
|
16
|
+
switch (x){
|
|
17
|
+
case 'Default':
|
|
18
|
+
form.className = 'ui-form';
|
|
19
|
+
break;
|
|
20
|
+
case 'Left':
|
|
21
|
+
form.className = 'ui-form ui-form-left';
|
|
22
|
+
break;
|
|
23
|
+
case 'Wide':
|
|
24
|
+
form.className = 'ui-form ui-form-wide';
|
|
25
|
+
break;
|
|
26
|
+
case 'Condensed':
|
|
27
|
+
form.className = 'ui-form ui-form-condensed';
|
|
28
|
+
break;
|
|
29
|
+
default: form.className = '.ui-form';
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
3
33
|
let name = ui.stringInput('Name', 'Arthur Dent');
|
|
4
34
|
let age = ui.intInput('Age', 30);
|
|
5
|
-
let
|
|
6
|
-
let date = ui.dateInput('Birthday', DG.DateTime.fromDate(new Date(1970, 5, 10)));
|
|
35
|
+
let date = ui.dateInput('Birthday', dayjs('1970-5-10'));
|
|
7
36
|
let alien = ui.boolInput('Alien', false);
|
|
8
37
|
let friends = ui.multiChoiceInput('Friends', ['Ford', 'Fenchurch'], ['Ford', 'Fenchurch', 'Zaphod', 'Slartibartfast']);
|
|
9
38
|
let active = ui.switchInput('Active', true);
|
|
10
39
|
let color = ui.colorInput('Favorite color', '#ff0000');
|
|
40
|
+
let data = ui.tableInput('Details', null);
|
|
41
|
+
let memo = ui.textInput('Memo', '');
|
|
11
42
|
|
|
12
|
-
let
|
|
13
|
-
let container = ui.div();
|
|
14
|
-
v.append(container);
|
|
15
|
-
container.appendChild(ui.inputs(inputs));
|
|
43
|
+
let form = ui.form([type, name, age, date, alien, friends, active, color, data, memo]);
|
|
16
44
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}));
|
|
45
|
+
form.append(ui.buttonsInput([ui.bigButton('Submit', ()=>{grok.shell.info(form.className)})]));
|
|
46
|
+
v.append(form);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Using custom inputs implemented in JS
|
|
2
|
+
// 'foo' editor is defined in the Widgets package.
|
|
3
|
+
|
|
4
|
+
var medication = { name: 'Aspirin', quantity: '20 mg'};
|
|
5
|
+
var nameProp = DG.Property.js('name', DG.TYPE.STRING);
|
|
6
|
+
var fooProp = DG.Property.fromOptions({name: 'quantity', type: DG.TYPE.STRING, semType: 'foo'});
|
|
7
|
+
|
|
8
|
+
ui.dialog()
|
|
9
|
+
.add(ui.input.form(medication, [nameProp, fooProp]))
|
|
10
|
+
.show();
|
|
11
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Manual handling of input-originated events
|
|
2
|
+
|
|
3
|
+
var medication = { name: 'Aspirin', quantity: '20 mg'};
|
|
4
|
+
|
|
5
|
+
// Core value input implemented in Dart
|
|
6
|
+
var nameProp = DG.Property.js('name', DG.TYPE.STRING);
|
|
7
|
+
var nameEditor = DG.InputBase.forProperty(nameProp, medication);
|
|
8
|
+
nameEditor.onChanged((_) => grok.shell.info('name changed: ' + nameEditor.value));
|
|
9
|
+
nameEditor.onInput((_) => grok.shell.info('name input: ' + nameEditor.value));
|
|
10
|
+
|
|
11
|
+
// 'foo' editor is defined in the Widgets package.
|
|
12
|
+
var fooProp = DG.Property.fromOptions({name: 'quantity', type: DG.TYPE.STRING, semType: 'foo'});
|
|
13
|
+
var quantityEditor = DG.InputBase.forProperty(fooProp, medication);
|
|
14
|
+
quantityEditor.onChanged((_) => grok.shell.info('quantity changed: ' + quantityEditor.value));
|
|
15
|
+
quantityEditor.onInput((_) => grok.shell.info('quantity input: ' + quantityEditor.value));
|
|
16
|
+
|
|
17
|
+
quantityEditor.onInput((_) => grok.shell.o = medication);
|
|
18
|
+
|
|
19
|
+
ui.dialog()
|
|
20
|
+
.add(ui.form([nameEditor, quantityEditor]))
|
|
21
|
+
.show();
|
|
22
|
+
|
package/scripts/ui/ui-events.js
CHANGED
|
@@ -13,7 +13,6 @@ grok.events.onProjectClosed.subscribe(p => info(`${p.name}: closed`));
|
|
|
13
13
|
grok.events.onProjectModified.subscribe(p => info(`${p.name}: modified`));
|
|
14
14
|
grok.events.onProjectOpened.subscribe(p => info(`${p.name}: opened`));
|
|
15
15
|
grok.events.onProjectSaved.subscribe(p => info(`${p.name}: saved`));
|
|
16
|
-
grok.events.onProjectUploaded.subscribe(p => info(`${p.name}: uploaded`));
|
|
17
16
|
|
|
18
17
|
grok.events.onCurrentProjectChanged.subscribe(p => info(`Current project changed: ${grok.shell.project.name}`));
|
|
19
18
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let showStats = true; // external storage in this case
|
|
2
|
+
let showStatsProperty = DG.Property.bool(
|
|
3
|
+
'showStatistics',
|
|
4
|
+
(plot) => showStats,
|
|
5
|
+
(plot, value) => showStats = value)
|
|
6
|
+
showStatsProperty.category = 'XXX';
|
|
7
|
+
DG.Property.registerAttachedProperty('ScatterPlotLook', showStatsProperty);
|
|
8
|
+
|
|
9
|
+
grok.events.onViewerAdded.subscribe((data) => {
|
|
10
|
+
console.log(data.args.viewer);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// this property is now editable
|
|
14
|
+
let view = grok.shell.addTableView(grok.data.demo.demog());
|
|
15
|
+
let plot = view.scatterPlot();
|
|
16
|
+
// plot.onAfterDrawScene.subscribe((_) => {
|
|
17
|
+
// if (showStats) {
|
|
18
|
+
// plot.
|
|
19
|
+
// }
|
|
20
|
+
// });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Set default viewer settings for the specific dataframe
|
|
2
|
+
|
|
3
|
+
let df = grok.data.demo.demog();
|
|
4
|
+
let defaultScatterPlotSettings = {
|
|
5
|
+
xColumnName: 'height',
|
|
6
|
+
yColumnName: 'weight',
|
|
7
|
+
sizeColumnName: 'age',
|
|
8
|
+
colorColumnName: 'race',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// now, all newly created viewers attached to df will inherit the specified settings:
|
|
12
|
+
df.tags['.Viewer Template: ' + DG.VIEWER.SCATTER_PLOT] = JSON.stringify(defaultScatterPlotSettings);
|
|
13
|
+
df.tags['.Viewer Template: ' + DG.VIEWER.HISTOGRAM] = JSON.stringify({valueColumnName: 'height'});
|
|
14
|
+
|
|
15
|
+
let view = grok.shell.addTableView(df);
|
|
16
|
+
view.scatterPlot();
|
|
17
|
+
view.histogram();
|
|
@@ -2,7 +2,7 @@ let view = grok.shell.addTableView(grok.data.demo.geo(10000));
|
|
|
2
2
|
let leaflet = view.addViewer('Leaflet');
|
|
3
3
|
leaflet.setOptions({
|
|
4
4
|
latitudeColumnName: 'lat',
|
|
5
|
-
longitudeColumnName: '
|
|
5
|
+
longitudeColumnName: 'lng'
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
grok.shell.info(leaflet.props.getProperties().map((p) => p.name).join(', '));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Different ways to filter, select, and highlight rows
|
|
2
|
+
|
|
3
|
+
let t = grok.data.demo.demog();
|
|
4
|
+
t.rows.filter((row) => row.idx % 3 === 0);
|
|
5
|
+
t.rows.select((row) => row.idx % 5 === 0);
|
|
6
|
+
|
|
7
|
+
let host = ui.divH([
|
|
8
|
+
DG.Viewer.scatterPlot(t, { x: 'height', y: 'weight'}),
|
|
9
|
+
DG.Viewer.histogram(t, { value: 'height' }),
|
|
10
|
+
DG.Viewer.barChart(t),
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
grok.shell.newView('foo').append(host);
|
|
14
|
+
|
|
15
|
+
let highlightHost = ui.divText('Mouse over to highlight');
|
|
16
|
+
highlightHost.onmouseenter = () => t.rows.highlight((i) => i % 2 === 0);
|
|
17
|
+
highlightHost.onmouseleave = () => t.rows.highlight(null);
|
|
18
|
+
|
|
19
|
+
host.appendChild(highlightHost);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// adding the specified filter to the already existing filter group
|
|
2
|
+
|
|
3
|
+
let tv = grok.shell.addTableView(grok.data.demo.molecules());
|
|
4
|
+
let options = {
|
|
5
|
+
type: "Chem:substructureFilter",
|
|
6
|
+
column: "smiles",
|
|
7
|
+
columnName: "smiles"
|
|
8
|
+
};
|
|
9
|
+
tv.getFiltersGroup({createDefaultFilters: false}).add(options);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// This is the fastest way of creating numerical columns
|
|
2
|
+
// The following example creates a table with 100 million rows and two columns
|
|
3
|
+
// See also: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
|
|
4
|
+
|
|
5
|
+
let n = 100;
|
|
6
|
+
let len = n * n;
|
|
7
|
+
let x = new Float32Array(len);
|
|
8
|
+
let y = new Float32Array(len);
|
|
9
|
+
let z = new Float32Array(len);
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < len; i++) {
|
|
12
|
+
x[i] = Math.floor(i / n) - n / 2;
|
|
13
|
+
y[i] = i % n - n / 2;
|
|
14
|
+
z[i] = x[i] * y[i];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let table = DG.DataFrame.fromColumns([
|
|
18
|
+
DG.Column.fromFloat32Array('x', x),
|
|
19
|
+
DG.Column.fromFloat32Array('y', y),
|
|
20
|
+
DG.Column.fromFloat32Array('z', z),
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
let tv = grok.shell.addTableView(table);
|
|
24
|
+
tv.addViewer('SurfacePlot');
|
|
@@ -15,6 +15,8 @@ v.setRibbonPanels([
|
|
|
15
15
|
[ui.divText('Custom panel')]
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
|
+
v.statusBarPanels = [ui.divText('Mission Accomplished')];
|
|
19
|
+
|
|
18
20
|
let acc = ui.accordion();
|
|
19
21
|
acc.addPane('header 1', () => ui.divText('Dynamic content'));
|
|
20
22
|
acc.addPane('header 2', () => ui.divText('More dynamic content'));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const df = grok.data.demo.demog();
|
|
2
|
+
const view = grok.shell.addTableView(df);
|
|
3
|
+
|
|
4
|
+
// Place a hint on a visual component in your application
|
|
5
|
+
const addNCIcon = $('div.d4-ribbon-item').has('i.svg-add-new-column')[0];
|
|
6
|
+
ui.hints.addHint(addNCIcon);
|
|
7
|
+
|
|
8
|
+
// Remove it once certain conditions are met, e.g., mouse events, platform events
|
|
9
|
+
// available via the grok.events entrypoint (use rxjs.operators.first(), if needed).
|
|
10
|
+
// Hints can be removed both programmatically and by the user (via the close icon).
|
|
11
|
+
$(addNCIcon).on('click', () => {
|
|
12
|
+
ui.hints.remove(addNCIcon);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
grok.events.onDialogShown.pipe(
|
|
16
|
+
rxjs.operators.first(),
|
|
17
|
+
rxjs.operators.filter((dlg) => dlg.title === 'Add New Column'))
|
|
18
|
+
.subscribe((dlg) => {
|
|
19
|
+
const input = dlg.inputs[0].root;
|
|
20
|
+
ui.hints.addHint(input);
|
|
21
|
+
setTimeout(() => ui.hints.remove(input), 4000);
|
|
22
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as DG from 'datagrok-api/dg';
|
|
2
|
+
import * as grok from 'datagrok-api/grok';
|
|
3
|
+
import {runTests, tests, TestContext} from '@datagrok-libraries/utils/src/test';
|
|
4
|
+
export const _package = new DG.Package();
|
|
5
|
+
export {tests};
|
|
6
|
+
|
|
7
|
+
import './tests/test';
|
|
8
|
+
|
|
9
|
+
//name: test
|
|
10
|
+
//input: string category {optional: true}
|
|
11
|
+
//input: string test {optional: true}
|
|
12
|
+
//input: object testContext {optional: true}
|
|
13
|
+
//output: dataframe result
|
|
14
|
+
export async function test(category: string, test: string, testContext: TestContext): Promise<DG.DataFrame> {
|
|
15
|
+
const data = await runTests({category, test, testContext});
|
|
16
|
+
return DG.DataFrame.fromObjects(data)!;
|
|
17
|
+
}
|
package/src/package.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {category, test, expect} from '@datagrok-libraries/utils/src/test';
|
|
2
|
+
|
|
3
|
+
category('ApiSamples', async () => {
|
|
4
|
+
test('dummy', async () => {
|
|
5
|
+
expect(1 == 1, true);
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
test('skipped dummy', async () => {
|
|
9
|
+
expect(1 == 1, false);
|
|
10
|
+
}, {skipReason: 'TASK-ID'})
|
|
11
|
+
})
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
+
"module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
+
"lib": ["es2020", "dom"], /* Specify library files to be included in the compilation. */
|
|
10
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
|
13
|
+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
+
// "outDir": "./", /* Redirect output structure to the directory. */
|
|
18
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
+
// "composite": true, /* Enable project compilation */
|
|
20
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
+
|
|
27
|
+
/* Strict Type-Checking Options */
|
|
28
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
+
|
|
37
|
+
/* Additional Checks */
|
|
38
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
43
|
+
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
44
|
+
|
|
45
|
+
/* Module Resolution Options */
|
|
46
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
47
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
48
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
49
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
50
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
51
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
52
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
53
|
+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
54
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
55
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
56
|
+
|
|
57
|
+
/* Source Map Options */
|
|
58
|
+
"sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
59
|
+
"mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
"inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
61
|
+
"inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
62
|
+
|
|
63
|
+
/* Experimental Options */
|
|
64
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
65
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
66
|
+
|
|
67
|
+
/* Advanced Options */
|
|
68
|
+
"skipLibCheck": false, /* Skip type checking of declaration files. */
|
|
69
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: 'development',
|
|
5
|
+
entry: {
|
|
6
|
+
test: {filename: 'package-test.js', library: {type: 'var', name: `apisamples_test`}, import: './src/package-test.ts'},
|
|
7
|
+
package: './src/package.ts',
|
|
8
|
+
},
|
|
9
|
+
resolve: {
|
|
10
|
+
extensions: ['.wasm', '.mjs', '.js', '.json', '.ts', '.tsx'],
|
|
11
|
+
},
|
|
12
|
+
module: {
|
|
13
|
+
rules: [
|
|
14
|
+
{
|
|
15
|
+
test: /\.ts$/,
|
|
16
|
+
loader: 'ts-loader',
|
|
17
|
+
exclude: /node_modules/,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
devtool: 'inline-source-map',
|
|
22
|
+
externals: {
|
|
23
|
+
'datagrok-api/dg': 'DG',
|
|
24
|
+
'datagrok-api/grok': 'grok',
|
|
25
|
+
'datagrok-api/ui': 'ui',
|
|
26
|
+
'openchemlib/full.js': 'OCL',
|
|
27
|
+
'rxjs': 'rxjs',
|
|
28
|
+
'rxjs/operators': 'rxjs.operators',
|
|
29
|
+
},
|
|
30
|
+
output: {
|
|
31
|
+
filename: '[name].js',
|
|
32
|
+
library: 'apisamples',
|
|
33
|
+
libraryTarget: 'var',
|
|
34
|
+
path: path.resolve(__dirname, 'dist'),
|
|
35
|
+
clean: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
package/package.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//name: testSubstructureSearch
|
|
2
|
-
//language: javascript
|
|
3
|
-
|
|
4
|
-
// An example of using substructure search.
|
|
5
|
-
|
|
6
|
-
grok.data.loadTable('https://public.datagrok.ai/demo/sar_small.csv')
|
|
7
|
-
.then(t => grok.chem.searchSubstructure(t.col('smiles'), 'O=C1CN=C(C2CCCCC2)C2:C:C:C:C:C:2N1', {substructLibrary: false})
|
|
8
|
-
.then(function (bs) {
|
|
9
|
-
t.filter.copyFrom(bs);
|
|
10
|
-
grok.shell.addTableView(t);
|
|
11
|
-
}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//name: testSubstructureSearch
|
|
2
|
-
//language: javascript
|
|
3
|
-
|
|
4
|
-
// An example of using substructure search.
|
|
5
|
-
|
|
6
|
-
grok.data.loadTable('https://public.datagrok.ai/demo/sar_small.csv')
|
|
7
|
-
.then(t => grok.chem.searchSubstructure(t.col('smiles'), 'O=C1CN=C(C2CCCCC2)C2:C:C:C:C:C:2N1')
|
|
8
|
-
.then(function (bs) {
|
|
9
|
-
t.filter.copyFrom(bs);
|
|
10
|
-
grok.shell.addTableView(t);
|
|
11
|
-
}));
|