neo.mjs 4.2.0 → 4.2.1

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.
@@ -15,12 +15,12 @@ class FooterComponent extends Component {
15
15
  * @member {Object} _vdom
16
16
  */
17
17
  _vdom:
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 &amp; design licensed under MIT.'}
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 &amp; 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
- {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: '&nbsp;New Article'}
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: '&nbsp;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: '&nbsp;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: '&nbsp;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: '&nbsp;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: '&nbsp;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 : name
450
+ name
451
451
  });
452
452
  } else {
453
453
  Object.assign(feeds[2], {
454
454
  active: true,
455
- name : 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: 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 : module.default,
410
- parentId : me.component.id,
411
- reference: reference
409
+ module : module.default,
410
+ parentId: me.component.id,
411
+ reference
412
412
  });
413
413
  }
414
414
 
@@ -233,8 +233,8 @@ class Component extends BaseComponent {
233
233
 
234
234
  VDomUtil.getByFlag(vdom, 'body').cn[0] = {
235
235
  cn: [{
236
- tag : 'p',
237
- html: html
236
+ tag: 'p',
237
+ html
238
238
  }]
239
239
  };
240
240
 
@@ -267,7 +267,7 @@ class PreviewComponent extends Component {
267
267
  favorited = !me.favorited;
268
268
 
269
269
  me.set({
270
- favorited : favorited,
270
+ favorited,
271
271
  favoritesCount: favorited ? (me.favoritesCount + 1) : (me.favoritesCount - 1)
272
272
  });
273
273
  }
@@ -78,8 +78,8 @@ class TagListComponent extends Component {
78
78
  afterSetActiveTag(value, oldValue) {
79
79
  if (oldValue !== undefined) {
80
80
  this.fire('tagChange', {
81
- oldValue: oldValue,
82
- value : value
81
+ oldValue,
82
+ value
83
83
  });
84
84
  }
85
85
  }
@@ -46,7 +46,7 @@ class MainContainer extends Viewport {
46
46
  ntype : 'container',
47
47
  flex : 1,
48
48
  items : [],
49
- layout : {ntype: 'card'},
49
+ layout : {ntype: 'card', activeIndex: null},
50
50
  reference: 'cards'
51
51
  }, {
52
52
  module: FooterComponent
@@ -209,8 +209,8 @@ class MainContainerController extends ComponentController {
209
209
 
210
210
  if (!card) {
211
211
  card = me.getReference('cards').add({
212
- module : module,
213
- reference: reference
212
+ module,
213
+ reference
214
214
  });
215
215
  }
216
216
 
@@ -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 {${opts.type}} value`
83
+ ` * @param {${type}} value`
82
84
  ];
83
85
 
84
86
  if (opts.oldValueParam) {
85
87
  method.push(
86
- ` * @param {${opts.type}} oldValue`
88
+ ` * @param {${type}} oldValue`
87
89
  );
88
90
  }
89
91
 
90
92
  if (opts.returnValue) {
91
93
  method.push(
92
- ` * @returns {${opts.type}}`
94
+ ` * @returns {${type}}`
93
95
  );
94
96
  }
95
97
 
96
98
  method.push(
97
- ' * @protected',
98
- ' */'
99
+ ' * @protected',
100
+ ' */'
99
101
  );
100
102
 
101
103
  if (opts.oldValueParam) {
102
104
  method.push(
103
- ` ${opts.name}(value, oldValue) {`
105
+ ` ${name}(value, oldValue) {`
104
106
  );
105
107
  } else {
106
108
  method.push(
107
- ` ${opts.name}(value) {`
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 > opts.name) {
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,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.grid.container'
6
+ });
@@ -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>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/grid/container/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["Stylesheet"]
7
+ }
@@ -10,16 +10,16 @@ class MainModel extends Model {
10
10
 
11
11
  fields: [{
12
12
  name: 'country',
13
- type: 'string'
13
+ type: 'String'
14
14
  }, {
15
15
  name: 'firstname',
16
- type: 'string'
16
+ type: 'String'
17
17
  }, {
18
18
  name: 'githubId',
19
- type: 'string'
19
+ type: 'String'
20
20
  }, {
21
21
  name: 'lastname',
22
- type: 'string'
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.0",
3
+ "version": "4.2.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -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: #323232;
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 #2b2b2b;
60
- border-right : 1px solid #2b2b2b;
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: #3c3f41;
77
+ background-color: v(grid-container-cell-background-color);
77
78
  display : flex;
78
79
  height : 32px !important;
79
80
  max-height : 32px !important;
@@ -17,6 +17,7 @@ class Socket extends Base {
17
17
  maxReconnectAttempts = 5
18
18
  /**
19
19
  * @member {Object} messageCallbacks={}
20
+ * @protected
20
21
  */
21
22
  messageCallbacks = {}
22
23
  /**
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-table-rowmodel') {
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 = this,
70
- id = ColumnModel.getCellId(data.path),
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, {tag: 'tbody'}).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
- dataFields = view.columns.map(c => c.dataField),
95
- newIndex = (dataFields.indexOf(currentColumn) + step) % dataFields.length,
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 += dataFields.length;
99
+ newIndex += fields.length;
100
100
  }
101
101
 
102
- tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {tag: 'tbody'}).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, {tag: 'tbody'}).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
- dataFields = view.columns.map(c => c.dataField),
95
- newIndex = (dataFields.indexOf(currentColumn) + step) % dataFields.length,
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 += dataFields.length;
99
+ newIndex += fields.length;
100
100
  }
101
101
 
102
- tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {tag: 'tbody'}).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].tagName === 'td') {
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
- if (id) {
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.dataField),
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
- if (view.keys) {
152
- view.keys._keys.push(
153
- {fn: 'onKeyDownDown' ,key: 'Down' ,scope: id},
154
- {fn: 'onKeyDownLeft' ,key: 'Left' ,scope: id},
155
- {fn: 'onKeyDownRight' ,key: 'Right' ,scope: id},
156
- {fn: 'onKeyDownUp' ,key: 'Up' ,scope: id}
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
- if (view.keys) {
170
- view.keys.removeKeys([
171
- {fn: 'onKeyDownDown' ,key: 'Down' ,scope: id},
172
- {fn: 'onKeyDownLeft' ,key: 'Left' ,scope: id},
173
- {fn: 'onKeyDownRight' ,key: 'Right' ,scope: id},
174
- {fn: 'onKeyDownUp' ,key: 'Up' ,scope: id}
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].tagName === 'td') {
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 table.Container or view
64
+ * todo: move to grid.Container or view
65
65
  * @param {String} cellId
66
- * @param {Array} columns
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.dataField);
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 = this,
82
- id = ColumnModel.getCellId(data.path),
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, {tag: 'tbody'}).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
- dataFields = view.columns.map(c => c.dataField),
118
- newIndex = (dataFields.indexOf(currentColumn) + step) % dataFields.length,
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 += dataFields.length;
122
+ newIndex += fields.length;
123
123
  }
124
124
 
125
- idArray[2] = dataFields[newIndex];
125
+ idArray[2] = fields[newIndex];
126
126
  id = idArray.join('__');
127
127
 
128
- tbodyNode = VDomUtil.findVdomChild(me.view.vdom, {tag: 'tbody'}).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
- if (view.keys) {
146
- view.keys._keys.push({
147
- fn : 'onKeyDownLeft',
148
- key : 'Left',
149
- scope: id
150
- }, {
151
- fn : 'onKeyDownRight',
152
- key : 'Right',
153
- scope: id
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
- if (view.keys) {
168
- view.keys.removeKeys([{
169
- fn : 'onKeyDownLeft',
170
- key : 'Left',
171
- scope: id
172
- }, {
173
- fn : 'onKeyDownRight',
174
- key : 'Right',
175
- scope: id
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
  }