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.
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/ContentComponent.mjs +1 -13
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/bigData/MainStore.mjs +12 -58
- package/examples/grid/cellEditing/MainContainer.mjs +10 -7
- package/examples/grid/container/MainContainer.mjs +26 -11
- package/examples/table/nestedRecordFields/EditUserDialog.mjs +25 -8
- package/examples/table/nestedRecordFields/MainContainerStateProvider.mjs +2 -2
- package/examples/table/nestedRecordFields/MainModel.mjs +3 -3
- package/package.json +3 -3
- package/resources/data/deck/learnneo/pages/tutorials/TodoList.md +1 -1
- package/resources/data/deck/training/pages/2023-02-05T17-44-53-815Z.md +6 -6
- package/resources/scss/src/apps/portal/examples/TabContainer.scss +5 -1
- package/resources/scss/src/grid/View.scss +4 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/Neo.mjs +4 -4
- package/src/component/Base.mjs +38 -11
- package/src/data/Model.mjs +69 -11
- package/src/data/RecordFactory.mjs +82 -55
- package/src/data/Store.mjs +1 -2
- package/src/dialog/Base.mjs +2 -0
- package/src/grid/Container.mjs +0 -40
- package/src/grid/View.mjs +64 -34
- package/src/grid/header/Button.mjs +2 -2
- package/src/grid/header/Toolbar.mjs +4 -2
- package/src/selection/Model.mjs +2 -2
- package/src/selection/grid/RowModel.mjs +16 -47
- package/src/table/View.mjs +2 -2
package/src/selection/Model.mjs
CHANGED
@@ -189,11 +189,11 @@ class Model extends Base {
|
|
189
189
|
*/
|
190
190
|
register(component) {
|
191
191
|
let me = this,
|
192
|
-
cls = component.
|
192
|
+
cls = component.wrapperCls || [];
|
193
193
|
|
194
194
|
if (me.cls && !cls.includes(me.cls)) {
|
195
195
|
cls.push(me.cls);
|
196
|
-
component.
|
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(
|
51
|
+
this.onNavKeyRow(1)
|
85
52
|
}
|
86
53
|
|
87
54
|
/**
|
88
55
|
* @param {Object} data
|
89
56
|
*/
|
90
57
|
onKeyDownUp(data) {
|
91
|
-
this.onNavKeyRow(
|
58
|
+
this.onNavKeyRow(-1)
|
92
59
|
}
|
93
60
|
|
94
61
|
/**
|
95
|
-
* @param {Object} data
|
96
62
|
* @param {Number} step
|
97
63
|
*/
|
98
|
-
onNavKeyRow(
|
64
|
+
onNavKeyRow(step) {
|
99
65
|
let me = this,
|
100
|
-
node = RowModel.getRowNode(data.path),
|
101
66
|
{view} = me,
|
102
67
|
{store} = view,
|
103
|
-
|
104
|
-
newIndex
|
105
|
-
|
106
|
-
|
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
|
-
|
81
|
+
newRecord = store.getAt(newIndex);
|
82
|
+
rowId = view.getRowId(newRecord);
|
113
83
|
|
114
|
-
if (
|
115
|
-
me.select(
|
116
|
-
view.focus(id);
|
84
|
+
if (rowId) {
|
85
|
+
me.select(rowId);
|
117
86
|
|
118
87
|
view.fire('select', {
|
119
88
|
record: store.getAt(newIndex)
|
package/src/table/View.mjs
CHANGED
@@ -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 =
|
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 &&
|
209
|
+
if (selectedRows && record[me.selectedRecordField]) {
|
210
210
|
NeoArray.add(selectedRows, id)
|
211
211
|
}
|
212
212
|
|