neo.mjs 8.33.0 → 8.35.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/finance/view/GridContainer.mjs +8 -7
- package/apps/finance/view/Viewport.mjs +27 -10
- package/apps/finance/view/ViewportController.mjs +55 -1
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/grid/column/AnimatedChange.scss +1 -1
- package/resources/scss/src/grid/column/AnimatedCurrency.scss +25 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/grid/Container.mjs +7 -6
- package/src/grid/column/AnimatedCurrency.mjs +87 -0
- package/src/grid/column/_export.mjs +8 -7
package/apps/ServiceWorker.mjs
CHANGED
@@ -42,15 +42,16 @@ class GridContainer extends BaseGridContainer {
|
|
42
42
|
dataField: 'change',
|
43
43
|
locale : 'en-US',
|
44
44
|
text : 'Change',
|
45
|
-
type : '
|
45
|
+
type : 'animatedCurrency',
|
46
46
|
width : 120
|
47
47
|
}, {
|
48
|
-
cellAlign: 'right',
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
cellAlign : 'right',
|
49
|
+
compareField: 'change',
|
50
|
+
dataField : 'value',
|
51
|
+
locale : 'en-US',
|
52
|
+
text : 'Value',
|
53
|
+
type : 'animatedCurrency',
|
54
|
+
width : 120
|
54
55
|
}]
|
55
56
|
}
|
56
57
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import BaseViewport from '../../../src/container/Viewport.mjs';
|
2
2
|
import GridContainer from './GridContainer.mjs';
|
3
|
+
import Toolbar from '../../../src/toolbar/Base.mjs';
|
3
4
|
import ViewportController from './ViewportController.mjs';
|
4
5
|
import ViewportStateProvider from './ViewportStateProvider.mjs';
|
5
6
|
|
@@ -18,17 +19,10 @@ class Viewport extends BaseViewport {
|
|
18
19
|
* @member {Neo.controller.Component} controller=ViewportController
|
19
20
|
*/
|
20
21
|
controller: ViewportController,
|
21
|
-
/**
|
22
|
-
* @member {Object[]} items
|
23
|
-
*/
|
24
|
-
items: [{
|
25
|
-
module : GridContainer,
|
26
|
-
reference: 'grid'
|
27
|
-
}],
|
28
22
|
/*
|
29
|
-
* @member {Object} layout={ntype:'
|
23
|
+
* @member {Object} layout={ntype:'vbox',align:'stretch'}
|
30
24
|
*/
|
31
|
-
layout: {ntype: '
|
25
|
+
layout: {ntype: 'vbox', align: 'stretch'},
|
32
26
|
/**
|
33
27
|
* @member {Neo.state.Provider} stateProvider=ViewportStateProvider
|
34
28
|
*/
|
@@ -36,7 +30,30 @@ class Viewport extends BaseViewport {
|
|
36
30
|
/**
|
37
31
|
* @member {Object} style
|
38
32
|
*/
|
39
|
-
style: {padding: '
|
33
|
+
style: {padding: '1.5em'},
|
34
|
+
/**
|
35
|
+
* @member {Object[]} items
|
36
|
+
*/
|
37
|
+
items: [{
|
38
|
+
module: Toolbar,
|
39
|
+
flex : 'none',
|
40
|
+
style : {marginBottom: '1.5em'},
|
41
|
+
|
42
|
+
items : [{
|
43
|
+
disabled : true,
|
44
|
+
handler : 'onStartButtonClick',
|
45
|
+
reference: 'start-button',
|
46
|
+
text : 'Start'
|
47
|
+
}, {
|
48
|
+
handler : 'onStopButtonClick',
|
49
|
+
reference: 'stop-button',
|
50
|
+
style : {marginLeft: '.3em'},
|
51
|
+
text : 'Stop'
|
52
|
+
}]
|
53
|
+
}, {
|
54
|
+
module : GridContainer,
|
55
|
+
reference: 'grid'
|
56
|
+
}]
|
40
57
|
}
|
41
58
|
}
|
42
59
|
|
@@ -13,6 +13,20 @@ class ViewportController extends Controller {
|
|
13
13
|
className: 'Finance.view.ViewportController'
|
14
14
|
}
|
15
15
|
|
16
|
+
/**
|
17
|
+
* @member {Number|null} intervalId=null
|
18
|
+
*/
|
19
|
+
intervalId = null
|
20
|
+
|
21
|
+
/**
|
22
|
+
*
|
23
|
+
*/
|
24
|
+
generateData() {
|
25
|
+
let me = this;
|
26
|
+
|
27
|
+
me.intervalId = setInterval(me.updateRecord.bind(me), 4)
|
28
|
+
}
|
29
|
+
|
16
30
|
/**
|
17
31
|
*
|
18
32
|
*/
|
@@ -28,7 +42,47 @@ class ViewportController extends Controller {
|
|
28
42
|
})
|
29
43
|
});
|
30
44
|
|
31
|
-
|
45
|
+
me.getReference('grid').bulkUpdateRecords(items);
|
46
|
+
me.generateData()
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* @param {Object} data
|
51
|
+
*/
|
52
|
+
onStartButtonClick(data) {
|
53
|
+
let me = this,
|
54
|
+
stopButton = me.getReference('stop-button');
|
55
|
+
|
56
|
+
me.generateData();
|
57
|
+
|
58
|
+
data.component.disabled = true;
|
59
|
+
stopButton .disabled = false
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @param {Object} data
|
64
|
+
*/
|
65
|
+
onStopButtonClick(data) {
|
66
|
+
let me = this,
|
67
|
+
startButton = me.getReference('start-button');
|
68
|
+
|
69
|
+
clearInterval(me.intervalId);
|
70
|
+
|
71
|
+
data.component.disabled = true;
|
72
|
+
startButton .disabled = false
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
*
|
77
|
+
*/
|
78
|
+
updateRecord() {
|
79
|
+
let me = this,
|
80
|
+
store = me.getStore('companies'),
|
81
|
+
change = Math.random() * 10 - 5,
|
82
|
+
index = Math.round(Math.random() * 100), // 0 - 100
|
83
|
+
record = store.getAt(index);
|
84
|
+
|
85
|
+
record.set({change, value: record.value + change})
|
32
86
|
}
|
33
87
|
}
|
34
88
|
|
package/apps/portal/index.html
CHANGED
package/package.json
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
@keyframes grid-animated-cell-negative {
|
2
|
+
50% {background-color: darkred;}
|
3
|
+
}
|
4
|
+
|
5
|
+
@keyframes grid-animated-cell-positive {
|
6
|
+
50% {background-color: darkgreen}
|
7
|
+
}
|
8
|
+
|
9
|
+
.neo-grid-container {
|
10
|
+
.neo-grid-row, .neo-grid-row.neo-even {
|
11
|
+
.neo-grid-cell {
|
12
|
+
&.neo-animated-negative {
|
13
|
+
animation-name : grid-animated-cell-negative;
|
14
|
+
animation-duration : .4s;
|
15
|
+
animation-timing-function: ease-in-out;
|
16
|
+
}
|
17
|
+
|
18
|
+
&.neo-animated-positive {
|
19
|
+
animation-name : grid-animated-cell-positive;
|
20
|
+
animation-duration : .4s;
|
21
|
+
animation-timing-function: ease-in-out;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -263,12 +263,12 @@ const DefaultConfig = {
|
|
263
263
|
useVdomWorker: true,
|
264
264
|
/**
|
265
265
|
* buildScripts/injectPackageVersion.mjs will update this value
|
266
|
-
* @default '8.
|
266
|
+
* @default '8.35.0'
|
267
267
|
* @memberOf! module:Neo
|
268
268
|
* @name config.version
|
269
269
|
* @type String
|
270
270
|
*/
|
271
|
-
version: '8.
|
271
|
+
version: '8.35.0'
|
272
272
|
};
|
273
273
|
|
274
274
|
Object.assign(DefaultConfig, {
|
package/src/grid/Container.mjs
CHANGED
@@ -19,12 +19,13 @@ class GridContainer extends BaseContainer {
|
|
19
19
|
* @static
|
20
20
|
*/
|
21
21
|
static columnTypes = {
|
22
|
-
animatedChange: column.AnimatedChange,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
animatedChange : column.AnimatedChange,
|
23
|
+
animatedCurrency: column.AnimatedCurrency,
|
24
|
+
column : column.Base,
|
25
|
+
component : column.Component,
|
26
|
+
currency : column.Currency,
|
27
|
+
index : column.Index,
|
28
|
+
progress : column.Progress
|
28
29
|
}
|
29
30
|
/**
|
30
31
|
* @member {Object} delayable
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import AnimatedChange from './AnimatedChange.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.grid.column.AnimatedCurrency
|
5
|
+
* @extends Neo.grid.column.AnimatedChange
|
6
|
+
*/
|
7
|
+
class AnimatedCurrency extends AnimatedChange {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.grid.column.AnimatedCurrency'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.grid.column.AnimatedCurrency',
|
14
|
+
/**
|
15
|
+
* @member {String} type='animatedCurrency'
|
16
|
+
* @protected
|
17
|
+
*/
|
18
|
+
type: 'animatedCurrency',
|
19
|
+
/**
|
20
|
+
* Set a different record field to base the change on.
|
21
|
+
* Defaults this.dataField
|
22
|
+
* @member {String|null} compareField=null
|
23
|
+
*/
|
24
|
+
compareField: null,
|
25
|
+
/**
|
26
|
+
* @member {String} currency='USD'
|
27
|
+
*/
|
28
|
+
currency: 'USD',
|
29
|
+
/**
|
30
|
+
* @member {String} locale='default'
|
31
|
+
*/
|
32
|
+
locale: 'default'
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @member {Intl.NumberFormat|null} formatter=null
|
37
|
+
*/
|
38
|
+
formatter = null
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @param {Object} config
|
42
|
+
*/
|
43
|
+
construct(config) {
|
44
|
+
super.construct(config);
|
45
|
+
this.createFormatter()
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @param {Object} data
|
50
|
+
* @param {Neo.button.Base} data.column
|
51
|
+
* @param {Number} data.columnIndex
|
52
|
+
* @param {String} data.dataField
|
53
|
+
* @param {Neo.grid.Container} data.gridContainer
|
54
|
+
* @param {Object} data.record
|
55
|
+
* @param {Number} data.rowIndex
|
56
|
+
* @param {Neo.data.Store} data.store
|
57
|
+
* @param {Number|String} data.value
|
58
|
+
* @returns {*}
|
59
|
+
*/
|
60
|
+
cellRenderer({value}) {
|
61
|
+
if (value === null || value === undefined) {
|
62
|
+
return ''
|
63
|
+
}
|
64
|
+
|
65
|
+
return this.formatter.format(value)
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
*
|
70
|
+
*/
|
71
|
+
createFormatter() {
|
72
|
+
let me = this;
|
73
|
+
|
74
|
+
me.formatter = new Intl.NumberFormat(me.locale, {style: 'currency', currency: me.currency})
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Override as needed for dynamic record-based animation classes
|
79
|
+
* @param {Record} record
|
80
|
+
* @returns {String}
|
81
|
+
*/
|
82
|
+
getAnimationCls(record) {
|
83
|
+
return record[this.compareField || this.dataField] < 0 ? 'neo-animated-negative' : 'neo-animated-positive'
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
export default Neo.setupClass(AnimatedCurrency);
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import AnimatedChange
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
1
|
+
import AnimatedChange from './AnimatedChange.mjs';
|
2
|
+
import AnimatedCurrency from './AnimatedCurrency.mjs';
|
3
|
+
import Base from './Base.mjs';
|
4
|
+
import Component from './Component.mjs';
|
5
|
+
import Currency from './Currency.mjs';
|
6
|
+
import Index from './Index.mjs';
|
7
|
+
import Progress from './Progress.mjs';
|
7
8
|
|
8
|
-
export {AnimatedChange, Base, Component, Currency, Index, Progress};
|
9
|
+
export {AnimatedChange, AnimatedCurrency, Base, Component, Currency, Index, Progress};
|