@datagrok/api-samples 1.0.8 → 1.2.1
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 +14 -1
- package/README.md +2 -2
- package/dist/package-test.js +1848 -2
- package/dist/package.js +30 -2
- package/files/viewer-events/bar-chart/on-category-clicked.js +1 -0
- package/files/viewer-events/grid/on-cell-clicked.js +1 -0
- package/files/viewer-events/pc-plot/on-line-clicked.js +1 -0
- package/files/viewer-events/pie-chart/on-segment-clicked.js +1 -0
- package/files/viewer-events/scatter-plot/on-point-clicked.js +1 -0
- package/files/viewer-events/scatter-plot/on-rendered.js +1 -0
- package/layouts/demog-table-layout.json +329 -181
- package/package.json +23 -20
- package/scripts/dapi/admin.js +5 -5
- package/scripts/dapi/applicable-layouts.js +3 -1
- package/scripts/dapi/fetch.js +8 -6
- package/scripts/dapi/files.js +45 -0
- package/scripts/dapi/projects-list.js +3 -3
- package/scripts/dapi/projects-open.js +4 -4
- package/scripts/dapi/sticky-meta-1-tags.js +54 -0
- package/scripts/dapi/sticky-meta-2-semtype.js +33 -0
- package/scripts/dapi/who-am-i.js +10 -10
- package/scripts/data-access/db/ad-hoc-query.js +16 -0
- package/scripts/data-access/db/db-edit.js +6 -9
- package/scripts/data-access/{parameterized-query.js → db/parameterized-query.js} +3 -2
- package/scripts/data-access/db/query_builder_join.js +15 -0
- package/scripts/data-access/db/query_builder_simple.js +15 -0
- package/scripts/data-access/db-master-details-manual.js +10 -12
- package/scripts/data-access/external/stock-prices.js +2 -2
- package/scripts/data-access/files/file-exists.js +10 -0
- package/scripts/data-access/files/read-file.js +19 -0
- package/scripts/data-access/load-csv.js +2 -2
- package/scripts/data-access/open-table-by-id.js +11 -3
- package/scripts/data-access/output-layouts.js +3 -1
- package/scripts/data-access/save-and-load-df.js +6 -5
- package/scripts/data-frame/advanced/data-frames-in-columns.js +4 -1
- package/scripts/data-frame/advanced/virtual-columns.js +1 -1
- package/scripts/data-frame/aggregation/unpivot.js +1 -1
- package/scripts/data-frame/column-access.js +5 -3
- package/scripts/data-frame/columns-ordering.js +4 -0
- package/scripts/data-frame/compare-tables.js +3 -2
- package/scripts/data-frame/construction/add-new-column.js +13 -0
- package/scripts/data-frame/construction/create-from-columns.js +4 -4
- package/scripts/data-frame/construction/create-from-csv-format.js +3 -3
- package/scripts/data-frame/construction/create-from-typed-arrays.js +7 -2
- package/scripts/data-frame/construction/date-time.js +24 -0
- package/scripts/data-frame/construction/export-to-csv-advanced.js +14 -4
- package/scripts/data-frame/construction/export-to-csv-molblock.js +3 -0
- package/scripts/data-frame/construction/export-to-csv.js +1 -1
- package/scripts/data-frame/events/calculated-columns/creation.js +1 -1
- package/scripts/data-frame/events/calculated-columns/deletion.js +1 -1
- package/scripts/data-frame/events/calculated-columns/update.js +1 -1
- package/scripts/data-frame/join-link/link-tables-dynamic.js +11 -12
- package/scripts/data-frame/join-link/link-tables.js +12 -8
- package/scripts/data-frame/metadata/dataframe-meta.js +1 -1
- package/scripts/data-frame/modification/add-columns.js +1 -1
- package/scripts/data-frame/modification/append.js +1 -1
- package/scripts/data-frame/modification/calculated-columns/edit-formula.js +2 -2
- package/scripts/data-frame/modification/double-precision.js +26 -0
- package/scripts/data-frame/modification/manipulate.js +3 -3
- package/scripts/demo/med-chem.js +103 -0
- package/scripts/demo/stock-broker.js +1 -1
- package/scripts/domains/chem/chem-benchmark.js +0 -5
- package/scripts/domains/chem/descriptors.js +2 -4
- package/scripts/domains/chem/diversity-search.js +2 -4
- package/scripts/domains/chem/mcs.js +3 -3
- package/scripts/domains/chem/r-group.js +3 -3
- package/scripts/domains/chem/similarity-scoring-scores.js +3 -5
- package/scripts/domains/chem/similarity-scoring-sorted.js +3 -5
- package/scripts/domains/chem/sketcher.js +2 -2
- package/scripts/domains/chem/substructure-search-smarts-molfile-als.js +11 -12
- package/scripts/domains/chem/substructure-search-smarts.js +4 -7
- package/scripts/domains/chem/substructure-search.js +5 -6
- package/scripts/domains/data-science/cluster.js +8 -10
- package/scripts/domains/data-science/missing-values-imputation.js +3 -3
- package/scripts/domains/data-science/pca.js +3 -3
- package/scripts/domains/data-science/predictive-model.js +4 -4
- package/scripts/domains/data-science/random-data.js +5 -6
- package/scripts/events/form-creation.js +2 -2
- package/scripts/events/function-events.js +1 -1
- package/scripts/events/global-events.js +1 -1
- package/scripts/events/layout-events.js +5 -6
- package/scripts/events/viewer-data-events.js +11 -0
- package/scripts/functions/caching-results.js +8 -9
- package/scripts/functions/calling.js +7 -10
- package/scripts/functions/func-call.js +9 -2
- package/scripts/functions/param-editor.js +1 -1
- package/scripts/functions/progress.js +2 -5
- package/scripts/functions/register-function.js +1 -1
- package/scripts/grid/advanced/cell-renderer.js +1 -1
- package/scripts/grid/advanced/column-groups.js +8 -0
- package/scripts/grid/advanced/dynamic-value-retrieval.js +12 -0
- package/scripts/grid/advanced/format-formula.js +7 -0
- package/scripts/grid/{hit-test.js → advanced/hit-test.js} +1 -1
- package/scripts/grid/advanced/link-click.js +3 -3
- package/scripts/grid/advanced/markup-link.js +6 -0
- package/scripts/grid/advanced/paint-counts.js +4 -1
- package/scripts/grid/cell-types/tags-multi-cell.js +18 -0
- package/scripts/grid/{color-coding-conditional.js → color-coding/color-coding-conditional.js} +17 -10
- package/scripts/grid/color-coding/color-coding.js +8 -9
- package/scripts/grid/color-coding/get-cell-color.js +3 -5
- package/scripts/grid/html-cells/html-table-cells.js +1 -1
- package/scripts/grid/styles/column-cell-styles.js +10 -0
- package/scripts/grid/{column-controlled-values.js → styles/column-controlled-values.js} +2 -2
- package/scripts/grid/{data-format.js → styles/data-format.js} +4 -4
- package/scripts/misc/audit/errors-summary.js +2 -2
- package/scripts/misc/audit/test-tracking.js +2 -2
- package/scripts/misc/audit/users-today.js +3 -5
- package/scripts/misc/package-credentials.js +2 -1
- package/scripts/misc/user-settings-storage.js +48 -0
- package/scripts/performance/all-chembl-structures.js +2 -1
- package/scripts/scripting/files-for-scripting.js +24 -0
- package/scripts/scripting/grok-scripting.js +2 -3
- package/scripts/scripting/package-scripting.js +8 -0
- package/scripts/shell/last-error.js +1 -1
- package/scripts/shell/ui-parts.js +9 -9
- package/scripts/shell/windows/browse/customize-tree.js +3 -0
- package/scripts/ui/apps/bioreactor.js +5 -5
- package/scripts/ui/components/accordion.js +3 -3
- package/scripts/ui/components/drop-down.js +8 -5
- package/scripts/ui/components/icons.js +7 -7
- package/scripts/ui/components/menu-advanced.js +85 -0
- package/scripts/ui/components/popup-menu.js +6 -5
- package/scripts/ui/components/summary-card.js +4 -3
- package/scripts/ui/components/tree-view-adv.js +4 -2
- package/scripts/ui/containers/splitters.js +12 -20
- package/scripts/ui/dialogs/wizard.js +8 -8
- package/scripts/ui/docking/docking.js +4 -1
- package/scripts/ui/handlers/markup-handlers.js +60 -0
- package/scripts/ui/inputs/advanced/all-input-types.js +47 -29
- package/scripts/ui/inputs/advanced/for-properties.js +1 -1
- package/scripts/ui/inputs/advanced/input-api.js +38 -0
- package/scripts/ui/inputs/advanced/input-events.js +10 -10
- package/scripts/ui/inputs/advanced/input-form.js +8 -8
- package/scripts/ui/inputs/choice-input.js +5 -5
- package/scripts/ui/inputs/column-combo-box.js +3 -3
- package/scripts/ui/inputs/column-inputs.js +3 -3
- package/scripts/ui/inputs/forms.js +15 -16
- package/scripts/ui/inputs/helm-input-ui.js +7 -0
- package/scripts/ui/inputs/inputs-events.js +8 -8
- package/scripts/ui/inputs/inputs-extended.js +2 -2
- package/scripts/ui/inputs/inputs.js +17 -15
- package/scripts/ui/inputs/molecule-input.js +1 -1
- package/scripts/ui/inputs/table-input.js +1 -1
- package/scripts/ui/inputs/tags-input.js +2 -2
- package/scripts/ui/inputs/typeahead-input.js +16 -17
- package/scripts/ui/inputs/validation/input-validators.js +11 -0
- package/scripts/ui/inputs/validation/parameter-expressions.js +9 -0
- package/scripts/ui/inputs/validation/parameter-validation.js +6 -0
- package/scripts/ui/interactivity/drag-and-drop.js +3 -3
- package/scripts/ui/rendering/render-items.js +9 -9
- package/scripts/ui/tooltips/tooltip-events.js +2 -1
- package/scripts/ui/tooltips/tooltips.js +11 -2
- package/scripts/ui/viewers/advanced/attached-properties.js +5 -5
- package/scripts/ui/viewers/advanced/default-axis-type.js +1 -1
- package/scripts/ui/viewers/advanced/descriptors.js +14 -0
- package/scripts/ui/viewers/advanced/init-function.js +21 -0
- package/scripts/ui/viewers/advanced/init-script.js +15 -0
- package/scripts/ui/viewers/filters/add-single-filter.js +5 -5
- package/scripts/ui/viewers/filters/custom-filters.js +7 -6
- package/scripts/ui/viewers/filters/filter-group.js +6 -1
- package/scripts/ui/viewers/filters/multi-value-filter.js +1 -1
- package/scripts/ui/viewers/js viewers/chord-viewer.js +1 -1
- package/scripts/ui/viewers/js viewers/globe-viewer.js +7 -7
- package/scripts/ui/viewers/js viewers/sankey-viewer.js +1 -1
- package/scripts/ui/viewers/js viewers/surface-plot.js +19 -1
- package/scripts/ui/viewers/js viewers/word-cloud.js +1 -1
- package/scripts/ui/viewers/scatter-plot-events.js +6 -1
- package/scripts/ui/viewers/trellis-plot-with-summary-viewer.js +3 -1
- package/scripts/ui/viewers/types/globe.js +2 -3
- package/scripts/ui/viewers/types/markup-advanced.js +2 -2
- package/scripts/ui/viewers/types/markup-eeg.js +5 -5
- package/scripts/ui/viewers/types/shape-map.js +4 -4
- package/scripts/ui/viewers/types/trellis-plot.js +13 -1
- package/scripts/ui/viewers/types/word-cloud.js +1 -1
- package/scripts/ui/viewers/viewer-tooltips.js +1 -1
- package/scripts/ui/views/default-views.js +8 -7
- package/scripts/ui/views/layouts.js +16 -17
- package/scripts/ui/views/multi-view.js +1 -1
- package/scripts/ui/widgets/widgets-tree.js +32 -0
- package/src/package-api.ts +8 -0
- package/src/package-test.ts +117 -14
- package/src/tests/owners.ts +8 -0
- package/test-console-output-1.log +6957 -0
- package/test-console-output-2.log +371 -0
- package/test-console-output-3.log +887 -0
- package/test-console-output-4.log +1085 -0
- package/test-console-output-5.log +944 -0
- package/test-console-output-6.log +2 -0
- package/test-record-1.mp4 +0 -0
- package/test-record-2.mp4 +0 -0
- package/test-record-3.mp4 +0 -0
- package/test-record-4.mp4 +0 -0
- package/test-record-5.mp4 +0 -0
- package/test-record-6.mp4 +0 -0
- package/to fix/dynamic-loading.js +13 -0
- package/tsconfig.json +1 -1
- package/webpack.config.js +4 -1
- package/files.js +0 -39
- package/scripts/misc/audit/activity-today.js +0 -4
- package/scripts/misc/user-data-storage.js +0 -49
- package/scripts/scripting/scripting.js +0 -6
- package/scripts/ui/handlers/dynamic-loading.js +0 -13
- /package/scripts/data-access/{dynamic-query.js → db/dynamic-query.js} +0 -0
- /package/scripts/grid/{cell-bounds.js → advanced/cell-bounds.js} +0 -0
- /package/scripts/grid/{category-colors.js → color-coding/category-colors.js} +0 -0
- /package/scripts/grid/{custom-cell-prepare.js → events/custom-cell-prepare.js} +0 -0
- /package/scripts/grid/{custom-cell-rendering-indexes.js → events/custom-cell-rendering-indexes.js} +0 -0
- /package/scripts/grid/{custom-cell-rendering.js → events/custom-cell-rendering.js} +0 -0
- /package/scripts/grid/{custom-cell-tooltip.js → events/custom-cell-tooltip.js} +0 -0
- /package/scripts/grid/{scroll-bars.js → navigate/scroll-bars.js} +0 -0
- /package/scripts/grid/{scroll-to-cell.js → navigate/scroll-to-cell.js} +0 -0
- /package/scripts/grid/{scroll-to-pixels.js → navigate/scroll-to-pixels.js} +0 -0
- /package/scripts/grid/{order-columns.js → order/order-columns.js} +0 -0
- /package/scripts/grid/{order-rows-by-comparer.js → order/order-rows-by-comparer.js} +0 -0
- /package/scripts/grid/{order-rows.js → order/order-rows.js} +0 -0
- /package/scripts/grid/{hide-columns.js → resize/hide-columns.js} +0 -0
- /package/scripts/grid/{resize-columns.js → resize/resize-columns.js} +0 -0
- /package/scripts/grid/{resize-events.js → resize/resize-events.js} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Icons
|
|
2
2
|
|
|
3
3
|
let view = ui.divV([
|
|
4
|
-
ui.h2('Font Awesome
|
|
5
|
-
ui.
|
|
4
|
+
ui.h2('Font Awesome'),
|
|
5
|
+
ui.ribbonPanel([
|
|
6
6
|
ui.iconFA('question'),
|
|
7
7
|
ui.iconFA('info'),
|
|
8
8
|
ui.iconFA('cogs'),
|
|
9
9
|
ui.iconFA('folder-open'),
|
|
10
10
|
ui.iconFA('save')
|
|
11
|
-
]
|
|
12
|
-
ui.h2('Special
|
|
13
|
-
ui.
|
|
11
|
+
]),
|
|
12
|
+
ui.h2('Special'),
|
|
13
|
+
ui.ribbonPanel([
|
|
14
14
|
ui.icons.settings(() => grok.shell.info('click'), 'Settings'),
|
|
15
15
|
ui.icons.help(() => grok.shell.info('click'), 'Help'),
|
|
16
16
|
ui.icons.close(() => grok.shell.info('click'), 'Close'),
|
|
@@ -25,9 +25,9 @@ let view = ui.divV([
|
|
|
25
25
|
ui.icons.info(() => grok.shell.info('click'), 'Info'),
|
|
26
26
|
ui.icons.search(() => grok.shell.info('click'), 'Search'),
|
|
27
27
|
ui.icons.filter(() => grok.shell.info('click'), 'Filter')
|
|
28
|
-
]
|
|
28
|
+
])
|
|
29
29
|
]);
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
ui.dialog('Icons')
|
|
32
32
|
.add(view)
|
|
33
33
|
.show();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Menu advanced item customization. For top menu, see menu.js
|
|
2
|
+
|
|
3
|
+
// Generate a dataframe for column selectors
|
|
4
|
+
const dataFrame = grok.data.testData('demog', 50);
|
|
5
|
+
const columnNames = dataFrame.columns.toList().map(c => c.name);
|
|
6
|
+
const numericalColumnNames = columnNames.filter(c => dataFrame.columns.byName(c).isNumerical);
|
|
7
|
+
|
|
8
|
+
// Create menu and disable immediate close after the first click
|
|
9
|
+
const menu = DG.Menu.popup();
|
|
10
|
+
menu.closeOnClick = false;
|
|
11
|
+
|
|
12
|
+
// Store selected items
|
|
13
|
+
let selectedContinuousPaletteIndex = -1;
|
|
14
|
+
let selectedCategoricalPaletteIndex = -1;
|
|
15
|
+
let lastHoveredCategoricalPaletteIndex = -1;
|
|
16
|
+
let selectedMultipleColumns = [];
|
|
17
|
+
let selectedSingleColumn = null;
|
|
18
|
+
let lastHoveredSingleColumn = null;
|
|
19
|
+
|
|
20
|
+
menu
|
|
21
|
+
// Add header with no extra options.
|
|
22
|
+
.header('Default header')
|
|
23
|
+
.separator()
|
|
24
|
+
// Add continuous color palette on the same menu level which stores and displays selected palette index.
|
|
25
|
+
.colorPalette(DG.Color.continuousSchemes, {
|
|
26
|
+
onSelect: color => {
|
|
27
|
+
selectedContinuousPaletteIndex = DG.Color.continuousSchemes.indexOf(color);
|
|
28
|
+
grok.shell.info(`Selected continuous palette: ${selectedContinuousPaletteIndex + 1}`);
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.separator()
|
|
32
|
+
// Add categorical color palette which stores and displays selected palette index,
|
|
33
|
+
// has hover and reset after hover effects. Placed in a nested 'Categorical Colors' group.
|
|
34
|
+
.colorPalette(DG.Color.categoricalSchemes, {
|
|
35
|
+
categorical: true, // the way how colors are displayed
|
|
36
|
+
asGroup: 'Categorical Colors', // nested submenu group name
|
|
37
|
+
getInitial: () => DG.Color.categoricalSchemes[0], // initial value on menu open
|
|
38
|
+
onPreview: color => {
|
|
39
|
+
lastHoveredCategoricalPaletteIndex = DG.Color.categoricalSchemes.indexOf(color);
|
|
40
|
+
grok.shell.info('Preview categorical palette: ' + (lastHoveredCategoricalPaletteIndex + 1));
|
|
41
|
+
},
|
|
42
|
+
onSelect: color => {
|
|
43
|
+
selectedCategoricalPaletteIndex = DG.Color.categoricalSchemes.indexOf(color);
|
|
44
|
+
grok.shell.info(`Selected categorical palette: ${selectedCategoricalPaletteIndex + 1}`);
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
.separator()
|
|
48
|
+
// Sdd header with some additional options
|
|
49
|
+
.header('Clickable header', {
|
|
50
|
+
hasHoverEffect: true, // enable effects on hover
|
|
51
|
+
onClick: () => grok.shell.info('Clicked on header!'), // add click action
|
|
52
|
+
getDescription: () => 'Click me!', // add description on hover
|
|
53
|
+
})
|
|
54
|
+
.separator()
|
|
55
|
+
// Add multi-column selector which allows to select column name array.
|
|
56
|
+
// Displays current action (select/deselect, or dragging)
|
|
57
|
+
// Placed in a nested 'multiColumSelector' group.
|
|
58
|
+
.multiColumnSelector(dataFrame, {
|
|
59
|
+
asGroup: 'multiColumSelector',
|
|
60
|
+
initialValue: columnNames.slice(0, 5), // select first 5 columns by default
|
|
61
|
+
onChange: grid => {
|
|
62
|
+
const previousLength = selectedMultipleColumns.length;
|
|
63
|
+
selectedMultipleColumns = grid.getCheckedColumnNames();
|
|
64
|
+
grok.shell.info( previousLength !== selectedMultipleColumns.length
|
|
65
|
+
? `${selectedMultipleColumns.length} columns selected` // if size is changed, then some column either added or removed
|
|
66
|
+
: `"${grid.currentColumn}" column drag and dropped`); // otherwise refresh fired because of drag and drop action
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
.separator()
|
|
70
|
+
// Add single-column selector which on the same menu
|
|
71
|
+
// which stores and displays selected and last hovered column name.
|
|
72
|
+
.singleColumnSelector(dataFrame, {
|
|
73
|
+
initialValue: numericalColumnNames.at(-2), // select 2nd from the end of numerical columns by default
|
|
74
|
+
onChange (grid, column, currentRowChanged) {
|
|
75
|
+
if (currentRowChanged) { // if current row is changed on click
|
|
76
|
+
selectedSingleColumn = column;
|
|
77
|
+
grok.shell.info( `"${column.name}" column selected`);
|
|
78
|
+
} else { // otherwise on hover
|
|
79
|
+
lastHoveredSingleColumn = grid.mouseOverColumn;
|
|
80
|
+
grok.shell.info(`"${lastHoveredSingleColumn?.name ?? '[none]'}" column hovered`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
columnFilter: (c) => c.isNumerical, // show only numerical columns
|
|
84
|
+
})
|
|
85
|
+
.show();
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
let v = grok.shell.newView('demo: context menu');
|
|
2
|
-
|
|
3
1
|
let showMenu = () => {
|
|
4
2
|
let showBalloon = (item) => grok.shell.info(item);
|
|
5
3
|
|
|
@@ -7,9 +5,12 @@ let showMenu = () => {
|
|
|
7
5
|
.item('Show info', () => grok.shell.info('Info'))
|
|
8
6
|
.separator()
|
|
9
7
|
.items(['First', 'Second'], showBalloon)
|
|
8
|
+
.group('Group')
|
|
9
|
+
.item('Inner item', () => grok.shell.info('item click'))
|
|
10
|
+
.endGroup()
|
|
10
11
|
.show();
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
let text = ui.divText('
|
|
14
|
-
|
|
15
|
-
text
|
|
14
|
+
let text = ui.divText('Click me');
|
|
15
|
+
text.onclick = () => showMenu();
|
|
16
|
+
text
|
|
@@ -6,7 +6,8 @@ let card = (project) => ui.cards.summary(
|
|
|
6
6
|
]
|
|
7
7
|
);
|
|
8
8
|
|
|
9
|
-
grok.
|
|
9
|
+
grok.shell.windows.showProperties = true;
|
|
10
|
+
let projects = await grok.dapi.projects
|
|
10
11
|
.filter('#demo')
|
|
11
|
-
.list({pageSize: 5})
|
|
12
|
-
|
|
12
|
+
.list({pageSize: 5});
|
|
13
|
+
grok.shell.o = ui.divV(projects.map(card));
|
|
@@ -4,6 +4,8 @@ let banana = { name: 'banana', type: 'fruit', color: 'orange' }
|
|
|
4
4
|
let ferrari = { name: 'ferrari', type: 'car', color: 'red' }
|
|
5
5
|
let items = [apple, cherry, banana, ferrari];
|
|
6
6
|
|
|
7
|
-
DG.
|
|
7
|
+
const tree = DG.TreeViewGroup.fromItemCategories(items,
|
|
8
8
|
['color', 'type'],
|
|
9
|
-
{ itemToString: (x) => x.name }).root
|
|
9
|
+
{ itemToString: (x) => x.name }).root
|
|
10
|
+
|
|
11
|
+
grok.shell.newView('Tree', [tree]);
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Use splitV and splitH to divide the area into resizable containers
|
|
2
|
+
// If you want a non-even split, specify it (in pixels - this is important) in the element width or height style.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ui.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ui.splitH([
|
|
14
|
-
DG.Viewer.scatterPlot(t).root,
|
|
15
|
-
DG.Viewer.histogram(t).root
|
|
16
|
-
], {}, true)
|
|
17
|
-
], {}, true);
|
|
18
|
-
|
|
19
|
-
let view = grok.shell.newView('Splitters');
|
|
20
|
-
view.box = true;
|
|
21
|
-
view.append(block);
|
|
4
|
+
ui.splitV([
|
|
5
|
+
ui.splitH([
|
|
6
|
+
ui.divText('Top Left', { style: { width: '100px'}}),
|
|
7
|
+
ui.divText('Top Right'),
|
|
8
|
+
], { style: { height: '40px'}}, true),
|
|
9
|
+
ui.splitH([
|
|
10
|
+
ui.divText('Panel 1'),
|
|
11
|
+
ui.divText('Panel 2')
|
|
12
|
+
], {}, true)
|
|
13
|
+
], {}, true)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Creating custom dialogs, and add the help url
|
|
2
2
|
|
|
3
|
-
let name = ui.
|
|
4
|
-
let type = ui.
|
|
3
|
+
let name = ui.input.string('Title');
|
|
4
|
+
let type = ui.input.choice('Type', {items: ['Bio', 'Chem'], value: 'Bio'});
|
|
5
5
|
|
|
6
6
|
new DG.Wizard({title: 'Onboard a model'})
|
|
7
7
|
.page({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.page({
|
|
13
|
-
.page({
|
|
8
|
+
caption: 'Details',
|
|
9
|
+
root: ui.inputs([name, type]),
|
|
10
|
+
validate: () => name.value !== '' ? null : 'Please provide a name'
|
|
11
|
+
})
|
|
12
|
+
.page({caption: 'Model Source', root: ui.divText('Second page')})
|
|
13
|
+
.page({caption: 'Finalize', root: ui.divText('Finish')})
|
|
14
14
|
.onOK(() => {})
|
|
15
15
|
.show({width: 500, height: 300});
|
|
@@ -10,4 +10,7 @@ let node2 = grok.shell.dockManager.dock(ui.divText('second'), 'down', node1, 'Se
|
|
|
10
10
|
let node3 = grok.shell.dockManager.dock(ui.divText('third'), 'fill', node2, 'Third');
|
|
11
11
|
|
|
12
12
|
// to the bottom of the current document
|
|
13
|
-
grok.shell.dockManager.dock(ui.divText('bottom'), 'down', grok.shell.v.dockNode, 'Bottom');
|
|
13
|
+
grok.shell.dockManager.dock(ui.divText('bottom'), 'down', grok.shell.v.dockNode, 'Bottom');
|
|
14
|
+
|
|
15
|
+
// handling events
|
|
16
|
+
grok.shell.dockManager.onClosed.subscribe((e) => grok.shell.info(e));
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//name: markup-handlers
|
|
2
|
+
//tags: demo
|
|
3
|
+
//language: javascript
|
|
4
|
+
// Custom markup handlers
|
|
5
|
+
// Allows logging and audit of events linked to in-app objects
|
|
6
|
+
|
|
7
|
+
// Defines a sample class
|
|
8
|
+
class Fruit {
|
|
9
|
+
constructor(name, color) {
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.color = color;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Defines the way Datagrok handles entities of the specified type
|
|
16
|
+
// Shortened version of a sample handlers.js
|
|
17
|
+
class FruitHandler extends DG.ObjectHandler {
|
|
18
|
+
get type() { return 'fruit' }
|
|
19
|
+
|
|
20
|
+
// Checks whether this is the handler for [x]
|
|
21
|
+
isApplicable(x) { return x instanceof Fruit; }
|
|
22
|
+
|
|
23
|
+
renderIcon(x) { return ui.iconFA(`apple-alt`); }
|
|
24
|
+
renderMarkup(x) { let m = ui.span([this.renderIcon(x), ui.label(x.name)]); $(m).css('color', x.color); return m; }
|
|
25
|
+
|
|
26
|
+
// Is used by platform to detect markup description of Fruit
|
|
27
|
+
get markupRegexp() {
|
|
28
|
+
return "fruit\\.([a-zA-Z]+)\\.([a-zA-Z]+)";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Converts fruit to markup description
|
|
32
|
+
toMarkup(x) {
|
|
33
|
+
return `fruit.${x.name}.${x.color}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Deserialize object from parsed markup
|
|
37
|
+
// Accepts list of strings, that comes from regexp group matches
|
|
38
|
+
// In our case, matches = ["fruit.apple.red", "apple", "red"]
|
|
39
|
+
fromMarkup(matches) {
|
|
40
|
+
var name = matches[1];
|
|
41
|
+
var color = matches[2];
|
|
42
|
+
return new Fruit(name, color);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Register handler with the platform
|
|
47
|
+
var handler = new FruitHandler();
|
|
48
|
+
DG.ObjectHandler.register(handler);
|
|
49
|
+
|
|
50
|
+
// Create some fruits
|
|
51
|
+
let apple = new Fruit('apple', 'red');
|
|
52
|
+
let orange = new Fruit('orange', 'orange');
|
|
53
|
+
|
|
54
|
+
// Log usage of the fruit.
|
|
55
|
+
// Highlight custom markup objects with "#"
|
|
56
|
+
grok.log.usage('@user liked #fruit', {'user': DG.User.current(), '#fruit': apple});
|
|
57
|
+
grok.log.usage('@user disliked #fruit', {'user': DG.User.current(), '#fruit': orange});
|
|
58
|
+
|
|
59
|
+
let logObject = await grok.dapi.log.filter('description = "@user liked #fruit"').first();
|
|
60
|
+
grok.shell.info(ui.render(logObject));
|
|
@@ -2,46 +2,64 @@ const df = grok.data.demo.demog();
|
|
|
2
2
|
grok.shell.addTable(df);
|
|
3
3
|
|
|
4
4
|
const properties = [
|
|
5
|
-
{
|
|
6
|
-
{
|
|
7
|
-
{
|
|
8
|
-
{
|
|
9
|
-
{
|
|
10
|
-
{
|
|
11
|
-
{
|
|
12
|
-
{
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
{
|
|
17
|
-
{
|
|
18
|
-
{
|
|
19
|
-
{
|
|
20
|
-
{
|
|
21
|
-
{
|
|
5
|
+
{'name': 'int', 'inputType': 'Int', 'showPlusMinus': true},
|
|
6
|
+
//{'name': 'bigInt', 'inputType': 'BigInt'},
|
|
7
|
+
{'name': 'float', 'inputType': 'Float', min: 0, max: 10, 'showSlider': true},
|
|
8
|
+
{'name': 'qnum', 'inputType': 'QNum'},
|
|
9
|
+
{'name': 'slider', 'inputType': 'Slider', 'min': 0, 'max': 10},
|
|
10
|
+
{'name': 'bool', 'inputType': 'Bool'},
|
|
11
|
+
{'name': 'switch', 'inputType': 'Switch'},
|
|
12
|
+
{'name': 'textArea', 'inputType': 'TextArea'},
|
|
13
|
+
{'name': 'text', 'inputType': 'Text'},
|
|
14
|
+
{'name': 'search', 'inputType': 'Search'},
|
|
15
|
+
{'name': 'date', 'inputType': 'Date'},
|
|
16
|
+
{'name': 'map', 'inputType': 'Map'},
|
|
17
|
+
{'name': 'list', 'inputType': 'List'},
|
|
18
|
+
{'name': 'color', 'inputType': 'Color'},
|
|
19
|
+
{'name': 'table', 'inputType': 'Table'},
|
|
20
|
+
{'name': 'column', 'inputType': 'Column'},
|
|
21
|
+
{'name': 'user', 'inputType': 'User'},
|
|
22
|
+
{'name': 'userGroups', 'inputType': 'UserGroups'},
|
|
23
|
+
{'name': 'radio', 'inputType': 'Radio', choices: ['Apple', 'Banana']},
|
|
24
|
+
{'name': 'choice', 'inputType': 'Choice', choices: ['Apple', 'Banana']},
|
|
25
|
+
{'name': 'multiChoice', 'inputType': 'MultiChoice', choices: ['Apple', 'Banana']},
|
|
26
|
+
{'name': 'file', 'inputType': 'File'},
|
|
22
27
|
];
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
const props = properties.map((p) => DG.Property.fromOptions(p));
|
|
30
|
+
const object = {
|
|
26
31
|
int: 12,
|
|
27
|
-
bigInt:
|
|
32
|
+
//bigInt: '123456789012345678',
|
|
28
33
|
float: 4.5,
|
|
29
|
-
qnum: DG.Qnum.
|
|
34
|
+
qnum: DG.Qnum.greater(5),
|
|
30
35
|
slider: 10,
|
|
31
36
|
bool: true,
|
|
32
|
-
|
|
37
|
+
switch: true,
|
|
38
|
+
textArea: 'Bins rise and they fall,\nDistribution\'s gentle dance,\nHistogram unveils',
|
|
33
39
|
text: 'Only text',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
search: '',
|
|
41
|
+
date: dayjs('2003-05-05').utc(true),
|
|
42
|
+
map: {key1: 'value1', key2: 'value2'},
|
|
37
43
|
list: ['1', '2', '4'],
|
|
44
|
+
color: '#e66465',
|
|
38
45
|
table: df,
|
|
39
46
|
column: df.columns.byName('race'),
|
|
40
|
-
|
|
47
|
+
user: [DG.User.system],
|
|
48
|
+
userGroups: [DG.Group.developers],
|
|
41
49
|
radio: 'Apple',
|
|
50
|
+
choice: 'Banana',
|
|
51
|
+
multiChoice: ['Apple'],
|
|
52
|
+
file: (await grok.dapi.files.list('System:DemoFiles/', true, 'curves'))[0],
|
|
42
53
|
};
|
|
43
54
|
|
|
44
|
-
ui.divV([
|
|
55
|
+
const div = ui.divV([
|
|
45
56
|
ui.input.form(object, props),
|
|
46
|
-
ui.button('Show', () =>
|
|
47
|
-
|
|
57
|
+
ui.button('Show values', () => {
|
|
58
|
+
let msg = '';
|
|
59
|
+
for (const [key, value] of Object.entries(object))
|
|
60
|
+
msg += `${key}: ${value}\n`;
|
|
61
|
+
grok.shell.info(msg);
|
|
62
|
+
})
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
grok.shell.newView('Inputs', [div]);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const df = grok.data.demo.demog();
|
|
2
|
+
grok.shell.addTable(df);
|
|
3
|
+
|
|
4
|
+
const inputs = [
|
|
5
|
+
ui.input.int('int', {value: 6, nullable: false, min: 2, max: 12, step: 2, showPlusMinus: true}),
|
|
6
|
+
// ui.input.bigInt('bigInt', {value: '12345678901234567890'}), // doesn't work yet with value
|
|
7
|
+
ui.input.float('float', {value: 6.5758, min: 0, max: 10, step: 0.5, format: '#0.000', showSlider: true}),
|
|
8
|
+
ui.input.qNum('qNum', {value: 5.959}),
|
|
9
|
+
ui.input.slider('slider', {value: 6, min: 0, max: 20, step: 2}),
|
|
10
|
+
ui.input.bool('bool', {value: false, tooltipText: 'Bool input tooltip'}),
|
|
11
|
+
ui.input.toggle('toggle', {value: true, tooltipText: 'Toggle input tooltip'}),
|
|
12
|
+
ui.input.textArea('textArea', {value: 'Text area', size: {width: 150, height: 35}}),
|
|
13
|
+
ui.input.string('string', {value: 'Text', placeholder: 'Text', clearIcon: true, escClears: true, icon: ui.iconFA('square')}),
|
|
14
|
+
ui.input.search('search', {value: 'Search'}),
|
|
15
|
+
ui.input.date('date', {value: dayjs('1970-5-10')}),
|
|
16
|
+
ui.input.map('map', {value: {key1: 'value1', key2: 'value2'}}),
|
|
17
|
+
ui.input.file('file', {value: (await grok.dapi.files.list('System:AppData/ApiTests/datasets/'))[1]}),
|
|
18
|
+
ui.input.list('list', {value: [1, 2, 3]}),
|
|
19
|
+
ui.input.color('color', {value: '#e66465'}),
|
|
20
|
+
ui.input.column('column', {value: df.col('height'), table: df, filter: (col) => col.type === DG.COLUMN_TYPE.FLOAT}),
|
|
21
|
+
ui.input.columns('columns', {table: df, value: df.columns.byNames(['weight', 'age']), available: ['height', 'weight', 'age']}),
|
|
22
|
+
ui.input.radio('radio', {items: ['apple', 'orange'], value: 'apple'}),
|
|
23
|
+
ui.input.choice('choice', {items: ['apple', 'orange'], value: 'apple'}),
|
|
24
|
+
ui.input.multiChoice('multiChoice', {items: ['apple', 'orange', 'pear'], value: ['apple', 'orange']}),
|
|
25
|
+
ui.input.table('table', {value: df}),
|
|
26
|
+
ui.input.molecule('molecule', {value: 'CN1CCC(O)(CC1)c2ccccc2'}),
|
|
27
|
+
ui.input.user('user', {value: [DG.User.system]}),
|
|
28
|
+
ui.input.userGroups('userGroups', {value: [DG.Group.developers]}),
|
|
29
|
+
ui.input.image('image', {value: 'https://datagrok.ai/img/logo.svg'}),
|
|
30
|
+
ui.input.tags('tags', {tags: ['Tag 1', 'Tag2', 'Tag3'], showButton: true}),
|
|
31
|
+
ui.input.code('code', {script: 'print(\'Hello world!\')', mode: 'python', placeholder: 'print(\'Hello world!\')'}),
|
|
32
|
+
ui.input.markdown('markdown', {value: await grok.dapi.files.readAsText('System:DemoFiles/bio/ngl-formats/README.md')}),
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const form = DG.InputForm.forInputs(inputs);
|
|
36
|
+
form.onInputChanged.subscribe((ed) => grok.shell.info(`Input - ${ed.args.input.caption}, new value - ${ed.args.input.value}`));
|
|
37
|
+
|
|
38
|
+
grok.shell.newView('Inputs', [form.root]);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// Manual handling of input-originated events
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const medication = {name: 'Aspirin', quantity: '20 mg'};
|
|
4
4
|
|
|
5
5
|
// Core value input implemented in Dart
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
nameEditor.onChanged((
|
|
9
|
-
nameEditor.onInput((_) => grok.shell.info('name input: ' + nameEditor.value));
|
|
6
|
+
const nameProp = DG.Property.js('name', DG.TYPE.STRING);
|
|
7
|
+
const nameEditor = DG.InputBase.forProperty(nameProp, medication);
|
|
8
|
+
nameEditor.onChanged.subscribe((value) => grok.shell.info('name changed: ' + value));
|
|
9
|
+
nameEditor.onInput.subscribe((_) => grok.shell.info('name input: ' + nameEditor.value));
|
|
10
10
|
|
|
11
11
|
// 'foo' editor is defined in the Widgets package.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
quantityEditor.onChanged((
|
|
15
|
-
quantityEditor.onInput((_) => grok.shell.info('quantity input: ' + quantityEditor.value));
|
|
12
|
+
const fooProp = DG.Property.fromOptions({name: 'quantity', type: DG.TYPE.STRING, semType: 'foo'});
|
|
13
|
+
const quantityEditor = DG.InputBase.forProperty(fooProp, medication);
|
|
14
|
+
quantityEditor.onChanged.subscribe((value) => grok.shell.info('quantity changed: ' + value));
|
|
15
|
+
quantityEditor.onInput.subscribe((_) => grok.shell.info('quantity input: ' + quantityEditor.value));
|
|
16
16
|
|
|
17
|
-
quantityEditor.onInput((_) => grok.shell.o = medication);
|
|
17
|
+
quantityEditor.onInput.subscribe((_) => grok.shell.o = medication);
|
|
18
18
|
|
|
19
19
|
ui.dialog()
|
|
20
20
|
.add(ui.form([nameEditor, quantityEditor]))
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// creating a form, and accessing its individual inputs
|
|
2
2
|
|
|
3
|
-
DG.Func.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const sin = DG.Func.find({name: 'Sin'});
|
|
4
|
+
|
|
5
|
+
let fc = sin[0].prepare({dosage: 77});
|
|
6
|
+
let inputForm = await DG.InputForm.forFuncCall(fc);
|
|
7
|
+
|
|
8
|
+
inputForm.getInput('x').addPostfix('foo');
|
|
9
|
+
inputForm.onInputChanged.subscribe((_) => grok.shell.info('changed'));
|
|
10
|
+
grok.shell.o = inputForm.root;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// Method #1. Using grok's wrapper classes only
|
|
4
4
|
let v = grok.shell.newView('Demo');
|
|
5
|
-
let choices = ui.
|
|
5
|
+
let choices = ui.input.choice('Value', {items: ['A', 'B', 'C'], value: 'A'});
|
|
6
6
|
let container = ui.div();
|
|
7
7
|
v.append(container);
|
|
8
8
|
let inputs = ui.inputs([choices]);
|
|
9
9
|
container.appendChild(inputs);
|
|
10
|
-
let
|
|
11
|
-
inputs.replaceChild(
|
|
12
|
-
choices =
|
|
13
|
-
choices.onChanged((v) => {
|
|
10
|
+
let choicesNew = ui.input.choice('Value', {items: ['B', 'C', 'D'], value: 'B'});
|
|
11
|
+
inputs.replaceChild(choicesNew.root, choices.root);
|
|
12
|
+
choices = choicesNew;
|
|
13
|
+
choices.onChanged.subscribe((v) => {
|
|
14
14
|
grok.shell.info('The selected value is changed');
|
|
15
15
|
});
|
|
16
16
|
choices.value = 'C';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Adds a view with a column combo box with int columns
|
|
1
|
+
// Adds a view with a column combo box with int and float columns
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const ccb = DG.ColumnComboBox.create(grok.data.demo.demog(), (c) => ['int', 'double'].includes(c.type));
|
|
4
|
+
grok.shell.newView('demo: column combo box', [ccb]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
let v = grok.shell.newView('demo: column inputs');
|
|
2
2
|
let t = grok.data.testData('demog', 100);
|
|
3
3
|
|
|
4
|
-
let predict = ui.
|
|
5
|
-
let features = ui.
|
|
4
|
+
let predict = ui.input.column('Predict', {value: t.col('age'), table: t});
|
|
5
|
+
let features = ui.input.columns('Features', {table: t});
|
|
6
6
|
features.value = [t.col('height'), t.col('weight')];
|
|
7
7
|
|
|
8
8
|
// events
|
|
9
|
-
features.onInput(() => grok.shell.info(features.value.map((col) => col.name).join()));
|
|
9
|
+
features.onInput.subscribe(() => grok.shell.info(features.value.map((col) => col.name).join()));
|
|
10
10
|
|
|
11
11
|
let inputs = [predict, features];
|
|
12
12
|
let container = ui.div();
|
|
@@ -5,31 +5,30 @@ let v = grok.shell.newView('demo: form types');
|
|
|
5
5
|
//Basic form
|
|
6
6
|
//To set labels aligned to left add class .ui-form-left
|
|
7
7
|
let form = ui.form([
|
|
8
|
-
ui.
|
|
9
|
-
ui.
|
|
10
|
-
ui.
|
|
11
|
-
ui.intInput('Age', 30)
|
|
8
|
+
ui.input.string('First name', {value: 'Arthur'}),
|
|
9
|
+
ui.input.string('Last name', {value: 'Dent'}),
|
|
10
|
+
ui.input.int('Age', {value: 30}),
|
|
12
11
|
]);
|
|
13
12
|
|
|
14
13
|
//Add class .ui-form-wide to make the form wide
|
|
15
|
-
let wideForm = ui.
|
|
16
|
-
ui.
|
|
17
|
-
ui.
|
|
18
|
-
ui.
|
|
19
|
-
|
|
20
|
-
], 'ui-form-wide');
|
|
14
|
+
let wideForm = ui.wideForm([
|
|
15
|
+
ui.input.string('First name', {value: 'Arthur'}),
|
|
16
|
+
ui.input.string('Last name', {value: 'Dent'}),
|
|
17
|
+
ui.input.int('Age', {value: 30}),
|
|
18
|
+
]);
|
|
21
19
|
|
|
22
20
|
//Condensed form. You can also use .ui-form-condensed
|
|
23
21
|
let narrowForm = ui.narrowForm([
|
|
24
|
-
ui.
|
|
25
|
-
ui.
|
|
26
|
-
ui.
|
|
27
|
-
ui.intInput('Age', 30)
|
|
22
|
+
ui.input.string('First name', {value: 'Arthur'}),
|
|
23
|
+
ui.input.string('Last name', {value: 'Dent'}),
|
|
24
|
+
ui.input.int('Age', {value: 30}),
|
|
28
25
|
]);
|
|
29
|
-
v.append(ui.panel([narrowForm]));
|
|
30
26
|
|
|
31
27
|
v.append(ui.divV([
|
|
28
|
+
ui.h1('Basic form'),
|
|
32
29
|
form,
|
|
30
|
+
ui.h1('Wide form'),
|
|
33
31
|
wideForm,
|
|
32
|
+
ui.h1('Condensed form'),
|
|
34
33
|
narrowForm,
|
|
35
|
-
]))
|
|
34
|
+
]));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const view = grok.shell.newView('demo: inputs');
|
|
2
|
+
|
|
3
|
+
const helmValue = 'PEPTIDE1{[D-Pyr].Y.C.A.T.P.F.G.T.S.R.T}$PEPTIDE1,PEPTIDE1,3:R3-12:R2$$$V2.0';
|
|
4
|
+
view.append(ui.inputs([await ui.input.helmAsync('Macromolecule', {value: helmValue})]));
|
|
5
|
+
|
|
6
|
+
view.append(ui.inputs([await grok.functions.call(
|
|
7
|
+
'Helm:helmInput', {name: 'Macromolecule', options: {value: helmValue}})]));
|
|
@@ -2,14 +2,14 @@ let v = grok.shell.newView('demo: inputs-events');
|
|
|
2
2
|
|
|
3
3
|
const msg = (v) => grok.shell.info(v);
|
|
4
4
|
|
|
5
|
-
let name = ui.
|
|
6
|
-
let age = ui.
|
|
7
|
-
let sex = ui.
|
|
8
|
-
let date = ui.
|
|
9
|
-
let alien = ui.
|
|
10
|
-
let friends = ui.
|
|
11
|
-
['Ford', 'Fenchurch'],
|
|
12
|
-
let active = ui.
|
|
5
|
+
let name = ui.input.string('Name', {value: 'Arthur Dent', onValueChanged: (v) => msg(v)});
|
|
6
|
+
let age = ui.input.int('Age', {value: 30, onValueChanged: (v) => msg(v)});
|
|
7
|
+
let sex = ui.input.choice('Sex', {items: ['Male', 'Female'], value: 'Male', onValueChanged: (v) => msg(v)});
|
|
8
|
+
let date = ui.input.date('Birthday', {value: dayjs('1970-5-10'), onValueChanged: (v) => msg(v)});
|
|
9
|
+
let alien = ui.input.bool('Alien', {value: false, onValueChanged: (v) => msg(v)});
|
|
10
|
+
let friends = ui.input.multiChoice('Friends', {items: ['Ford', 'Fenchurch', 'Zaphod', 'Slartibartfast'],
|
|
11
|
+
value: ['Ford', 'Fenchurch'], onValueChanged: (v) => msg(v)});
|
|
12
|
+
let active = ui.input.toggle('Active', {value: true, onValueChanged: (v) => msg(v)});
|
|
13
13
|
|
|
14
14
|
let inputs = [name, age, sex, date, alien, friends, active];
|
|
15
15
|
let container = ui.div();
|