neo.mjs 10.0.0-alpha.4 → 10.0.0-beta.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.
- package/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/resources/data/examples_devmode.json +26 -27
- package/apps/portal/resources/data/examples_dist_dev.json +26 -27
- package/apps/portal/resources/data/examples_dist_esm.json +26 -27
- package/apps/portal/resources/data/examples_dist_prod.json +27 -28
- package/apps/portal/view/blog/List.mjs +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/ContentComponent.mjs +102 -111
- package/buildScripts/buildThemes.mjs +1 -1
- package/examples/grid/animatedRowSorting/Viewport.mjs +4 -4
- package/examples/grid/bigData/ControlsContainer.mjs +3 -3
- package/examples/grid/bigData/GridContainer.mjs +8 -8
- package/examples/grid/cellEditing/MainContainer.mjs +5 -5
- package/examples/grid/container/MainContainer.mjs +4 -4
- package/examples/grid/nestedRecordFields/Viewport.mjs +5 -5
- package/examples/table/cellEditing/MainContainer.mjs +1 -1
- package/examples/table/container/MainContainer.mjs +3 -3
- package/examples/table/nestedRecordFields/Viewport.mjs +6 -6
- package/examples/tableFiltering/MainContainer.mjs +1 -1
- package/examples/tablePerformance/MainContainer.mjs +1 -1
- package/examples/tablePerformance/MainContainer2.mjs +1 -1
- package/examples/tablePerformance/MainContainer3.mjs +2 -2
- package/examples/tableStore/MainContainer.mjs +2 -2
- package/learn/UsingTheseTopics.md +2 -2
- package/learn/benefits/ConfigSystem.md +2 -2
- package/learn/benefits/FormsEngine.md +14 -14
- package/learn/benefits/MultiWindow.md +2 -2
- package/learn/benefits/OffTheMainThread.md +2 -2
- package/learn/benefits/Speed.md +2 -2
- package/learn/gettingstarted/ComponentModels.md +4 -4
- package/learn/gettingstarted/Config.md +6 -6
- package/learn/gettingstarted/DescribingTheUI.md +4 -4
- package/learn/gettingstarted/Events.md +6 -6
- package/learn/gettingstarted/Extending.md +4 -4
- package/learn/gettingstarted/References.md +6 -6
- package/learn/gettingstarted/Workspaces.md +6 -6
- package/learn/guides/ApplicationBootstrap.md +40 -42
- package/learn/guides/ComponentsAndContainers.md +12 -12
- package/learn/guides/CustomComponents.md +2 -2
- package/learn/guides/MainThreadAddonIntro.md +2 -2
- package/learn/guides/PortalApp.md +2 -2
- package/learn/guides/StateProviders.md +12 -12
- package/learn/guides/events/CustomEvents.md +16 -16
- package/learn/guides/events/DomEvents.md +12 -12
- package/learn/javascript/ClassFeatures.md +3 -2
- package/learn/javascript/Classes.md +8 -8
- package/learn/javascript/NewNode.md +4 -4
- package/learn/javascript/Overrides.md +8 -8
- package/learn/javascript/Super.md +10 -8
- package/learn/tutorials/Earthquakes.md +54 -57
- package/learn/tutorials/TodoList.md +4 -4
- package/package.json +1 -1
- package/resources/scss/src/apps/portal/learn/ContentComponent.scss +12 -0
- package/resources/scss/src/grid/{View.scss → Body.scss} +2 -2
- package/resources/scss/src/grid/VerticalScrollbar.scss +1 -1
- package/resources/scss/src/grid/plugin/AnimateRows.scss +1 -1
- package/resources/scss/src/grid/plugin/CellEditing.scss +1 -1
- package/resources/scss/src/table/{View.scss → Body.scss} +1 -1
- package/resources/scss/src/table/plugin/CellEditing.scss +1 -1
- package/resources/scss/theme-dark/grid/{View.scss → Body.scss} +1 -1
- package/resources/scss/theme-dark/table/{View.scss → Body.scss} +1 -1
- package/resources/scss/theme-light/grid/{View.scss → Body.scss} +1 -1
- package/resources/scss/theme-light/table/{View.scss → Body.scss} +1 -1
- package/resources/scss/theme-neo-light/Global.scss +1 -2
- package/resources/scss/theme-neo-light/grid/{View.scss → Body.scss} +1 -1
- package/resources/scss/theme-neo-light/table/{View.scss → Body.scss} +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/core/Base.mjs +59 -12
- package/src/core/Util.mjs +14 -2
- package/src/draggable/grid/header/toolbar/SortZone.mjs +21 -21
- package/src/draggable/table/header/toolbar/SortZone.mjs +1 -1
- package/src/grid/{View.mjs → Body.mjs} +19 -20
- package/src/grid/Container.mjs +58 -58
- package/src/grid/ScrollManager.mjs +56 -56
- package/src/grid/VerticalScrollbar.mjs +2 -2
- package/src/grid/_export.mjs +2 -2
- package/src/grid/column/AnimatedChange.mjs +5 -5
- package/src/grid/column/Base.mjs +1 -1
- package/src/grid/column/Component.mjs +6 -6
- package/src/grid/header/Toolbar.mjs +9 -9
- package/src/grid/plugin/AnimateRows.mjs +1 -2
- package/src/main/addon/AmCharts.mjs +8 -11
- package/src/main/addon/Base.mjs +150 -42
- package/src/main/addon/GoogleMaps.mjs +9 -16
- package/src/main/addon/HighlightJS.mjs +2 -13
- package/src/main/addon/IntersectionObserver.mjs +21 -21
- package/src/main/addon/MonacoEditor.mjs +1 -6
- package/src/table/{View.mjs → Body.mjs} +19 -20
- package/src/table/Container.mjs +43 -43
- package/src/table/_export.mjs +2 -2
- package/src/table/plugin/CellEditing.mjs +19 -19
- package/src/util/Style.mjs +2 -6
- package/src/vdom/Helper.mjs +10 -13
- package/src/worker/App.mjs +6 -18
- package/src/worker/Base.mjs +1 -1
- package/src/worker/Manager.mjs +4 -8
- package/src/worker/mixin/RemoteMethodAccess.mjs +1 -1
package/src/grid/Container.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import BaseContainer from '../container/Base.mjs';
|
2
2
|
import ClassSystemUtil from '../util/ClassSystem.mjs';
|
3
3
|
import Collection from '../collection/Base.mjs';
|
4
|
-
import
|
4
|
+
import GridBody from './Body.mjs';
|
5
5
|
import ScrollManager from './ScrollManager.mjs';
|
6
6
|
import Store from '../data/Store.mjs';
|
7
7
|
import VerticalScrollbar from './VerticalScrollbar.mjs';
|
@@ -52,6 +52,16 @@ class GridContainer extends BaseContainer {
|
|
52
52
|
* @protected
|
53
53
|
*/
|
54
54
|
baseCls: ['neo-grid-container'],
|
55
|
+
/**
|
56
|
+
* Configs for Neo.grid.Body
|
57
|
+
* @member {Object|null} [bodyConfig=null]
|
58
|
+
*/
|
59
|
+
bodyConfig: null,
|
60
|
+
/**
|
61
|
+
* @member {String|null} bodyId_=null
|
62
|
+
* @protected
|
63
|
+
*/
|
64
|
+
bodyId_: null,
|
55
65
|
/**
|
56
66
|
* true uses grid.plugin.CellEditing
|
57
67
|
* @member {Boolean} cellEditing_=false
|
@@ -105,16 +115,6 @@ class GridContainer extends BaseContainer {
|
|
105
115
|
* @member {Neo.data.Store} store_=null
|
106
116
|
*/
|
107
117
|
store_: null,
|
108
|
-
/**
|
109
|
-
* Configs for Neo.grid.View
|
110
|
-
* @member {Object|null} [viewConfig=null]
|
111
|
-
*/
|
112
|
-
viewConfig: null,
|
113
|
-
/**
|
114
|
-
* @member {String|null} viewId_=null
|
115
|
-
* @protected
|
116
|
-
*/
|
117
|
-
viewId_: null,
|
118
118
|
/**
|
119
119
|
* @member {Array|null} items=null
|
120
120
|
* @protected
|
@@ -142,19 +142,19 @@ class GridContainer extends BaseContainer {
|
|
142
142
|
scrollManager = null
|
143
143
|
|
144
144
|
/**
|
145
|
-
* Convenience method to access the Neo.grid.
|
146
|
-
* @returns {Neo.grid.
|
145
|
+
* Convenience method to access the Neo.grid.Body
|
146
|
+
* @returns {Neo.grid.Body|null}
|
147
147
|
*/
|
148
|
-
get
|
149
|
-
return Neo.getComponent(this.
|
148
|
+
get body() {
|
149
|
+
return Neo.getComponent(this.bodyId) || Neo.get(this.bodyId)
|
150
150
|
}
|
151
151
|
|
152
152
|
/**
|
153
|
-
* Convenience method to access the Neo.grid.
|
154
|
-
* @returns {Neo.grid.
|
153
|
+
* Convenience method to access the Neo.grid.header.Toolbar
|
154
|
+
* @returns {Neo.grid.header.Toolbar|null}
|
155
155
|
*/
|
156
|
-
get
|
157
|
-
return Neo.getComponent(this.
|
156
|
+
get headerToolbar() {
|
157
|
+
return Neo.getComponent(this.headerToolbarId) || Neo.get(this.headerToolbarId)
|
158
158
|
}
|
159
159
|
|
160
160
|
/**
|
@@ -166,8 +166,8 @@ class GridContainer extends BaseContainer {
|
|
166
166
|
let me = this,
|
167
167
|
{appName, rowHeight, store, windowId} = me;
|
168
168
|
|
169
|
+
me.bodyId = Neo.getId('grid-body');
|
169
170
|
me.headerToolbarId = Neo.getId('grid-header-toolbar');
|
170
|
-
me.viewId = Neo.getId('grid-view');
|
171
171
|
|
172
172
|
me.items = [{
|
173
173
|
module : header.Toolbar,
|
@@ -176,13 +176,13 @@ class GridContainer extends BaseContainer {
|
|
176
176
|
sortable : me.sortable,
|
177
177
|
...me.headerToolbarConfig
|
178
178
|
}, {
|
179
|
-
module :
|
179
|
+
module : GridBody,
|
180
180
|
flex : 1,
|
181
181
|
gridContainer: me,
|
182
|
-
id : me.
|
182
|
+
id : me.bodyId,
|
183
183
|
rowHeight,
|
184
184
|
store,
|
185
|
-
...me.
|
185
|
+
...me.bodyConfig
|
186
186
|
}];
|
187
187
|
|
188
188
|
me.scrollbar = Neo.create({
|
@@ -218,7 +218,7 @@ class GridContainer extends BaseContainer {
|
|
218
218
|
|
219
219
|
if (mounted) {
|
220
220
|
ResizeObserver.register(resizeParams);
|
221
|
-
await me.
|
221
|
+
await me.passSizeToBody()
|
222
222
|
} else {
|
223
223
|
me.initialResizeEvent = true;
|
224
224
|
ResizeObserver.unregister(resizeParams)
|
@@ -262,9 +262,9 @@ class GridContainer extends BaseContainer {
|
|
262
262
|
|
263
263
|
await me.timeout(50);
|
264
264
|
|
265
|
-
await me.
|
265
|
+
await me.passSizeToBody();
|
266
266
|
|
267
|
-
me.
|
267
|
+
me.body?.createViewData()
|
268
268
|
}
|
269
269
|
}
|
270
270
|
|
@@ -287,14 +287,14 @@ class GridContainer extends BaseContainer {
|
|
287
287
|
*/
|
288
288
|
afterSetRowHeight(value, oldValue) {
|
289
289
|
if (value > 0) {
|
290
|
-
let {
|
290
|
+
let {body, scrollbar} = this;
|
291
291
|
|
292
292
|
if (scrollbar) {
|
293
293
|
scrollbar.rowHeight = value
|
294
294
|
}
|
295
295
|
|
296
|
-
if (
|
297
|
-
|
296
|
+
if (body) {
|
297
|
+
body.rowHeight = value
|
298
298
|
}
|
299
299
|
}
|
300
300
|
}
|
@@ -340,12 +340,22 @@ class GridContainer extends BaseContainer {
|
|
340
340
|
value ?.on(listeners);
|
341
341
|
oldValue?.un(listeners);
|
342
342
|
|
343
|
-
// in case we dynamically change the store,
|
344
|
-
if (me.
|
345
|
-
me.
|
343
|
+
// in case we dynamically change the store, grid.Body needs to get the new reference
|
344
|
+
if (me.body) {
|
345
|
+
me.body.store = value
|
346
346
|
}
|
347
347
|
}
|
348
348
|
|
349
|
+
/**
|
350
|
+
* Triggered before the bodyId config gets changed.
|
351
|
+
* @param {String} value
|
352
|
+
* @param {String} oldValue
|
353
|
+
* @protected
|
354
|
+
*/
|
355
|
+
beforeSetBodyId(value, oldValue) {
|
356
|
+
return value || oldValue
|
357
|
+
}
|
358
|
+
|
349
359
|
/**
|
350
360
|
* Triggered before the columns config gets changed.
|
351
361
|
* @param {Object[]} value
|
@@ -384,16 +394,6 @@ class GridContainer extends BaseContainer {
|
|
384
394
|
return value
|
385
395
|
}
|
386
396
|
|
387
|
-
/**
|
388
|
-
* Triggered before the viewId config gets changed.
|
389
|
-
* @param {String} value
|
390
|
-
* @param {String} oldValue
|
391
|
-
* @protected
|
392
|
-
*/
|
393
|
-
beforeSetViewId(value, oldValue) {
|
394
|
-
return value || oldValue
|
395
|
-
}
|
396
|
-
|
397
397
|
/**
|
398
398
|
* In case you want to update multiple existing records in parallel,
|
399
399
|
* using this method is faster than updating each record one by one.
|
@@ -401,19 +401,19 @@ class GridContainer extends BaseContainer {
|
|
401
401
|
* @param {Object[]} records
|
402
402
|
*/
|
403
403
|
bulkUpdateRecords(records) {
|
404
|
-
let {
|
404
|
+
let {body, store} = this,
|
405
405
|
{keyProperty} = store;
|
406
406
|
|
407
|
-
if (
|
408
|
-
|
407
|
+
if (body) {
|
408
|
+
body.silentVdomUpdate = true;
|
409
409
|
|
410
410
|
records.forEach(item => {
|
411
411
|
store.get(item[keyProperty])?.set(item)
|
412
412
|
});
|
413
413
|
|
414
|
-
|
414
|
+
body.silentVdomUpdate = false;
|
415
415
|
|
416
|
-
|
416
|
+
body.update()
|
417
417
|
}
|
418
418
|
}
|
419
419
|
|
@@ -527,9 +527,9 @@ class GridContainer extends BaseContainer {
|
|
527
527
|
let me = this;
|
528
528
|
|
529
529
|
me.scrollManager = Neo.create({
|
530
|
+
gridBody : me.body,
|
530
531
|
module : ScrollManager,
|
531
|
-
gridContainer: me
|
532
|
-
gridView : me.view
|
532
|
+
gridContainer: me
|
533
533
|
})
|
534
534
|
}
|
535
535
|
|
@@ -540,11 +540,11 @@ class GridContainer extends BaseContainer {
|
|
540
540
|
let me = this;
|
541
541
|
|
542
542
|
if (!me.initialResizeEvent) {
|
543
|
-
await me.
|
543
|
+
await me.passSizeToBody(true);
|
544
544
|
|
545
|
-
me.
|
545
|
+
me.body.updateMountedAndVisibleColumns();
|
546
546
|
|
547
|
-
await me.headerToolbar.
|
547
|
+
await me.headerToolbar.passSizeToBody()
|
548
548
|
} else {
|
549
549
|
me.initialResizeEvent = false
|
550
550
|
}
|
@@ -561,7 +561,7 @@ class GridContainer extends BaseContainer {
|
|
561
561
|
|
562
562
|
me.store.sort(opts);
|
563
563
|
me.removeSortingCss(opts.property);
|
564
|
-
opts.direction && me.
|
564
|
+
opts.direction && me.body.onStoreLoad()
|
565
565
|
}
|
566
566
|
|
567
567
|
/**
|
@@ -589,16 +589,16 @@ class GridContainer extends BaseContainer {
|
|
589
589
|
* @param {Boolean} silent=false
|
590
590
|
* @returns {Promise<void>}
|
591
591
|
*/
|
592
|
-
async
|
592
|
+
async passSizeToBody(silent=false) {
|
593
593
|
let me = this,
|
594
594
|
[containerRect, headerRect] = await me.getDomRect([me.id, me.headerToolbarId]);
|
595
595
|
|
596
596
|
// delay for slow connections, where the container-sizing is not done yet
|
597
597
|
if (containerRect.height === headerRect.height) {
|
598
598
|
await me.timeout(100);
|
599
|
-
await me.
|
599
|
+
await me.passSizeToBody(silent)
|
600
600
|
} else {
|
601
|
-
me.
|
601
|
+
me.body[silent ? 'setSilent' : 'set']({
|
602
602
|
availableHeight: containerRect.height - headerRect.height,
|
603
603
|
containerWidth : containerRect.width
|
604
604
|
})
|
@@ -624,8 +624,8 @@ class GridContainer extends BaseContainer {
|
|
624
624
|
*/
|
625
625
|
scrollByColumns(index, step) {
|
626
626
|
let me = this,
|
627
|
-
{
|
628
|
-
{columnPositions, containerWidth, mountedColumns, visibleColumns} =
|
627
|
+
{body} = me,
|
628
|
+
{columnPositions, containerWidth, mountedColumns, visibleColumns} = body,
|
629
629
|
countColumns = columnPositions.getCount(),
|
630
630
|
newIndex = index + step,
|
631
631
|
column, mounted, scrollLeft, visible;
|
@@ -24,15 +24,15 @@ class ScrollManager extends Base {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
/**
|
27
|
-
* @member {Neo.grid.
|
27
|
+
* @member {Neo.grid.Body|null} gridBody=null
|
28
28
|
* @protected
|
29
29
|
*/
|
30
|
-
|
30
|
+
gridBody = null
|
31
31
|
/**
|
32
|
-
* @member {Neo.grid.
|
32
|
+
* @member {Neo.grid.Container|null} gridContainer=null
|
33
33
|
* @protected
|
34
34
|
*/
|
35
|
-
|
35
|
+
gridContainer = null
|
36
36
|
/**
|
37
37
|
* Storing touchmove position for mobile envs
|
38
38
|
* @member {Number} lastTouchX=0
|
@@ -52,7 +52,7 @@ class ScrollManager extends Base {
|
|
52
52
|
scrollTimeoutId = null
|
53
53
|
/**
|
54
54
|
* Flag for identifying the ownership of a touchmove operation
|
55
|
-
* @member {'
|
55
|
+
* @member {'body'|'container'|null} touchMoveOwner=null
|
56
56
|
* @protected
|
57
57
|
*/
|
58
58
|
touchMoveOwner = null
|
@@ -65,19 +65,59 @@ class ScrollManager extends Base {
|
|
65
65
|
|
66
66
|
let me = this;
|
67
67
|
|
68
|
-
me.
|
69
|
-
scroll: me.
|
70
|
-
scope : me
|
71
|
-
});
|
72
|
-
|
73
|
-
me.gridView.addDomListeners({
|
74
|
-
scroll : me.onViewScroll,
|
68
|
+
me.gridBody.addDomListeners({
|
69
|
+
scroll : me.onBodyScroll,
|
75
70
|
touchcancel: me.onTouchCancel,
|
76
71
|
touchend : me.onTouchEnd,
|
77
72
|
scope : me
|
73
|
+
});
|
74
|
+
|
75
|
+
me.gridContainer.addDomListeners({
|
76
|
+
scroll: me.onContainerScroll,
|
77
|
+
scope : me
|
78
78
|
})
|
79
79
|
}
|
80
80
|
|
81
|
+
/**
|
82
|
+
* Only triggers for vertical scrolling
|
83
|
+
* @param {Object} data
|
84
|
+
* @protected
|
85
|
+
*/
|
86
|
+
onBodyScroll({scrollTop, touches}) {
|
87
|
+
let me = this,
|
88
|
+
body = me.gridBody,
|
89
|
+
deltaX, lastTouchX;
|
90
|
+
|
91
|
+
me.scrollTop = scrollTop;
|
92
|
+
|
93
|
+
me.scrollTimeoutId && clearTimeout(me.scrollTimeoutId);
|
94
|
+
|
95
|
+
me.scrollTimeoutId = setTimeout(() => {
|
96
|
+
body.isScrolling = false
|
97
|
+
}, 100);
|
98
|
+
|
99
|
+
body.set({isScrolling: true, scrollTop});
|
100
|
+
|
101
|
+
if (touches) {
|
102
|
+
if (me.touchMoveOwner !== 'container') {
|
103
|
+
me.touchMoveOwner = 'body'
|
104
|
+
}
|
105
|
+
|
106
|
+
if (me.touchMoveOwner === 'body') {
|
107
|
+
lastTouchX = touches.lastTouch.clientX - touches.firstTouch.clientX;
|
108
|
+
deltaX = me.lastTouchX - lastTouchX;
|
109
|
+
|
110
|
+
deltaX !== 0 && Neo.main.DomAccess.scrollTo({
|
111
|
+
direction: 'left',
|
112
|
+
id : me.gridContainer.id,
|
113
|
+
value : me.scrollLeft + deltaX
|
114
|
+
})
|
115
|
+
|
116
|
+
me.lastTouchX = lastTouchX
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
81
121
|
/**
|
82
122
|
* @param {Object} data
|
83
123
|
* @param {Number} data.scrollLeft
|
@@ -86,18 +126,18 @@ class ScrollManager extends Base {
|
|
86
126
|
*/
|
87
127
|
onContainerScroll({scrollLeft, target, touches}) {
|
88
128
|
let me = this,
|
89
|
-
|
129
|
+
body = me.gridBody,
|
90
130
|
deltaY, lastTouchY;
|
91
131
|
|
92
132
|
// We must ignore events for grid-scrollbar
|
93
133
|
if (target.id.includes('grid-container')) {
|
94
134
|
me .scrollLeft = scrollLeft;
|
95
|
-
|
135
|
+
body.scrollLeft = scrollLeft;
|
96
136
|
|
97
137
|
me.gridContainer.headerToolbar.scrollLeft = scrollLeft;
|
98
138
|
|
99
139
|
if (touches && !me.gridContainer.headerToolbar.cls.includes('neo-is-dragging')) {
|
100
|
-
if (me.touchMoveOwner !== '
|
140
|
+
if (me.touchMoveOwner !== 'body') {
|
101
141
|
me.touchMoveOwner = 'container'
|
102
142
|
}
|
103
143
|
|
@@ -107,7 +147,7 @@ class ScrollManager extends Base {
|
|
107
147
|
|
108
148
|
deltaY !== 0 && Neo.main.DomAccess.scrollTo({
|
109
149
|
direction: 'top',
|
110
|
-
id :
|
150
|
+
id : body.vdom.id,
|
111
151
|
value : me.scrollTop + deltaY
|
112
152
|
})
|
113
153
|
|
@@ -134,46 +174,6 @@ class ScrollManager extends Base {
|
|
134
174
|
me.lastTouchX = 0;
|
135
175
|
me.lastTouchY = 0
|
136
176
|
}
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Only triggers for vertical scrolling
|
140
|
-
* @param {Object} data
|
141
|
-
* @protected
|
142
|
-
*/
|
143
|
-
onViewScroll({scrollTop, touches}) {
|
144
|
-
let me = this,
|
145
|
-
view = me.gridView,
|
146
|
-
deltaX, lastTouchX;
|
147
|
-
|
148
|
-
me.scrollTop = scrollTop;
|
149
|
-
|
150
|
-
me.scrollTimeoutId && clearTimeout(me.scrollTimeoutId);
|
151
|
-
|
152
|
-
me.scrollTimeoutId = setTimeout(() => {
|
153
|
-
view.isScrolling = false
|
154
|
-
}, 100);
|
155
|
-
|
156
|
-
view.set({isScrolling: true, scrollTop});
|
157
|
-
|
158
|
-
if (touches) {
|
159
|
-
if (me.touchMoveOwner !== 'container') {
|
160
|
-
me.touchMoveOwner = 'view'
|
161
|
-
}
|
162
|
-
|
163
|
-
if (me.touchMoveOwner === 'view') {
|
164
|
-
lastTouchX = touches.lastTouch.clientX - touches.firstTouch.clientX;
|
165
|
-
deltaX = me.lastTouchX - lastTouchX;
|
166
|
-
|
167
|
-
deltaX !== 0 && Neo.main.DomAccess.scrollTo({
|
168
|
-
direction: 'left',
|
169
|
-
id : me.gridContainer.id,
|
170
|
-
value : me.scrollLeft + deltaX
|
171
|
-
})
|
172
|
-
|
173
|
-
me.lastTouchX = lastTouchX
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
177
177
|
}
|
178
178
|
|
179
179
|
export default Neo.setupClass(ScrollManager);
|
@@ -53,9 +53,9 @@ class VerticalScrollbar extends Component {
|
|
53
53
|
|
54
54
|
if (mounted) {
|
55
55
|
ScrollSync.register({
|
56
|
-
fromId: me.parent.
|
56
|
+
fromId: me.parent.body.vdom.id,
|
57
57
|
toId : me.id,
|
58
|
-
twoWay: !Neo.config.hasTouchEvents, // Syncing the scroller back to the
|
58
|
+
twoWay: !Neo.config.hasTouchEvents, // Syncing the scroller back to the body affects mobile scrolling
|
59
59
|
...params
|
60
60
|
})
|
61
61
|
} else {
|
package/src/grid/_export.mjs
CHANGED
@@ -55,7 +55,7 @@ class AnimatedChange extends Column {
|
|
55
55
|
*/
|
56
56
|
async onRecordChange({fields, record}) {
|
57
57
|
let me = this,
|
58
|
-
{
|
58
|
+
{body} = me.parent,
|
59
59
|
cellId, field, node;
|
60
60
|
|
61
61
|
for (field of fields) {
|
@@ -63,16 +63,16 @@ class AnimatedChange extends Column {
|
|
63
63
|
// Wait for the next animation frame
|
64
64
|
await me.timeout(20);
|
65
65
|
|
66
|
-
cellId =
|
67
|
-
node = VdomUtil.find(
|
66
|
+
cellId = body.getCellId(me.parent.store.indexOf(record), me.dataField);
|
67
|
+
node = VdomUtil.find(body.vdom, cellId)?.vdom;
|
68
68
|
|
69
69
|
if (node) {
|
70
70
|
NeoArray.add(node.cls, me.getAnimationCls(record));
|
71
71
|
|
72
|
-
// This will trigger a 2nd
|
72
|
+
// This will trigger a 2nd body update, after grid.Body: onStoreRecordChange()
|
73
73
|
// It is crucial to restart the keyframe based animation
|
74
74
|
// => The previous update call will remove the last animationCls
|
75
|
-
|
75
|
+
body.update()
|
76
76
|
}
|
77
77
|
|
78
78
|
break
|
package/src/grid/column/Base.mjs
CHANGED
@@ -26,7 +26,7 @@ class Column extends Base {
|
|
26
26
|
renderer_: 'cellRenderer',
|
27
27
|
/**
|
28
28
|
* Scope to execute the column renderer.
|
29
|
-
* Defaults to the grid.
|
29
|
+
* Defaults to the grid.Body.
|
30
30
|
* You can pass the strings 'this' or 'me'
|
31
31
|
* @member {Neo.core.Base|String|null} rendererScope=null
|
32
32
|
*/
|
@@ -76,7 +76,7 @@ class Component extends Column {
|
|
76
76
|
*/
|
77
77
|
cellRenderer(data) {
|
78
78
|
let {gridContainer, record, rowIndex} = data,
|
79
|
-
{appName,
|
79
|
+
{appName, body, windowId} = gridContainer,
|
80
80
|
me = this,
|
81
81
|
{recordProperty} = me,
|
82
82
|
id = me.getComponentId(rowIndex),
|
@@ -104,7 +104,7 @@ class Component extends Column {
|
|
104
104
|
...componentConfig,
|
105
105
|
appName,
|
106
106
|
id,
|
107
|
-
parentComponent :
|
107
|
+
parentComponent : body,
|
108
108
|
[recordProperty]: record,
|
109
109
|
windowId
|
110
110
|
});
|
@@ -118,10 +118,10 @@ class Component extends Column {
|
|
118
118
|
}
|
119
119
|
|
120
120
|
if (me.useBindings) {
|
121
|
-
|
121
|
+
body.getStateProvider()?.parseConfig(component)
|
122
122
|
}
|
123
123
|
|
124
|
-
|
124
|
+
body.updateDepth = -1;
|
125
125
|
|
126
126
|
return component.createVdomReference()
|
127
127
|
}
|
@@ -132,9 +132,9 @@ class Component extends Column {
|
|
132
132
|
*/
|
133
133
|
getComponentId(rowIndex) {
|
134
134
|
let me = this,
|
135
|
-
{
|
135
|
+
{body} = me.parent;
|
136
136
|
|
137
|
-
return `${me.id}-component-${rowIndex % (
|
137
|
+
return `${me.id}-component-${rowIndex % (body.availableRows + 2 * body.bufferRowRange)}`
|
138
138
|
}
|
139
139
|
}
|
140
140
|
|
@@ -89,7 +89,7 @@ class Toolbar extends BaseToolbar {
|
|
89
89
|
*/
|
90
90
|
afterSetMounted(value, oldValue) {
|
91
91
|
super.afterSetMounted(value, oldValue);
|
92
|
-
value && this.
|
92
|
+
value && this.passSizeToBody()
|
93
93
|
}
|
94
94
|
|
95
95
|
/**
|
@@ -181,7 +181,7 @@ class Toolbar extends BaseToolbar {
|
|
181
181
|
|
182
182
|
me.promiseUpdate().then(() => {
|
183
183
|
// To prevent duplicate calls, we need to check the mounted state before the update call
|
184
|
-
mounted && me.
|
184
|
+
mounted && me.passSizeToBody()
|
185
185
|
})
|
186
186
|
}
|
187
187
|
|
@@ -203,10 +203,10 @@ class Toolbar extends BaseToolbar {
|
|
203
203
|
* @param {Boolean} silent=false
|
204
204
|
* @returns {Promise<void>}
|
205
205
|
*/
|
206
|
-
async
|
206
|
+
async passSizeToBody(silent=false) {
|
207
207
|
let me = this,
|
208
208
|
{items} = me,
|
209
|
-
{
|
209
|
+
{body} = me.parent,
|
210
210
|
rects = await me.getDomRect(items.map(item => item.id)),
|
211
211
|
lastItem = rects[rects.length - 1],
|
212
212
|
columnPositions = rects.map((item, index) => ({dataField: items[index].dataField, width: item.width, x: item.x - rects[0].x})),
|
@@ -225,16 +225,16 @@ class Toolbar extends BaseToolbar {
|
|
225
225
|
// Delay for slow connections, where the container-sizing is not done yet
|
226
226
|
if (!layoutFinished) {
|
227
227
|
await me.timeout(100);
|
228
|
-
await me.
|
228
|
+
await me.passSizeToBody(silent)
|
229
229
|
} else {
|
230
|
-
|
231
|
-
|
230
|
+
body.columnPositions.clear();
|
231
|
+
body.columnPositions.add(columnPositions);
|
232
232
|
|
233
|
-
|
233
|
+
body[silent ? 'setSilent' : 'set']({
|
234
234
|
availableWidth: lastItem.x + lastItem.width - rects[0].x
|
235
235
|
});
|
236
236
|
|
237
|
-
!silent &&
|
237
|
+
!silent && body.updateMountedAndVisibleColumns()
|
238
238
|
}
|
239
239
|
}
|
240
240
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import Base from '../../plugin/Base.mjs';
|
2
|
-
import CssUtil from '../../util/Css.mjs';
|
3
2
|
import NeoArray from '../../util/Array.mjs';
|
4
3
|
|
5
4
|
/**
|
@@ -151,7 +150,7 @@ class AnimateRows extends Base {
|
|
151
150
|
|
152
151
|
for (rowIndex=mountedRows[0]; rowIndex < mountedRows[1]; rowIndex++) {
|
153
152
|
record = owner.store.getAt(rowIndex);
|
154
|
-
id = owner.getRowId(
|
153
|
+
id = owner.getRowId(rowIndex)
|
155
154
|
mapItem = map[id];
|
156
155
|
|
157
156
|
if (mapItem) {
|
@@ -192,7 +192,7 @@ class AmCharts extends Base {
|
|
192
192
|
* => fetching the other files after core.js is loaded
|
193
193
|
* @param {Boolean} useFallback=false
|
194
194
|
*/
|
195
|
-
loadFiles(useFallback=false) {
|
195
|
+
async loadFiles(useFallback=false) {
|
196
196
|
let me = this,
|
197
197
|
useFallbackPath = me.useFallbackPath || useFallback,
|
198
198
|
basePath;
|
@@ -207,24 +207,21 @@ class AmCharts extends Base {
|
|
207
207
|
basePath = useFallbackPath ? me.fallbackPath : me.downloadPath
|
208
208
|
}
|
209
209
|
|
210
|
-
|
210
|
+
try {
|
211
|
+
await DomAccess.loadScript(basePath + 'core.js');
|
211
212
|
|
212
|
-
|
213
|
-
Promise.all([
|
213
|
+
await Promise.all([
|
214
214
|
DomAccess.loadScript(basePath + 'charts.js'),
|
215
215
|
DomAccess.loadScript(basePath + 'maps.js'),
|
216
216
|
DomAccess.loadScript(basePath + 'themes/dark.js'),
|
217
217
|
DomAccess.loadScript(basePath + 'geodata/worldLow.js')
|
218
|
-
])
|
219
|
-
|
220
|
-
me.isReady = true
|
221
|
-
})
|
222
|
-
}).catch(e => {
|
218
|
+
])
|
219
|
+
} catch(e) {
|
223
220
|
if (!useFallback && !me.useFallbackPath) {
|
224
221
|
console.log('Download from amcharts.com failed, switching to fallback', e);
|
225
|
-
me.loadFiles(true)
|
222
|
+
await me.loadFiles(true)
|
226
223
|
}
|
227
|
-
}
|
224
|
+
}
|
228
225
|
}
|
229
226
|
|
230
227
|
/**
|