neo.mjs 8.29.0 → 8.30.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/view/home/FooterContainer.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/bigData/GridContainer.mjs +3 -2
- package/examples/grid/bigData/MainModel.mjs +3 -2
- package/examples/grid/bigData/MainStore.mjs +3 -2
- package/package.json +1 -1
- package/resources/scss/src/component/Progress.scss +1 -1
- package/resources/scss/src/grid/column/Progress.scss +34 -0
- package/resources/scss/theme-dark/grid/column/Progress.scss +6 -0
- package/resources/scss/theme-light/grid/column/Progress.scss +6 -0
- package/resources/scss/theme-neo-light/grid/column/Progress.scss +6 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +1 -1
- package/src/component/Progress.mjs +26 -5
- package/src/grid/Container.mjs +2 -1
- package/src/grid/ScrollManager.mjs +1 -1
- package/src/grid/column/Component.mjs +51 -8
- package/src/grid/column/Progress.mjs +42 -0
- package/src/grid/column/_export.mjs +2 -1
- package/src/vdom/Helper.mjs +1 -1
package/apps/ServiceWorker.mjs
CHANGED
package/apps/portal/index.html
CHANGED
@@ -46,7 +46,7 @@ class GridContainer extends BaseGridContainer {
|
|
46
46
|
* @protected
|
47
47
|
*/
|
48
48
|
afterSetAmountColumns(value, oldValue) {
|
49
|
-
let i =
|
49
|
+
let i = 7,
|
50
50
|
columns = [
|
51
51
|
{type: 'index', dataField: 'id', text: '#', width: 60},
|
52
52
|
{cellAlign: 'left', dataField: 'firstname', defaultSortDirection: 'ASC', text: 'Firstname', width: 150},
|
@@ -57,7 +57,8 @@ class GridContainer extends BaseGridContainer {
|
|
57
57
|
text : record.firstname + ' ++',
|
58
58
|
width : 130
|
59
59
|
})},
|
60
|
-
{type: 'animatedChange', dataField: 'counter', text: 'Counter'}
|
60
|
+
{type: 'animatedChange', dataField: 'counter', text: 'Counter'},
|
61
|
+
{type: 'progress', dataField: 'progress', text: 'Progress', width: 150}
|
61
62
|
];
|
62
63
|
|
63
64
|
for (; i <= value; i++) {
|
@@ -24,13 +24,14 @@ class MainModel extends Model {
|
|
24
24
|
* @protected
|
25
25
|
*/
|
26
26
|
afterSetAmountColumns(value, oldValue) {
|
27
|
-
let i =
|
27
|
+
let i = 7,
|
28
28
|
fields = [
|
29
29
|
{name: 'id', type: 'Int'},
|
30
30
|
{name: 'countAction'},
|
31
31
|
{name: 'counter', type: 'Int'},
|
32
32
|
{name: 'firstname', type: 'String'},
|
33
|
-
{name: 'lastname', type: 'String'}
|
33
|
+
{name: 'lastname', type: 'String'},
|
34
|
+
{name: 'progress', type: 'Int'}
|
34
35
|
];
|
35
36
|
|
36
37
|
for (; i <= value; i++) {
|
@@ -113,12 +113,13 @@ class MainStore extends Store {
|
|
113
113
|
column, record;
|
114
114
|
|
115
115
|
for (; row < amountRows; row++) {
|
116
|
-
column =
|
116
|
+
column = 7;
|
117
117
|
record = {
|
118
118
|
id : row + 1,
|
119
119
|
counter : Math.round(Math.random() * 100),
|
120
120
|
firstname: me.firstnames[Math.floor(Math.random() * amountFirstnames)],
|
121
|
-
lastname : me.lastnames[ Math.floor(Math.random() * amountLastnames)]
|
121
|
+
lastname : me.lastnames[ Math.floor(Math.random() * amountLastnames)],
|
122
|
+
progress : Math.round(Math.random() * 100)
|
122
123
|
};
|
123
124
|
|
124
125
|
for (; column <= amountColumns; column++) {
|
package/package.json
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
.neo-grid-cell {
|
2
|
+
.neo-progress-wrapper {
|
3
|
+
progress[value] {
|
4
|
+
appearance: none;
|
5
|
+
border : none;
|
6
|
+
display : flex;
|
7
|
+
height : var(--grid-cell-progress-height);
|
8
|
+
|
9
|
+
@-moz-document url-prefix() {
|
10
|
+
background-color: var(--grid-cell-progress-track-color);
|
11
|
+
border-radius : var(--grid-cell-progress-border-radius);
|
12
|
+
box-shadow : 0 2px 5px rgba(0, 0, 0, 0.25) inset;
|
13
|
+
}
|
14
|
+
|
15
|
+
// for webkit the progress-bar is the track
|
16
|
+
&::-webkit-progress-bar {
|
17
|
+
background-color: var(--grid-cell-progress-track-color);
|
18
|
+
border-radius : var(--grid-cell-progress-border-radius);
|
19
|
+
box-shadow : 0 2px 5px rgba(0, 0, 0, 0.25) inset;
|
20
|
+
}
|
21
|
+
|
22
|
+
// for mozilla the progress-bar is the active range
|
23
|
+
&::-moz-progress-bar {
|
24
|
+
background-color: var(--grid-cell-progress-active-color);
|
25
|
+
border-radius : var(--grid-cell-progress-border-radius);
|
26
|
+
}
|
27
|
+
|
28
|
+
&::-webkit-progress-value {
|
29
|
+
background-color: var(--grid-cell-progress-active-color);
|
30
|
+
border-radius : var(--grid-cell-progress-border-radius);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
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.30.0'
|
267
267
|
* @memberOf! module:Neo
|
268
268
|
* @name config.version
|
269
269
|
* @type String
|
270
270
|
*/
|
271
|
-
version: '8.
|
271
|
+
version: '8.30.0'
|
272
272
|
};
|
273
273
|
|
274
274
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -451,7 +451,7 @@ class Component extends Base {
|
|
451
451
|
get parent() {
|
452
452
|
let me = this;
|
453
453
|
|
454
|
-
return me.parentComponent || me.parentId === 'document.body' ? null : Neo.getComponent(me.parentId)
|
454
|
+
return me.parentComponent || (me.parentId === 'document.body' ? null : Neo.getComponent(me.parentId))
|
455
455
|
}
|
456
456
|
|
457
457
|
/**
|
@@ -37,12 +37,25 @@ class Progress extends Base {
|
|
37
37
|
* @member {Object} _vdom
|
38
38
|
*/
|
39
39
|
_vdom:
|
40
|
-
{tag: 'div', cls: ['neo-progress'], cn: [
|
40
|
+
{tag: 'div', cls: ['neo-progress-wrapper'], cn: [
|
41
41
|
{tag: 'label'},
|
42
42
|
{tag: 'progress'}
|
43
43
|
]}
|
44
44
|
}
|
45
45
|
|
46
|
+
/**
|
47
|
+
* @member {Object} label
|
48
|
+
*/
|
49
|
+
get label() {
|
50
|
+
return this.vdom.cn[0]
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* @member {Object} progress
|
54
|
+
*/
|
55
|
+
get progress() {
|
56
|
+
return this.vdom.cn[1]
|
57
|
+
}
|
58
|
+
|
46
59
|
/**
|
47
60
|
* Triggered after the id config got changed
|
48
61
|
* @param {String} value
|
@@ -52,7 +65,7 @@ class Progress extends Base {
|
|
52
65
|
afterSetId(value, oldValue) {
|
53
66
|
super.afterSetId(value, oldValue);
|
54
67
|
|
55
|
-
this.
|
68
|
+
this.label.for = value;
|
56
69
|
this.update()
|
57
70
|
}
|
58
71
|
|
@@ -63,7 +76,15 @@ class Progress extends Base {
|
|
63
76
|
* @protected
|
64
77
|
*/
|
65
78
|
afterSetLabelText(value, oldValue) {
|
66
|
-
|
79
|
+
let {label} = this;
|
80
|
+
|
81
|
+
if (!value) {
|
82
|
+
label.removeDom = true
|
83
|
+
} else {
|
84
|
+
delete label.removeDom
|
85
|
+
}
|
86
|
+
|
87
|
+
label.html = value;
|
67
88
|
this.update()
|
68
89
|
}
|
69
90
|
|
@@ -74,7 +95,7 @@ class Progress extends Base {
|
|
74
95
|
* @protected
|
75
96
|
*/
|
76
97
|
afterSetMax(value, oldValue) {
|
77
|
-
this.
|
98
|
+
this.progress.max = value;
|
78
99
|
this.update()
|
79
100
|
}
|
80
101
|
|
@@ -85,7 +106,7 @@ class Progress extends Base {
|
|
85
106
|
* @protected
|
86
107
|
*/
|
87
108
|
afterSetValue(value, oldValue) {
|
88
|
-
this.
|
109
|
+
this.progress.value = value;
|
89
110
|
this.update()
|
90
111
|
}
|
91
112
|
|
package/src/grid/Container.mjs
CHANGED
@@ -22,7 +22,8 @@ class GridContainer extends BaseContainer {
|
|
22
22
|
animatedChange: column.AnimatedChange,
|
23
23
|
column : column.Base,
|
24
24
|
component : column.Component,
|
25
|
-
index : column.Index
|
25
|
+
index : column.Index,
|
26
|
+
progress : column.Progress
|
26
27
|
}
|
27
28
|
/**
|
28
29
|
* @member {Object} delayable
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import Button from '../../button/Base.mjs';
|
2
1
|
import Column from './Base.mjs';
|
3
2
|
|
4
3
|
/**
|
@@ -16,6 +15,20 @@ class Component extends Column {
|
|
16
15
|
* @member {Function|Object|null} component=null
|
17
16
|
*/
|
18
17
|
component: null,
|
18
|
+
/**
|
19
|
+
* @member {Object} defaults
|
20
|
+
* @protected
|
21
|
+
*/
|
22
|
+
defaults: null,
|
23
|
+
/**
|
24
|
+
* Components can delegate event listeners (or button handlers) into methods somewhere inside
|
25
|
+
* the view controller or component tree hierarchy.
|
26
|
+
*
|
27
|
+
* In this case, it is helpful to know what the related record is, so we are adding the record
|
28
|
+
* to the component as a property. By default, as 'record', but this config can change the property name.
|
29
|
+
* @member {String} recordProperty='record'
|
30
|
+
*/
|
31
|
+
recordProperty: 'record',
|
19
32
|
/**
|
20
33
|
* @member {String} type='component'
|
21
34
|
* @protected
|
@@ -29,9 +42,19 @@ class Component extends Column {
|
|
29
42
|
*/
|
30
43
|
map = new Map()
|
31
44
|
|
45
|
+
/**
|
46
|
+
* Override as needed inside class extensions
|
47
|
+
* @param {Object} config
|
48
|
+
* @param {Record} record
|
49
|
+
* @returns {Object}
|
50
|
+
*/
|
51
|
+
applyRecordConfigs(config, record) {
|
52
|
+
return config
|
53
|
+
}
|
54
|
+
|
32
55
|
/**
|
33
56
|
* @param {Object} data
|
34
|
-
* @param {Neo.
|
57
|
+
* @param {Neo.column.Base} data.column
|
35
58
|
* @param {Number} data.columnIndex
|
36
59
|
* @param {String} data.dataField
|
37
60
|
* @param {Neo.grid.Container} data.gridContainer
|
@@ -42,28 +65,37 @@ class Component extends Column {
|
|
42
65
|
* @returns {*}
|
43
66
|
*/
|
44
67
|
cellRenderer(data) {
|
45
|
-
let {gridContainer, rowIndex} = data,
|
46
|
-
{appName, view, windowId}
|
47
|
-
me
|
48
|
-
|
49
|
-
|
50
|
-
|
68
|
+
let {gridContainer, record, rowIndex} = data,
|
69
|
+
{appName, view, windowId} = gridContainer,
|
70
|
+
me = this,
|
71
|
+
{recordProperty} = me,
|
72
|
+
id = me.getComponentId(rowIndex),
|
73
|
+
component = me.map.get(id),
|
74
|
+
componentConfig = me.component;
|
51
75
|
|
52
76
|
if (Neo.typeOf(componentConfig) === 'Function') {
|
53
77
|
componentConfig = componentConfig(data)
|
54
78
|
}
|
55
79
|
|
80
|
+
componentConfig = me.applyRecordConfigs(componentConfig, record);
|
81
|
+
|
56
82
|
if (component) {
|
57
83
|
delete componentConfig.className;
|
58
84
|
delete componentConfig.module;
|
59
85
|
delete componentConfig.ntype;
|
60
86
|
|
87
|
+
|
88
|
+
componentConfig[recordProperty] = record;
|
89
|
+
|
61
90
|
component.set(componentConfig)
|
62
91
|
} else {
|
63
92
|
component = Neo.create({
|
93
|
+
...me.defaults,
|
64
94
|
...componentConfig,
|
65
95
|
appName,
|
66
96
|
id,
|
97
|
+
parentComponent : view,
|
98
|
+
[recordProperty]: record,
|
67
99
|
windowId
|
68
100
|
});
|
69
101
|
|
@@ -74,6 +106,17 @@ class Component extends Column {
|
|
74
106
|
|
75
107
|
return component.createVdomReference()
|
76
108
|
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* @param {Number} rowIndex
|
112
|
+
* @returns {String}
|
113
|
+
*/
|
114
|
+
getComponentId(rowIndex) {
|
115
|
+
let me = this,
|
116
|
+
{view} = me.parent;
|
117
|
+
|
118
|
+
return `${me.id}-component-${rowIndex % (view.availableRows + 2 * view.bufferRowRange)}`
|
119
|
+
}
|
77
120
|
}
|
78
121
|
|
79
122
|
export default Neo.setupClass(Component);
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import ComponentColumn from './Component.mjs';
|
2
|
+
import ProgressComponent from '../../component/Progress.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.grid.column.Progress
|
6
|
+
* @extends Neo.grid.column.Component
|
7
|
+
*/
|
8
|
+
class Progress extends ComponentColumn {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.grid.column.Progress'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.grid.column.Progress',
|
15
|
+
/**
|
16
|
+
* @member {Object} defaults
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
defaults: {
|
20
|
+
module: ProgressComponent
|
21
|
+
},
|
22
|
+
/**
|
23
|
+
* @member {String} type='progress'
|
24
|
+
* @protected
|
25
|
+
*/
|
26
|
+
type: 'progress'
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* @param {Object} config
|
31
|
+
* @param {Record} record
|
32
|
+
* @returns {Object}
|
33
|
+
*/
|
34
|
+
applyRecordConfigs(config, record) {
|
35
|
+
return {
|
36
|
+
value: record[this.dataField],
|
37
|
+
...config
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
export default Neo.setupClass(Progress);
|
@@ -2,5 +2,6 @@ import AnimatedChange from './AnimatedChange.mjs';
|
|
2
2
|
import Base from './Base.mjs';
|
3
3
|
import Component from './Component.mjs';
|
4
4
|
import Index from './Index.mjs';
|
5
|
+
import Progress from './Progress.mjs';
|
5
6
|
|
6
|
-
export {AnimatedChange, Base, Component, Index};
|
7
|
+
export {AnimatedChange, Base, Component, Index, Progress};
|
package/src/vdom/Helper.mjs
CHANGED
@@ -250,7 +250,7 @@ class Helper extends Base {
|
|
250
250
|
return deltas
|
251
251
|
}
|
252
252
|
|
253
|
-
if (vnodeId !== oldVnodeId) {
|
253
|
+
if (vnodeId !== oldVnodeId && vnode.componentId !== oldVnode.componentId) {
|
254
254
|
throw new Error(`createDeltas() must get called for the same node. ${vnodeId}, ${oldVnodeId}`);
|
255
255
|
}
|
256
256
|
|