neo.mjs 8.4.2 → 8.6.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.
@@ -189,11 +189,11 @@ class Model extends Base {
189
189
  */
190
190
  register(component) {
191
191
  let me = this,
192
- cls = component.cls || [];
192
+ cls = component.wrapperCls || [];
193
193
 
194
194
  if (me.cls && !cls.includes(me.cls)) {
195
195
  cls.push(me.cls);
196
- component.cls = cls
196
+ component.wrapperCls = cls
197
197
  }
198
198
 
199
199
  me.view = component;
@@ -30,7 +30,7 @@ class RowModel extends BaseModel {
30
30
  addDomListener() {
31
31
  let me = this;
32
32
 
33
- me.view.on('rowClick', me.onRowClick, me)
33
+ me.view.gridContainer.on('rowClick', me.onRowClick, me)
34
34
  }
35
35
 
36
36
  /**
@@ -44,76 +44,45 @@ class RowModel extends BaseModel {
44
44
  super.destroy(...args)
45
45
  }
46
46
 
47
- /**
48
- * Finds the matching table row for a given row index
49
- * @param {Number} index row index
50
- * @returns {String|null} The table row node id
51
- */
52
- getRowId(index) {
53
- if (index < 0 || this.view.store.getCount() < index) {
54
- return null
55
- }
56
-
57
- return this.view.vdom.cn[0].cn[1].cn[index].id
58
- }
59
-
60
- /**
61
- * Finds the matching table row for a given event path
62
- * @param {Object} path The event path
63
- * @returns {Object|null} The node containing the table row class or null
64
- * @protected
65
- */
66
- static getRowNode(path) {
67
- let i = 0,
68
- len = path.length,
69
- node = null;
70
-
71
- for (; i < len; i++) {
72
- if (path[i].cls.includes('neo-grid-row')) {
73
- node = path[i]
74
- }
75
- }
76
-
77
- return node
78
- }
79
-
80
47
  /**
81
48
  * @param {Object} data
82
49
  */
83
50
  onKeyDownDown(data) {
84
- this.onNavKeyRow(data, 1)
51
+ this.onNavKeyRow(1)
85
52
  }
86
53
 
87
54
  /**
88
55
  * @param {Object} data
89
56
  */
90
57
  onKeyDownUp(data) {
91
- this.onNavKeyRow(data, -1)
58
+ this.onNavKeyRow(-1)
92
59
  }
93
60
 
94
61
  /**
95
- * @param {Object} data
96
62
  * @param {Number} step
97
63
  */
98
- onNavKeyRow(data, step) {
64
+ onNavKeyRow(step) {
99
65
  let me = this,
100
- node = RowModel.getRowNode(data.path),
101
66
  {view} = me,
102
67
  {store} = view,
103
- vdomNode = VDomUtil.find(view.vdom, node.id),
104
- newIndex = (vdomNode.index + step) % store.getCount(),
105
- {parentNode} = vdomNode,
106
- id;
68
+ currentIndex = 0,
69
+ newIndex, newRecord, rowId;
70
+
71
+ if (me.hasSelection()) {
72
+ currentIndex = store.indexOf(view.getRecordByRowId(me.items[0]))
73
+ }
74
+
75
+ newIndex = (currentIndex + step) % store.getCount();
107
76
 
108
77
  while (newIndex < 0) {
109
78
  newIndex += store.getCount()
110
79
  }
111
80
 
112
- id = parentNode.cn[newIndex].id;
81
+ newRecord = store.getAt(newIndex);
82
+ rowId = view.getRowId(newRecord);
113
83
 
114
- if (id) {
115
- me.select(id);
116
- view.focus(id);
84
+ if (rowId) {
85
+ me.select(rowId);
117
86
 
118
87
  view.fire('select', {
119
88
  record: store.getAt(newIndex)
@@ -104,7 +104,7 @@ class View extends Component {
104
104
  cellCls = ['neo-table-cell'],
105
105
  colspan = record[me.colspanField],
106
106
  {dataField} = column,
107
- fieldValue = Neo.ns(dataField, false, record),
107
+ fieldValue = record[dataField],
108
108
  hasStore = tableContainer.store?.model, // todo: remove as soon as all tables use stores (examples table)
109
109
  {vdom} = me,
110
110
  cellConfig, rendererOutput;
@@ -206,7 +206,7 @@ class View extends Component {
206
206
 
207
207
  me.recordVnodeMap[id] = rowIndex;
208
208
 
209
- if (selectedRows && Neo.ns(me.selectedRecordField, false, record)) {
209
+ if (selectedRows && record[me.selectedRecordField]) {
210
210
  NeoArray.add(selectedRows, id)
211
211
  }
212
212