neo.mjs 4.1.1 → 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.
Files changed (30) hide show
  1. package/apps/realworld/view/FooterComponent.mjs +5 -5
  2. package/apps/realworld/view/HeaderComponent.mjs +30 -30
  3. package/apps/realworld/view/HomeComponent.mjs +4 -4
  4. package/apps/realworld/view/MainContainerController.mjs +4 -4
  5. package/apps/realworld/view/article/Component.mjs +2 -2
  6. package/apps/realworld/view/article/PreviewComponent.mjs +1 -1
  7. package/apps/realworld/view/article/TagListComponent.mjs +2 -2
  8. package/apps/realworld2/view/MainContainer.mjs +1 -1
  9. package/apps/realworld2/view/MainContainerController.mjs +2 -2
  10. package/buildScripts/addConfig.mjs +400 -0
  11. package/buildScripts/createApp.mjs +3 -3
  12. package/buildScripts/createClass.mjs +15 -7
  13. package/examples/grid/container/MainContainer.mjs +102 -0
  14. package/examples/grid/container/MainModel.mjs +29 -0
  15. package/examples/grid/container/MainStore.mjs +55 -0
  16. package/examples/grid/container/app.mjs +6 -0
  17. package/examples/grid/container/index.html +11 -0
  18. package/examples/grid/container/neo-config.json +7 -0
  19. package/examples/table/container/MainModel.mjs +4 -4
  20. package/package.json +4 -3
  21. package/resources/scss/src/grid/Container.scss +6 -5
  22. package/resources/scss/src/grid/header/Button.scss +6 -0
  23. package/resources/scss/src/grid/header/Toolbar.scss +2 -0
  24. package/src/data/connection/WebSocket.mjs +1 -0
  25. package/src/grid/View.mjs +2 -2
  26. package/src/grid/header/Button.mjs +25 -0
  27. package/src/selection/grid/CellColumnModel.mjs +7 -7
  28. package/src/selection/grid/CellColumnRowModel.mjs +5 -5
  29. package/src/selection/grid/CellModel.mjs +17 -23
  30. package/src/selection/grid/ColumnModel.mjs +30 -34
@@ -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
  }