neo.mjs 6.16.0 → 6.16.2
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/buildScripts/webpack/json/myApps.template.json +0 -1
- package/package.json +8 -8
- package/src/model/Component.mjs +1 -1
- package/src/table/Container.mjs +42 -0
- package/apps/colors/app.mjs +0 -6
- package/apps/colors/childapps/widget/app.mjs +0 -7
- package/apps/colors/childapps/widget/index.html +0 -11
- package/apps/colors/childapps/widget/neo-config.json +0 -10
- package/apps/colors/childapps/widget/view/Viewport.mjs +0 -19
- package/apps/colors/index.html +0 -11
- package/apps/colors/model/Color.mjs +0 -59
- package/apps/colors/neo-config.json +0 -9
- package/apps/colors/store/Colors.mjs +0 -24
- package/apps/colors/view/BarChartComponent.mjs +0 -67
- package/apps/colors/view/PieChartComponent.mjs +0 -53
- package/apps/colors/view/TableContainer.mjs +0 -73
- package/apps/colors/view/Viewport.mjs +0 -83
- package/apps/colors/view/ViewportController.mjs +0 -268
- package/apps/colors/view/ViewportModel.mjs +0 -32
- package/resources/scss/src/apps/colors/BarChartComponent.scss +0 -3
- package/resources/scss/src/apps/colors/PieChartComponent.scss +0 -3
- package/resources/scss/src/apps/colors/TableContainer.scss +0 -44
- package/resources/scss/src/apps/colors/Viewport.scss +0 -17
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "6.16.
|
3
|
+
"version": "6.16.2",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -47,23 +47,23 @@
|
|
47
47
|
"autoprefixer": "^10.4.19",
|
48
48
|
"chalk": "^5.3.0",
|
49
49
|
"clean-webpack-plugin": "^4.0.0",
|
50
|
-
"commander": "^12.
|
51
|
-
"cssnano": "^
|
52
|
-
"envinfo": "^7.
|
50
|
+
"commander": "^12.1.0",
|
51
|
+
"cssnano": "^7.0.2",
|
52
|
+
"envinfo": "^7.13.0",
|
53
53
|
"fs-extra": "^11.2.0",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
|
-
"inquirer": "^9.2.
|
55
|
+
"inquirer": "^9.2.23",
|
56
56
|
"marked": "^12.0.2",
|
57
|
-
"monaco-editor": "^0.
|
57
|
+
"monaco-editor": "^0.49.0",
|
58
58
|
"neo-jsdoc": "1.0.1",
|
59
59
|
"neo-jsdoc-x": "1.0.5",
|
60
60
|
"postcss": "^8.4.38",
|
61
|
-
"sass": "^1.
|
61
|
+
"sass": "^1.77.4",
|
62
62
|
"siesta-lite": "5.5.2",
|
63
63
|
"url": "^0.11.3",
|
64
64
|
"webpack": "^5.91.0",
|
65
65
|
"webpack-cli": "^5.1.4",
|
66
|
-
"webpack-dev-server": "^
|
66
|
+
"webpack-dev-server": "^5.0.4",
|
67
67
|
"webpack-hook-plugin": "^1.0.7",
|
68
68
|
"webpack-node-externals": "^3.0.0"
|
69
69
|
},
|
package/src/model/Component.mjs
CHANGED
@@ -564,7 +564,7 @@ class Component extends Base {
|
|
564
564
|
Object.entries(binding).forEach(([componentId, configObject]) => {
|
565
565
|
component = Neo.getComponent(componentId) || Neo.get(componentId); // timing issue: the cmp might not be registered inside manager.Component yet
|
566
566
|
config = {};
|
567
|
-
model = component.getModel();
|
567
|
+
model = component.getModel() || me;
|
568
568
|
|
569
569
|
if (!hierarchyData[model.id]) {
|
570
570
|
hierarchyData[model.id] = model.getHierarchyData()
|
package/src/table/Container.mjs
CHANGED
@@ -161,6 +161,26 @@ class Container extends BaseContainer {
|
|
161
161
|
me.createColumns(me.columns)
|
162
162
|
}
|
163
163
|
|
164
|
+
/**
|
165
|
+
* Triggered after the columns config got changed
|
166
|
+
* @param {Object[]|null} value
|
167
|
+
* @param {Object[]|null} oldValue
|
168
|
+
* @protected
|
169
|
+
*/
|
170
|
+
afterSetColumns(value, oldValue) {
|
171
|
+
if (Array.isArray(oldValue) && oldValue.length > 0) {
|
172
|
+
let me = this,
|
173
|
+
headerToolbar = me.headerToolbar;
|
174
|
+
|
175
|
+
if (headerToolbar) {
|
176
|
+
headerToolbar.items = value;
|
177
|
+
headerToolbar.createItems()
|
178
|
+
}
|
179
|
+
|
180
|
+
me.view?.createViewData(me.store.items)
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
164
184
|
/**
|
165
185
|
* Triggered after the selectionModel config got changed
|
166
186
|
* @param {Neo.selection.Model} value
|
@@ -312,6 +332,28 @@ class Container extends BaseContainer {
|
|
312
332
|
return value || oldValue
|
313
333
|
}
|
314
334
|
|
335
|
+
/**
|
336
|
+
* In case you want to update multiple existing records in parallel,
|
337
|
+
* using this method is faster than updating each record one by one.
|
338
|
+
* At least until we introduce row based vdom updates.
|
339
|
+
* @param {Object[]} records
|
340
|
+
*/
|
341
|
+
bulkUpdateRecords(records) {
|
342
|
+
let {view} = this;
|
343
|
+
|
344
|
+
if (view) {
|
345
|
+
view.silentVdomUpdate = true;
|
346
|
+
|
347
|
+
this.store.items.forEach((record, index) => {
|
348
|
+
record.set(records[index])
|
349
|
+
});
|
350
|
+
|
351
|
+
view.silentVdomUpdate = false;
|
352
|
+
|
353
|
+
view.update()
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
315
357
|
/**
|
316
358
|
* @param {Object[]} columns
|
317
359
|
* @returns {*}
|
package/apps/colors/app.mjs
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
<title>Dashboard Widget</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<script src="../../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
-
</body>
|
11
|
-
</html>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"appPath" : "apps/colors/childapps/widget/app.mjs",
|
3
|
-
"basePath" : "../../../../",
|
4
|
-
"environment" : "development",
|
5
|
-
"loadApplicationDelay": 100,
|
6
|
-
"mainPath" : "./Main.mjs",
|
7
|
-
"mainThreadAddons" : ["AmCharts", "DragDrop", "Navigator", "Stylesheet"],
|
8
|
-
"themes" : ["neo-theme-dark"],
|
9
|
-
"useSharedWorkers" : true
|
10
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import BaseViewport from '../../../../../src/container/Viewport.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Colors.view.Viewport
|
5
|
-
* @extends Neo.container.Viewport
|
6
|
-
*/
|
7
|
-
class Viewport extends BaseViewport {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Widget.view.Viewport'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'SharedDialog2.view.Viewport'
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
Neo.setupClass(Viewport);
|
18
|
-
|
19
|
-
export default Viewport;
|
package/apps/colors/index.html
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
<title>Colors</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<script src="../../src/MicroLoader.mjs" type="module"></script>
|
10
|
-
</body>
|
11
|
-
</html>
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import Model from '../../../src/data/Model.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Colors.model.Color
|
5
|
-
* @extends Neo.data.Model
|
6
|
-
*/
|
7
|
-
class Color extends Model {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Colors.model.Color'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'Colors.model.Color',
|
14
|
-
/**
|
15
|
-
* @member {Object[]} fields
|
16
|
-
*/
|
17
|
-
fields: [{
|
18
|
-
name: 'id',
|
19
|
-
type: 'String'
|
20
|
-
}, {
|
21
|
-
name: 'index',
|
22
|
-
type: 'Integer'
|
23
|
-
}, {
|
24
|
-
name: 'columnA',
|
25
|
-
type: 'String'
|
26
|
-
}, {
|
27
|
-
name: 'columnB',
|
28
|
-
type: 'String'
|
29
|
-
}, {
|
30
|
-
name: 'columnC',
|
31
|
-
type: 'String'
|
32
|
-
}, {
|
33
|
-
name: 'columnD',
|
34
|
-
type: 'String'
|
35
|
-
}, {
|
36
|
-
name: 'columnE',
|
37
|
-
type: 'String'
|
38
|
-
}, {
|
39
|
-
name: 'columnF',
|
40
|
-
type: 'String'
|
41
|
-
}, {
|
42
|
-
name: 'columnG',
|
43
|
-
type: 'String'
|
44
|
-
}, {
|
45
|
-
name: 'columnH',
|
46
|
-
type: 'String'
|
47
|
-
}, {
|
48
|
-
name: 'columnI',
|
49
|
-
type: 'String'
|
50
|
-
}, {
|
51
|
-
name: 'columnJ',
|
52
|
-
type: 'String'
|
53
|
-
}]
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
Neo.setupClass(Color);
|
58
|
-
|
59
|
-
export default Color;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"appPath" : "apps/colors/app.mjs",
|
3
|
-
"basePath" : "../../",
|
4
|
-
"environment" : "development",
|
5
|
-
"mainPath" : "./Main.mjs",
|
6
|
-
"mainThreadAddons": ["AmCharts", "DragDrop", "Navigator", "Stylesheet"],
|
7
|
-
"themes" : ["neo-theme-dark"],
|
8
|
-
"useSharedWorkers": true
|
9
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import ColorModel from '../model/Color.mjs';
|
2
|
-
import Store from '../../../src/data/Store.mjs';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @class Colors.store.Colors
|
6
|
-
* @extends Neo.data.Store
|
7
|
-
*/
|
8
|
-
class Colors extends Store {
|
9
|
-
static config = {
|
10
|
-
/**
|
11
|
-
* @member {String} className='Colors.store.Colors'
|
12
|
-
* @protected
|
13
|
-
*/
|
14
|
-
className: 'Colors.store.Colors',
|
15
|
-
/**
|
16
|
-
* @member {Neo.data.Model} model=ColorModel
|
17
|
-
*/
|
18
|
-
model: ColorModel
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
Neo.setupClass(Colors);
|
23
|
-
|
24
|
-
export default Colors;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import AmChartComponent from '../../../src/component/wrapper/AmChart.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Colors.view.BarChartComponent
|
5
|
-
* @extends Neo.component.wrapper.AmChart
|
6
|
-
*/
|
7
|
-
class BarChartComponent extends AmChartComponent {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Colors.view.BarChartComponent'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'Colors.view.BarChartComponent',
|
14
|
-
/**
|
15
|
-
* @member {String[]} baseCls=['colors-bar-chart']
|
16
|
-
*/
|
17
|
-
baseCls: ['colors-bar-chart'],
|
18
|
-
/**
|
19
|
-
* @member {String} chartType='PieChart'
|
20
|
-
*/
|
21
|
-
chartType: 'XYChart',
|
22
|
-
/**
|
23
|
-
* @member {Object} _vdom
|
24
|
-
*/
|
25
|
-
/**
|
26
|
-
* @member {Object} chartConfig
|
27
|
-
*/
|
28
|
-
chartConfig: {
|
29
|
-
series: [{
|
30
|
-
type: 'ColumnSeries',
|
31
|
-
|
32
|
-
columns: {
|
33
|
-
propertyFields: {
|
34
|
-
fill : 'color',
|
35
|
-
stroke: 'color'
|
36
|
-
}
|
37
|
-
},
|
38
|
-
|
39
|
-
dataFields: {
|
40
|
-
categoryX: 'color',
|
41
|
-
valueY : 'count'
|
42
|
-
}
|
43
|
-
}],
|
44
|
-
xAxes: [{
|
45
|
-
type: 'CategoryAxis',
|
46
|
-
|
47
|
-
dataFields: {
|
48
|
-
category: 'color',
|
49
|
-
title: {
|
50
|
-
text: 'Colors'
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}],
|
54
|
-
yAxes: [{
|
55
|
-
type: 'ValueAxis',
|
56
|
-
|
57
|
-
title: {
|
58
|
-
text: 'Occurrences in table cells'
|
59
|
-
}
|
60
|
-
}]
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
Neo.setupClass(BarChartComponent);
|
66
|
-
|
67
|
-
export default BarChartComponent;
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import AmChartComponent from '../../../src/component/wrapper/AmChart.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Colors.view.PieChartComponent
|
5
|
-
* @extends Neo.component.wrapper.AmChart
|
6
|
-
*/
|
7
|
-
class PieChartComponent extends AmChartComponent {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Colors.view.PieChartComponent'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'Colors.view.PieChartComponent',
|
14
|
-
/**
|
15
|
-
* @member {String[]} baseCls=['colors-pie-chart']
|
16
|
-
*/
|
17
|
-
baseCls: ['colors-pie-chart'],
|
18
|
-
/**
|
19
|
-
* @member {String} chartType='PieChart'
|
20
|
-
*/
|
21
|
-
chartType: 'PieChart',
|
22
|
-
/**
|
23
|
-
* @member {Object} _vdom
|
24
|
-
*/
|
25
|
-
/**
|
26
|
-
* @member {Object} chartConfig
|
27
|
-
*/
|
28
|
-
chartConfig: {
|
29
|
-
series: [{
|
30
|
-
type: 'PieSeries',
|
31
|
-
|
32
|
-
colors: {
|
33
|
-
list: [
|
34
|
-
'#247acb',
|
35
|
-
'#4493de',
|
36
|
-
'#6face6',
|
37
|
-
'#9bc5ed',
|
38
|
-
'#c6def5'
|
39
|
-
]
|
40
|
-
},
|
41
|
-
|
42
|
-
dataFields: {
|
43
|
-
category: 'color',
|
44
|
-
value : 'count'
|
45
|
-
}
|
46
|
-
}]
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
Neo.setupClass(PieChartComponent);
|
52
|
-
|
53
|
-
export default PieChartComponent;
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import Container from '../../../src/table/Container.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Colors.view.TableContainer
|
5
|
-
* @extends Neo.table.Container
|
6
|
-
*/
|
7
|
-
class TableContainer extends Container {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Colors.view.TableContainer'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'Colors.view.TableContainer',
|
14
|
-
/**
|
15
|
-
* @member {String[]} cls=['colors-table-container']
|
16
|
-
*/
|
17
|
-
cls: ['colors-table-container'],
|
18
|
-
/**
|
19
|
-
* @member {Object} columnDefaults
|
20
|
-
*/
|
21
|
-
columnDefaults: {
|
22
|
-
renderer(data) {
|
23
|
-
return {cls: ['color-' + data.value], html: ' '}
|
24
|
-
}
|
25
|
-
},
|
26
|
-
/**
|
27
|
-
* @member {Object[]} columns
|
28
|
-
*/
|
29
|
-
columns: [{
|
30
|
-
cls : ['neo-index-column', 'neo-table-header-button'],
|
31
|
-
dataField: 'index',
|
32
|
-
dock : 'left',
|
33
|
-
minWidth : 40,
|
34
|
-
text : '#',
|
35
|
-
renderer : data => ({cls : ['neo-index-column', 'neo-table-cell'], html: data.index + 1}),
|
36
|
-
width : 40
|
37
|
-
}, {
|
38
|
-
dataField: 'columnA',
|
39
|
-
text : 'A'
|
40
|
-
}, {
|
41
|
-
dataField: 'columnB',
|
42
|
-
text : 'B'
|
43
|
-
}, {
|
44
|
-
dataField: 'columnC',
|
45
|
-
text : 'C'
|
46
|
-
}, {
|
47
|
-
dataField: 'columnD',
|
48
|
-
text : 'D'
|
49
|
-
}, {
|
50
|
-
dataField: 'columnE',
|
51
|
-
text : 'E'
|
52
|
-
}, {
|
53
|
-
dataField: 'columnF',
|
54
|
-
text : 'F'
|
55
|
-
}, {
|
56
|
-
dataField: 'columnG',
|
57
|
-
text : 'G'
|
58
|
-
}, {
|
59
|
-
dataField: 'columnH',
|
60
|
-
text : 'H'
|
61
|
-
}, {
|
62
|
-
dataField: 'columnI',
|
63
|
-
text : 'I'
|
64
|
-
}, {
|
65
|
-
dataField: 'columnJ',
|
66
|
-
text : 'J'
|
67
|
-
}]
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
Neo.setupClass(TableContainer);
|
72
|
-
|
73
|
-
export default TableContainer;
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import BaseViewport from '../../../src/container/Viewport.mjs';
|
2
|
-
import BarChartComponent from './BarChartComponent.mjs';
|
3
|
-
import PieChartComponent from './PieChartComponent.mjs';
|
4
|
-
import TableContainer from './TableContainer.mjs';
|
5
|
-
import Toolbar from '../../../src/toolbar/Base.mjs';
|
6
|
-
import ViewportController from './ViewportController.mjs';
|
7
|
-
import ViewportModel from './ViewportModel.mjs';
|
8
|
-
|
9
|
-
/**
|
10
|
-
* @class Colors.view.Viewport
|
11
|
-
* @extends Neo.container.Viewport
|
12
|
-
*/
|
13
|
-
class Viewport extends BaseViewport {
|
14
|
-
static config = {
|
15
|
-
/**
|
16
|
-
* @member {String} className='Colors.view.Viewport'
|
17
|
-
* @protected
|
18
|
-
*/
|
19
|
-
className: 'Colors.view.Viewport',
|
20
|
-
/**
|
21
|
-
* @member {String[]} cls=['colors-viewport']
|
22
|
-
*/
|
23
|
-
cls: ['colors-viewport'],
|
24
|
-
/**
|
25
|
-
* @member {Neo.controller.Component} controller=ViewportController
|
26
|
-
*/
|
27
|
-
controller: ViewportController,
|
28
|
-
/**
|
29
|
-
* @member {Object} layout
|
30
|
-
*/
|
31
|
-
layout: {ntype: 'vbox', align: 'stretch'},
|
32
|
-
/**
|
33
|
-
* @member {Object[]} items
|
34
|
-
*/
|
35
|
-
items: [{
|
36
|
-
module: Toolbar,
|
37
|
-
cls : ['portal-header-toolbar'],
|
38
|
-
flex : 'none',
|
39
|
-
|
40
|
-
items: [{
|
41
|
-
handler: 'onStartButtonClick',
|
42
|
-
text : 'Start'
|
43
|
-
}, {
|
44
|
-
handler: 'onStopButtonClick',
|
45
|
-
text : 'Stop'
|
46
|
-
}, '->', {
|
47
|
-
handler : 'onDetachTableButtonClick',
|
48
|
-
iconCls : 'far fa-window-maximize',
|
49
|
-
reference: 'detach-table-button',
|
50
|
-
text : 'Table'
|
51
|
-
}, {
|
52
|
-
handler : 'onDetachPieChartButtonClick',
|
53
|
-
iconCls : 'far fa-window-maximize',
|
54
|
-
reference: 'detach-pie-chart-button',
|
55
|
-
text : 'Pie Chart'
|
56
|
-
}, {
|
57
|
-
handler : 'onDetachBarChartButtonClick',
|
58
|
-
iconCls : 'far fa-window-maximize',
|
59
|
-
reference: 'detach-bar-chart-button',
|
60
|
-
text : 'Bar Chart'
|
61
|
-
}]
|
62
|
-
}, {
|
63
|
-
module : TableContainer,
|
64
|
-
bind : {store: 'stores.colors'},
|
65
|
-
height : 300,
|
66
|
-
reference: 'table'
|
67
|
-
}, {
|
68
|
-
module : PieChartComponent,
|
69
|
-
reference: 'pie-chart'
|
70
|
-
}, {
|
71
|
-
module : BarChartComponent,
|
72
|
-
reference: 'bar-chart'
|
73
|
-
}],
|
74
|
-
/**
|
75
|
-
* @member {Neo.model.Component} model=ViewportModel
|
76
|
-
*/
|
77
|
-
model: ViewportModel
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
Neo.setupClass(Viewport);
|
82
|
-
|
83
|
-
export default Viewport;
|
@@ -1,268 +0,0 @@
|
|
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 createPopupWindow(name) {
|
37
|
-
let me = this,
|
38
|
-
widget = me.getReference(name),
|
39
|
-
winData = await Neo.Main.getWindowData(),
|
40
|
-
rect = await me.component.getDomRect(widget.vdom.id), // using the vdom id to always get the top-level node
|
41
|
-
{height, left, top, width} = rect;
|
42
|
-
|
43
|
-
height -= 50; // popup header in Chrome
|
44
|
-
left += winData.screenLeft;
|
45
|
-
top += (winData.outerHeight - winData.innerHeight + winData.screenTop);
|
46
|
-
|
47
|
-
Neo.Main.windowOpen({
|
48
|
-
url : `./childapps/widget/index.html?name=${name}`,
|
49
|
-
windowFeatures: `height=${height},left=${left},top=${top},width=${width}`,
|
50
|
-
windowName : name
|
51
|
-
})
|
52
|
-
}
|
53
|
-
|
54
|
-
/**
|
55
|
-
* @returns {Object[]}
|
56
|
-
*/
|
57
|
-
generateData() {
|
58
|
-
let me = this,
|
59
|
-
data = [],
|
60
|
-
i = 0,
|
61
|
-
len = 20;
|
62
|
-
|
63
|
-
for (; i < len; i++) {
|
64
|
-
data.push({
|
65
|
-
id : `row${i + 1}`,
|
66
|
-
columnA: me.getRandomInteger(),
|
67
|
-
columnB: me.getRandomInteger(),
|
68
|
-
columnC: me.getRandomInteger(),
|
69
|
-
columnD: me.getRandomInteger(),
|
70
|
-
columnE: me.getRandomInteger(),
|
71
|
-
columnF: me.getRandomInteger(),
|
72
|
-
columnG: me.getRandomInteger(),
|
73
|
-
columnH: me.getRandomInteger(),
|
74
|
-
columnI: me.getRandomInteger(),
|
75
|
-
columnJ: me.getRandomInteger()
|
76
|
-
})
|
77
|
-
}
|
78
|
-
|
79
|
-
return data
|
80
|
-
}
|
81
|
-
|
82
|
-
/**
|
83
|
-
* @returns {Number}
|
84
|
-
*/
|
85
|
-
getRandomInteger() {
|
86
|
-
return Math.floor(Math.random() * 5) + 1
|
87
|
-
}
|
88
|
-
|
89
|
-
/**
|
90
|
-
* @param {Object} data
|
91
|
-
* @param {String} data.appName
|
92
|
-
* @param {Number} data.windowId
|
93
|
-
*/
|
94
|
-
async onAppConnect(data) {
|
95
|
-
if (data.appName !== 'Colors') {
|
96
|
-
let me = this,
|
97
|
-
app = Neo.apps[data.appName],
|
98
|
-
mainView = app.mainView,
|
99
|
-
{windowId} = data,
|
100
|
-
url = await Neo.Main.getByPath({path: 'document.URL', windowId}),
|
101
|
-
widgetName = new URL(url).searchParams.get('name'),
|
102
|
-
widget = me.getReference(widgetName),
|
103
|
-
widgetParent = widget.up();
|
104
|
-
|
105
|
-
me.connectedApps.push(widgetName);
|
106
|
-
|
107
|
-
widgetParent.remove(widget, false);
|
108
|
-
mainView.add(widget)
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
/**
|
113
|
-
* @param {Object} data
|
114
|
-
* @param {String} data.appName
|
115
|
-
* @param {Number} data.windowId
|
116
|
-
*/
|
117
|
-
async onAppDisconnect(data) {
|
118
|
-
let me = this,
|
119
|
-
{appName, windowId} = data,
|
120
|
-
url = await Neo.Main.getByPath({path: 'document.URL', windowId}),
|
121
|
-
widgetName = new URL(url).searchParams.get('name'),
|
122
|
-
widget = me.getReference(widgetName),
|
123
|
-
widgetParent = widget.up();
|
124
|
-
|
125
|
-
// Closing a code preview window needs to drop the preview back into the related main app
|
126
|
-
if (appName !== 'Colors') {
|
127
|
-
widgetParent.remove(widget, false);
|
128
|
-
me.component.insert(me.widgetIndexMap[widgetName], widget);
|
129
|
-
|
130
|
-
me.getReference(`detach-${widgetName}-button`).disabled = false
|
131
|
-
}
|
132
|
-
// Close popup windows when closing or reloading the main window
|
133
|
-
else {
|
134
|
-
Neo.Main.windowClose({names: me.connectedApps, windowId})
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
/**
|
139
|
-
*
|
140
|
-
*/
|
141
|
-
onConstructed() {
|
142
|
-
super.onConstructed();
|
143
|
-
|
144
|
-
let me = this;
|
145
|
-
|
146
|
-
Neo.currentWorker.on({
|
147
|
-
connect : me.onAppConnect,
|
148
|
-
disconnect: me.onAppDisconnect,
|
149
|
-
scope : me
|
150
|
-
})
|
151
|
-
}
|
152
|
-
|
153
|
-
/**
|
154
|
-
*
|
155
|
-
*/
|
156
|
-
onComponentConstructed() {
|
157
|
-
super.onComponentConstructed();
|
158
|
-
|
159
|
-
let me = this,
|
160
|
-
data = me.generateData();
|
161
|
-
|
162
|
-
me.getStore('colors').data = data;
|
163
|
-
me.updateCharts(data)
|
164
|
-
}
|
165
|
-
|
166
|
-
/**
|
167
|
-
* @param {Object} data
|
168
|
-
*/
|
169
|
-
async onDetachBarChartButtonClick(data) {
|
170
|
-
data.component.disabled = true;
|
171
|
-
await this.createPopupWindow('bar-chart')
|
172
|
-
}
|
173
|
-
|
174
|
-
/**
|
175
|
-
* @param {Object} data
|
176
|
-
*/
|
177
|
-
async onDetachPieChartButtonClick(data) {
|
178
|
-
data.component.disabled = true;
|
179
|
-
await this.createPopupWindow('pie-chart')
|
180
|
-
}
|
181
|
-
|
182
|
-
/**
|
183
|
-
* @param {Object} data
|
184
|
-
*/
|
185
|
-
async onDetachTableButtonClick(data) {
|
186
|
-
data.component.disabled = true;
|
187
|
-
await this.createPopupWindow('table')
|
188
|
-
}
|
189
|
-
|
190
|
-
/**
|
191
|
-
* @param {Object} data
|
192
|
-
*/
|
193
|
-
onStopButtonClick(data) {
|
194
|
-
let me = this;
|
195
|
-
|
196
|
-
if (me.intervalId) {
|
197
|
-
clearInterval(me.intervalId);
|
198
|
-
me.intervalId = null
|
199
|
-
}
|
200
|
-
}
|
201
|
-
|
202
|
-
/**
|
203
|
-
* @param {Object} data
|
204
|
-
*/
|
205
|
-
onStartButtonClick(data) {
|
206
|
-
let me = this,
|
207
|
-
intervalTime = 1000 / 60, // assuming 60 FPS
|
208
|
-
store = me.getStore('colors'),
|
209
|
-
table = me.getReference('table'),
|
210
|
-
tableView = table.view;
|
211
|
-
|
212
|
-
if (!me.intervalId) {
|
213
|
-
me.intervalId = setInterval(() => {
|
214
|
-
let data = me.generateData();
|
215
|
-
|
216
|
-
tableView.silentVdomUpdate = true;
|
217
|
-
|
218
|
-
store.items.forEach((record, index) => {
|
219
|
-
record.set(data[index])
|
220
|
-
});
|
221
|
-
|
222
|
-
tableView.silentVdomUpdate = false;
|
223
|
-
|
224
|
-
tableView.update();
|
225
|
-
|
226
|
-
me.updateCharts(data)
|
227
|
-
}, intervalTime);
|
228
|
-
}
|
229
|
-
}
|
230
|
-
|
231
|
-
/**
|
232
|
-
* @param {Object} data
|
233
|
-
*/
|
234
|
-
updateCharts(data) {
|
235
|
-
let startCharCode = 'A'.charCodeAt(0),
|
236
|
-
colorSummary = {
|
237
|
-
colorA: 0,
|
238
|
-
colorB: 0,
|
239
|
-
colorC: 0,
|
240
|
-
colorD: 0,
|
241
|
-
colorE: 0
|
242
|
-
},
|
243
|
-
chartData;
|
244
|
-
|
245
|
-
data.forEach(item => {
|
246
|
-
Object.entries(item).forEach(([key, value]) => {
|
247
|
-
if (key !== 'id') {
|
248
|
-
colorSummary['color' + String.fromCharCode(startCharCode + value - 1)]++
|
249
|
-
}
|
250
|
-
})
|
251
|
-
});
|
252
|
-
|
253
|
-
chartData = [
|
254
|
-
{color: '#247acb', count: colorSummary['colorA']},
|
255
|
-
{color: '#4493de', count: colorSummary['colorB']},
|
256
|
-
{color: '#6face6', count: colorSummary['colorC']},
|
257
|
-
{color: '#9bc5ed', count: colorSummary['colorD']},
|
258
|
-
{color: '#c6def5', count: colorSummary['colorE']}
|
259
|
-
];
|
260
|
-
|
261
|
-
this.getReference('bar-chart').chartData = chartData;
|
262
|
-
this.getReference('pie-chart').chartData = chartData
|
263
|
-
}
|
264
|
-
}
|
265
|
-
|
266
|
-
Neo.setupClass(ViewportController);
|
267
|
-
|
268
|
-
export default ViewportController;
|
@@ -1,32 +0,0 @@
|
|
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 {Object} stores
|
21
|
-
*/
|
22
|
-
stores: {
|
23
|
-
colors: {
|
24
|
-
module: ColorsStore
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
Neo.setupClass(ViewportModel);
|
31
|
-
|
32
|
-
export default ViewportModel;
|
@@ -1,44 +0,0 @@
|
|
1
|
-
$base-color: #1c60a0;
|
2
|
-
|
3
|
-
.colors-table-container.neo-table-container {
|
4
|
-
width: 100%;
|
5
|
-
|
6
|
-
.color-1 {
|
7
|
-
background-color: lighten($base-color, 10%);
|
8
|
-
}
|
9
|
-
|
10
|
-
.color-2 {
|
11
|
-
background-color: lighten($base-color, 20%);
|
12
|
-
}
|
13
|
-
|
14
|
-
.color-3 {
|
15
|
-
background-color: lighten($base-color, 30%);
|
16
|
-
}
|
17
|
-
|
18
|
-
.color-4 {
|
19
|
-
background-color: lighten($base-color, 40%);
|
20
|
-
}
|
21
|
-
|
22
|
-
.color-5 {
|
23
|
-
background-color: lighten($base-color, 50%);
|
24
|
-
}
|
25
|
-
|
26
|
-
.neo-index-column {
|
27
|
-
max-width: 40px;
|
28
|
-
min-width: 40px;
|
29
|
-
width : 40px;
|
30
|
-
}
|
31
|
-
|
32
|
-
.neo-table-view {
|
33
|
-
.neo-table-row {
|
34
|
-
&:hover .neo-table-cell {
|
35
|
-
background-color: #d0aa72;
|
36
|
-
color : #2b2b2b;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
td, th {
|
42
|
-
min-width: 10%;
|
43
|
-
}
|
44
|
-
}
|