@datagrok/api-samples 1.0.5 → 1.0.7
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/.eslintrc.json +47 -0
- package/CHANGELOG.md +9 -0
- package/README.md +11 -9
- package/dist/package-test.js +2 -519
- package/dist/package.js +2 -30
- package/layouts/demog-table-layout.json +236 -0
- package/package.json +15 -13
- package/scripts/dapi/files.js +12 -12
- package/scripts/dapi/groups.js +3 -0
- package/scripts/dapi/users.js +1 -1
- package/scripts/data-access/db/db-edit.js +27 -0
- package/scripts/data-access/db-master-details-manual.js +3 -3
- package/scripts/data-access/dynamic-query.js +13 -0
- package/scripts/data-access/output-layouts.js +5 -0
- package/scripts/data-access/parameterized-query.js +3 -3
- package/scripts/data-frame/bitset/similarity-metrics.js +3 -3
- package/scripts/data-frame/construction/create-from-csv-format.js +3 -3
- package/scripts/data-frame/events/calculated-columns/update.js +1 -1
- package/scripts/data-frame/join-link/join-tables.js +5 -6
- package/scripts/data-frame/modification/remove-where.js +8 -0
- package/scripts/data-frame/row-matching/patterns.js +1 -3
- package/scripts/domains/chem/chem-benchmark.js +26 -26
- package/scripts/domains/chem/descriptors.js +1 -2
- package/scripts/domains/chem/diversity-search.js +3 -5
- package/scripts/domains/chem/inspect-molecule.js +1 -1
- package/scripts/domains/chem/mcs.js +2 -3
- package/scripts/domains/chem/mol-atoms-bonds.js +1 -2
- package/scripts/domains/chem/mol-panel.js +0 -1
- package/scripts/domains/chem/mol-rendering-canvas.js +4 -6
- package/scripts/domains/chem/mol-rendering.js +0 -1
- package/scripts/domains/chem/r-group.js +3 -5
- package/scripts/domains/chem/similarity-scoring-scores.js +0 -3
- package/scripts/domains/chem/similarity-scoring-sorted.js +0 -3
- package/scripts/domains/chem/substructure-search-benchmark.js +5 -8
- package/scripts/domains/chem/substructure-search-smarts-molfile-als.js +6 -9
- package/scripts/domains/chem/substructure-search-smarts.js +4 -7
- package/scripts/domains/chem/substructure-search.js +1 -4
- package/scripts/domains/data-science/predictive-model.js +2 -3
- package/scripts/functions/caching-results.js +36 -0
- package/scripts/functions/calling.js +2 -2
- package/scripts/functions/discover-functions.js +1 -1
- package/scripts/functions/func-call.js +18 -0
- package/scripts/functions/progress.js +2 -7
- package/scripts/grid/advanced/charts-in-cells.js +16 -14
- package/scripts/grid/advanced/link-click.js +19 -0
- package/scripts/grid/advanced/pinned-columns.js +7 -0
- package/scripts/grid/advanced/pinned-rows.js +8 -0
- package/scripts/grid/advanced/visible-cells.js +3 -4
- package/scripts/grid/scroll-to-pixels.js +9 -4
- package/scripts/misc/audit/activity-today.js +3 -3
- package/scripts/misc/audit/errors-summary.js +2 -4
- package/scripts/misc/audit/test-tracking.js +2 -4
- package/scripts/misc/audit/users-today.js +6 -7
- package/scripts/misc/package-credentials.js +2 -4
- package/scripts/misc/paint/paint.js +14 -0
- package/scripts/misc/sdtm.js +8 -10
- package/scripts/misc/utils/hide-empty-columns.js +19 -0
- package/scripts/scripting/grok-scripting.js +1 -1
- package/scripts/scripting/scripting.js +2 -2
- package/scripts/shell/current-object.js +1 -1
- package/scripts/shell/last-error.js +0 -4
- package/scripts/shell/windows/shell-windows.js +6 -0
- package/scripts/ui/components/balloons.js +9 -0
- package/scripts/ui/components/breadcrumbs.js +4 -0
- package/scripts/ui/{elements → components}/color-palettes.js +4 -4
- package/scripts/ui/components/drop-down.js +7 -0
- package/scripts/ui/components/html-tables.js +27 -0
- package/scripts/ui/components/loading-indicators.js +4 -6
- package/scripts/ui/components/menu-customization.js +18 -0
- package/scripts/ui/components/property-grid.js +10 -10
- package/scripts/ui/{layouts → containers}/splitters.js +3 -3
- package/scripts/ui/css.js +20 -0
- package/scripts/ui/docking/README.md +3 -3
- package/scripts/ui/handlers/handlers.js +1 -1
- package/scripts/ui/inputs/advanced/all-input-types.js +47 -0
- package/scripts/ui/inputs/{for-properties.js → advanced/for-properties.js} +17 -2
- package/scripts/ui/inputs/advanced/input-form.js +10 -0
- package/scripts/ui/inputs/forms.js +35 -0
- package/scripts/ui/inputs/grid-input.js +14 -0
- package/scripts/ui/inputs/inputs.js +24 -0
- package/scripts/ui/{elements/inputs → inputs}/table-input.js +1 -2
- package/scripts/ui/inputs/tags-input.js +12 -0
- package/scripts/ui/inputs/typeahead-input.js +19 -0
- package/scripts/ui/interactivity/hints.js +25 -0
- package/scripts/ui/interactivity/wizard-hints.js +15 -0
- package/scripts/ui/viewers/advanced/sketch-form.js +9 -0
- package/scripts/ui/viewers/custom-scatterplot-rendering.js +1 -1
- package/scripts/ui/viewers/custom-viewer-properties.js +5 -5
- package/scripts/ui/viewers/filters/custom-filters.js +8 -3
- package/scripts/ui/viewers/js viewers/chord-viewer.js +3 -0
- package/scripts/ui/viewers/js viewers/globe-viewer.js +13 -0
- package/scripts/ui/viewers/js viewers/radar-viewer.js +9 -0
- package/scripts/ui/viewers/js viewers/sankey-viewer.js +4 -0
- package/scripts/ui/viewers/js viewers/sunburst-viewer.js +3 -0
- package/scripts/ui/viewers/js viewers/surface-plot.js +2 -0
- package/scripts/ui/viewers/js viewers/timelines-viewer.js +3 -0
- package/scripts/ui/viewers/js viewers/tree-viewer.js +3 -0
- package/scripts/ui/viewers/js viewers/word-cloud.js +5 -0
- package/scripts/ui/viewers/trellis-plot-with-summary-viewer.js +14 -0
- package/scripts/ui/viewers/types/form-advanced.js +7 -0
- package/scripts/ui/views/currently-open-views.js +5 -5
- package/src/package-test.ts +31 -1
- package/tsconfig.json +1 -1
- package/scripts/misc/audit/errors.js +0 -4
- package/scripts/misc/audit/event-types-summary.js +0 -4
- package/scripts/misc/audit/rolling-events.js +0 -11
- package/scripts/ui/apps/color-checker.js +0 -328
- package/scripts/ui/components/panels.js +0 -19
- package/scripts/ui/elements/html-tables.js +0 -24
- package/scripts/ui/elements/inputs/inputs.js +0 -46
- package/scripts/ui/layouts/templates/2 Column.js +0 -14
- package/scripts/ui/layouts/templates/3 Column.js +0 -15
- package/scripts/ui/layouts/templates/Flex box.js +0 -16
- package/scripts/ui/layouts/templates/Fluid layout.js +0 -19
- package/scripts/ui/layouts/templates/Gallery grid.js +0 -18
- package/scripts/ui/layouts/templates/Splitter (1 Column 2 Row).js +0 -19
- package/scripts/ui/layouts/templates/Splitter (2 Column).js +0 -16
- package/scripts/ui/layouts/templates/Splitter (2 Row).js +0 -18
- package/scripts/ui/layouts/templates/Splitter (2-3 Column).js +0 -23
- package/scripts/ui/layouts/templates/Tabs 2 column.js +0 -19
- package/scripts/ui/layouts/templates/Tabs navbar.js +0 -16
- package/scripts/ui/viewers/types/google-map.js +0 -5
- package/scripts/ux/Dialogs/add-new-column-dlg.js +0 -58
- package/scripts/ux/Dialogs/link-table-dlg.js +0 -23
- package/scripts/ux/Filters/data-filtering.js +0 -99
- package/scripts/ux/Input forms/form-types.js +0 -133
- package/scripts/ux/Input forms/misc.js +0 -52
- package/scripts/ux/Interactivity/hints.js +0 -22
- package/scripts/ux/Layouts/example-1.js +0 -50
- package/scripts/ux/Layouts/example-2.js +0 -63
- package/scripts/ux/Layouts/example-3.js +0 -192
- package/scripts/ux/Layouts/example-4.js +0 -51
- package/scripts/ux/Managing Collections/datasource-view.js +0 -47
- package/scripts/ux/Views/property-panel.js +0 -120
- package/scripts/ux/Views/toolbar.js +0 -146
- package/scripts/ux/Views/toolbox.js +0 -124
- /package/scripts/ui/{elements → components}/buttons.js +0 -0
- /package/scripts/ui/{elements → components}/icons.js +0 -0
- /package/scripts/ui/{elements → components}/image.js +0 -0
- /package/scripts/ui/{elements → components}/list.js +0 -0
- /package/scripts/ui/{elements → components}/range-slider.js +0 -0
- /package/scripts/ui/{cards → components}/summary-card.js +0 -0
- /package/scripts/ui/{elements → components}/typography.js +0 -0
- /package/scripts/ui/{layouts → containers}/blocks.js +0 -0
- /package/scripts/ui/{layouts → containers}/box.js +0 -0
- /package/scripts/ui/{layouts → containers}/containers.js +0 -0
- /package/scripts/ui/{layouts → containers}/flexbox.js +0 -0
- /package/scripts/ui/{layouts → containers}/panels.js +0 -0
- /package/scripts/ui/inputs/{custom-inputs.js → advanced/custom-inputs.js} +0 -0
- /package/scripts/ui/inputs/{for-columns.js → advanced/for-columns.js} +0 -0
- /package/scripts/ui/inputs/{input-events.js → advanced/input-events.js} +0 -0
- /package/scripts/ui/inputs/{master-details.js → advanced/master-details.js} +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/choice-input.js +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/column-combo-box.js +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/column-inputs.js +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/inputs-events.js +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/inputs-extended.js +0 -0
- /package/scripts/ui/{elements/inputs → inputs}/molecule-input.js +0 -0
- /package/scripts/{ux/Interactivity → ui/interactivity}/drag-and-drop.js +0 -0
- /package/scripts/{ux/Rendering → ui/rendering}/render-items.js +0 -0
- /package/scripts/ui/{components/tooltips → tooltips}/row-group-tooltips.js +0 -0
- /package/scripts/ui/{components/tooltips → tooltips}/tooltip-events.js +0 -0
- /package/scripts/ui/{components/tooltips → tooltips}/tooltips.js +0 -0
- /package/scripts/{ux/Navigations → ui/views}/navigation.js +0 -0
- /package/scripts/{ux/Managing Collections → ui/views}/virtual-view.js +0 -0
package/scripts/misc/sdtm.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
let links = {
|
|
2
|
-
ae: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
lb: { key: 'USUBJID', start: 'LBDY', event: 'LBTEST'}
|
|
2
|
+
ae: {key: 'USUBJID', start: 'AESTDY', end: 'AEENDY', event: 'AETERM'},
|
|
3
|
+
sv: {key: 'USUBJID', start: 'VISITDY', event: 'VISIT'},
|
|
4
|
+
lb: {key: 'USUBJID', start: 'LBDY', event: 'LBTEST'}
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
let result = null;
|
|
9
8
|
|
|
10
|
-
let getTable = function(domain) {
|
|
9
|
+
let getTable = async function(domain) {
|
|
11
10
|
let info = links[domain];
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
.clone(null, Object.keys(info).map(e => info[e]));
|
|
11
|
+
let df = await grok.data.files.openTable(`System:AppData/ClinicalCase/${domain}.csv`);
|
|
12
|
+
let t = df.clone(null, Object.keys(info).map(e => info[e]));
|
|
15
13
|
t.columns.addNew('domain', DG.TYPE.STRING).init(domain);
|
|
16
14
|
for (let name in info)
|
|
17
15
|
t.col(info[name]).name = name;
|
|
18
16
|
return t;
|
|
19
|
-
}
|
|
17
|
+
};
|
|
20
18
|
|
|
21
19
|
for (let domain in links) {
|
|
22
|
-
let t = getTable(domain);
|
|
20
|
+
let t = await getTable(domain);
|
|
23
21
|
if (result == null)
|
|
24
22
|
result = t;
|
|
25
23
|
else
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Hides completely empty columns
|
|
2
|
+
|
|
3
|
+
let table = DG.DataFrame.fromCsv(
|
|
4
|
+
`make, model, cylinders, volume, price
|
|
5
|
+
Honda, Civic, , 1.4, 15000
|
|
6
|
+
Honda, Accord, , 1.8, 20000
|
|
7
|
+
BMW, 328i, , 1.7, 60000
|
|
8
|
+
BMW, 535i, , 1.5, 35000
|
|
9
|
+
Tesla, Roadster, , 1.6, 100000
|
|
10
|
+
Tesla, Model S, , 1.6, 120000`);
|
|
11
|
+
|
|
12
|
+
let tv = grok.shell.addTableView(table);
|
|
13
|
+
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
for (let c of tv.dataFrame.columns) {
|
|
16
|
+
if (c.stats.missingValueCount === tv.dataFrame.rowCount)
|
|
17
|
+
tv.grid.col(c.name).visible = false;
|
|
18
|
+
}
|
|
19
|
+
}, 1000);
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
//help-url: https://datagrok.ai/help/compute/scripting
|
|
3
3
|
// An example of using scripting (R, Python etc.)
|
|
4
4
|
|
|
5
|
-
grok.functions.call('
|
|
6
|
-
grok.functions.call('
|
|
5
|
+
grok.functions.call('Demo:PythonDup', {'s': '1010'}).then(result => grok.shell.info(result));
|
|
6
|
+
grok.functions.call('Demo:RDup', {'s': '0101'}).then(result => grok.shell.info(result));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
let v = grok.shell.newView('palettes');
|
|
4
4
|
|
|
5
5
|
function getBlock(c) {
|
|
6
|
-
let block = ui.
|
|
6
|
+
let block = ui.div([DG.Color.toRgb(c),' hex:', DG.Color.toHtml(c)]);
|
|
7
7
|
block.style.backgroundColor = DG.Color.toRgb(c);
|
|
8
8
|
block.style.color = DG.Color.toRgb(DG.Color.getContrastColor(c));
|
|
9
9
|
return block;
|
|
@@ -12,6 +12,6 @@ function getBlock(c) {
|
|
|
12
12
|
v.appendAll([
|
|
13
13
|
ui.h1('Categorical palette with contrast text color'),
|
|
14
14
|
ui.div(DG.Color.categoricalPalette.map(getBlock)),
|
|
15
|
-
ui.h1('
|
|
16
|
-
ui.div(DG.
|
|
17
|
-
]);
|
|
15
|
+
ui.h1('Get contrast color from white'),
|
|
16
|
+
ui.div(getBlock(DG.Color.getContrastColor(DG.Color.white)))
|
|
17
|
+
]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const dropDown = ui.dropDown(ui.iconFA('plus'), () => ui.div('Element'));
|
|
2
|
+
const dropDown2 = ui.dropDown(ui.iconFA('minus'), () => ui.list(['Element 1', 'Element 2', 'Element 3']));
|
|
3
|
+
|
|
4
|
+
dropDown.onElementClick.subscribe(() => grok.shell.info('Element click'));
|
|
5
|
+
dropDown.onExpand.subscribe(() => grok.shell.info('expand event'));
|
|
6
|
+
|
|
7
|
+
grok.shell.newView('DropDown', [ui.ribbonPanel([dropDown.root, dropDown2.root])]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Creating HTML-driven tables
|
|
2
|
+
// For high-performance grid, check out samples under /grid
|
|
3
|
+
|
|
4
|
+
var users = [
|
|
5
|
+
{name: 'Mike', surname: 'Moore', age: 30, sex: 'Male'},
|
|
6
|
+
{name: 'Kate', surname: 'Jackson', age: 27, sex: 'Female'},
|
|
7
|
+
{name: 'John', surname: 'Stone', age: 32, sex: 'Male'},
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
let table1 = ui.tableFromMap({
|
|
11
|
+
user: grok.shell.user.toMarkup(),
|
|
12
|
+
project: grok.shell.project.toMarkup(),
|
|
13
|
+
time: new Date(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
let table2 = DG.HtmlTable.create(users, (item) => [item.name, item.surname, item.age, item.sex]);
|
|
17
|
+
|
|
18
|
+
let table3 = ui.table(users, (item) => [item.name, item.surname, item.age, item.sex],
|
|
19
|
+
['First name', 'Last name', 'Age', 'Sex']);
|
|
20
|
+
|
|
21
|
+
let view = grok.shell.newView('table with renderer', [
|
|
22
|
+
table1,
|
|
23
|
+
table2,
|
|
24
|
+
table3,
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
table2.remove(users[2]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//wait, waitBox, loader
|
|
2
2
|
|
|
3
|
-
async function sleep() {
|
|
4
|
-
return new Promise(resolve => setTimeout(resolve,
|
|
3
|
+
async function sleep(time) {
|
|
4
|
+
return new Promise(resolve => setTimeout(resolve, time));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//load indicator
|
|
@@ -9,16 +9,14 @@ let loader = ui.loader();
|
|
|
9
9
|
|
|
10
10
|
//wait container
|
|
11
11
|
let wait = ui.wait(async () => {
|
|
12
|
-
await sleep();
|
|
12
|
+
await sleep(500);
|
|
13
13
|
return ui.divText('ui.wait element');
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
//wait container. Recommend to use inside tabControl, accordion, box, view.box
|
|
17
17
|
let waitBox = ui.waitBox(async () => {
|
|
18
|
-
await sleep();
|
|
18
|
+
await sleep(1000);
|
|
19
19
|
return ui.divText('ui.waitBox element');
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
wait.style.border = '1px solid var(--grey-1)';
|
|
23
|
-
waitBox.style.border = '1px solid var(--grey-1)';
|
|
24
22
|
grok.shell.newView('Demo, loader, wait, waitBox', [wait, waitBox, loader]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Menu item customization. For top menu, see menu.js
|
|
2
|
+
|
|
3
|
+
const host = ui.divText('Click for context menu');
|
|
4
|
+
DG.Menu.popup()
|
|
5
|
+
.item('Explore', () => grok.shell.info('Foo'), null, {
|
|
6
|
+
description: 'Explore Foo',
|
|
7
|
+
shortcut: 'Ctrl+E'})
|
|
8
|
+
.group('Single choice')
|
|
9
|
+
.items(['Apple', 'Banana', 'Peach'], (s) => grok.shell.info(s),
|
|
10
|
+
{radioGroup: 'Fruits', isChecked: (s) => s === 'Banana'})
|
|
11
|
+
.endGroup()
|
|
12
|
+
.group('Multi choice')
|
|
13
|
+
.items(['Apple', 'Banana', 'Peach'], (s) => grok.shell.info(s), {isChecked: (s) => s === 'Banana'})
|
|
14
|
+
.endGroup()
|
|
15
|
+
.separator()
|
|
16
|
+
.item('Touch', () => grok.shell.info('Foo'), null, {isEnabled: () => 'Can\'t touch this!'})
|
|
17
|
+
.bind(host)
|
|
18
|
+
.show();
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// dynamically create properties and edit objects in the property grid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const person = {name: 'John', sex: 'M', weight: 67.2, age: 32, checked: true};
|
|
4
4
|
|
|
5
5
|
// generate properties
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const name = DG.Property.string('name', (x) => x.name, (x, v) => x.name = v, '');
|
|
7
|
+
const sex = DG.Property.string('sex', (x) => x.sex, (x, v) => x.sex = v, '');
|
|
8
8
|
|
|
9
9
|
// shorter notation for JS properties
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const weight = DG.Property.jsFloat('weight');
|
|
11
|
+
const age = DG.Property.jsInt('age');
|
|
12
|
+
const checked = DG.Property.jsBool('checked');
|
|
13
13
|
|
|
14
14
|
// change properties if you wish
|
|
15
15
|
sex.choices = ['M', 'F'];
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
propGrid.update(person, [name, sex,
|
|
17
|
+
const propGrid = new DG.PropertyGrid();
|
|
18
|
+
propGrid.update(person, [name, sex, weight, age, checked]);
|
|
19
19
|
|
|
20
20
|
//ui.dialog().add(propGrid).show({width: 400, height: 250});
|
|
21
21
|
|
|
@@ -23,5 +23,5 @@ ui.dialog()
|
|
|
23
23
|
.add(ui.h1('Property grid'))
|
|
24
24
|
.add(propGrid)
|
|
25
25
|
.add(ui.h1('Form'))
|
|
26
|
-
.add(ui.input.form(person, [name, sex,
|
|
27
|
-
.show({width: 350, height: 500});
|
|
26
|
+
.add(ui.input.form(person, [name, sex, weight, age, checked]))
|
|
27
|
+
.show({width: 350, height: 500});
|
|
@@ -9,12 +9,12 @@ let block = ui.splitV([
|
|
|
9
9
|
ui.textInput('text',' multi line /n text input'),
|
|
10
10
|
]),
|
|
11
11
|
DG.Viewer.grid(t).root
|
|
12
|
-
]),
|
|
12
|
+
], {}, true),
|
|
13
13
|
ui.splitH([
|
|
14
14
|
DG.Viewer.scatterPlot(t).root,
|
|
15
15
|
DG.Viewer.histogram(t).root
|
|
16
|
-
])
|
|
17
|
-
]);
|
|
16
|
+
], {}, true)
|
|
17
|
+
], {}, true);
|
|
18
18
|
|
|
19
19
|
let view = grok.shell.newView('Splitters');
|
|
20
20
|
view.box = true;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//Datagrok has pre-build CSS helper classes to manipulate most common parameters such as:
|
|
2
|
+
//margins, paddings, text size, text weight, etc.
|
|
3
|
+
//To call them, use ui.css.
|
|
4
|
+
|
|
5
|
+
let div1 = ui.div('Child 1');
|
|
6
|
+
|
|
7
|
+
div1.classList.add(
|
|
8
|
+
ui.css.padding.large, // Padding
|
|
9
|
+
ui.css.border.all, // Border
|
|
10
|
+
ui.css.background.white, // Background color
|
|
11
|
+
ui.css.margin.medium, // Margin
|
|
12
|
+
ui.css.textSize.medium, // Text size
|
|
13
|
+
ui.css.textWeight.bold, // Text weight
|
|
14
|
+
ui.css.shadow.small // Shadow
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
ui.div([
|
|
18
|
+
'Parent',
|
|
19
|
+
div1
|
|
20
|
+
], ui.css.background.light); //add light grey background color
|
|
@@ -5,12 +5,12 @@ could be either dragged out and positioned manually, or set up automatically.
|
|
|
5
5
|
|
|
6
6
|
## Top-level window docking
|
|
7
7
|
|
|
8
|
-
Use `grok.shell.dockManager` to dock, undock, or reposition windows.
|
|
9
|
-
See also `View.dockNode`
|
|
8
|
+
Use `grok.shell.dockManager` to dock, undock, or reposition windows.
|
|
9
|
+
See also `View.dockNode`
|
|
10
10
|
|
|
11
11
|
## Nested docking
|
|
12
12
|
|
|
13
13
|
Some of the views contain a nested docking manager, which allows to manage
|
|
14
14
|
windows within that particular view (they cannot be undocked and docked on
|
|
15
|
-
a top level, or within a different view). See `dockManager` property of the
|
|
15
|
+
a top level, or within a different view). See `dockManager` property of the
|
|
16
16
|
View class.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const df = grok.data.demo.demog();
|
|
2
|
+
grok.shell.addTable(df);
|
|
3
|
+
|
|
4
|
+
const properties = [
|
|
5
|
+
{ "name": "int", "inputType": "Int", "showPlusMinus": true },
|
|
6
|
+
{ "name": "float", "inputType": "Float", min: 0, max: 10, "showSlider": true},
|
|
7
|
+
{ "name": "bigInt", "inputType": "BigInt"},
|
|
8
|
+
{ "name": "qnum", "inputType": "QNum"},
|
|
9
|
+
{ "name": "slider", "inputType": "Slider", "min": 0, "max": 10},
|
|
10
|
+
{ "name": "bool", "inputType": "Bool"},
|
|
11
|
+
{ "name": "textArea", "inputType": "TextArea"},
|
|
12
|
+
{ "name": "text", "inputType": "Text"},
|
|
13
|
+
{ "name": "date", "inputType": "Date"},
|
|
14
|
+
//{ "name": "map", "inputType": "Map"},
|
|
15
|
+
{ "name": "list", "inputType": "List"},
|
|
16
|
+
{ "name": "color", "inputType": "Color"},
|
|
17
|
+
{ "name": "table", "inputType": "Table"},
|
|
18
|
+
{ "name": "column", "inputType": "Column"},
|
|
19
|
+
{ "name": "radio", "inputType": "Radio", choices: ["Apple", "Banana"]},
|
|
20
|
+
{ "name": "choice", "inputType": "Choice", choices: ["Apple", "Banana"]},
|
|
21
|
+
{ "name": "multiChoice", "inputType": "MultiChoice", choices: ["Apple", "Banana"]},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
let props = properties.map((p) => DG.Property.fromOptions(p))
|
|
25
|
+
let object = {
|
|
26
|
+
int: 12,
|
|
27
|
+
bigInt: "12345678901234567890",
|
|
28
|
+
float: 4.5,
|
|
29
|
+
qnum: DG.Qnum.less(5),
|
|
30
|
+
slider: 10,
|
|
31
|
+
bool: true,
|
|
32
|
+
textArea: "Bins rise and they fall,\nDistribution's gentle dance,\nHistogram unveils",
|
|
33
|
+
text: 'Only text',
|
|
34
|
+
//date: '2023/10/30', //dayjs(1977, 10, 2),
|
|
35
|
+
map: { key1: 'value1', key2: 'value2'},
|
|
36
|
+
color: '#e66465',
|
|
37
|
+
list: ['1', '2', '4'],
|
|
38
|
+
table: df,
|
|
39
|
+
column: df.columns.byName('race'),
|
|
40
|
+
choice: 'Apple',
|
|
41
|
+
radio: 'Apple',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
ui.divV([
|
|
45
|
+
ui.input.form(object, props),
|
|
46
|
+
ui.button('Show', () => grok.shell.info(JSON.stringify(object)))
|
|
47
|
+
])
|
|
@@ -9,17 +9,30 @@ const properties = [
|
|
|
9
9
|
{
|
|
10
10
|
"name": "structure",
|
|
11
11
|
"type": "string",
|
|
12
|
-
"semType": "Molecule"
|
|
12
|
+
//"semType": "Molecule"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "weight",
|
|
16
16
|
"type": DG.TYPE.FLOAT,
|
|
17
|
-
"valueValidators": [(w) => w > 10]
|
|
17
|
+
"valueValidators": [(w) => w > 10 ? null : 'Too small']
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"name": "started",
|
|
21
21
|
"type": DG.TYPE.DATE_TIME,
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"name": "stage",
|
|
25
|
+
"type": "int",
|
|
26
|
+
"showPlusMinus": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "slider",
|
|
30
|
+
"type": DG.TYPE.FLOAT,
|
|
31
|
+
"showSlider": true,
|
|
32
|
+
"min": 2.2,
|
|
33
|
+
"max": 5.5,
|
|
34
|
+
"nullable": false,
|
|
35
|
+
},
|
|
23
36
|
{
|
|
24
37
|
"name": "rating",
|
|
25
38
|
"type": "int",
|
|
@@ -33,6 +46,8 @@ let props = properties.map((p) => DG.Property.fromOptions(p))
|
|
|
33
46
|
let object = {
|
|
34
47
|
reactorType: 'Production',
|
|
35
48
|
structure: 'CC(=O)OC1=CC=CC=C1C(=O)O',
|
|
49
|
+
stage: 5,
|
|
50
|
+
slider: 3.3,
|
|
36
51
|
rating: 7,
|
|
37
52
|
department: 'IT'
|
|
38
53
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// creating a form, and accessing its individual inputs
|
|
2
|
+
|
|
3
|
+
DG.Func.findAll({name: 'Pkpd'}).then((fs) => {
|
|
4
|
+
let fc = fs[0].prepare({dosage: 77});
|
|
5
|
+
DG.InputForm.forFuncCall(fc).then((inputForm) => {
|
|
6
|
+
inputForm.getInput('Clearance').addPostfix('foo');
|
|
7
|
+
inputForm.onInputChanged.subscribe((_) => grok.shell.info('changed'));
|
|
8
|
+
grok.shell.o = inputForm.root;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Different form types
|
|
2
|
+
|
|
3
|
+
let v = grok.shell.newView('demo: form types');
|
|
4
|
+
|
|
5
|
+
//Basic form
|
|
6
|
+
//To set labels aligned to left add class .ui-form-left
|
|
7
|
+
let form = ui.form([
|
|
8
|
+
ui.h1('Basic form'),
|
|
9
|
+
ui.stringInput('First name', 'Arthur'),
|
|
10
|
+
ui.stringInput('Last name', 'Dent'),
|
|
11
|
+
ui.intInput('Age', 30)
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
//Add class .ui-form-wide to make the form wide
|
|
15
|
+
let wideForm = ui.form([
|
|
16
|
+
ui.h1('Wide form'),
|
|
17
|
+
ui.stringInput('First name', 'Arthur'),
|
|
18
|
+
ui.stringInput('Last name', 'Dent'),
|
|
19
|
+
ui.intInput('Age', 30)
|
|
20
|
+
], 'ui-form-wide');
|
|
21
|
+
|
|
22
|
+
//Condensed form. You can also use .ui-form-condensed
|
|
23
|
+
let narrowForm = ui.narrowForm([
|
|
24
|
+
ui.h1('Condensed form'),
|
|
25
|
+
ui.stringInput('First name', 'Arthur'),
|
|
26
|
+
ui.stringInput('Last name', 'Dent'),
|
|
27
|
+
ui.intInput('Age', 30)
|
|
28
|
+
]);
|
|
29
|
+
v.append(ui.panel([narrowForm]));
|
|
30
|
+
|
|
31
|
+
v.append(ui.divV([
|
|
32
|
+
form,
|
|
33
|
+
wideForm,
|
|
34
|
+
narrowForm,
|
|
35
|
+
]))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const props = [
|
|
2
|
+
//DG.Property.js("fragment", "string", {semType: "Molecule"}),
|
|
3
|
+
DG.Property.js("chemist", "string"),
|
|
4
|
+
DG.Property.js("stage", "string", {choices: ['Screening', 'Optimization']}),
|
|
5
|
+
DG.Property.js("color", "string", {inputType: "Color"})
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
let molColors = [
|
|
9
|
+
{ chemist: 'Jon Snow', stage: 'Screening', fragment: 'CC(=O)OC1=CC=CC=C1C(=O)O', color: '#ff0000' },
|
|
10
|
+
{ chemist: 'John Wick', stage: 'Optimization', fragment: 'OC1=CC', color: '#00ff00' }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const grid = ui.input.grid(molColors, props);
|
|
14
|
+
grid.root
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Different input types
|
|
2
|
+
|
|
3
|
+
let v = grok.shell.newView('demo: inputs');
|
|
4
|
+
|
|
5
|
+
let search = ui.searchInput('Search', '');
|
|
6
|
+
let name = ui.stringInput('Name', 'Arthur Dent');
|
|
7
|
+
let age = ui.intInput('Age', 30);
|
|
8
|
+
let date = ui.dateInput('Birthday', dayjs('1970-5-10'));
|
|
9
|
+
let alien = ui.boolInput('Alien', false);
|
|
10
|
+
let friends = ui.multiChoiceInput('Friends', ['Ford', 'Fenchurch'], ['Ford', 'Fenchurch', 'Zaphod', 'Slartibartfast']);
|
|
11
|
+
let bestFriend = ui.radioInput('Best friend', 'Ford', ['Ford', 'Fenchurch']);
|
|
12
|
+
let active = ui.switchInput('Active', true);
|
|
13
|
+
let color = ui.colorInput('Favorite color', '#ff0000');
|
|
14
|
+
let country = ui.typeAhead('Country', {source: {local: ['USA', 'Ukraine', 'Antigua', 'United Kingdom', 'United Arab Emirates']}});
|
|
15
|
+
let data = ui.tableInput('Data', null);
|
|
16
|
+
let tags = ui.tagsInput('Skills', ['HTML', 'CSS', 'JS'], true);
|
|
17
|
+
let memo = ui.textInput('Memo', '');
|
|
18
|
+
|
|
19
|
+
name.addValidator(s => s.length < 15 ? 'Too short' : null);
|
|
20
|
+
|
|
21
|
+
let form = ui.form([search, data, name, age, date, alien, friends,bestFriend, active, color, country, tags, memo]);
|
|
22
|
+
|
|
23
|
+
form.append(ui.buttonsInput([ui.bigButton('Submit', ()=>{grok.shell.info('Submit')})]));
|
|
24
|
+
v.append(form);
|
|
@@ -3,6 +3,5 @@ grok.shell.addTableView(grok.data.demo.randomWalk());
|
|
|
3
3
|
|
|
4
4
|
let tables = grok.shell.tables;
|
|
5
5
|
let input = ui.tableInput('Table', tables[0], tables, (t) => grok.shell.info(t.name));
|
|
6
|
-
grok.shell.newView('tableInput', [input.root]);
|
|
7
6
|
|
|
8
|
-
grok.shell.
|
|
7
|
+
grok.shell.newView('tableInput', [input.root]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const tagsInput = ui.tagsInput('Tags', ['Apps', 'Demo', 'Curves'], false);
|
|
2
|
+
|
|
3
|
+
tagsInput.addTag('New');
|
|
4
|
+
tagsInput.removeTag('Demo');
|
|
5
|
+
|
|
6
|
+
tagsInput.onTagAdded.subscribe((value) => grok.shell.info(`${value} tag was added.`));
|
|
7
|
+
tagsInput.onTagRemoved.subscribe((value) => grok.shell.info(`${value} tag was removed.`));
|
|
8
|
+
|
|
9
|
+
const tagsInput2 = ui.tagsInput('Tags', ['Apps2', 'Demo2', 'Curves2'], true);
|
|
10
|
+
tagsInput2.setTags(['Apps', 'Demo', 'Viewers', 'Tree']);
|
|
11
|
+
|
|
12
|
+
grok.shell.newView('TagsInput', [ui.form([tagsInput, tagsInput2])]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const typeAhead = ui.typeAhead('Countries', {
|
|
2
|
+
source: {
|
|
3
|
+
local: ['USA', 'Ukraine', 'Antigua', 'United Kingdom', 'United Arab Emirates']
|
|
4
|
+
},
|
|
5
|
+
minLength: 2,
|
|
6
|
+
limit: 3,
|
|
7
|
+
hint: true,
|
|
8
|
+
autoSelect: true,
|
|
9
|
+
highlight: true,
|
|
10
|
+
diacritics: true,
|
|
11
|
+
onSubmit: (event, value) => grok.shell.info(value.label),
|
|
12
|
+
debounceRemote: 100
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
typeAhead.onInput(() => grok.shell.info('input event'));
|
|
16
|
+
typeAhead.onChanged(() => grok.shell.info('change event'));
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
grok.shell.newView('TypeAhead', [typeAhead.root]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const df = grok.data.demo.demog();
|
|
2
|
+
const view = grok.shell.addTableView(df);
|
|
3
|
+
let scatterPlot = view.scatterPlot();
|
|
4
|
+
let histogram = view.histogram();
|
|
5
|
+
|
|
6
|
+
// Place a hint on a visual component in your application.
|
|
7
|
+
// Remove it by clicking on the root element event or by time-out.
|
|
8
|
+
const icon1 = $('div.d4-ribbon-item').has('i.svg-remove-selected-rows')[0];
|
|
9
|
+
|
|
10
|
+
let indicator1 = ui.hints.addHintIndicator(icon1, false, 4000);
|
|
11
|
+
let indicator2 = ui.hints.addHintIndicator(scatterPlot.root, true);
|
|
12
|
+
|
|
13
|
+
// Place a hint popup with a custom HTMLElement.
|
|
14
|
+
let msg = ui.divV([
|
|
15
|
+
ui.h1('Title'),
|
|
16
|
+
ui.divV([
|
|
17
|
+
ui.divText('Click on Scatter plot to close hint indicator'),
|
|
18
|
+
ui.link('Remove hint-indicator and hint-popup',()=>{
|
|
19
|
+
indicator2.click();
|
|
20
|
+
popup.remove();
|
|
21
|
+
}, '','')
|
|
22
|
+
])
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
let popup = ui.hints.addHint(scatterPlot.root, msg, 'left');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const df = grok.data.demo.demog();
|
|
2
|
+
const view = grok.shell.addTableView(df);
|
|
3
|
+
|
|
4
|
+
// You can describe a series of visual components in the wizard. Each wizard page is associated
|
|
5
|
+
// with the [showNextTo] element. Provide either [text] or [root] parameter to populate the page, the
|
|
6
|
+
// other parameters are optional. The wizard header is shown only if [title] or [helpUrl] are provided.
|
|
7
|
+
// The user can use the arrow buttons to navigate the set of instructions. The wizard can be closed
|
|
8
|
+
// from the dialog header (the "x" icon), via the "Cancel" button, or via the [Wizard.close()] method.
|
|
9
|
+
const sp = view.scatterPlot();
|
|
10
|
+
const hist = view.histogram();
|
|
11
|
+
|
|
12
|
+
const wizard = ui.hints.addTextHint({title: 'Viewers', pages: [
|
|
13
|
+
{caption: 'First Hint', text: 'Welcome! This is the 1st hint about a scatter plot.', showNextTo: sp.root},
|
|
14
|
+
{caption: 'Second Hint', root: ui.divText('This is the 2nd hint about a histogram.'), showNextTo: hist.root},
|
|
15
|
+
]});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const view = grok.shell.addTableView(grok.data.demo.geo(1000));
|
|
2
|
+
const map = view.addViewer('Map');
|
|
3
|
+
map.setOptions({
|
|
4
4
|
latitudeColumnName: 'lat',
|
|
5
|
-
longitudeColumnName: 'lng'
|
|
5
|
+
longitudeColumnName: 'lng',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
grok.shell.info(
|
|
8
|
+
grok.shell.info(map.props.getProperties().map((p) => p.name).join(', '));
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
let tv = grok.shell.addTableView(grok.data.demo.demog());
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
// We need to load the external package before we use the
|
|
4
|
+
// synchronous "tv.filters" method that uses the filter
|
|
5
|
+
grok.functions.call('Widgets:radioButtonFilter').then((_) => {
|
|
6
|
+
tv.filters({filters: [
|
|
7
|
+
{type: 'Widgets:radioButtonFilter', columnName: 'race'},
|
|
8
|
+
]});
|
|
9
|
+
});
|