neo.mjs 8.19.0 → 8.20.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.19.0'
23
+ * @member {String} version='8.20.0'
24
24
  */
25
- version: '8.19.0'
25
+ version: '8.20.0'
26
26
  }
27
27
 
28
28
  /**
@@ -107,7 +107,7 @@ class FooterContainer extends Container {
107
107
  }, {
108
108
  module: Component,
109
109
  cls : ['neo-version'],
110
- html : 'v8.19.0'
110
+ html : 'v8.20.0'
111
111
  }]
112
112
  }],
113
113
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.19.0'
23
+ * @member {String} version='8.20.0'
24
24
  */
25
- version: '8.19.0'
25
+ version: '8.20.0'
26
26
  }
27
27
 
28
28
  /**
@@ -36,15 +36,10 @@ class ControlsContainer extends Container {
36
36
  },
37
37
 
38
38
  items: [{
39
- ntype: 'component',
40
- html : '<a class="github-button" href="https://github.com/neomjs/neo" data-size="large" data-show-count="true" aria-label="Star neomjs/neo on GitHub">Star</a>',
41
- style: {marginLeft: 'auto'}
42
- }, {
43
39
  labelText : 'Amount Rows',
44
40
  labelWidth: 120,
45
41
  listeners : {change: 'up.onAmountRowsChange'},
46
42
  store : ['1000', '5000', '10000', '20000', '50000'],
47
- style : {marginTop: '2em'},
48
43
  value : '1000',
49
44
  width : 200
50
45
  }, {
@@ -103,20 +98,6 @@ class ControlsContainer extends Container {
103
98
  return this.parent.getItem('grid')
104
99
  }
105
100
 
106
- /**
107
- *
108
- */
109
- onConstructed() {
110
- super.onConstructed();
111
-
112
- Neo.main.DomAccess.addScript({
113
- async : true,
114
- defer : true,
115
- src : 'https://buttons.github.io/buttons.js',
116
- windowId: this.windowId
117
- })
118
- }
119
-
120
101
  /**
121
102
  * @param {Object} data
122
103
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "8.19.0",
3
+ "version": "8.20.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -9,15 +9,6 @@
9
9
  &:focus {
10
10
  outline: none;
11
11
  }
12
-
13
- .neo-grid-stretcher {
14
- height : 1px;
15
- position : absolute;
16
- top : 0;
17
- visibility : hidden;
18
- width : 1px;
19
- z-index : 1001; // Above the column dragProxy element
20
- }
21
12
  }
22
13
 
23
14
  .neo-grid-view {
@@ -68,12 +59,6 @@
68
59
  }
69
60
  }
70
61
 
71
- &:hover {
72
- .neo-grid-cell {
73
- background-color: var(--grid-cell-background-color-hover);
74
- }
75
- }
76
-
77
62
  // selection.RowModel
78
63
  &.neo-selected {
79
64
  .neo-grid-cell {
@@ -111,6 +96,16 @@
111
96
  }
112
97
  }
113
98
 
99
+ .neo-mouse {
100
+ .neo-grid-row {
101
+ &:hover {
102
+ .neo-grid-cell {
103
+ background-color: var(--grid-cell-background-color-hover);
104
+ }
105
+ }
106
+ }
107
+ }
108
+
114
109
  .neo-selection-cellrowmodel,
115
110
  .neo-selection-cellcolumnrowmodel{
116
111
  .neo-grid-row {
@@ -72,5 +72,10 @@
72
72
  color : var(--grid-header-button-color);
73
73
  pointer-events: none;
74
74
  text-transform: none;
75
+
76
+ @media (max-width: 600px) {
77
+ // Default Buttons use a slightly bigger font-size, which does not make sense here
78
+ font-size: var(--button-text-font-size);
79
+ }
75
80
  }
76
81
  }
@@ -262,12 +262,12 @@ const DefaultConfig = {
262
262
  useVdomWorker: true,
263
263
  /**
264
264
  * buildScripts/injectPackageVersion.mjs will update this value
265
- * @default '8.19.0'
265
+ * @default '8.20.0'
266
266
  * @memberOf! module:Neo
267
267
  * @name config.version
268
268
  * @type String
269
269
  */
270
- version: '8.19.0'
270
+ version: '8.20.0'
271
271
  };
272
272
 
273
273
  Object.assign(DefaultConfig, {
@@ -87,7 +87,7 @@ class SortZone extends BaseSortZone {
87
87
  {...config.vdom, cls: ['neo-grid-header-toolbar', 'neo-toolbar']},
88
88
  {cls: ['neo-grid-view-wrapper'], id: viewWrapperId, cn: [
89
89
  {cls: ['neo-grid-view'], cn: rows},
90
- {cls: ['neo-grid-scrollbar'], style: {height: view.vdom.cn[1].height}}
90
+ {cls: ['neo-grid-scrollbar'], style: {height: view.vdom.cn[0].height}}
91
91
  ]}
92
92
  ]}
93
93
  ]};
