neo.mjs 8.22.0 → 8.24.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/README.md +5 -0
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FeatureSection.mjs +4 -4
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/home/MainContainer.mjs +7 -7
- package/apps/portal/view/home/parts/MainNeo.mjs +35 -4
- package/examples/ConfigurationViewport.mjs +21 -8
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/magicmovetext/MainContainer.mjs +92 -0
- package/examples/component/magicmovetext/app.mjs +6 -0
- package/examples/component/magicmovetext/index.html +11 -0
- package/examples/component/magicmovetext/neo-config.json +6 -0
- package/examples/grid/bigData/GridContainer.mjs +3 -0
- package/package.json +2 -2
- package/resources/scss/src/apps/portal/home/parts/MainNeo.scss +30 -0
- package/resources/scss/src/component/MagicMoveText.scss +39 -0
- package/resources/scss/src/examples/ConfigurationViewport.scss +27 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/MagicMoveText.mjs +494 -0
- package/src/data/Store.mjs +12 -0
- package/src/grid/Container.mjs +78 -25
- package/src/grid/View.mjs +89 -74
- package/src/grid/header/Toolbar.mjs +2 -3
- package/src/selection/grid/CellModel.mjs +8 -4
- package/src/selection/grid/RowModel.mjs +2 -2
- package/resources/scss/src/examples/ConfigurationPanel.scss +0 -25
package/src/grid/View.mjs
CHANGED
@@ -81,6 +81,12 @@ class GridView extends Component {
|
|
81
81
|
* @member {Object} keys
|
82
82
|
*/
|
83
83
|
keys: {},
|
84
|
+
/**
|
85
|
+
* Stores the indexes of the first & last mounted columns, including bufferColumnRange
|
86
|
+
* @member {Number[]} mountedColumns_=[0,0]
|
87
|
+
* @protected
|
88
|
+
*/
|
89
|
+
mountedColumns_: [0, 0],
|
84
90
|
/**
|
85
91
|
* Stores the indexes of the first & last mounted rows, including bufferRowRange
|
86
92
|
* @member {Number[]} mountedRows=[0,0]
|
@@ -118,10 +124,10 @@ class GridView extends Component {
|
|
118
124
|
store_: null,
|
119
125
|
/**
|
120
126
|
* Stores the indexes of the first & last painted columns
|
121
|
-
* @member {Number[]}
|
127
|
+
* @member {Number[]} visibleColumns=[0,0]
|
122
128
|
* @protected
|
123
129
|
*/
|
124
|
-
|
130
|
+
visibleColumns: [0, 0],
|
125
131
|
/**
|
126
132
|
* Stores the indexes of the first & last visible rows, excluding bufferRowRange
|
127
133
|
* @member {Number[]} visibleRows=[0,0]
|
@@ -136,9 +142,9 @@ class GridView extends Component {
|
|
136
142
|
* @member {Object} _vdom
|
137
143
|
*/
|
138
144
|
_vdom:
|
139
|
-
|
140
|
-
|
141
|
-
|
145
|
+
{tabIndex: '-1', cn: [
|
146
|
+
{cn: []}
|
147
|
+
]}
|
142
148
|
}
|
143
149
|
|
144
150
|
/**
|
@@ -229,9 +235,7 @@ class GridView extends Component {
|
|
229
235
|
* @protected
|
230
236
|
*/
|
231
237
|
afterSetAvailableRows(value, oldValue) {
|
232
|
-
|
233
|
-
this.createViewData()
|
234
|
-
}
|
238
|
+
value > 0 && this.createViewData()
|
235
239
|
}
|
236
240
|
|
237
241
|
/**
|
@@ -277,9 +281,7 @@ class GridView extends Component {
|
|
277
281
|
* @protected
|
278
282
|
*/
|
279
283
|
afterSetContainerWidth(value, oldValue) {
|
280
|
-
|
281
|
-
this.updateVisibleColumns()
|
282
|
-
}
|
284
|
+
value > 0 && this.updateMountedAndVisibleColumns()
|
283
285
|
}
|
284
286
|
|
285
287
|
/**
|
@@ -305,6 +307,16 @@ class GridView extends Component {
|
|
305
307
|
this.toggleCls('neo-is-scrolling', value)
|
306
308
|
}
|
307
309
|
|
310
|
+
/**
|
311
|
+
* Triggered after the mountedColumns config got changed
|
312
|
+
* @param {Number[]} value
|
313
|
+
* @param {Number[]} oldValue
|
314
|
+
* @protected
|
315
|
+
*/
|
316
|
+
afterSetMountedColumns(value, oldValue) {
|
317
|
+
oldValue && this.createViewData()
|
318
|
+
}
|
319
|
+
|
308
320
|
/**
|
309
321
|
* Triggered after the rowHeight config got changed
|
310
322
|
* @param {Number} value
|
@@ -327,7 +339,7 @@ class GridView extends Component {
|
|
327
339
|
newStartIndex;
|
328
340
|
|
329
341
|
if (value.x !== oldValue?.x) {
|
330
|
-
me.
|
342
|
+
me.updateMountedAndVisibleColumns()
|
331
343
|
}
|
332
344
|
|
333
345
|
if (value.y !== oldValue?.y) {
|
@@ -362,18 +374,6 @@ class GridView extends Component {
|
|
362
374
|
oldValue !== undefined && this.createViewData()
|
363
375
|
}
|
364
376
|
|
365
|
-
/**
|
366
|
-
* Triggered after the visibleColumns config got changed
|
367
|
-
* @param {Number[]} value
|
368
|
-
* @param {Number[]} oldValue
|
369
|
-
* @protected
|
370
|
-
*/
|
371
|
-
afterSetVisibleColumns(value, oldValue) {
|
372
|
-
if (oldValue !== undefined) {
|
373
|
-
this.createViewData()
|
374
|
-
}
|
375
|
-
}
|
376
|
-
|
377
377
|
/**
|
378
378
|
* @param {Object} data
|
379
379
|
* @param {String} [data.cellId]
|
@@ -516,12 +516,12 @@ class GridView extends Component {
|
|
516
516
|
}
|
517
517
|
|
518
518
|
let me = this,
|
519
|
-
{
|
519
|
+
{mountedColumns, selectedRows} = me,
|
520
520
|
gridContainer = me.parent,
|
521
521
|
columns = gridContainer.headerToolbar.items,
|
522
522
|
id = me.getRowId(record, rowIndex),
|
523
523
|
rowCls = me.getRowClass(record, rowIndex),
|
524
|
-
config, column, columnPosition,
|
524
|
+
config, column, columnPosition, gridRow, i;
|
525
525
|
|
526
526
|
if (rowIndex % 2 !== 0) {
|
527
527
|
rowCls.push('neo-even')
|
@@ -549,10 +549,7 @@ class GridView extends Component {
|
|
549
549
|
}
|
550
550
|
};
|
551
551
|
|
552
|
-
|
553
|
-
startIndex = Math.max(0, visibleColumns[0] - bufferColumnRange);
|
554
|
-
|
555
|
-
for (i=startIndex; i <= endIndex; i++) {
|
552
|
+
for (i=mountedColumns[0]; i <= mountedColumns[1]; i++) {
|
556
553
|
column = columns[i];
|
557
554
|
config = me.applyRendererOutput({column, columnIndex: i, record, rowIndex});
|
558
555
|
|
@@ -593,7 +590,7 @@ class GridView extends Component {
|
|
593
590
|
me.availableRows < 1 ||
|
594
591
|
me._containerWidth < 1 || // we are not checking me.containerWidth, since we want to ignore the config symbol
|
595
592
|
me.columnPositions.getCount() < 1 ||
|
596
|
-
me.
|
593
|
+
me.mountedColumns[1] < 1
|
597
594
|
) {
|
598
595
|
return
|
599
596
|
}
|
@@ -729,6 +726,7 @@ class GridView extends Component {
|
|
729
726
|
|
730
727
|
/**
|
731
728
|
* Get the matching record by passing a row id, a cell id or an id inside a grid cell.
|
729
|
+
* Limited to mounted rows (must be inside the vdom).
|
732
730
|
* @param {String} nodeId
|
733
731
|
* @returns {Object|null}
|
734
732
|
*/
|
@@ -743,7 +741,7 @@ class GridView extends Component {
|
|
743
741
|
|
744
742
|
parentNodes = VDomUtil.getParentNodes(me.vdom, nodeId);
|
745
743
|
|
746
|
-
for (node of parentNodes) {
|
744
|
+
for (node of parentNodes || []) {
|
747
745
|
record = me.getRecordByRowId(node.id);
|
748
746
|
|
749
747
|
if (record) {
|
@@ -754,6 +752,22 @@ class GridView extends Component {
|
|
754
752
|
return null
|
755
753
|
}
|
756
754
|
|
755
|
+
/**
|
756
|
+
* @param {String} cellId
|
757
|
+
* @returns {Record}
|
758
|
+
*/
|
759
|
+
getRecordByCellId(cellId) {
|
760
|
+
let recordId = cellId.split('__')[1],
|
761
|
+
{store} = this,
|
762
|
+
keyType = store.getKeyType();
|
763
|
+
|
764
|
+
if (keyType === 'int' || keyType === 'integer') {
|
765
|
+
recordId = parseInt(recordId)
|
766
|
+
}
|
767
|
+
|
768
|
+
return store.get(recordId)
|
769
|
+
}
|
770
|
+
|
757
771
|
/**
|
758
772
|
* @param {String} rowId
|
759
773
|
* @returns {Record}
|
@@ -761,9 +775,7 @@ class GridView extends Component {
|
|
761
775
|
getRecordByRowId(rowId) {
|
762
776
|
let recordId = rowId.split('__')[2],
|
763
777
|
{store} = this,
|
764
|
-
|
765
|
-
keyField = model?.getField(store.getKeyProperty()),
|
766
|
-
keyType = keyField?.type?.toLowerCase();
|
778
|
+
keyType = store.getKeyType();
|
767
779
|
|
768
780
|
if (keyType === 'int' || keyType === 'integer') {
|
769
781
|
recordId = parseInt(recordId)
|
@@ -1020,16 +1032,42 @@ class GridView extends Component {
|
|
1020
1032
|
}
|
1021
1033
|
|
1022
1034
|
/**
|
1023
|
-
*
|
1035
|
+
*
|
1024
1036
|
*/
|
1025
|
-
|
1026
|
-
let me
|
1027
|
-
|
1028
|
-
{
|
1037
|
+
updateMountedAndVisibleColumns() {
|
1038
|
+
let me = this,
|
1039
|
+
{bufferColumnRange, columnPositions, mountedColumns, visibleColumns} = me,
|
1040
|
+
{x} = me.scrollPosition,
|
1041
|
+
i = 0,
|
1042
|
+
countColumns = columnPositions.getCount(),
|
1043
|
+
endIndex = countColumns - 1,
|
1044
|
+
column, startIndex;
|
1029
1045
|
|
1030
|
-
if (
|
1031
|
-
|
1032
|
-
|
1046
|
+
if (countColumns < 1) {
|
1047
|
+
return
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
for (; i < countColumns; i++) {
|
1051
|
+
column = columnPositions.getAt(i);
|
1052
|
+
|
1053
|
+
if (x >= column.x && x <= column.x + column.width) {
|
1054
|
+
startIndex = i
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
if (me.containerWidth + x < column.x) {
|
1058
|
+
endIndex = i - 1;
|
1059
|
+
break
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
visibleColumns[0] = startIndex; // update the array inline
|
1064
|
+
visibleColumns[1] = endIndex;
|
1065
|
+
|
1066
|
+
if (visibleColumns[0] <= mountedColumns[0] || visibleColumns[1] >= mountedColumns[1]) {
|
1067
|
+
startIndex = Math.max(0, visibleColumns[0] - bufferColumnRange);
|
1068
|
+
endIndex = Math.min(countColumns - 1, visibleColumns[1] + bufferColumnRange);
|
1069
|
+
|
1070
|
+
me.mountedColumns = [startIndex, endIndex]
|
1033
1071
|
}
|
1034
1072
|
}
|
1035
1073
|
|
@@ -1053,39 +1091,16 @@ class GridView extends Component {
|
|
1053
1091
|
}
|
1054
1092
|
|
1055
1093
|
/**
|
1056
|
-
*
|
1094
|
+
* @param {Boolean} silent=false
|
1057
1095
|
*/
|
1058
|
-
|
1059
|
-
let me
|
1060
|
-
|
1061
|
-
{
|
1062
|
-
i = 0,
|
1063
|
-
len = columnPositions.getCount(),
|
1064
|
-
endIndex = len - 1,
|
1065
|
-
column, startIndex;
|
1066
|
-
|
1067
|
-
if (len < 1) {
|
1068
|
-
return
|
1069
|
-
}
|
1070
|
-
|
1071
|
-
for (; i < len; i++) {
|
1072
|
-
column = columnPositions.getAt(i);
|
1073
|
-
|
1074
|
-
if (x >= column.x && x <= column.x + column.width) {
|
1075
|
-
startIndex = i
|
1076
|
-
}
|
1077
|
-
|
1078
|
-
if (me.containerWidth + x < column.x) {
|
1079
|
-
endIndex = i - 1;
|
1080
|
-
break
|
1081
|
-
}
|
1082
|
-
}
|
1096
|
+
updateScrollHeight(silent=false) {
|
1097
|
+
let me = this,
|
1098
|
+
countRecords = me.store.getCount(),
|
1099
|
+
{rowHeight} = me;
|
1083
1100
|
|
1084
|
-
if (
|
1085
|
-
|
1086
|
-
me.
|
1087
|
-
) {
|
1088
|
-
me.visibleColumns = [startIndex, endIndex]
|
1101
|
+
if (countRecords > 0 && rowHeight > 0) {
|
1102
|
+
me.vdom.cn[0].height = `${(countRecords + 1) * rowHeight}px`;
|
1103
|
+
!silent && me.update()
|
1089
1104
|
}
|
1090
1105
|
}
|
1091
1106
|
}
|
@@ -229,16 +229,15 @@ class Toolbar extends BaseToolbar {
|
|
229
229
|
availableWidth: lastItem.x + lastItem.width - rects[0].x
|
230
230
|
});
|
231
231
|
|
232
|
-
!silent && view.
|
232
|
+
!silent && view.updateMountedAndVisibleColumns()
|
233
233
|
}
|
234
234
|
}
|
235
235
|
|
236
236
|
/**
|
237
237
|
* @param {Number} index
|
238
|
-
* @param {DOMRect} itemRect
|
239
238
|
* @returns {Promise<void>}
|
240
239
|
*/
|
241
|
-
async scrollToIndex(index
|
240
|
+
async scrollToIndex(index) {
|
242
241
|
await Neo.main.DomAccess.scrollIntoView({
|
243
242
|
delay : 125,
|
244
243
|
id : this.items[index].id,
|
@@ -85,7 +85,7 @@ class CellModel extends BaseModel {
|
|
85
85
|
let me = this,
|
86
86
|
{dataFields, view} = me,
|
87
87
|
{store} = view,
|
88
|
-
currentColumn, newIndex, record;
|
88
|
+
currentColumn, currentIndex, newIndex, record;
|
89
89
|
|
90
90
|
if (me.hasSelection()) {
|
91
91
|
currentColumn = view.getDataField(me.items[0]);
|
@@ -95,13 +95,16 @@ class CellModel extends BaseModel {
|
|
95
95
|
record = store.getAt(0)
|
96
96
|
}
|
97
97
|
|
98
|
-
|
98
|
+
currentIndex = dataFields.indexOf(currentColumn);
|
99
|
+
newIndex = (currentIndex + step) % dataFields.length;
|
99
100
|
|
100
101
|
while (newIndex < 0) {
|
101
102
|
newIndex += dataFields.length
|
102
103
|
}
|
103
104
|
|
104
|
-
me.select(view.getCellId(record, dataFields[newIndex]))
|
105
|
+
me.select(view.getCellId(record, dataFields[newIndex]));
|
106
|
+
|
107
|
+
view.parent.scrollByColumns(currentIndex, step)
|
105
108
|
}
|
106
109
|
|
107
110
|
/**
|
@@ -127,7 +130,8 @@ class CellModel extends BaseModel {
|
|
127
130
|
newIndex += store.getCount()
|
128
131
|
}
|
129
132
|
|
130
|
-
me.select(view.getCellId(store.getAt(newIndex), dataField))
|
133
|
+
me.select(view.getCellId(store.getAt(newIndex), dataField));
|
134
|
+
view.scrollByRows(currentIndex, step)
|
131
135
|
}
|
132
136
|
|
133
137
|
/**
|
@@ -1,25 +0,0 @@
|
|
1
|
-
.neo-configuration-panel {
|
2
|
-
transition: width .5s ease-in-out;
|
3
|
-
|
4
|
-
.neo-details-label {
|
5
|
-
background-color: #323232;
|
6
|
-
color : #ddd;
|
7
|
-
font-size : 13px;
|
8
|
-
margin : 10px;
|
9
|
-
padding : 10px;
|
10
|
-
white-space : normal;
|
11
|
-
}
|
12
|
-
|
13
|
-
.neo-toolbar {
|
14
|
-
border : 0;
|
15
|
-
border-bottom: 1px solid var(--panel-border-color);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
.neo-configuration-panel-body {
|
20
|
-
overflow-y: scroll;
|
21
|
-
}
|
22
|
-
|
23
|
-
.neo-examples-tab-component {
|
24
|
-
background-color: var(--examples-tab-component-background-color);
|
25
|
-
}
|