neo.mjs 7.6.0 → 7.8.0
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 +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/neo-config.json +1 -0
- package/apps/portal/resources/data/examples_devmode.json +20 -21
- package/apps/portal/resources/data/examples_dist_dev.json +19 -20
- package/apps/portal/resources/data/examples_dist_prod.json +19 -20
- package/apps/portal/view/ViewportController.mjs +20 -4
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/{ContentView.mjs → ContentComponent.mjs} +98 -38
- package/apps/portal/view/learn/CubeLayoutButton.mjs +77 -0
- package/apps/portal/view/learn/MainContainerController.mjs +1 -0
- package/apps/portal/view/learn/PageContainer.mjs +4 -4
- package/apps/shareddialog/view/DemoDialog.mjs +2 -10
- package/apps/shareddialog/view/MainContainerController.mjs +137 -126
- package/buildScripts/webpack/json/myApps.template.json +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +3 -3
- package/resources/data/deck/learnneo/pages/Welcome.md +1 -1
- package/resources/data/deck/learnneo/pages/benefits/FormsEngine.md +1 -1
- package/resources/data/deck/learnneo/pages/guides/PortalApp.md +35 -0
- package/resources/data/deck/learnneo/tree.json +1 -0
- package/resources/scss/src/apps/colors/TableContainer.scss +11 -9
- package/resources/scss/src/apps/portal/blog/List.scss +1 -0
- package/resources/scss/src/apps/portal/examples/List.scss +1 -0
- package/resources/scss/src/apps/portal/services/Component.scss +7 -8
- package/resources/scss/theme-dark/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-dark/button/Base.scss +3 -1
- package/resources/scss/theme-dark/list/Base.scss +3 -1
- package/resources/scss/theme-dark/table/header/Button.scss +3 -1
- package/resources/scss/theme-dark/tree/List.scss +3 -1
- package/resources/scss/theme-light/apps/covid/HeaderContainer.scss +6 -4
- package/resources/scss/theme-light/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-light/button/Base.scss +3 -1
- package/resources/scss/theme-light/grid/View.scss +8 -6
- package/resources/scss/theme-light/list/Base.scss +6 -4
- package/resources/scss/theme-light/table/View.scss +8 -6
- package/resources/scss/theme-light/table/header/Button.scss +3 -1
- package/resources/scss/theme-neo-light/apps/covid/HeaderContainer.scss +6 -4
- package/resources/scss/theme-neo-light/apps/docs/classdetails/MembersList.scss +3 -1
- package/resources/scss/theme-neo-light/design-tokens/Core.scss +11 -9
- package/resources/scss/theme-neo-light/grid/View.scss +8 -6
- package/resources/scss/theme-neo-light/table/View.scss +8 -6
- package/resources/scss/theme-neo-light/table/header/Button.scss +3 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/collection/Base.mjs +4 -3
- package/src/container/Base.mjs +12 -7
- package/src/draggable/DragProxyComponent.mjs +10 -20
- package/src/main/addon/Navigator.mjs +34 -32
- package/src/main/addon/WindowPosition.mjs +13 -15
- package/src/plugin/Resizable.mjs +20 -11
- package/src/tab/Container.mjs +5 -1
- package/src/table/View.mjs +2 -2
- package/test/siesta/siesta.js +1 -0
- package/test/siesta/tests/ManagerInstance.mjs +35 -0
- package/apps/krausest/README.md +0 -3
- package/apps/krausest/TableCollection.mjs +0 -46
- package/apps/krausest/app.mjs +0 -8
- package/apps/krausest/css/currentStyle.css +0 -2
- package/apps/krausest/css/main.css +0 -26
- package/apps/krausest/index.html +0 -12
- package/apps/krausest/neo-config.json +0 -10
- package/apps/krausest/view/MainComponent.mjs +0 -122
- package/apps/krausest/view/MainComponentController.mjs +0 -33
- package/apps/krausest/view/TableComponent.mjs +0 -152
- /package/resources/scss/src/apps/portal/learn/{ContentView.scss → ContentComponent.scss} +0 -0
@@ -440,40 +440,42 @@ class Navigator extends Base {
|
|
440
440
|
subject = data.subject = DomAccess.getElement(data.id),
|
441
441
|
eventSource = data.eventSource = data.eventSource ? DomAccess.getElement(data.eventSource) : subject;
|
442
442
|
|
443
|
-
subject
|
443
|
+
if (subject) {
|
444
|
+
subject.$navigator = data;
|
444
445
|
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
// Ensure that only *one* of the child focusables is actually tabbable.
|
450
|
-
// We use arrow keys for internal navigation. TAB must move out.
|
451
|
-
me.fixItemFocusability(data);
|
452
|
-
|
453
|
-
// Finds a focusable item starting from a descendant el within one of our selector items
|
454
|
-
data.findFocusable = el => DomUtils.closest(el, el =>
|
455
|
-
// We're looking for an element that is focusable
|
456
|
-
DomUtils.isFocusable(el) &&
|
457
|
-
// And within our subject element
|
458
|
-
(subject.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_CONTAINED_BY) &&
|
459
|
-
// And within an element that matches our selector
|
460
|
-
el.closest(data.selector)
|
461
|
-
);
|
462
|
-
|
463
|
-
// TreeWalker so that we can easily move between navigable elements within the target.
|
464
|
-
data.treeWalker = document.createTreeWalker(subject, NodeFilter.SHOW_ELEMENT, node => me.navigateNodeFilter(node, data));
|
465
|
-
|
466
|
-
// We have to know when the DOM mutates in case the active item is removed.
|
467
|
-
(data.targetMutationMonitor = new MutationObserver(e => me.navigateTargetChildListChange(e, data))).observe(subject, {
|
468
|
-
childList : true,
|
469
|
-
subtree : true
|
470
|
-
});
|
446
|
+
if (!data.activeCls) {
|
447
|
+
data.activeCls = 'neo-navigator-active-item'
|
448
|
+
}
|
471
449
|
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
450
|
+
// Ensure that only *one* of the child focusables is actually tabbable.
|
451
|
+
// We use arrow keys for internal navigation. TAB must move out.
|
452
|
+
me.fixItemFocusability(data);
|
453
|
+
|
454
|
+
// Finds a focusable item starting from a descendant el within one of our selector items
|
455
|
+
data.findFocusable = el => DomUtils.closest(el, el =>
|
456
|
+
// We're looking for an element that is focusable
|
457
|
+
DomUtils.isFocusable(el) &&
|
458
|
+
// And within our subject element
|
459
|
+
(subject.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_CONTAINED_BY) &&
|
460
|
+
// And within an element that matches our selector
|
461
|
+
el.closest(data.selector)
|
462
|
+
);
|
463
|
+
|
464
|
+
// TreeWalker so that we can easily move between navigable elements within the target.
|
465
|
+
data.treeWalker = document.createTreeWalker(subject, NodeFilter.SHOW_ELEMENT, node => me.navigateNodeFilter(node, data));
|
466
|
+
|
467
|
+
// We have to know when the DOM mutates in case the active item is removed.
|
468
|
+
(data.targetMutationMonitor = new MutationObserver(e => me.navigateTargetChildListChange(e, data))).observe(subject, {
|
469
|
+
childList : true,
|
470
|
+
subtree : true
|
471
|
+
});
|
472
|
+
|
473
|
+
eventSource.addEventListener('keydown', data.l1 = e => me.navigateKeyDownHandler(e, data));
|
474
|
+
subject.addEventListener('mousedown', data.l2 = e => me.navigateMouseDownHandler(e, data));
|
475
|
+
subject.addEventListener('click', data.l3 = e => me.navigateClickHandler(e, data));
|
476
|
+
subject.addEventListener('focusin', data.l4 = e => me.navigateFocusInHandler(e, data));
|
477
|
+
subject.addEventListener('focusout', data.l5 = e => me.navigateFocusOutHandler(e, data))
|
478
|
+
}
|
477
479
|
}
|
478
480
|
|
479
481
|
/**
|
@@ -67,13 +67,13 @@ class WindowPosition extends Base {
|
|
67
67
|
construct(config) {
|
68
68
|
super.construct(config);
|
69
69
|
|
70
|
-
let me
|
71
|
-
|
70
|
+
let me = this,
|
71
|
+
{screenLeft, screenTop} = window;
|
72
72
|
|
73
|
-
me.screenLeft =
|
74
|
-
me.screenTop =
|
73
|
+
me.screenLeft = screenLeft;
|
74
|
+
me.screenTop = screenTop;
|
75
75
|
|
76
|
-
|
76
|
+
window.addEventListener('mouseout', me.onMouseOut.bind(me))
|
77
77
|
}
|
78
78
|
|
79
79
|
/**
|
@@ -96,15 +96,13 @@ class WindowPosition extends Base {
|
|
96
96
|
*
|
97
97
|
*/
|
98
98
|
adjustPositions() {
|
99
|
-
let position;
|
100
|
-
|
101
99
|
Object.entries(this.windows).forEach(([key, value]) => {
|
102
|
-
|
100
|
+
let {left, top} = this.getPosition(value);
|
103
101
|
|
104
102
|
Neo.Main.windowMoveTo({
|
105
103
|
windowName: key,
|
106
|
-
x :
|
107
|
-
y :
|
104
|
+
x : left,
|
105
|
+
y : top
|
108
106
|
})
|
109
107
|
})
|
110
108
|
}
|
@@ -161,19 +159,19 @@ class WindowPosition extends Base {
|
|
161
159
|
switch(data.dock) {
|
162
160
|
case 'bottom':
|
163
161
|
left = screenLeft;
|
164
|
-
top = win.outerHeight + screenTop -
|
162
|
+
top = win.outerHeight + screenTop - 62;
|
165
163
|
break
|
166
164
|
case 'left':
|
167
165
|
left = screenLeft - size;
|
168
|
-
top = screenTop +
|
166
|
+
top = screenTop + 24;
|
169
167
|
break
|
170
168
|
case 'right':
|
171
169
|
left = win.outerWidth + screenLeft;
|
172
|
-
top = screenTop +
|
170
|
+
top = screenTop + 24;
|
173
171
|
break
|
174
172
|
case 'top':
|
175
173
|
left = screenLeft;
|
176
|
-
top = screenTop - size +
|
174
|
+
top = screenTop - size + 86;
|
177
175
|
break
|
178
176
|
}
|
179
177
|
|
@@ -199,7 +197,7 @@ class WindowPosition extends Base {
|
|
199
197
|
/**
|
200
198
|
* @param {Object} event
|
201
199
|
*/
|
202
|
-
onResize(event) {
|
200
|
+
onResize(event) {
|
203
201
|
let me = this,
|
204
202
|
win = window,
|
205
203
|
height, width;
|
package/src/plugin/Resizable.mjs
CHANGED
@@ -246,7 +246,7 @@ class Resizable extends Base {
|
|
246
246
|
afterSetWindowId(value, oldValue) {
|
247
247
|
let me = this;
|
248
248
|
|
249
|
-
value && Neo.currentWorker.insertThemeFiles(value, me.__proto__)
|
249
|
+
value && Neo.currentWorker.insertThemeFiles(value, me.__proto__);
|
250
250
|
|
251
251
|
if (me.dragZone) {
|
252
252
|
me.dragZone.windowId = value
|
@@ -279,8 +279,9 @@ class Resizable extends Base {
|
|
279
279
|
* @param {Object} data
|
280
280
|
*/
|
281
281
|
onDragEnd(data) {
|
282
|
-
let me
|
283
|
-
|
282
|
+
let me = this,
|
283
|
+
{owner} = me,
|
284
|
+
style = owner.wrapperStyle; // todo: delegation target
|
284
285
|
|
285
286
|
Object.assign(me, {
|
286
287
|
boundaryContainerRect: null,
|
@@ -294,12 +295,14 @@ class Resizable extends Base {
|
|
294
295
|
...me.dragZone.dragProxy.wrapperStyle
|
295
296
|
});
|
296
297
|
|
297
|
-
|
298
|
+
owner.wrapperStyle = style;
|
298
299
|
|
299
300
|
me.removeBodyCursorCls();
|
300
301
|
|
301
302
|
me.dragZone.dragEnd();
|
302
|
-
me.removeAllNodes()
|
303
|
+
me.removeAllNodes();
|
304
|
+
|
305
|
+
owner.focus(owner.id, true)
|
303
306
|
}
|
304
307
|
|
305
308
|
/**
|
@@ -386,12 +389,12 @@ class Resizable extends Base {
|
|
386
389
|
* @param {Object} data
|
387
390
|
*/
|
388
391
|
onDragStart(data) {
|
389
|
-
let me
|
390
|
-
containerId
|
391
|
-
i
|
392
|
-
len
|
393
|
-
{appName, owner} = me,
|
394
|
-
style
|
392
|
+
let me = this,
|
393
|
+
containerId = me.boundaryContainerId,
|
394
|
+
i = 0,
|
395
|
+
len = data.path.length,
|
396
|
+
{appName, owner, windowId} = me,
|
397
|
+
style = owner.wrapperStyle, // todo: delegation target
|
395
398
|
target, vdom, vdomStyle;
|
396
399
|
|
397
400
|
me.isDragging = true;
|
@@ -426,11 +429,16 @@ class Resizable extends Base {
|
|
426
429
|
vdom = Neo.clone(owner.vdom, true);
|
427
430
|
vdomStyle = vdom.style;
|
428
431
|
|
432
|
+
delete vdom.height;
|
433
|
+
delete vdom.width;
|
434
|
+
|
429
435
|
delete vdomStyle.height;
|
430
436
|
delete vdomStyle.left;
|
431
437
|
delete vdomStyle.top;
|
432
438
|
delete vdomStyle.width;
|
433
439
|
|
440
|
+
vdomStyle.opacity = 0.7;
|
441
|
+
|
434
442
|
me.dragZone = Neo.create({
|
435
443
|
module : DragZone,
|
436
444
|
appName,
|
@@ -438,6 +446,7 @@ class Resizable extends Base {
|
|
438
446
|
dragElement : vdom,
|
439
447
|
moveInMainThread : false,
|
440
448
|
owner,
|
449
|
+
windowId,
|
441
450
|
...me.dragZoneConfig
|
442
451
|
})
|
443
452
|
} else {
|
package/src/tab/Container.mjs
CHANGED
@@ -57,6 +57,10 @@ class Container extends BaseContainer {
|
|
57
57
|
* @member {Object|null} headerToolbarDefaults=null
|
58
58
|
*/
|
59
59
|
headerToolbarDefaults: null,
|
60
|
+
/**
|
61
|
+
* @member {Object|null} layout=null
|
62
|
+
*/
|
63
|
+
layout: null,
|
60
64
|
/**
|
61
65
|
* True to not apply a background effect to the tab header container
|
62
66
|
* @member {Boolean} plain_=true
|
@@ -514,7 +518,7 @@ class Container extends BaseContainer {
|
|
514
518
|
*
|
515
519
|
*/
|
516
520
|
onConstructed() {
|
517
|
-
this.
|
521
|
+
this.layout = this.getLayoutConfig(); // silent update
|
518
522
|
super.onConstructed()
|
519
523
|
}
|
520
524
|
|
package/src/table/View.mjs
CHANGED
@@ -277,7 +277,7 @@ class View extends Component {
|
|
277
277
|
dataField = me.getCellDataField(id),
|
278
278
|
record = me.getRecord(id);
|
279
279
|
|
280
|
-
me.parent.fire(eventName, {
|
280
|
+
me.parent.fire(eventName, {data, dataField, record, view: me})
|
281
281
|
}
|
282
282
|
|
283
283
|
/**
|
@@ -289,7 +289,7 @@ class View extends Component {
|
|
289
289
|
id = data.currentTarget,
|
290
290
|
record = me.getRecord(id);
|
291
291
|
|
292
|
-
me.parent.fire(eventName, {
|
292
|
+
me.parent.fire(eventName, {data, record, view: me})
|
293
293
|
}
|
294
294
|
|
295
295
|
/**
|
package/test/siesta/siesta.js
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
import Neo from '../../../src/Neo.mjs';
|
2
|
+
import * as core from '../../../src/core/_export.mjs';
|
3
|
+
import InstanceManager from '../../../src/manager/Instance.mjs';
|
4
|
+
|
5
|
+
let startCount;
|
6
|
+
|
7
|
+
StartTest(t => {
|
8
|
+
t.it('Module imports', t => {
|
9
|
+
t.ok(Neo, 'Neo is imported as a JS module');
|
10
|
+
t.ok(InstanceManager, 'InstanceManager is imported as a JS module');
|
11
|
+
});
|
12
|
+
|
13
|
+
t.it('Adding & removing items', t => {
|
14
|
+
startCount = InstanceManager.getCount();
|
15
|
+
|
16
|
+
t.diag("Create 3 Neo instances");
|
17
|
+
|
18
|
+
const
|
19
|
+
item1 = Neo.create('Neo.core.Base'),
|
20
|
+
item2 = Neo.create('Neo.core.Base'),
|
21
|
+
item3 = Neo.create('Neo.core.Base');
|
22
|
+
|
23
|
+
t.is(InstanceManager.getCount() - startCount, 3, '3 instances got added');
|
24
|
+
|
25
|
+
t.is(InstanceManager.findFirst(item2), item2, 'Found item via reference');
|
26
|
+
|
27
|
+
t.is(InstanceManager.findFirst({id: item3.id}), item3, 'Found item via id');
|
28
|
+
|
29
|
+
item1.destroy();
|
30
|
+
item2.destroy();
|
31
|
+
item3.destroy()
|
32
|
+
|
33
|
+
t.is(InstanceManager.getCount(), startCount, '3 instances got removed');
|
34
|
+
});
|
35
|
+
});
|
package/apps/krausest/README.md
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
import BaseCollection from '../../src/collection/Base.mjs';
|
2
|
-
|
3
|
-
function _random(max) {
|
4
|
-
return Math.round(Math.random()*1000)%max;
|
5
|
-
}
|
6
|
-
|
7
|
-
/**
|
8
|
-
* @class NeoApp.TableCollection
|
9
|
-
* @extends Neo.collection.Base
|
10
|
-
*/
|
11
|
-
class TableCollection extends BaseCollection {
|
12
|
-
static config = {
|
13
|
-
/**
|
14
|
-
* @member {String} className='NeoApp.TableCollection'
|
15
|
-
* @protected
|
16
|
-
*/
|
17
|
-
className: 'NeoApp.TableCollection',
|
18
|
-
/**
|
19
|
-
* @member {Number} idCounter=1
|
20
|
-
*/
|
21
|
-
idCounter: 1
|
22
|
-
}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* @param {Number} count
|
26
|
-
* @returns {Object[]}
|
27
|
-
*/
|
28
|
-
buildData(count=1000) {
|
29
|
-
let adjectives = ['pretty', 'large', 'big', 'small', 'tall', 'short', 'long', 'handsome', 'plain', 'quaint', 'clean', 'elegant', 'easy', 'angry', 'crazy', 'helpful', 'mushy', 'odd', 'unsightly', 'adorable', 'important', 'inexpensive', 'cheap', 'expensive', 'fancy'],
|
30
|
-
colours = ['red', 'yellow', 'blue', 'green', 'pink', 'brown', 'purple', 'brown', 'white', 'black', 'orange'],
|
31
|
-
nouns = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie', 'sandwich', 'burger', 'pizza', 'mouse', 'keyboard'],
|
32
|
-
data = [],
|
33
|
-
i = 0;
|
34
|
-
|
35
|
-
for (; i < count; i++) {
|
36
|
-
data.push({
|
37
|
-
id : this.idCounter++,
|
38
|
-
label: adjectives[_random(adjectives.length)] + ' ' + colours[_random(colours.length)] + ' ' + nouns[_random(nouns.length)]
|
39
|
-
});
|
40
|
-
}
|
41
|
-
|
42
|
-
return data;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
export default Neo.setupClass(TableCollection);;
|
package/apps/krausest/app.mjs
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
padding: 10px 0 0 0;
|
3
|
-
margin: 0;
|
4
|
-
overflow-y: scroll;
|
5
|
-
}
|
6
|
-
#duration {
|
7
|
-
padding-top: 0px;
|
8
|
-
}
|
9
|
-
.jumbotron {
|
10
|
-
padding-top:10px;
|
11
|
-
padding-bottom:10px;
|
12
|
-
}
|
13
|
-
.test-data a {
|
14
|
-
display: block;
|
15
|
-
}
|
16
|
-
.preloadicon {
|
17
|
-
position: absolute;
|
18
|
-
top:-20px;
|
19
|
-
left:-20px;
|
20
|
-
}
|
21
|
-
.col-sm-6.smallpad {
|
22
|
-
padding: 5px;
|
23
|
-
}
|
24
|
-
.jumbotron .row h1 {
|
25
|
-
font-size: 40px;
|
26
|
-
}
|
package/apps/krausest/index.html
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8"/>
|
5
|
-
<title>neo.mjs-"keyed"</title>
|
6
|
-
<link href="./css/currentStyle.css" rel="stylesheet"/>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<div id="main"></div>
|
10
|
-
<script src="../../src/MicroLoader.mjs" type="module"></script>
|
11
|
-
</body>
|
12
|
-
</html>
|
@@ -1,122 +0,0 @@
|
|
1
|
-
import Base from '../../../src/component/Base.mjs';
|
2
|
-
import MainComponentController from './MainComponentController.mjs';
|
3
|
-
import TableComponent from './TableComponent.mjs';
|
4
|
-
import VdomUtil from '../../../src/util/VDom.mjs';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* @class NeoApp.view.MainComponent
|
8
|
-
* @extends Neo.component.Base
|
9
|
-
*/
|
10
|
-
class MainComponent extends Base {
|
11
|
-
static config = {
|
12
|
-
/**
|
13
|
-
* @member {String} className='NeoApp.view.MainComponent'
|
14
|
-
* @protected
|
15
|
-
*/
|
16
|
-
className: 'NeoApp.view.MainComponent',
|
17
|
-
/**
|
18
|
-
* True automatically mounts a component after being rendered.
|
19
|
-
* @member {Boolean} autoMount=true
|
20
|
-
*/
|
21
|
-
autoMount: true,
|
22
|
-
/**
|
23
|
-
* @member {String[]} baseCls=['container']
|
24
|
-
*/
|
25
|
-
baseCls: ['container'],
|
26
|
-
/**
|
27
|
-
* @member {Neo.controller.Component} controller=MainComponentController
|
28
|
-
*/
|
29
|
-
controller: MainComponentController,
|
30
|
-
/**
|
31
|
-
* @member {Object[]} domListeners
|
32
|
-
* @protected
|
33
|
-
*/
|
34
|
-
domListeners: [{
|
35
|
-
click : 'onButtonClick',
|
36
|
-
delegate: '.btn'
|
37
|
-
}],
|
38
|
-
/**
|
39
|
-
* @member {NeoApp.view.TableComponent|null} table=null
|
40
|
-
*/
|
41
|
-
table: null,
|
42
|
-
/**
|
43
|
-
* @member {Object} _vdom
|
44
|
-
*/
|
45
|
-
_vdom:
|
46
|
-
{cls: ['container'], cn: [
|
47
|
-
{cls: ['jumbotron'], cn: [
|
48
|
-
{cls: ['row'], cn: [
|
49
|
-
{cls: ['col-md-6'], cn: [
|
50
|
-
{cls: ['row'], cn: [
|
51
|
-
{tag: 'h1', html: 'neo.mjs'}
|
52
|
-
]}
|
53
|
-
]},
|
54
|
-
{cls: ['col-md-6'], cn: [
|
55
|
-
{cls: ['row'], flag: 'row', cn: []}
|
56
|
-
]}
|
57
|
-
]}
|
58
|
-
]},
|
59
|
-
{tag: 'span', cls: ['preloadicon', 'glyphicon', 'glyphicon-remove'], 'aria-hidden': true}
|
60
|
-
]}
|
61
|
-
}
|
62
|
-
|
63
|
-
/**
|
64
|
-
* @param {Object} config
|
65
|
-
*/
|
66
|
-
construct(config) {
|
67
|
-
super.construct(config);
|
68
|
-
|
69
|
-
this.createColumns(); // silent vdom update
|
70
|
-
this.createTable();
|
71
|
-
}
|
72
|
-
|
73
|
-
/**
|
74
|
-
*
|
75
|
-
*/
|
76
|
-
createColumns() {
|
77
|
-
let me = this,
|
78
|
-
vdom = me.vdom,
|
79
|
-
row = VdomUtil.getByFlag(vdom, 'row'),
|
80
|
-
i = 0,
|
81
|
-
item,
|
82
|
-
|
83
|
-
map = [
|
84
|
-
{id: 'run', html: 'Create 1,000 rows'},
|
85
|
-
{id: 'runlots', html: 'Create 10,000 rows'},
|
86
|
-
{id: 'add', html: 'Append 1,000 rows'},
|
87
|
-
{id: 'update', html: 'Update every 10th row'},
|
88
|
-
{id: 'clear', html: 'Clear'},
|
89
|
-
{id: 'swaprows', html: 'Swap Rows'}
|
90
|
-
];
|
91
|
-
|
92
|
-
for (; i < 6; i++) {
|
93
|
-
item = map[i];
|
94
|
-
|
95
|
-
row.cn.push(
|
96
|
-
{cls: ['col-sm-6 smallpad'], cn: [
|
97
|
-
{tag: 'button', type: 'button', cls: ['btn', 'btn-primary', 'btn-block'], id: item.id, html: item.html}
|
98
|
-
]}
|
99
|
-
);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
/**
|
104
|
-
*
|
105
|
-
*/
|
106
|
-
createTable() {
|
107
|
-
let me = this;
|
108
|
-
|
109
|
-
me.table = Neo.create({
|
110
|
-
module : TableComponent,
|
111
|
-
appName : me.appName,
|
112
|
-
parentId : me.id,
|
113
|
-
reference: 'table'
|
114
|
-
});
|
115
|
-
|
116
|
-
me.vdom.cn.splice(1, 0, me.table.vdom);
|
117
|
-
|
118
|
-
me.update();
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
export default Neo.setupClass(MainComponent);
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import ComponentController from '../../../src/controller/Component.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class NeoApp.view.MainComponentController
|
5
|
-
* @extends Neo.controller.Component
|
6
|
-
*/
|
7
|
-
class MainComponentController extends ComponentController {
|
8
|
-
static config = {
|
9
|
-
/**
|
10
|
-
* @member {String} className='NeoApp.view.MainComponentController'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'NeoApp.view.MainComponentController'
|
14
|
-
}
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @param {Object} data
|
18
|
-
*/
|
19
|
-
onButtonClick(data) {
|
20
|
-
let me = this,
|
21
|
-
table = me.getReference('table');
|
22
|
-
|
23
|
-
switch (data.path[0].id) {
|
24
|
-
case 'add' : table.add(); break;
|
25
|
-
case 'clear' : table.clear(); break;
|
26
|
-
case 'runlots': table.runlots(); break;
|
27
|
-
}
|
28
|
-
|
29
|
-
// console.log(data.path[0].id);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
export default Neo.setupClass(MainComponentController);
|