neo.mjs 5.5.0 → 5.5.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.5.0'
23
+ * @member {String} version='5.5.1'
24
24
  */
25
- version: '5.5.0'
25
+ version: '5.5.1'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.5.0'
23
+ * @member {String} version='5.5.1'
24
24
  */
25
- version: '5.5.0'
25
+ version: '5.5.1'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.5.0",
3
+ "version": "5.5.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -113,17 +113,16 @@ const DefaultConfig = {
113
113
  logDeltaUpdates: false,
114
114
  /**
115
115
  * Add addons for the main thread
116
- * Possible values: AmCharts, AnalyticsByGoogle, DragDrop, HighlightJS, LocalStorage, MapboxGL, Markdown, Siesta, Stylesheet, WindowPosition
117
- * (src/main/addon) contains all framework related options.
116
+ * ./src/main/addon/ contains all framework related options.
118
117
  * You can also create your own addons within your workspace scope. Make sure to put them inside 'src/main/addon/'
119
118
  * and prefix them with 'WS/' inside your neo-config.json file.
120
119
  * Example: ['DragDrop', 'Stylesheet', 'WS/MyAddon']
121
- * @default ['DragDrop','Stylesheet']
120
+ * @default ['DragDrop','ScrollSync','Stylesheet']
122
121
  * @memberOf! module:Neo
123
122
  * @name config.mainThreadAddons
124
123
  * @type String[]
125
124
  */
126
- mainThreadAddons: ['DragDrop', 'Stylesheet'],
125
+ mainThreadAddons: ['DragDrop', 'ScrollSync', 'Stylesheet'],
127
126
  /**
128
127
  * Pass the URL of a JSON-file, which contains the services and methods from your backend,
129
128
  * which you want to expose to the client.
@@ -237,12 +236,12 @@ const DefaultConfig = {
237
236
  useVdomWorker: true,
238
237
  /**
239
238
  * buildScripts/injectPackageVersion.mjs will update this value
240
- * @default '5.5.0'
239
+ * @default '5.5.1'
241
240
  * @memberOf! module:Neo
242
241
  * @name config.version
243
242
  * @type String
244
243
  */
245
- version: '5.5.0'
244
+ version: '5.5.1'
246
245
  };
247
246
 
248
247
  Object.assign(DefaultConfig, {
@@ -1180,6 +1180,31 @@ class Base extends CoreBase {
1180
1180
  return this.getConfigInstanceByNtype('model', ntype);
1181
1181
  }
1182
1182
 
1183
+ /**
1184
+ * Calculate the real parentIndex inside the DOM
1185
+ * @returns {Number|undefined}
1186
+ */
1187
+ getMountedParentIndex() {
1188
+ let parent = Neo.getComponent(this.parentId),
1189
+ items = parent?.items || [],
1190
+ i = 0,
1191
+ index = 0,
1192
+ len = items.length,
1193
+ item;
1194
+
1195
+ for (; i < len; i++) {
1196
+ item = items[i];
1197
+
1198
+ if (item === this) {
1199
+ return index
1200
+ }
1201
+
1202
+ if (!item.hidden && item.hideMode === 'removeDom') {
1203
+ index++
1204
+ }
1205
+ }
1206
+ }
1207
+
1183
1208
  /**
1184
1209
  * Get the parent components as an array
1185
1210
  * @returns {Neo.component.Base[]}
@@ -1404,7 +1429,7 @@ class Base extends CoreBase {
1404
1429
  id : me.id,
1405
1430
  html : me.vnode.outerHTML,
1406
1431
  parentId : me.parentId,
1407
- parentIndex: me.parentIndex
1432
+ parentIndex: me.getMountedParentIndex()
1408
1433
  });
1409
1434
 
1410
1435
  delete me.vdom.removeDom;
@@ -1626,8 +1651,8 @@ class Base extends CoreBase {
1626
1651
  Neo.vdom.Helper.create({
1627
1652
  appName : me.appName,
1628
1653
  autoMount,
1629
- parentId : autoMount ? me.parentId : undefined,
1630
- parentIndex: autoMount ? me.parentIndex : undefined,
1654
+ parentId : autoMount ? me.parentId : undefined,
1655
+ parentIndex: autoMount ? me.getMountedParentIndex() : undefined,
1631
1656
  ...me.vdom
1632
1657
  }).then(data => {
1633
1658
  me.onRender(data, useVdomWorker ? autoMount : false);
@@ -2,7 +2,6 @@ import Container from '../../container/Base.mjs';
2
2
  import NeoArray from '../../util/Array.mjs';
3
3
  import PickerTrigger from './trigger/Picker.mjs';
4
4
  import Text from './Text.mjs';
5
- import VDomUtil from '../../util/VDom.mjs';
6
5
 
7
6
  /**
8
7
  * The abstract picker field provides an arrow down trigger which opens a floating container to provide
@@ -274,7 +273,7 @@ class Picker extends Text {
274
273
  * @param {Object} data
275
274
  * @protected
276
275
  */
277
- onFocusEnter(data) {console.log('onFocusEnter')
276
+ onFocusEnter(data) {
278
277
  super.onFocusEnter(data);
279
278
 
280
279
  let me = this;
@@ -286,7 +285,7 @@ class Picker extends Text {
286
285
  * @param {Object} data
287
286
  * @protected
288
287
  */
289
- onFocusLeave(data) {console.log('onFocusLeave')
288
+ onFocusLeave(data) {
290
289
  let me = this,
291
290
  insidePicker = false,
292
291
  item;
@@ -307,7 +306,7 @@ class Picker extends Text {
307
306
  /**
308
307
  * @param {Object} data
309
308
  */
310
- onInputClick(data) {console.log('onInputClick')
309
+ onInputClick(data) {
311
310
  let me = this;
312
311
 
313
312
  if (!me.editable) {
@@ -0,0 +1,58 @@
1
+ import Base from '../../core/Base.mjs';
2
+
3
+ /**
4
+ * @class Neo.main.addon.ScrollSync
5
+ * @extends Neo.core.Base
6
+ * @singleton
7
+ */
8
+ class ScrollSync extends Base {
9
+ static config = {
10
+ /**
11
+ * @member {String} className='Neo.main.addon.ScrollSync'
12
+ * @protected
13
+ */
14
+ className: 'Neo.main.addon.ScrollSync',
15
+ /**
16
+ * Remote method access for other workers
17
+ * @member {Object} remote={app: [//...]}
18
+ * @protected
19
+ */
20
+ remote: {
21
+ app: [
22
+ 'register',
23
+ 'unregister'
24
+ ]
25
+ },
26
+ /**
27
+ * @member {Boolean} singleton=true
28
+ * @protected
29
+ */
30
+ singleton: true
31
+ }
32
+
33
+ /**
34
+ * @param {Object} data
35
+ * @param {String} data.sourceId
36
+ * @param {String} data.targetId
37
+ */
38
+ register(data) {
39
+ console.log('register', data)
40
+ }
41
+
42
+ /**
43
+ * @param {Object} data
44
+ * @param {String} data.sourceId
45
+ * @param {String} data.targetId
46
+ */
47
+ unregister(data) {
48
+ console.log('unregister', data)
49
+ }
50
+ }
51
+
52
+ Neo.applyClassConfig(ScrollSync);
53
+
54
+ let instance = Neo.create(ScrollSync);
55
+
56
+ Neo.applyToGlobalNs(instance);
57
+
58
+ export default instance;