neo.mjs 6.17.2 → 6.18.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/apps/ServiceWorker.mjs +3 -5
- package/apps/colors/README.md +8 -0
- package/apps/colors/app.mjs +6 -0
- package/apps/colors/childapps/widget/app.mjs +7 -0
- package/apps/colors/childapps/widget/index.html +11 -0
- package/apps/colors/childapps/widget/neo-config.json +10 -0
- package/apps/colors/childapps/widget/view/Viewport.mjs +19 -0
- package/apps/colors/index.html +11 -0
- package/apps/colors/model/Color.mjs +43 -0
- package/apps/colors/neo-config.json +10 -0
- package/apps/colors/remotes-api.json +13 -0
- package/apps/colors/store/Colors.mjs +24 -0
- package/apps/colors/view/BarChartComponent.mjs +64 -0
- package/apps/colors/view/HeaderToolbar.mjs +95 -0
- package/apps/colors/view/PieChartComponent.mjs +58 -0
- package/apps/colors/view/TableContainer.mjs +91 -0
- package/apps/colors/view/Viewport.mjs +57 -0
- package/apps/colors/view/ViewportController.mjs +277 -0
- package/apps/colors/view/ViewportModel.mjs +53 -0
- package/apps/portal/Util.mjs +11 -0
- package/apps/portal/childapps/preview/neo-config.json +2 -2
- package/apps/portal/neo-config.json +2 -1
- package/apps/portal/remotes-api.json +13 -0
- package/apps/portal/view/HeaderToolbar.mjs +1 -1
- package/apps/portal/view/ViewportController.mjs +89 -1
- package/apps/portal/view/home/MainContainer.mjs +34 -6
- package/apps/portal/view/home/parts/AfterMath.mjs +1 -1
- package/apps/portal/view/home/parts/Colors.mjs +98 -0
- package/apps/portal/view/home/parts/Helix.mjs +114 -0
- package/apps/portal/view/home/parts/HelloWorld.mjs +6 -3
- package/apps/portal/view/home/parts/How.mjs +66 -0
- package/apps/portal/view/home/parts/MainNeo.mjs +4 -3
- package/apps/portal/view/learn/LivePreview.mjs +56 -15
- package/apps/portal/view/learn/MainContainerController.mjs +10 -90
- package/apps/realworld/api/Article.mjs +1 -3
- package/apps/realworld/api/Favorite.mjs +1 -3
- package/apps/realworld/api/Profile.mjs +1 -3
- package/apps/realworld/api/Tag.mjs +1 -3
- package/apps/realworld/api/User.mjs +1 -3
- package/apps/realworld2/api/Article.mjs +1 -3
- package/apps/realworld2/api/Favorite.mjs +1 -3
- package/apps/realworld2/api/Profile.mjs +1 -3
- package/apps/realworld2/api/Tag.mjs +1 -3
- package/apps/realworld2/api/User.mjs +1 -3
- package/apps/realworld2/view/article/HelixContainer.mjs +5 -5
- package/buildScripts/webpack/json/myApps.template.json +1 -0
- package/docs/app/view/MainContainer.mjs +5 -0
- package/docs/app/view/classdetails/MembersList.mjs +1 -1
- package/examples/ServiceWorker.mjs +3 -5
- package/examples/component/helix/Viewport.mjs +309 -0
- package/examples/component/helix/ViewportController.mjs +122 -0
- package/examples/component/helix/app.mjs +2 -2
- package/examples/component/helix/neo-config.json +0 -1
- package/examples/component/multiWindowHelix/Viewport.mjs +11 -3
- package/examples/component/multiWindowHelix/ViewportController.mjs +21 -9
- package/examples/component/multiWindowHelix/neo-config.json +0 -1
- package/examples/fieldWithPrefix/MainContainer.mjs +1 -6
- package/examples/list/animate/MainContainerController.mjs +1 -1
- package/examples/worker/task/MyTasks.mjs +1 -3
- package/package.json +2 -2
- package/resources/data/deck/learnneo/pages/Events.md +15 -9
- package/resources/data/deck/learnneo/pages/GuideEvents.md +254 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +1 -1
- package/resources/images/logo/neo_logo_primary.svg +6 -0
- package/resources/images/logo/neo_logo_text_primary.svg +5 -0
- package/resources/scss/src/apps/colors/BarChartComponent.scss +3 -0
- package/resources/scss/src/apps/colors/HeaderToolbar.scss +11 -0
- package/resources/scss/src/apps/colors/PieChartComponent.scss +3 -0
- package/resources/scss/src/apps/colors/TableContainer.scss +64 -0
- package/resources/scss/src/apps/colors/Viewport.scss +9 -0
- package/resources/scss/src/apps/portal/HeaderToolbar.scss +142 -124
- package/resources/scss/src/apps/portal/home/MainContainer.scss +9 -22
- package/resources/scss/src/apps/portal/home/parts/MainNeo.scss +22 -0
- package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +1 -1
- package/resources/scss/src/examples/component/multiWindowHelix/Viewport.scss +3 -0
- package/resources/scss/src/form/field/CheckBox.scss +1 -0
- package/resources/scss/src/tab/header/Button.scss +2 -1
- package/resources/scss/theme-dark/Global.scss +8 -0
- package/resources/scss/theme-dark/button/Base.scss +1 -1
- package/resources/scss/theme-dark/tab/header/Button.scss +1 -0
- package/resources/scss/theme-light/Global.scss +8 -0
- package/resources/scss/theme-light/button/Base.scss +1 -1
- package/resources/scss/theme-light/tab/header/Button.scss +1 -0
- package/resources/scss/theme-neo-light/Global.scss +53 -53
- package/resources/scss/theme-neo-light/button/Base.scss +3 -4
- package/resources/scss/theme-neo-light/tab/header/Button.scss +6 -8
- package/src/DefaultConfig.mjs +2 -2
- package/src/Fetch.mjs +1 -3
- package/src/Main.mjs +13 -11
- package/src/MicroLoader.mjs +2 -2
- package/src/Neo.mjs +27 -26
- package/src/Xhr.mjs +1 -3
- package/src/button/Base.mjs +6 -4
- package/src/button/Split.mjs +10 -9
- package/src/calendar/view/EditEventContainer.mjs +13 -12
- package/src/calendar/view/MainContainer.mjs +40 -40
- package/src/calendar/view/MainContainerModel.mjs +5 -5
- package/src/calendar/view/SettingsContainer.mjs +11 -11
- package/src/calendar/view/YearComponent.mjs +73 -75
- package/src/calendar/view/calendars/ColorsList.mjs +2 -2
- package/src/calendar/view/calendars/EditContainer.mjs +2 -2
- package/src/calendar/view/calendars/List.mjs +12 -13
- package/src/calendar/view/month/Component.mjs +72 -73
- package/src/calendar/view/settings/GeneralContainer.mjs +5 -5
- package/src/calendar/view/settings/MonthContainer.mjs +5 -5
- package/src/calendar/view/settings/WeekContainer.mjs +6 -6
- package/src/calendar/view/settings/YearContainer.mjs +4 -4
- package/src/calendar/view/week/Component.mjs +47 -57
- package/src/calendar/view/week/EventDragZone.mjs +43 -50
- package/src/calendar/view/week/TimeAxisComponent.mjs +21 -21
- package/src/calendar/view/week/plugin/DragDrop.mjs +53 -45
- package/src/calendar/view/week/plugin/EventResizable.mjs +8 -3
- package/src/collection/Base.mjs +15 -22
- package/src/collection/Filter.mjs +4 -9
- package/src/collection/Sorter.mjs +6 -7
- package/src/component/Base.mjs +73 -41
- package/src/component/Canvas.mjs +9 -9
- package/src/component/Carousel.mjs +31 -33
- package/src/component/Chip.mjs +9 -9
- package/src/component/Circle.mjs +84 -91
- package/src/component/Clock.mjs +8 -8
- package/src/component/DateSelector.mjs +14 -15
- package/src/component/Gallery.mjs +82 -80
- package/src/component/Helix.mjs +131 -126
- package/src/component/Iframe.mjs +1 -1
- package/src/component/Label.mjs +1 -1
- package/src/component/Legend.mjs +3 -3
- package/src/component/Process.mjs +39 -37
- package/src/component/Splitter.mjs +9 -11
- package/src/component/StatusBadge.mjs +2 -3
- package/src/component/Timer.mjs +62 -68
- package/src/component/Toast.mjs +11 -11
- package/src/component/Video.mjs +7 -8
- package/src/component/mwc/Button.mjs +10 -10
- package/src/component/mwc/TextField.mjs +17 -17
- package/src/component/wrapper/AmChart.mjs +5 -5
- package/src/component/wrapper/CesiumJS.mjs +11 -17
- package/src/component/wrapper/GoogleMaps.mjs +58 -35
- package/src/component/wrapper/MapboxGL.mjs +112 -79
- package/src/container/Accordion.mjs +18 -20
- package/src/container/AccordionItem.mjs +12 -11
- package/src/container/Base.mjs +24 -23
- package/src/container/Panel.mjs +9 -9
- package/src/controller/Base.mjs +12 -14
- package/src/controller/Component.mjs +60 -66
- package/src/core/Base.mjs +5 -8
- package/src/core/IdGenerator.mjs +1 -3
- package/src/core/Observable.mjs +40 -24
- package/src/core/Util.mjs +5 -5
- package/src/data/Model.mjs +3 -3
- package/src/data/RecordFactory.mjs +3 -6
- package/src/data/Store.mjs +34 -34
- package/src/data/connection/Fetch.mjs +3 -3
- package/src/data/connection/WebSocket.mjs +21 -25
- package/src/data/connection/Xhr.mjs +31 -28
- package/src/date/DayViewComponent.mjs +1 -1
- package/src/date/SelectorContainer.mjs +2 -2
- package/src/dialog/Base.mjs +27 -25
- package/src/dialog/header/Toolbar.mjs +5 -4
- package/src/draggable/DragProxyComponent.mjs +7 -4
- package/src/draggable/DragZone.mjs +30 -30
- package/src/draggable/DropZone.mjs +7 -7
- package/src/draggable/list/DragZone.mjs +18 -18
- package/src/draggable/tab/header/toolbar/SortZone.mjs +7 -7
- package/src/draggable/toolbar/DragZone.mjs +15 -15
- package/src/draggable/toolbar/SortZone.mjs +30 -31
- package/src/draggable/tree/DragZone.mjs +9 -9
- package/src/filter/BooleanContainer.mjs +3 -3
- package/src/filter/NumberContainer.mjs +5 -5
- package/src/filter/ToggleOperatorsButton.mjs +5 -5
- package/src/form/Fieldset.mjs +26 -26
- package/src/form/field/Base.mjs +1 -1
- package/src/form/field/CheckBox.mjs +15 -16
- package/src/form/field/Color.mjs +13 -15
- package/src/form/field/ComboBox.mjs +16 -24
- package/src/form/field/Country.mjs +1 -1
- package/src/form/field/Date.mjs +3 -4
- package/src/form/field/Display.mjs +1 -1
- package/src/form/field/Email.mjs +2 -2
- package/src/form/field/Number.mjs +51 -56
- package/src/form/field/Picker.mjs +2 -2
- package/src/form/field/Radio.mjs +1 -1
- package/src/form/field/Range.mjs +7 -6
- package/src/form/field/Text.mjs +29 -36
- package/src/form/field/TextArea.mjs +9 -9
- package/src/form/field/Time.mjs +30 -30
- package/src/form/field/trigger/Base.mjs +19 -13
- package/src/form/field/trigger/Clear.mjs +13 -13
- package/src/form/field/trigger/CopyToClipboard.mjs +7 -7
- package/src/form/field/trigger/Picker.mjs +2 -2
- package/src/form/field/trigger/SpinDown.mjs +1 -1
- package/src/form/field/trigger/SpinUp.mjs +1 -1
- package/src/form/field/trigger/SpinUpDown.mjs +3 -3
- package/src/form/field/trigger/Time.mjs +3 -3
- package/src/grid/Container.mjs +33 -33
- package/src/grid/View.mjs +20 -22
- package/src/grid/header/Button.mjs +12 -12
- package/src/grid/header/Toolbar.mjs +4 -4
- package/src/layout/Base.mjs +5 -4
- package/src/layout/Card.mjs +15 -16
- package/src/layout/Fit.mjs +22 -8
- package/src/layout/Flexbox.mjs +30 -29
- package/src/layout/Form.mjs +15 -15
- package/src/layout/Grid.mjs +2 -2
- package/src/layout/HBox.mjs +3 -2
- package/src/layout/VBox.mjs +3 -2
- package/src/list/Base.mjs +45 -47
- package/src/list/Chip.mjs +4 -4
- package/src/list/Circle.mjs +3 -3
- package/src/list/Color.mjs +4 -4
- package/src/list/Component.mjs +10 -10
- package/src/list/plugin/Animate.mjs +18 -13
- package/src/main/DomAccess.mjs +92 -56
- package/src/main/DomEvents.mjs +38 -39
- package/src/main/addon/AmCharts.mjs +37 -37
- package/src/main/addon/AnalyticsByGoogle.mjs +4 -4
- package/src/main/addon/CesiumJS.mjs +8 -8
- package/src/main/addon/CloneNode.mjs +5 -5
- package/src/main/addon/Cookie.mjs +4 -4
- package/src/main/addon/DragDrop.mjs +35 -34
- package/src/main/addon/GoogleMaps.mjs +19 -19
- package/src/main/addon/IntersectionObserver.mjs +20 -1
- package/src/main/addon/LocalStorage.mjs +3 -3
- package/src/main/addon/MapboxGL.mjs +40 -41
- package/src/main/addon/MonacoEditor.mjs +5 -5
- package/src/main/addon/Mwc.mjs +6 -6
- package/src/main/addon/Navigator.mjs +35 -39
- package/src/main/addon/Popover.mjs +5 -6
- package/src/main/addon/PrefixField.mjs +1 -2
- package/src/main/addon/ServiceWorker.mjs +9 -9
- package/src/main/addon/Siesta.mjs +3 -2
- package/src/main/addon/Stylesheet.mjs +37 -37
- package/src/main/addon/WebComponent.mjs +2 -3
- package/src/main/addon/WindowPosition.mjs +18 -18
- package/src/main/draggable/sensor/Base.mjs +2 -2
- package/src/main/draggable/sensor/Mouse.mjs +15 -15
- package/src/main/draggable/sensor/Touch.mjs +24 -23
- package/src/main/mixin/DeltaUpdates.mjs +10 -12
- package/src/main/mixin/TouchDomEvents.mjs +6 -6
- package/src/manager/Base.mjs +4 -4
- package/src/manager/Component.mjs +41 -41
- package/src/manager/DomEvent.mjs +41 -44
- package/src/manager/Focus.mjs +14 -16
- package/src/manager/Instance.mjs +2 -4
- package/src/manager/Store.mjs +4 -8
- package/src/manager/Task.mjs +20 -22
- package/src/manager/Toast.mjs +14 -16
- package/src/manager/rpc/Api.mjs +1 -3
- package/src/manager/rpc/Message.mjs +16 -18
- package/src/menu/List.mjs +16 -16
- package/src/menu/Panel.mjs +4 -4
- package/src/model/Component.mjs +16 -14
- package/src/plugin/Base.mjs +2 -0
- package/src/plugin/Popover.mjs +1 -1
- package/src/plugin/PrefixField.mjs +35 -45
- package/src/plugin/Resizable.mjs +86 -101
- package/src/plugin/Responsive.mjs +1 -1
- package/src/remotes/Api.mjs +4 -6
- package/src/selection/CircleModel.mjs +12 -16
- package/src/selection/DateSelectorModel.mjs +21 -23
- package/src/selection/GalleryModel.mjs +49 -63
- package/src/selection/HelixModel.mjs +35 -41
- package/src/selection/ListModel.mjs +9 -14
- package/src/selection/Model.mjs +31 -31
- package/src/selection/TreeAccordionModel.mjs +74 -80
- package/src/selection/grid/CellColumnModel.mjs +10 -10
- package/src/selection/grid/CellColumnRowModel.mjs +10 -10
- package/src/selection/grid/CellModel.mjs +26 -28
- package/src/selection/grid/CellRowModel.mjs +24 -24
- package/src/selection/grid/ColumnModel.mjs +16 -20
- package/src/selection/grid/RowModel.mjs +27 -29
- package/src/selection/menu/ListModel.mjs +2 -2
- package/src/selection/table/CellColumnModel.mjs +12 -12
- package/src/selection/table/CellColumnRowModel.mjs +12 -12
- package/src/selection/table/CellModel.mjs +26 -29
- package/src/selection/table/CellRowModel.mjs +19 -19
- package/src/selection/table/ColumnModel.mjs +18 -22
- package/src/selection/table/RowModel.mjs +27 -29
- package/src/sitemap/Component.mjs +20 -20
- package/src/sitemap/Store.mjs +1 -1
- package/src/tab/Container.mjs +15 -15
- package/src/tab/Strip.mjs +1 -1
- package/src/tab/header/Toolbar.mjs +4 -4
- package/src/table/Container.mjs +8 -10
- package/src/table/View.mjs +29 -34
- package/src/table/header/Button.mjs +18 -18
- package/src/table/header/Toolbar.mjs +2 -2
- package/src/toolbar/Base.mjs +14 -14
- package/src/toolbar/Breadcrumb.mjs +11 -11
- package/src/toolbar/Paging.mjs +18 -18
- package/src/tooltip/Base.mjs +20 -22
- package/src/tree/Accordion.mjs +69 -75
- package/src/tree/List.mjs +22 -25
- package/src/util/Array.mjs +19 -18
- package/src/util/ClassSystem.mjs +9 -9
- package/src/util/Css.mjs +2 -2
- package/src/util/Date.mjs +9 -9
- package/src/util/Function.mjs +2 -2
- package/src/util/HashHistory.mjs +3 -5
- package/src/util/KeyNavigation.mjs +17 -17
- package/src/util/Logger.mjs +9 -9
- package/src/util/Matrix.mjs +19 -19
- package/src/util/String.mjs +9 -9
- package/src/util/Style.mjs +11 -11
- package/src/util/VDom.mjs +12 -14
- package/src/util/VNode.mjs +29 -29
- package/src/vdom/Helper.mjs +84 -93
- package/src/vdom/VNode.mjs +1 -1
- package/src/worker/App.mjs +19 -16
- package/src/worker/Base.mjs +14 -15
- package/src/worker/Canvas.mjs +1 -3
- package/src/worker/Data.mjs +4 -8
- package/src/worker/Manager.mjs +27 -32
- package/src/worker/Message.mjs +1 -1
- package/src/worker/ServiceBase.mjs +38 -42
- package/src/worker/Task.mjs +1 -3
- package/src/worker/VDom.mjs +2 -4
- package/src/worker/mixin/RemoteMethodAccess.mjs +5 -6
- package/apps/portal/view/home/parts/CoolStuff.mjs +0 -82
- package/examples/component/helix/MainContainer.mjs +0 -340
- /package/resources/images/{Neo_Logo_Blue.svg → logo/neo_logo_secondary.svg} +0 -0
- /package/resources/images/{Neo_Logo_Text.svg → logo/neo_logo_text_secondary.svg} +0 -0
- /package/resources/images/{Neo_Logo_White.svg → logo/neo_logo_white.svg} +0 -0
@@ -0,0 +1,277 @@
|
|
1
|
+
import Component from '../../../src/controller/Component.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Colors.view.ViewportController
|
5
|
+
* @extends Neo.controller.Component
|
6
|
+
*/
|
7
|
+
class ViewportController extends Component {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Colors.view.ViewportController'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Colors.view.ViewportController'
|
14
|
+
}
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @member {String[]} connectedApps=[]
|
18
|
+
*/
|
19
|
+
connectedApps = []
|
20
|
+
/**
|
21
|
+
* @member {Number|null} intervalId
|
22
|
+
*/
|
23
|
+
intervalId = null
|
24
|
+
/**
|
25
|
+
* @member {Object} widgetIndexMap
|
26
|
+
*/
|
27
|
+
widgetIndexMap = {
|
28
|
+
'bar-chart': 3,
|
29
|
+
'pie-chart': 2,
|
30
|
+
table : 1
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @param {String} name The name of the reference
|
35
|
+
*/
|
36
|
+
async createBrowserWindow(name) {
|
37
|
+
let me = this,
|
38
|
+
{windowId} = me,
|
39
|
+
{windowConfigs} = Neo,
|
40
|
+
firstWindowId = parseInt(Object.keys(windowConfigs)[0]),
|
41
|
+
{basePath} = windowConfigs[firstWindowId],
|
42
|
+
url = `${basePath}apps/colors/childapps/widget/index.html?name=${name}`;
|
43
|
+
|
44
|
+
if (me.getModel().getData('openWidgetsAsPopups')) {
|
45
|
+
let widget = me.getReference(name),
|
46
|
+
winData = await Neo.Main.getWindowData({windowId} ),
|
47
|
+
rect = await me.component.getDomRect(widget.vdom.id), // using the vdom id to always get the top-level node
|
48
|
+
{height, left, top, width} = rect;
|
49
|
+
|
50
|
+
height -= 50; // popup header in Chrome
|
51
|
+
left += winData.screenLeft;
|
52
|
+
top += (winData.outerHeight - winData.innerHeight + winData.screenTop);
|
53
|
+
|
54
|
+
await Neo.Main.windowOpen({
|
55
|
+
url,
|
56
|
+
windowFeatures: `height=${height},left=${left},top=${top},width=${width}`,
|
57
|
+
windowName : name
|
58
|
+
})
|
59
|
+
} else {
|
60
|
+
await Neo.Main.windowOpen({url, windowName: '_blank'})
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @param {Object} data
|
66
|
+
* @param {String} data.appName
|
67
|
+
* @param {Number} data.windowId
|
68
|
+
*/
|
69
|
+
async onAppConnect(data) {
|
70
|
+
if (data.appName === 'ColorsWidget') {
|
71
|
+
let me = this,
|
72
|
+
app = Neo.apps[data.appName],
|
73
|
+
mainView = app.mainView,
|
74
|
+
{windowId} = data,
|
75
|
+
url = await Neo.Main.getByPath({path: 'document.URL', windowId}),
|
76
|
+
widgetName = new URL(url).searchParams.get('name'),
|
77
|
+
widget = me.getReference(widgetName),
|
78
|
+
widgetParent = widget.up();
|
79
|
+
|
80
|
+
me.connectedApps.push(widgetName);
|
81
|
+
|
82
|
+
me.getReference(`detach-${widgetName}-button`).disabled = true;
|
83
|
+
|
84
|
+
widgetParent.remove(widget, false);
|
85
|
+
mainView.add(widget)
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
* @param {Object} data
|
91
|
+
* @param {String} data.appName
|
92
|
+
* @param {Number} data.windowId
|
93
|
+
*/
|
94
|
+
async onAppDisconnect(data) {
|
95
|
+
let me = this,
|
96
|
+
{appName, windowId} = data,
|
97
|
+
url = await Neo.Main.getByPath({path: 'document.URL', windowId}),
|
98
|
+
widgetName = new URL(url).searchParams.get('name'),
|
99
|
+
widget = me.getReference(widgetName),
|
100
|
+
widgetParent = widget.up();
|
101
|
+
|
102
|
+
// Closing a non-main app needs to move the widget back into its original position & re-enable the show button
|
103
|
+
if (appName === 'ColorsWidget') {
|
104
|
+
widgetParent.remove(widget, false);
|
105
|
+
me.component.insert(me.widgetIndexMap[widgetName], widget);
|
106
|
+
|
107
|
+
me.getReference(`detach-${widgetName}-button`).disabled = false
|
108
|
+
}
|
109
|
+
// Close popup windows when closing or reloading the main window
|
110
|
+
else if (appName === 'Colors') {
|
111
|
+
Neo.Main.windowClose({names: me.connectedApps, windowId})
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @param {Object} data
|
117
|
+
*/
|
118
|
+
onChangeAmountColors(data) {
|
119
|
+
this.updateDataProperty(data, 'amountColors', data.value)
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* @param {Object} data
|
124
|
+
*/
|
125
|
+
onChangeAmountColumns(data) {
|
126
|
+
this.updateDataProperty(data, 'amountColumns', parseInt(data.value.name))
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* @param {Object} data
|
131
|
+
*/
|
132
|
+
onChangeAmountRows(data) {
|
133
|
+
this.updateDataProperty(data, 'amountRows', parseInt(data.value.name))
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @param {Object} data
|
138
|
+
*/
|
139
|
+
onChangeOpenWidgetsAsPopups(data) {
|
140
|
+
this.getModel().setData('openWidgetsAsPopups', data.value)
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
*
|
145
|
+
*/
|
146
|
+
onConstructed() {
|
147
|
+
super.onConstructed();
|
148
|
+
|
149
|
+
let me = this;
|
150
|
+
|
151
|
+
Neo.currentWorker.on({
|
152
|
+
connect : me.onAppConnect,
|
153
|
+
disconnect: me.onAppDisconnect,
|
154
|
+
scope : me
|
155
|
+
})
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
*
|
160
|
+
*/
|
161
|
+
onComponentConstructed() {
|
162
|
+
super.onComponentConstructed();
|
163
|
+
this.updateWidgets()
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* @param {Object} data
|
168
|
+
*/
|
169
|
+
async onDetachBarChartButtonClick(data) {
|
170
|
+
await this.createBrowserWindow('bar-chart')
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* @param {Object} data
|
175
|
+
*/
|
176
|
+
async onDetachPieChartButtonClick(data) {
|
177
|
+
await this.createBrowserWindow('pie-chart')
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* @param {Object} data
|
182
|
+
*/
|
183
|
+
async onDetachTableButtonClick(data) {
|
184
|
+
await this.createBrowserWindow('table')
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* @param {Object} data
|
189
|
+
*/
|
190
|
+
onStopButtonClick(data) {
|
191
|
+
let me = this;
|
192
|
+
|
193
|
+
me.getModel().setData({isUpdating: false});
|
194
|
+
|
195
|
+
if (me.intervalId) {
|
196
|
+
clearInterval(me.intervalId);
|
197
|
+
me.intervalId = null
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
* @param {Object} data
|
203
|
+
*/
|
204
|
+
onStartButtonClick(data) {
|
205
|
+
let me = this,
|
206
|
+
intervalTime = 1000 / 60; // assuming 60 FPS
|
207
|
+
|
208
|
+
me.getModel().setData({isUpdating: true});
|
209
|
+
|
210
|
+
if (!me.intervalId) {
|
211
|
+
me.intervalId = setInterval(() => {
|
212
|
+
me.updateWidgets()
|
213
|
+
}, intervalTime)
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* @param {Object} data
|
219
|
+
*/
|
220
|
+
updateCharts(data) {
|
221
|
+
this.getReference('bar-chart').chartData = data;
|
222
|
+
this.getReference('pie-chart').chartData = data
|
223
|
+
}
|
224
|
+
|
225
|
+
/**
|
226
|
+
* If the WebSocket stream is not running, we need to pull new data once to see the new setting visually
|
227
|
+
* @param {Object} data The change event data
|
228
|
+
* @param {String} name The VM data property name
|
229
|
+
* @param {Number|Object|null} value The new VM data property value
|
230
|
+
*/
|
231
|
+
updateDataProperty(data, name, value) {
|
232
|
+
let model = this.getModel();
|
233
|
+
|
234
|
+
model.setData(name, value);
|
235
|
+
|
236
|
+
if (data.oldValue !== null && !model.getData('isUpdating')) {
|
237
|
+
this.updateWidgets()
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* @param {Object[]} records
|
243
|
+
*/
|
244
|
+
updateTable(records) {
|
245
|
+
let table = this.getReference('table'),
|
246
|
+
{store} = table;
|
247
|
+
|
248
|
+
if (store.getCount()) {
|
249
|
+
table.bulkUpdateRecords(records)
|
250
|
+
} else {
|
251
|
+
store.data = records
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
*
|
257
|
+
*/
|
258
|
+
updateWidgets() {
|
259
|
+
let me = this,
|
260
|
+
model = me.getModel();
|
261
|
+
|
262
|
+
Colors.backend.ColorService.read({
|
263
|
+
amountColors : model.getData('amountColors'),
|
264
|
+
amountColumns: model.getData('amountColumns'),
|
265
|
+
amountRows : model.getData('amountRows')
|
266
|
+
}).then(response => {
|
267
|
+
let {data} = response;
|
268
|
+
|
269
|
+
me.updateTable(data.tableData);
|
270
|
+
me.updateCharts(data.summaryData)
|
271
|
+
})
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
Neo.setupClass(ViewportController);
|
276
|
+
|
277
|
+
export default ViewportController;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import Component from '../../../src/model/Component.mjs';
|
2
|
+
import ColorsStore from '../store/Colors.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Colors.view.ViewportModel
|
6
|
+
* @extends Neo.model.Component
|
7
|
+
*/
|
8
|
+
class ViewportModel extends Component {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Colors.view.ViewportModel'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Colors.view.ViewportModel',
|
15
|
+
/**
|
16
|
+
* @member {Object} data
|
17
|
+
*/
|
18
|
+
data: {
|
19
|
+
/**
|
20
|
+
* @member {Number} data.amountColors=10
|
21
|
+
*/
|
22
|
+
amountColors: 10,
|
23
|
+
/**
|
24
|
+
* @member {Number} data.amountColumns=10
|
25
|
+
*/
|
26
|
+
amountColumns: 10,
|
27
|
+
/**
|
28
|
+
* @member {Number} data.amountRows=10
|
29
|
+
*/
|
30
|
+
amountRows: 10,
|
31
|
+
/**
|
32
|
+
* @member {Boolean} data.isUpdating=false
|
33
|
+
*/
|
34
|
+
isUpdating: false,
|
35
|
+
/**
|
36
|
+
* @member {Boolean} data.openWidgetsAsPopups=true
|
37
|
+
*/
|
38
|
+
openWidgetsAsPopups: true
|
39
|
+
},
|
40
|
+
/**
|
41
|
+
* @member {Object} stores
|
42
|
+
*/
|
43
|
+
stores: {
|
44
|
+
colors: {
|
45
|
+
module: ColorsStore
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
Neo.setupClass(ViewportModel);
|
52
|
+
|
53
|
+
export default ViewportModel;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @param {String|null} searchString
|
3
|
+
* @returns {Function}
|
4
|
+
*/
|
5
|
+
export function getSearchParams(searchString) {
|
6
|
+
if (searchString?.startsWith('?')) {
|
7
|
+
searchString = searchString.substring(1)
|
8
|
+
}
|
9
|
+
|
10
|
+
return searchString ? JSON.parse(`{"${decodeURI(searchString.replace(/&/g, "\",\"").replace(/=/g, "\":\""))}"}`) : {}
|
11
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"basePath" : "../../../../",
|
4
4
|
"environment" : "development",
|
5
5
|
"mainPath" : "./Main.mjs",
|
6
|
-
"mainThreadAddons": ["Stylesheet"],
|
7
|
-
"themes" : ["neo-theme-neo-light"],
|
6
|
+
"mainThreadAddons": ["AmCharts", "DragDrop", "Navigator", "Stylesheet"],
|
7
|
+
"themes" : ["neo-theme-neo-light", "neo-theme-dark"],
|
8
8
|
"useSharedWorkers": true
|
9
9
|
}
|
@@ -3,7 +3,8 @@
|
|
3
3
|
"basePath" : "../../",
|
4
4
|
"environment" : "development",
|
5
5
|
"mainPath" : "./Main.mjs",
|
6
|
-
"mainThreadAddons": ["DragDrop", "HighlightJS", "IntersectionObserver", "MonacoEditor", "Navigator", "ResizeObserver", "Stylesheet"],
|
6
|
+
"mainThreadAddons": ["AmCharts", "DragDrop", "HighlightJS", "IntersectionObserver", "MonacoEditor", "Navigator", "ResizeObserver", "Stylesheet"],
|
7
|
+
"remotesApiUrl" : "remotes-api.json",
|
7
8
|
"themes" : ["neo-theme-neo-light", "neo-theme-light", "neo-theme-dark"],
|
8
9
|
"useSharedWorkers": true
|
9
10
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import Controller
|
1
|
+
import Controller from '../../../src/controller/Component.mjs';
|
2
|
+
import {getSearchParams} from '../Util.mjs';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @class Portal.view.ViewportController
|
@@ -11,6 +12,11 @@ class ViewportController extends Controller {
|
|
11
12
|
* @protected
|
12
13
|
*/
|
13
14
|
className: 'Portal.view.ViewportController',
|
15
|
+
/**
|
16
|
+
* @member {String} ntype='viewport-controller'
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
ntype: 'viewport-controller',
|
14
20
|
/**
|
15
21
|
* @member {String|null} defaultHash='/home'
|
16
22
|
*/
|
@@ -27,6 +33,73 @@ class ViewportController extends Controller {
|
|
27
33
|
}
|
28
34
|
}
|
29
35
|
|
36
|
+
/**
|
37
|
+
* @member {String[]} connectedApps=[]
|
38
|
+
*/
|
39
|
+
connectedApps = []
|
40
|
+
|
41
|
+
/**
|
42
|
+
* @param {Object} data
|
43
|
+
* @param {String} data.appName
|
44
|
+
* @param {Number} data.windowId
|
45
|
+
*/
|
46
|
+
async onAppConnect(data) {
|
47
|
+
let {appName, windowId} = data,
|
48
|
+
app = Neo.apps[appName],
|
49
|
+
mainView = app.mainView;
|
50
|
+
|
51
|
+
if (appName === 'PortalPreview') {
|
52
|
+
let searchString = await Neo.Main.getByPath({path: 'location.search', windowId}),
|
53
|
+
livePreviewId = getSearchParams(searchString).id,
|
54
|
+
livePreview = Neo.getComponent(livePreviewId),
|
55
|
+
sourceContainer = livePreview.getReference('preview'),
|
56
|
+
tabContainer = livePreview.tabContainer,
|
57
|
+
sourceView = sourceContainer.removeAt(0, false);
|
58
|
+
|
59
|
+
livePreview.previewContainer = mainView;
|
60
|
+
mainView.add(sourceView);
|
61
|
+
|
62
|
+
tabContainer.activeIndex = 0; // switch to the source view
|
63
|
+
|
64
|
+
tabContainer.getTabAtIndex(1).disabled = true
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* @param {Object} data
|
70
|
+
* @param {String} data.appName
|
71
|
+
* @param {Number} data.windowId
|
72
|
+
*/
|
73
|
+
async onAppDisconnect(data) {
|
74
|
+
let me = this,
|
75
|
+
{appName, windowId} = data,
|
76
|
+
app = Neo.apps[appName],
|
77
|
+
mainView = app.mainView;
|
78
|
+
|
79
|
+
// Closing a code preview window needs to drop the preview back into the related main app
|
80
|
+
if (appName === 'PortalPreview') {
|
81
|
+
let searchString = await Neo.Main.getByPath({path: 'location.search', windowId}),
|
82
|
+
livePreviewId = getSearchParams(searchString).id,
|
83
|
+
livePreview = Neo.getComponent(livePreviewId),
|
84
|
+
sourceContainer = livePreview.getReference('preview'),
|
85
|
+
tabContainer = livePreview.tabContainer,
|
86
|
+
sourceView = mainView.removeAt(0, false);
|
87
|
+
|
88
|
+
livePreview.previewContainer = null;
|
89
|
+
sourceContainer.add(sourceView);
|
90
|
+
|
91
|
+
livePreview.disableRunSource = true; // will get reset after the next activeIndex change (async)
|
92
|
+
tabContainer.activeIndex = 1; // switch to the source view
|
93
|
+
|
94
|
+
livePreview.getReference('popout-window-button').disabled = false;
|
95
|
+
tabContainer.getTabAtIndex(1).disabled = false
|
96
|
+
}
|
97
|
+
// Close popup windows when closing or reloading the main window
|
98
|
+
else if (appName === 'Portal') {
|
99
|
+
Neo.Main.windowClose({names: me.connectedApps, windowId})
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
30
103
|
/**
|
31
104
|
* @param {Object[]} records
|
32
105
|
*/
|
@@ -50,6 +123,21 @@ class ViewportController extends Controller {
|
|
50
123
|
this.getReference('blog-list').filterItems(data)
|
51
124
|
}
|
52
125
|
|
126
|
+
/**
|
127
|
+
*
|
128
|
+
*/
|
129
|
+
onConstructed() {
|
130
|
+
super.onConstructed();
|
131
|
+
|
132
|
+
let me = this;
|
133
|
+
|
134
|
+
Neo.currentWorker.on({
|
135
|
+
connect : me.onAppConnect,
|
136
|
+
disconnect: me.onAppDisconnect,
|
137
|
+
scope : me
|
138
|
+
});
|
139
|
+
}
|
140
|
+
|
53
141
|
/**
|
54
142
|
* @param {Object} params
|
55
143
|
* @param {Object} value
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import AfterMath from './parts/AfterMath.mjs';
|
2
|
+
import Colors from './parts/Colors.mjs';
|
2
3
|
import Container from '../../../../src/container/Base.mjs';
|
3
|
-
import CoolStuff from './parts/CoolStuff.mjs';
|
4
4
|
import Features from './parts/Features.mjs';
|
5
|
+
import Helix from './parts/Helix.mjs';
|
6
|
+
import How from './parts/How.mjs';
|
5
7
|
import HelloWorld from './parts/HelloWorld.mjs';
|
6
8
|
import MainNeo from './parts/MainNeo.mjs';
|
7
9
|
|
@@ -24,14 +26,13 @@ class MainContainer extends Container {
|
|
24
26
|
* @member {Object[]} items
|
25
27
|
*/
|
26
28
|
items: [
|
27
|
-
{
|
28
|
-
ntype: 'component',
|
29
|
-
id : 'progress'
|
30
|
-
},
|
29
|
+
{ntype: 'component', id: 'progress'},
|
31
30
|
MainNeo,
|
32
31
|
Features,
|
33
32
|
HelloWorld,
|
34
|
-
|
33
|
+
Helix,
|
34
|
+
Colors,
|
35
|
+
How,
|
35
36
|
AfterMath
|
36
37
|
],
|
37
38
|
/**
|
@@ -40,11 +41,38 @@ class MainContainer extends Container {
|
|
40
41
|
scrollable: true,
|
41
42
|
|
42
43
|
domListeners: [{
|
44
|
+
intersect(data) {
|
45
|
+
Neo.getComponent(data.targetId)?.activate?.()
|
46
|
+
},
|
43
47
|
scroll(event) {
|
44
48
|
this.toggleCls('hide-sidebar', event.scrollTop > 80)
|
45
49
|
}
|
46
50
|
}]
|
47
51
|
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Triggered after the mounted config got changed
|
55
|
+
* @param {Boolean} value
|
56
|
+
* @param {Boolean} oldValue
|
57
|
+
* @protected
|
58
|
+
*/
|
59
|
+
afterSetMounted(value, oldValue) {
|
60
|
+
super.afterSetMounted(value, oldValue);
|
61
|
+
|
62
|
+
let me = this,
|
63
|
+
{id, windowId} = me;
|
64
|
+
|
65
|
+
value && setTimeout(() => {
|
66
|
+
Neo.main.addon.IntersectionObserver.register({
|
67
|
+
callback : 'isVisible',
|
68
|
+
id,
|
69
|
+
observe : ['.page'],
|
70
|
+
root : `#${id}`,
|
71
|
+
threshold: 1.0,
|
72
|
+
windowId
|
73
|
+
})
|
74
|
+
}, 50)
|
75
|
+
}
|
48
76
|
}
|
49
77
|
|
50
78
|
Neo.setupClass(MainContainer);
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
import LivePreview from '../../learn/LivePreview.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.parts.Colors
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class Colors extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.parts.Colors'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.parts.Colors',
|
15
|
+
|
16
|
+
cls: ['page', 'cool-stuff'],
|
17
|
+
|
18
|
+
responsive: {
|
19
|
+
medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
|
20
|
+
large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
|
21
|
+
},
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @member {Object[]} items
|
25
|
+
*/
|
26
|
+
items: [{
|
27
|
+
module: Container,
|
28
|
+
flex : '1',
|
29
|
+
style : {padding: '2rem'},
|
30
|
+
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
31
|
+
items : [{
|
32
|
+
cls : 'neo-h1',
|
33
|
+
flex: 'none',
|
34
|
+
html: 'Amazing Potential',
|
35
|
+
vdom: {tag: 'h1'}
|
36
|
+
}, {
|
37
|
+
cls : 'neo-h2',
|
38
|
+
flex: 'none',
|
39
|
+
html: 'Socket Data',
|
40
|
+
vdom: {tag: 'h2'}
|
41
|
+
}, {
|
42
|
+
flex: 'none',
|
43
|
+
vdom: {tag: 'p'},
|
44
|
+
html: [
|
45
|
+
'This is similar to the Helix demo — it\'s an extremely fast multi-window app. Click the start button',
|
46
|
+
'to see the view reflect changes in the data. And the app is multi-window: the table and charts can be',
|
47
|
+
'undocked into their own windows. In fact, the entire demo can be undocked.'
|
48
|
+
].join('')
|
49
|
+
}, {
|
50
|
+
flex: 'none',
|
51
|
+
html: 'But the demo differs from the helix example because the data is provided via a <i>socket</i>.',
|
52
|
+
vdom: {tag: 'p'}
|
53
|
+
}, {
|
54
|
+
flex: 'none',
|
55
|
+
vdom: {tag: 'p'},
|
56
|
+
html: [
|
57
|
+
'Neo.mjs uniquely fits the bill for applications that need real-time visualizations of real-time data, such as',
|
58
|
+
'stock market trading data and medical or scientific telemetry.'
|
59
|
+
].join('')
|
60
|
+
}]
|
61
|
+
}, {
|
62
|
+
module: Container,
|
63
|
+
flex : '2',
|
64
|
+
style : {background: 'lightgray', padding: '20px'},
|
65
|
+
layout: {ntype: 'vbox', align: 'stretch', pack: 'center'},
|
66
|
+
items : [{
|
67
|
+
module : LivePreview,
|
68
|
+
cls : ['page-live-preview'],
|
69
|
+
height : '100%',
|
70
|
+
reference: 'live-preview',
|
71
|
+
|
72
|
+
value: [
|
73
|
+
"import Viewport from '../../../../apps/colors/view/Viewport.mjs';",
|
74
|
+
"",
|
75
|
+
"class MainView extends Viewport {",
|
76
|
+
" static config = {",
|
77
|
+
" className: 'Portal.view.Colors',",
|
78
|
+
" theme : 'neo-theme-dark'",
|
79
|
+
" }",
|
80
|
+
"}",
|
81
|
+
"",
|
82
|
+
"Neo.setupClass(MainView);"
|
83
|
+
].join('\n')
|
84
|
+
}]
|
85
|
+
}]
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
*
|
90
|
+
*/
|
91
|
+
activate() {
|
92
|
+
this.getReference('live-preview').activeView = 'preview'
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
Neo.setupClass(Colors);
|
97
|
+
|
98
|
+
export default Colors;
|