@@ -114,9 +114,22 @@ class GridContainer extends BaseContainer {
114
114
 
115
115
  /**
116
116
  * We do not need the first event to trigger logic, since afterSetMounted() handles this
117
- * @member {Boolean}} initialResizeEvent=true
117
+ * @member {Boolean} initialResizeEvent=true
118
+ * @protected
118
119
  */
119
120
  initialResizeEvent = true
121
+ /**
122
+ * Flag for identifying the ownership of a touchmove operation
123
+ * @member {Boolean} isTouchMoveOwner=false
124
+ * @protected
125
+ */
126
+ isTouchMoveOwner = false
127
+ /**
128
+ * Storing touchmove position for mobile envs
129
+ * @member {Number} lastTouchY=0
130
+ * @protected
131
+ */
132
+ lastTouchY = 0
120
133
 
121
134
  /**
122
135
  * Convenience method to access the Neo.grid.header.Toolbar
@@ -521,14 +534,36 @@ class GridContainer extends BaseContainer {
521
534
  * @param {Object} data
522
535
  * @param {Number} data.scrollLeft
523
536
  * @param {Object} data.target
537
+ * @param {Object} data.touches
524
538
  */
525
- onScroll({scrollLeft, target}) {
526
- let me = this;
539
+ onScroll({scrollLeft, target, touches}) {
540
+ let me = this,
541
+ deltaY, lastTouchY;
527
542
 
528
543
  // We must ignore events for grid-scrollbar
529
544
  if (target.id.includes('grid-container')) {
530
545
  me.headerToolbar.scrollLeft = scrollLeft;
531
- me.view.scrollPosition = {x: scrollLeft, y: me.view.scrollPosition.y}
546
+ me.view.scrollPosition = {x: scrollLeft, y: me.view.scrollPosition.y};
547
+
548
+ if (touches) {
549
+ if (!me.view.isTouchMoveOwner) {
550
+ me.isTouchMoveOwner = true
551
+ }
552
+
553
+ if (me.isTouchMoveOwner) {
554
+ lastTouchY = touches.lastTouch.clientY - touches.firstTouch.clientY;
555
+ deltaY = me.lastTouchY - lastTouchY;
556
+
557
+ deltaY !== 0 && Neo.main.DomAccess.scrollTo({
558
+ direction: 'top',
559
+ id : me.view.vdom.id,
560
+ value : me.view.scrollPosition.y + deltaY
561
+ })
562
+
563
+ me.lastTouchY = lastTouchY
564
+ }
565
+ }
566
+
532
567
  }
533
568
  }
534
569
 
@@ -53,6 +53,7 @@ class GridScrollbar extends Component {
53
53
  ScrollSync.register({
54
54
  fromId: me.parent.view.vdom.id,
55
55
  toId : me.id,
56
+ twoWay: !Neo.config.useTouchEvents, // Syncing the scroller back to the view affects mobile scrolling
56
57
  ...params
57
58
  })
58
59
  } else {
package/src/grid/View.mjs CHANGED
@@ -125,11 +125,22 @@ class GridView extends Component {
125
125
  */
126
126
  _vdom:
127
127
  {tabIndex: '-1', cn: [
128
- {cn: []},
129
- {cls: 'neo-grid-stretcher'}
128
+ {cn: []}
130
129
  ]}
131
130
  }
132
131
 
132
+ /**
133
+ * Flag for identifying the ownership of a touchmove operation
134
+ * @member {Boolean} isTouchMoveOwner=false
135
+ * @protected
136
+ */
137
+ isTouchMoveOwner = false
138
+ /**
139
+ * Storing touchmove position for mobile envs
140
+ * @member {Number} lastTouchX=0
141
+ * @protected
142
+ */
143
+ lastTouchX = 0
133
144
  /**
134
145
  * @member {Number|null}} scrollTimeoutId=null
135
146
  */
@@ -157,8 +168,10 @@ class GridView extends Component {
157
168
  let me = this;
158
169
 
159
170
  me.addDomListeners([{
160
- scroll: me.onScroll,
161
- scope : me
171
+ scroll : me.onScroll,
172
+ touchcancel: me.onTouchCancel,
173
+ touchend : me.onTouchEnd,
174
+ scope : me
162
175
  }, {
163
176
  click : me.onCellClick,
164
177
  dblclick: me.onCellDoubleClick,
@@ -207,7 +220,7 @@ class GridView extends Component {
207
220
  let me = this;
208
221
 
209
222
  me.vdom.width = value + 'px';
210
- me.vdom.cn[1].width = value + 'px';
223
+ me.vdom.cn[0].width = value + 'px';
211
224
  me.update()
212
225
  }
213
226
  }
@@ -827,8 +840,9 @@ class GridView extends Component {
827
840
  * Only triggers for vertical scrolling
828
841
  * @param {Object} data
829
842
  */
830
- onScroll(data) {
831
- let me = this;
843
+ onScroll({scrollTop, touches}) {
844
+ let me = this,
845
+ deltaX, lastTouchX;
832
846
 
833
847
  me.scrollTimeoutId && clearTimeout(me.scrollTimeoutId);
834
848
 
@@ -838,8 +852,27 @@ class GridView extends Component {
838
852
 
839
853
  me.set({
840
854
  isScrolling : true,
841
- scrollPosition: {x: me.scrollPosition.x, y: data.scrollTop}
842
- })
855
+ scrollPosition: {x: me.scrollPosition.x, y: scrollTop}
856
+ });
857
+
858
+ if (touches) {
859
+ if (!me.parent.isTouchMoveOwner) {
860
+ me.isTouchMoveOwner = true
861
+ }
862
+
863
+ if (me.isTouchMoveOwner) {
864
+ lastTouchX = touches.lastTouch.clientX - touches.firstTouch.clientX;
865
+ deltaX = me.lastTouchX - lastTouchX;
866
+
867
+ deltaX !== 0 && Neo.main.DomAccess.scrollTo({
868
+ direction: 'left',
869
+ id : me.parent.id,
870
+ value : me.scrollPosition.x + deltaX
871
+ })
872
+
873
+ me.lastTouchX = lastTouchX
874
+ }
875
+ }
843
876
  }
844
877
 
845
878
  /**
@@ -896,6 +929,34 @@ class GridView extends Component {
896
929
  needsUpdate && me.update()
897
930
  }
898
931
 
932
+ /**
933
+ * @param {Object} data
934
+ */
935
+ onTouchCancel(data) {
936
+ let me = this,
937
+ {parent} = me;
938
+
939
+ me.isTouchMoveOwner = false;
940
+ me.lastTouchX = 0;
941
+
942
+ parent.isTouchMoveOwner = false;
943
+ parent.lastTouchY = 0
944
+ }
945
+
946
+ /**
947
+ * @param {Object} data
948
+ */
949
+ onTouchEnd(data) {
950
+ let me = this,
951
+ {parent} = me;
952
+
953
+ me.isTouchMoveOwner = false;
954
+ me.lastTouchX = 0;
955
+
956
+ parent.isTouchMoveOwner = false;
957
+ parent.lastTouchY = 0
958
+ }
959
+
899
960
  /**
900
961
  *
901
962
  */
@@ -905,7 +966,7 @@ class GridView extends Component {
905
966
  {rowHeight} = me;
906
967
 
907
968
  if (countRecords > 0 && rowHeight > 0) {
908
- me.vdom.cn[1].height = `${(countRecords + 1) * rowHeight}px`;
969
+ me.vdom.cn[0].height = `${(countRecords + 1) * rowHeight}px`;
909
970
  me.update()
910
971
  }
911
972
  }
@@ -590,17 +590,29 @@ class DomEvents extends Base {
590
590
  * @param {Event} event
591
591
  */
592
592
  onScroll(event) {
593
- let {clientHeight, clientWidth, scrollLeft, scrollTop} = event.target;
593
+ let me = this,
594
+ {firstTouch, lastTouch} = me,
595
+ {clientHeight, clientWidth, scrollLeft, scrollTop} = event.target,
596
+ data;
594
597
 
595
598
  event.preventDefault();
596
599
 
597
- this.sendMessageToApp({
598
- ...this.getEventData(event),
600
+ data = {
601
+ ...me.getEventData(event),
599
602
  clientHeight,
600
603
  clientWidth,
601
604
  scrollLeft,
602
605
  scrollTop
603
- })
606
+ };
607
+
608
+ if (firstTouch) {
609
+ data.touches = {
610
+ firstTouch: {clientX: firstTouch.clientX, clientY: firstTouch.clientY},
611
+ lastTouch : {clientX: lastTouch .clientX, clientY: lastTouch .clientY}
612
+ }
613
+ }
614
+
615
+ me.sendMessageToApp(data)
604
616
  }
605
617
 
606
618
  /**
@@ -22,7 +22,8 @@ class TouchDomEvents extends Base {
22
22
  let me = this;
23
23
 
24
24
  me.sendMessageToApp(me.getEventData(event));
25
- me.lastTouch = null
25
+ me.firstTouch = null;
26
+ me.lastTouch = null
26
27
  }
27
28
 
28
29
  /**
@@ -32,7 +33,8 @@ class TouchDomEvents extends Base {
32
33
  let me = this;
33
34
 
34
35
  me.sendMessageToApp(me.getEventData(event));
35
- me.lastTouch = null
36
+ me.firstTouch = null;
37
+ me.lastTouch = null
36
38
  }
37
39
 
38
40
  /**
@@ -80,7 +82,8 @@ class TouchDomEvents extends Base {
80
82
  onTouchStart(event) {
81
83
  let me = this;
82
84
 
83
- me.lastTouch = event.touches[0];
85
+ me.firstTouch = event.touches[0];
86
+ me.lastTouch = event.touches[0];
84
87
 
85
88
  me.sendMessageToApp(me.getEventData(event))
86
89
  }