neo.mjs 4.2.0 → 4.2.3
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/realworld/view/FooterComponent.mjs +5 -5
- package/apps/realworld/view/HeaderComponent.mjs +30 -30
- package/apps/realworld/view/HomeComponent.mjs +4 -4
- package/apps/realworld/view/MainContainerController.mjs +4 -4
- package/apps/realworld/view/article/Component.mjs +2 -2
- package/apps/realworld/view/article/PreviewComponent.mjs +1 -1
- package/apps/realworld/view/article/TagListComponent.mjs +2 -2
- package/apps/realworld2/view/MainContainer.mjs +1 -1
- package/apps/realworld2/view/MainContainerController.mjs +2 -2
- package/apps/website/data/blog.json +13 -0
- package/buildScripts/addConfig.mjs +10 -8
- package/buildScripts/createClass.mjs +8 -0
- package/examples/grid/container/MainContainer.mjs +102 -0
- package/examples/grid/container/MainModel.mjs +29 -0
- package/examples/grid/container/MainStore.mjs +55 -0
- package/examples/grid/container/app.mjs +6 -0
- package/examples/grid/container/index.html +11 -0
- package/examples/grid/container/neo-config.json +7 -0
- package/examples/table/container/MainModel.mjs +4 -4
- package/package.json +3 -3
- package/resources/scss/src/form/field/Select.scss +2 -1
- package/resources/scss/src/grid/Container.scss +5 -4
- package/src/data/connection/WebSocket.mjs +1 -0
- package/src/form/field/Select.mjs +1 -1
- package/src/grid/View.mjs +1 -1
- package/src/grid/header/Button.mjs +25 -0
- package/src/selection/grid/CellColumnModel.mjs +7 -7
- package/src/selection/grid/CellColumnRowModel.mjs +5 -5
- package/src/selection/grid/CellModel.mjs +17 -23
- package/src/selection/grid/ColumnModel.mjs +30 -34
@@ -15,12 +15,12 @@ class FooterComponent extends Component {
|
|
15
15
|
* @member {Object} _vdom
|
16
16
|
*/
|
17
17
|
_vdom:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
]}
|
18
|
+
{tag: 'footer', cn: [
|
19
|
+
{cls: ['container'], cn: [
|
20
|
+
{tag: 'a', cls: ['logo-font'], href: '#/', html: 'conduit'},
|
21
|
+
{tag: 'span', cls: 'attribution', html: 'An interactive learning project from <a href="https://thinkster.io">Thinkster</a>. Code & design licensed under MIT.'}
|
23
22
|
]}
|
23
|
+
]}
|
24
24
|
}}
|
25
25
|
}
|
26
26
|
|
@@ -36,40 +36,40 @@ class HeaderComponent extends Component {
|
|
36
36
|
* @member {Object} _vdom
|
37
37
|
*/
|
38
38
|
_vdom:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
]}
|
51
|
-
]},
|
52
|
-
{tag: 'li', cls: ['nav-item'], removeDom: true, cn: [
|
53
|
-
{tag: 'a', cls: ['nav-link'], href: '#/settings', cn: [
|
54
|
-
{tag: 'i', cls: 'ion-gear-a'},
|
55
|
-
{vtype: 'text', html: ' Settings'}
|
56
|
-
]}
|
57
|
-
]},
|
58
|
-
{tag: 'li', cls: ['nav-item'], removeDom: true, cn: [
|
59
|
-
{tag: 'a', cls : ['nav-link'], href: '#/profile', cn: [
|
60
|
-
{tag: 'img', cls: ['user-pic']},
|
61
|
-
{vtype: 'text', html: ' Profile'}
|
62
|
-
]}
|
63
|
-
]},
|
64
|
-
{tag: 'li', cls: ['nav-item'], cn: [
|
65
|
-
{tag : 'a', cls : ['nav-link'], href: '#/login', html: 'Sign in'}
|
66
|
-
]},
|
67
|
-
{tag: 'li', cls: ['nav-item'], cn: [
|
68
|
-
{tag: 'a', cls : ['nav-link'], href: '#/register', html: 'Sign up'}
|
39
|
+
{tag: 'nav', cls: ['navbar navbar-light'], cn: [
|
40
|
+
{cls: ['container'], cn: [
|
41
|
+
{tag: 'a', cls: ['navbar-brand'], href: '#/', html: 'conduit'},
|
42
|
+
{tag: 'ul', cls: ['nav navbar-nav', 'pull-xs-right'], cn: [
|
43
|
+
{tag: 'li', cls: ['nav-item'], cn: [
|
44
|
+
{tag: 'a', cls: ['nav-link'], href: '#/', html: 'Home'}
|
45
|
+
]},
|
46
|
+
{tag: 'li', cls: ['nav-item'], removeDom: true, cn: [
|
47
|
+
{tag: 'a', cls: ['nav-link'], href: '#/editor', cn: [
|
48
|
+
{tag: 'i', cls: 'ion-compose'},
|
49
|
+
{vtype: 'text', html: ' New Article'}
|
69
50
|
]}
|
51
|
+
]},
|
52
|
+
{tag: 'li', cls: ['nav-item'], removeDom: true, cn: [
|
53
|
+
{tag: 'a', cls: ['nav-link'], href: '#/settings', cn: [
|
54
|
+
{tag: 'i', cls: 'ion-gear-a'},
|
55
|
+
{vtype: 'text', html: ' Settings'}
|
56
|
+
]}
|
57
|
+
]},
|
58
|
+
{tag: 'li', cls: ['nav-item'], removeDom: true, cn: [
|
59
|
+
{tag: 'a', cls : ['nav-link'], href: '#/profile', cn: [
|
60
|
+
{tag: 'img', cls: ['user-pic']},
|
61
|
+
{vtype: 'text', html: ' Profile'}
|
62
|
+
]}
|
63
|
+
]},
|
64
|
+
{tag: 'li', cls: ['nav-item'], cn: [
|
65
|
+
{tag : 'a', cls : ['nav-link'], href: '#/login', html: 'Sign in'}
|
66
|
+
]},
|
67
|
+
{tag: 'li', cls: ['nav-item'], cn: [
|
68
|
+
{tag: 'a', cls : ['nav-link'], href: '#/register', html: 'Sign up'}
|
70
69
|
]}
|
71
70
|
]}
|
72
71
|
]}
|
72
|
+
]}
|
73
73
|
}}
|
74
74
|
|
75
75
|
/**
|
@@ -280,8 +280,8 @@ class HomeComponent extends Component {
|
|
280
280
|
cls: ['nav-item'],
|
281
281
|
id : me.id + '__nav-item_' + index,
|
282
282
|
cn : [{
|
283
|
-
tag: 'a',
|
284
|
-
cls: cls,
|
283
|
+
tag : 'a',
|
284
|
+
cls : cls,
|
285
285
|
href: '',
|
286
286
|
html: item.name,
|
287
287
|
id : me.id + '__nav-item-link_' + index,
|
@@ -447,12 +447,12 @@ class HomeComponent extends Component {
|
|
447
447
|
if (feeds.length < 3) {
|
448
448
|
feeds.push({
|
449
449
|
active: true,
|
450
|
-
name
|
450
|
+
name
|
451
451
|
});
|
452
452
|
} else {
|
453
453
|
Object.assign(feeds[2], {
|
454
454
|
active: true,
|
455
|
-
name
|
455
|
+
name
|
456
456
|
});
|
457
457
|
}
|
458
458
|
|
@@ -144,7 +144,7 @@ class MainContainerController extends ComponentController {
|
|
144
144
|
*/
|
145
145
|
getArticle(slug) {
|
146
146
|
return ArticleApi.get({
|
147
|
-
slug
|
147
|
+
slug
|
148
148
|
});
|
149
149
|
}
|
150
150
|
|
@@ -406,9 +406,9 @@ class MainContainerController extends ComponentController {
|
|
406
406
|
module = await module();
|
407
407
|
|
408
408
|
me[key] = Neo.create({
|
409
|
-
module
|
410
|
-
parentId
|
411
|
-
reference
|
409
|
+
module : module.default,
|
410
|
+
parentId: me.component.id,
|
411
|
+
reference
|
412
412
|
});
|
413
413
|
}
|
414
414
|
|
@@ -1,4 +1,17 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"author" : "Tobias Uhlig",
|
4
|
+
"authorImage" : "author_TobiasUhlig.jpeg",
|
5
|
+
"date" : "Sep 07, 2022",
|
6
|
+
"id" : 53,
|
7
|
+
"image" : "the-secret-of-successfully-using-multi-window-webgl-canvas.png",
|
8
|
+
"name" : "The secret of successfully using multi window WebGL Canvas",
|
9
|
+
"provider" : "Medium",
|
10
|
+
"publisher" : "",
|
11
|
+
"selectedInto": [],
|
12
|
+
"type" : "Blog Post",
|
13
|
+
"url" : "https://tobiasuhlig.medium.com/the-secret-of-successfully-using-multi-window-webgl-canvas-5a2d05555ad1?source=friends_link&sk=d24ec0ec25aa6678d5fd1f59aaf09007"
|
14
|
+
},
|
2
15
|
{
|
3
16
|
"author" : "Tobias Uhlig",
|
4
17
|
"authorImage" : "author_TobiasUhlig.jpeg",
|
@@ -71,40 +71,42 @@ function addHook(opts) {
|
|
71
71
|
let contentArray = opts.contentArray,
|
72
72
|
i = 0,
|
73
73
|
inserted = false,
|
74
|
+
name = opts.name,
|
74
75
|
len = contentArray.length,
|
76
|
+
type = opts.type,
|
75
77
|
j, methodName, nextLine,
|
76
78
|
|
77
79
|
method = [
|
78
80
|
'',
|
79
81
|
' /**',
|
80
82
|
` * ${opts.comment}`,
|
81
|
-
` * @param {${
|
83
|
+
` * @param {${type}} value`
|
82
84
|
];
|
83
85
|
|
84
86
|
if (opts.oldValueParam) {
|
85
87
|
method.push(
|
86
|
-
` * @param {${
|
88
|
+
` * @param {${type}} oldValue`
|
87
89
|
);
|
88
90
|
}
|
89
91
|
|
90
92
|
if (opts.returnValue) {
|
91
93
|
method.push(
|
92
|
-
` * @returns {${
|
94
|
+
` * @returns {${type}}`
|
93
95
|
);
|
94
96
|
}
|
95
97
|
|
96
98
|
method.push(
|
97
|
-
|
98
|
-
|
99
|
+
' * @protected',
|
100
|
+
' */'
|
99
101
|
);
|
100
102
|
|
101
103
|
if (opts.oldValueParam) {
|
102
104
|
method.push(
|
103
|
-
` ${
|
105
|
+
` ${name}(value, oldValue) {`
|
104
106
|
);
|
105
107
|
} else {
|
106
108
|
method.push(
|
107
|
-
` ${
|
109
|
+
` ${name}(value) {`
|
108
110
|
);
|
109
111
|
}
|
110
112
|
|
@@ -137,7 +139,7 @@ function addHook(opts) {
|
|
137
139
|
continue;
|
138
140
|
}
|
139
141
|
|
140
|
-
if (methodName >
|
142
|
+
if (methodName > name) {
|
141
143
|
for (j=i; j > 0; j--) {
|
142
144
|
if (contentArray[j].includes('/**')) {
|
143
145
|
contentArray.splice(j - 1, 0, method.join(os.EOL));
|
@@ -114,6 +114,7 @@ if (programOpts.info) {
|
|
114
114
|
choices: [
|
115
115
|
'component.Base',
|
116
116
|
'container.Base',
|
117
|
+
'container.Viewport',
|
117
118
|
'controller.Component',
|
118
119
|
'core.Base',
|
119
120
|
'data.Model',
|
@@ -583,6 +584,13 @@ if (programOpts.info) {
|
|
583
584
|
` className: '${className}'`
|
584
585
|
);
|
585
586
|
|
587
|
+
baseClass === 'container.Viewport' && addComma(classContent).push(
|
588
|
+
" /**",
|
589
|
+
" * @member {Boolean} autoMount=true",
|
590
|
+
" */",
|
591
|
+
" autoMount: true"
|
592
|
+
);
|
593
|
+
|
586
594
|
baseClass === 'table.Container' && addComma(classContent).push(
|
587
595
|
" /**",
|
588
596
|
" * @member {Object[]} columns",
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import CellColumnModel from '../../../src/selection/grid/CellColumnModel.mjs';
|
2
|
+
import CellColumnRowModel from '../../../src/selection/grid/CellColumnRowModel.mjs';
|
3
|
+
import CellModel from '../../../src/selection/grid/CellModel.mjs';
|
4
|
+
import CellRowModel from '../../../src/selection/grid/CellRowModel.mjs';
|
5
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
6
|
+
import ColumnModel from '../../../src/selection/grid/ColumnModel.mjs';
|
7
|
+
import GridContainer from '../../../src/grid/Container.mjs';
|
8
|
+
import MainStore from './MainStore.mjs';
|
9
|
+
import NumberField from '../../../src/form/field/Number.mjs';
|
10
|
+
import Radio from '../../../src/form/field/Radio.mjs';
|
11
|
+
import RowModel from '../../../src/selection/grid/RowModel.mjs';
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @class Neo.examples.grid.container.MainContainer
|
15
|
+
* @extends Neo.examples.ConfigurationViewport
|
16
|
+
*/
|
17
|
+
class MainContainer extends ConfigurationViewport {
|
18
|
+
static getConfig() {return {
|
19
|
+
className : 'Neo.examples.grid.container.MainContainer',
|
20
|
+
autoMount : true,
|
21
|
+
configItemLabelWidth: 130,
|
22
|
+
configPanelFlex : 1.5,
|
23
|
+
exampleComponentFlex: 3,
|
24
|
+
layout : {ntype: 'hbox', align: 'stretch'}
|
25
|
+
}}
|
26
|
+
|
27
|
+
createConfigurationComponents() {
|
28
|
+
let me = this;
|
29
|
+
|
30
|
+
const selectionModelRadioDefaults = {
|
31
|
+
module : Radio,
|
32
|
+
hideValueLabel: false,
|
33
|
+
labelText : '',
|
34
|
+
name : 'selectionModel',
|
35
|
+
width : 350
|
36
|
+
};
|
37
|
+
|
38
|
+
return [{
|
39
|
+
module : NumberField,
|
40
|
+
labelText: 'height',
|
41
|
+
listeners: {change: me.onConfigChange.bind(me, 'height')},
|
42
|
+
maxValue : 800,
|
43
|
+
minValue : 225,
|
44
|
+
stepSize : 5,
|
45
|
+
value : me.exampleComponent.height
|
46
|
+
}, {
|
47
|
+
...selectionModelRadioDefaults,
|
48
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-cellmodel',
|
49
|
+
labelText : 'selectionModel',
|
50
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', CellModel)},
|
51
|
+
style : {marginTop: '10px'},
|
52
|
+
valueLabelText: 'Cell'
|
53
|
+
}, {
|
54
|
+
...selectionModelRadioDefaults,
|
55
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-columnmodel',
|
56
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', ColumnModel)},
|
57
|
+
valueLabelText: 'Column'
|
58
|
+
}, {
|
59
|
+
...selectionModelRadioDefaults,
|
60
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-rowmodel',
|
61
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', RowModel)},
|
62
|
+
valueLabelText: 'Row'
|
63
|
+
}, {
|
64
|
+
...selectionModelRadioDefaults,
|
65
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-cellcolumnmodel',
|
66
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', CellColumnModel)},
|
67
|
+
valueLabelText: 'Cell & Column'
|
68
|
+
}, {
|
69
|
+
...selectionModelRadioDefaults,
|
70
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-cellrowmodel',
|
71
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', CellRowModel)},
|
72
|
+
valueLabelText: 'Cell & Row'
|
73
|
+
}, {
|
74
|
+
...selectionModelRadioDefaults,
|
75
|
+
checked : me.exampleComponent.selectionModel.ntype === 'selection-grid-cellcolumnrowmodel',
|
76
|
+
listeners : {change: me.onRadioChange.bind(me, 'selectionModel', CellColumnRowModel)},
|
77
|
+
valueLabelText: 'Cell & Column & Row'
|
78
|
+
}];
|
79
|
+
}
|
80
|
+
|
81
|
+
createExampleComponent() {
|
82
|
+
return Neo.create(GridContainer, {
|
83
|
+
selectionModel: CellModel,
|
84
|
+
store : MainStore,
|
85
|
+
|
86
|
+
columnDefaults: {
|
87
|
+
width: 200
|
88
|
+
},
|
89
|
+
|
90
|
+
columns: [
|
91
|
+
{field: 'firstname', text: 'Firstname'},
|
92
|
+
{field: 'lastname', text: 'Lastname'},
|
93
|
+
{field: 'githubId', text: 'Github Id'},
|
94
|
+
{field: 'country', text: 'Country'}
|
95
|
+
]
|
96
|
+
});
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
Neo.applyClassConfig(MainContainer);
|
101
|
+
|
102
|
+
export default MainContainer;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import Model from '../../../src/data/Model.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.examples.grid.container.MainModel
|
5
|
+
* @extends Neo.data.Model
|
6
|
+
*/
|
7
|
+
class MainModel extends Model {
|
8
|
+
static getConfig() {return {
|
9
|
+
className: 'Neo.examples.grid.container.MainModel',
|
10
|
+
|
11
|
+
fields: [{
|
12
|
+
name: 'country',
|
13
|
+
type: 'String'
|
14
|
+
}, {
|
15
|
+
name: 'firstname',
|
16
|
+
type: 'String'
|
17
|
+
}, {
|
18
|
+
name: 'githubId',
|
19
|
+
type: 'String'
|
20
|
+
}, {
|
21
|
+
name: 'lastname',
|
22
|
+
type: 'String'
|
23
|
+
}]
|
24
|
+
}}
|
25
|
+
}
|
26
|
+
|
27
|
+
Neo.applyClassConfig(MainModel);
|
28
|
+
|
29
|
+
export default MainModel;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import Store from '../../../src/data/Store.mjs';
|
2
|
+
import Model from './MainModel.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.grid.container.MainStore
|
6
|
+
* @extends Neo.data.Store
|
7
|
+
*/
|
8
|
+
class MainStore extends Store {
|
9
|
+
static getConfig() {return {
|
10
|
+
className : 'Neo.examples.grid.container.MainStore',
|
11
|
+
keyProperty: 'githubId',
|
12
|
+
model : Model,
|
13
|
+
|
14
|
+
data: [{
|
15
|
+
country : 'Germany',
|
16
|
+
firstname: 'Tobias',
|
17
|
+
githubId : 'tobiu',
|
18
|
+
lastname : 'Uhlig'
|
19
|
+
},
|
20
|
+
{
|
21
|
+
country : 'USA',
|
22
|
+
firstname: 'Rich',
|
23
|
+
githubId : 'rwaters',
|
24
|
+
lastname : 'Waters'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
country : 'Germany',
|
28
|
+
firstname: 'Nils',
|
29
|
+
githubId : 'mrsunshine',
|
30
|
+
lastname : 'Dehl'
|
31
|
+
},
|
32
|
+
{
|
33
|
+
country : 'USA',
|
34
|
+
firstname: 'Gerard',
|
35
|
+
githubId : 'camtnbikerrwc',
|
36
|
+
lastname : 'Horan'
|
37
|
+
},
|
38
|
+
{
|
39
|
+
country : 'Slovakia',
|
40
|
+
firstname: 'Jozef',
|
41
|
+
githubId : 'jsakalos',
|
42
|
+
lastname : 'Sakalos'
|
43
|
+
},
|
44
|
+
{
|
45
|
+
country : 'Germany',
|
46
|
+
firstname: 'Bastian',
|
47
|
+
githubId : 'bhaustein',
|
48
|
+
lastname : 'Haustein'
|
49
|
+
}]
|
50
|
+
}}
|
51
|
+
}
|
52
|
+
|
53
|
+
Neo.applyClassConfig(MainStore);
|
54
|
+
|
55
|
+
export default MainStore;
|
@@ -0,0 +1,11 @@
|
|
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>Neo GridContainer</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -10,16 +10,16 @@ class MainModel extends Model {
|
|
10
10
|
|
11
11
|
fields: [{
|
12
12
|
name: 'country',
|
13
|
-
type: '
|
13
|
+
type: 'String'
|
14
14
|
}, {
|
15
15
|
name: 'firstname',
|
16
|
-
type: '
|
16
|
+
type: 'String'
|
17
17
|
}, {
|
18
18
|
name: 'githubId',
|
19
|
-
type: '
|
19
|
+
type: 'String'
|
20
20
|
}, {
|
21
21
|
name: 'lastname',
|
22
|
-
type: '
|
22
|
+
type: 'String'
|
23
23
|
}]
|
24
24
|
}}
|
25
25
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.3",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -55,10 +55,10 @@
|
|
55
55
|
"neo-jsdoc": "^1.0.1",
|
56
56
|
"neo-jsdoc-x": "^1.0.4",
|
57
57
|
"postcss": "^8.4.16",
|
58
|
-
"sass": "^1.54.
|
58
|
+
"sass": "^1.54.9",
|
59
59
|
"webpack": "^5.74.0",
|
60
60
|
"webpack-cli": "^4.10.0",
|
61
|
-
"webpack-dev-server": "4.
|
61
|
+
"webpack-dev-server": "4.11.0",
|
62
62
|
"webpack-hook-plugin": "^1.0.7",
|
63
63
|
"webpack-node-externals": "^3.0.0"
|
64
64
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
.neo-grid-container {
|
2
2
|
border : 1px solid v(grid-container-border-color);
|
3
3
|
border-spacing: 0;
|
4
|
+
color : v(grid-container-color);
|
4
5
|
font-size : 13px;
|
5
6
|
font-weight : 400;
|
6
7
|
height : 100%;
|
@@ -32,7 +33,7 @@
|
|
32
33
|
|
33
34
|
.neo-grid-row:nth-child(even) {
|
34
35
|
.neo-grid-cell {
|
35
|
-
background-color:
|
36
|
+
background-color: v(grid-container-cell-background-color-even);
|
36
37
|
}
|
37
38
|
}
|
38
39
|
|
@@ -56,8 +57,8 @@
|
|
56
57
|
}
|
57
58
|
|
58
59
|
.neo-grid-cell, .neo-grid-header-cell {
|
59
|
-
border-bottom: 1px solid
|
60
|
-
border-right : 1px solid
|
60
|
+
border-bottom: 1px solid v(grid-container-border-color);
|
61
|
+
border-right : 1px solid v(grid-container-border-color);
|
61
62
|
height : inherit;
|
62
63
|
min-width : 300px;
|
63
64
|
|
@@ -73,7 +74,7 @@
|
|
73
74
|
|
74
75
|
.neo-grid-cell {
|
75
76
|
align-items : center;
|
76
|
-
background-color:
|
77
|
+
background-color: v(grid-container-cell-background-color);
|
77
78
|
display : flex;
|
78
79
|
height : 32px !important;
|
79
80
|
max-height : 32px !important;
|
@@ -5,7 +5,7 @@ import Store from '../../data/Store.mjs';
|
|
5
5
|
import VDomUtil from '../../util/VDom.mjs';
|
6
6
|
|
7
7
|
/**
|
8
|
-
* Provides a
|
8
|
+
* Provides a dropdown list to select one or multiple items
|
9
9
|
* @class Neo.form.field.Select
|
10
10
|
* @extends Neo.form.field.Picker
|
11
11
|
*/
|
package/src/grid/View.mjs
CHANGED
@@ -41,7 +41,7 @@ class View extends Component {
|
|
41
41
|
|
42
42
|
// console.log('createViewData', me.id, inputData);
|
43
43
|
|
44
|
-
if (container.selectionModel?.ntype === 'selection-
|
44
|
+
if (container.selectionModel?.ntype === 'selection-grid-rowmodel') {
|
45
45
|
selectedRows = container.selectionModel.items || [];
|
46
46
|
}
|
47
47
|
|
@@ -16,6 +16,16 @@ class Button extends BaseButton {
|
|
16
16
|
*/
|
17
17
|
field = null
|
18
18
|
|
19
|
+
static getStaticConfig() {return {
|
20
|
+
/**
|
21
|
+
* Valid values for align
|
22
|
+
* @member {String[]} alignValues: ['left', 'center', 'right']
|
23
|
+
* @protected
|
24
|
+
* @static
|
25
|
+
*/
|
26
|
+
alignValues: ['left', 'center', 'right']
|
27
|
+
}}
|
28
|
+
|
19
29
|
static getConfig() {return {
|
20
30
|
/**
|
21
31
|
* @member {String} className='Neo.grid.header.Button'
|
@@ -27,6 +37,11 @@ class Button extends BaseButton {
|
|
27
37
|
* @protected
|
28
38
|
*/
|
29
39
|
ntype: 'grid-header-button',
|
40
|
+
/**
|
41
|
+
* Alignment of the matching table cells. Valid values are left, center, right
|
42
|
+
* @member {String} align_='left'
|
43
|
+
*/
|
44
|
+
align_: 'left',
|
30
45
|
/**
|
31
46
|
* @member {String[]} cls=['neo-grid-header-button']
|
32
47
|
*/
|
@@ -98,6 +113,16 @@ class Button extends BaseButton {
|
|
98
113
|
});
|
99
114
|
}
|
100
115
|
|
116
|
+
/**
|
117
|
+
* Triggered before the align config gets changed
|
118
|
+
* @param {String} value
|
119
|
+
* @param {String} oldValue
|
120
|
+
* @protected
|
121
|
+
*/
|
122
|
+
beforeSetAlign(value, oldValue) {
|
123
|
+
return this.beforeSetEnumValue(value, oldValue, 'align', 'alignValues');
|
124
|
+
}
|
125
|
+
|
101
126
|
/**
|
102
127
|
* @protected
|
103
128
|
*/
|
@@ -66,13 +66,13 @@ class CellColumnModel extends CellModel {
|
|
66
66
|
* @param {Object} data
|
67
67
|
*/
|
68
68
|
onCellClick(data) {
|
69
|
-
let me
|
70
|
-
id
|
69
|
+
let me = this,
|
70
|
+
id = ColumnModel.getCellId(data.path),
|
71
71
|
columnNodeIds, index, tbodyNode;
|
72
72
|
|
73
73
|
if (id) {
|
74
74
|
index = ColumnModel.getColumnIndex(id, me.view.items[0].items);
|
75
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
75
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
76
76
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, index);
|
77
77
|
|
78
78
|
me.deselectAllCells(true);
|
@@ -91,15 +91,15 @@ class CellColumnModel extends CellModel {
|
|
91
91
|
idArray = ColumnModel.getCellId(data.path).split('__'),
|
92
92
|
currentColumn = idArray[2],
|
93
93
|
view = me.view,
|
94
|
-
|
95
|
-
newIndex = (
|
94
|
+
fields = view.columns.map(c => c.field),
|
95
|
+
newIndex = (fields.indexOf(currentColumn) + step) % fields.length,
|
96
96
|
columnNodeIds, tbodyNode;
|
97
97
|
|
98
98
|
while (newIndex < 0) {
|
99
|
-
newIndex +=
|
99
|
+
newIndex += fields.length;
|
100
100
|
}
|
101
101
|
|
102
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
102
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
103
103
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, newIndex);
|
104
104
|
|
105
105
|
me.deselectAllCells(true);
|
@@ -72,7 +72,7 @@ class CellColumnRowModel extends CellRowModel {
|
|
72
72
|
|
73
73
|
if (id) {
|
74
74
|
index = ColumnModel.getColumnIndex(id, me.view.items[0].items);
|
75
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
75
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
76
76
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, index);
|
77
77
|
|
78
78
|
me.deselectAllCells(true);
|
@@ -91,15 +91,15 @@ class CellColumnRowModel extends CellRowModel {
|
|
91
91
|
idArray = ColumnModel.getCellId(data.path).split('__'),
|
92
92
|
currentColumn = idArray[2],
|
93
93
|
view = me.view,
|
94
|
-
|
95
|
-
newIndex = (
|
94
|
+
fields = view.columns.map(c => c.field),
|
95
|
+
newIndex = (fields.indexOf(currentColumn) + step) % fields.length,
|
96
96
|
columnNodeIds, tbodyNode;
|
97
97
|
|
98
98
|
while (newIndex < 0) {
|
99
|
-
newIndex +=
|
99
|
+
newIndex += fields.length;
|
100
100
|
}
|
101
101
|
|
102
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
102
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
103
103
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, newIndex);
|
104
104
|
|
105
105
|
me.deselectAllCells(true);
|
@@ -45,21 +45,19 @@ class CellModel extends Model {
|
|
45
45
|
*/
|
46
46
|
onCellClick(data) {
|
47
47
|
let me = this,
|
48
|
-
id = null,
|
49
48
|
path = data.path,
|
50
49
|
i = 0,
|
51
|
-
len = path.length
|
50
|
+
len = path.length,
|
51
|
+
id;
|
52
52
|
|
53
53
|
for (; i < len; i++) {
|
54
|
-
if (path[i].
|
54
|
+
if (path[i].cls.includes('neo-grid-cell')) {
|
55
55
|
id = path[i].id;
|
56
56
|
break;
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
60
|
-
|
61
|
-
me.toggleSelection(id);
|
62
|
-
}
|
60
|
+
id && me.toggleSelection(id);
|
63
61
|
}
|
64
62
|
|
65
63
|
/**
|
@@ -99,7 +97,7 @@ class CellModel extends Model {
|
|
99
97
|
view = me.view,
|
100
98
|
idArray = data.path[0].id.split('__'),
|
101
99
|
currentColumn = idArray[2],
|
102
|
-
dataFields = view.columns.map(c => c.
|
100
|
+
dataFields = view.columns.map(c => c.field),
|
103
101
|
newIndex = (dataFields.indexOf(currentColumn) + step) % dataFields.length,
|
104
102
|
id;
|
105
103
|
|
@@ -148,14 +146,12 @@ class CellModel extends Model {
|
|
148
146
|
id = me.id,
|
149
147
|
view = me.view;
|
150
148
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
);
|
158
|
-
}
|
149
|
+
view.keys?._keys.push(
|
150
|
+
{fn: 'onKeyDownDown' ,key: 'Down' ,scope: id},
|
151
|
+
{fn: 'onKeyDownLeft' ,key: 'Left' ,scope: id},
|
152
|
+
{fn: 'onKeyDownRight' ,key: 'Right' ,scope: id},
|
153
|
+
{fn: 'onKeyDownUp' ,key: 'Up' ,scope: id}
|
154
|
+
);
|
159
155
|
}
|
160
156
|
|
161
157
|
/**
|
@@ -166,14 +162,12 @@ class CellModel extends Model {
|
|
166
162
|
id = me.id,
|
167
163
|
view = me.view;
|
168
164
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
]);
|
176
|
-
}
|
165
|
+
view.keys?.removeKeys([
|
166
|
+
{fn: 'onKeyDownDown' ,key: 'Down' ,scope: id},
|
167
|
+
{fn: 'onKeyDownLeft' ,key: 'Left' ,scope: id},
|
168
|
+
{fn: 'onKeyDownRight' ,key: 'Right' ,scope: id},
|
169
|
+
{fn: 'onKeyDownUp' ,key: 'Up' ,scope: id}
|
170
|
+
]);
|
177
171
|
|
178
172
|
super.unregister();
|
179
173
|
}
|
@@ -51,7 +51,7 @@ class ColumnModel extends Model {
|
|
51
51
|
len = eventPath.length;
|
52
52
|
|
53
53
|
for (; i < len; i++) {
|
54
|
-
if (eventPath[i].
|
54
|
+
if (eventPath[i].cls.includes('neo-grid-cell')) {
|
55
55
|
id = eventPath[i].id;
|
56
56
|
break;
|
57
57
|
}
|
@@ -61,15 +61,15 @@ class ColumnModel extends Model {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
/**
|
64
|
-
* todo: move to
|
64
|
+
* todo: move to grid.Container or view
|
65
65
|
* @param {String} cellId
|
66
|
-
* @param {
|
66
|
+
* @param {Object[]} columns
|
67
67
|
* @returns {Number} index
|
68
68
|
*/
|
69
69
|
static getColumnIndex(cellId, columns) {
|
70
70
|
let idArray = cellId.split('__'),
|
71
71
|
currentColumn = idArray[2],
|
72
|
-
dataFields = columns.map(c => c.
|
72
|
+
dataFields = columns.map(c => c.field);
|
73
73
|
|
74
74
|
return dataFields.indexOf(currentColumn);
|
75
75
|
}
|
@@ -78,13 +78,13 @@ class ColumnModel extends Model {
|
|
78
78
|
* @param {Object} data
|
79
79
|
*/
|
80
80
|
onCellClick(data) {
|
81
|
-
let me
|
82
|
-
id
|
81
|
+
let me = this,
|
82
|
+
id = ColumnModel.getCellId(data.path),
|
83
83
|
columnNodeIds, index, tbodyNode;
|
84
84
|
|
85
85
|
if (id) {
|
86
86
|
index = ColumnModel.getColumnIndex(id, me.view.items[0].items);
|
87
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
87
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
88
88
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, index);
|
89
89
|
|
90
90
|
me.select(columnNodeIds);
|
@@ -114,18 +114,18 @@ class ColumnModel extends Model {
|
|
114
114
|
idArray = ColumnModel.getCellId(data.path).split('__'),
|
115
115
|
currentColumn = idArray[2],
|
116
116
|
view = me.view,
|
117
|
-
|
118
|
-
newIndex = (
|
117
|
+
fields = view.columns.map(c => c.field),
|
118
|
+
newIndex = (fields.indexOf(currentColumn) + step) % fields.length,
|
119
119
|
columnNodeIds, id, tbodyNode;
|
120
120
|
|
121
121
|
while (newIndex < 0) {
|
122
|
-
newIndex +=
|
122
|
+
newIndex += fields.length;
|
123
123
|
}
|
124
124
|
|
125
|
-
idArray[2] =
|
125
|
+
idArray[2] = fields[newIndex];
|
126
126
|
id = idArray.join('__');
|
127
127
|
|
128
|
-
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {
|
128
|
+
tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {cls: 'neo-grid-view'}).vdom;
|
129
129
|
columnNodeIds = VDomUtil.getColumnNodesIds(tbodyNode, newIndex);
|
130
130
|
|
131
131
|
me.select(columnNodeIds);
|
@@ -142,17 +142,15 @@ class ColumnModel extends Model {
|
|
142
142
|
id = me.id,
|
143
143
|
view = me.view;
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
});
|
155
|
-
}
|
145
|
+
view.keys?._keys.push({
|
146
|
+
fn : 'onKeyDownLeft',
|
147
|
+
key : 'Left',
|
148
|
+
scope: id
|
149
|
+
}, {
|
150
|
+
fn : 'onKeyDownRight',
|
151
|
+
key : 'Right',
|
152
|
+
scope: id
|
153
|
+
});
|
156
154
|
}
|
157
155
|
|
158
156
|
|
@@ -164,17 +162,15 @@ class ColumnModel extends Model {
|
|
164
162
|
id = me.id,
|
165
163
|
view = me.view;
|
166
164
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
}]);
|
177
|
-
}
|
165
|
+
view.keys?.removeKeys([{
|
166
|
+
fn : 'onKeyDownLeft',
|
167
|
+
key : 'Left',
|
168
|
+
scope: id
|
169
|
+
}, {
|
170
|
+
fn : 'onKeyDownRight',
|
171
|
+
key : 'Right',
|
172
|
+
scope: id
|
173
|
+
}]);
|
178
174
|
|
179
175
|
super.unregister();
|
180
176
|
}
|