neo.mjs 5.6.10 → 5.6.12

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.6.10'
23
+ * @member {String} version='5.6.12'
24
24
  */
25
- version: '5.6.10'
25
+ version: '5.6.12'
26
26
  }
27
27
 
28
28
  /**
@@ -3,5 +3,5 @@
3
3
  "basePath" : "../../",
4
4
  "environment" : "development",
5
5
  "mainPath" : "./Main.mjs",
6
- "mainThreadAddons": ["DragDrop", "LocalStorage", "Stylesheet"]
6
+ "mainThreadAddons": ["DragDrop", "LocalStorage", "ScrollSync", "Stylesheet"]
7
7
  }
@@ -1,5 +1,5 @@
1
+ import CountryField from '../../../../src/form/field/Country.mjs';
1
2
  import FormPageContainer from '../FormPageContainer.mjs';
2
- import SelectField from '../../../../src/form/field/Select.mjs';
3
3
  import ZipCodeField from '../../../../src/form/field/ZipCode.mjs';
4
4
 
5
5
  /**
@@ -13,36 +13,75 @@ class Page11 extends FormPageContainer {
13
13
  * @protected
14
14
  */
15
15
  className: 'Form.view.pages.Page11',
16
+ /**
17
+ * @member {Object} itemDefaults
18
+ */
19
+ itemDefaults: {
20
+ itemDefaults: {
21
+ flex : 1,
22
+ style: {maxWidth: '300px'}
23
+ }
24
+ },
16
25
  /**
17
26
  * @member {Object[]} items
18
27
  */
19
28
  items: [{
20
- module : SelectField,
21
- editable : false,
22
- forceSelection: true,
23
- labelText : 'Country',
24
- name : 'page11.countryfield',
25
- reference : 'country',
26
- value : 'DE',
29
+ ntype : 'container',
30
+ layout: {ntype: 'hbox'},
27
31
 
28
- store: {
29
- data: [
30
- {id: 'DE', name: 'Germany'},
31
- {id: 'Others', name: 'Others'}
32
- ]
33
- }
34
- }, {
35
- module : ZipCodeField,
36
- countryField: 'country',
37
- labelText : 'Munich',
38
- name : 'page11.field1',
39
- required : true,
40
- value : '80796'
32
+ items : [{
33
+ module : CountryField,
34
+ editable : false,
35
+ forceSelection: true,
36
+ labelText : 'Country',
37
+ name : 'page11.countryfield1',
38
+ reference : 'country1',
39
+ value : 'DE',
40
+
41
+ store: {
42
+ data: [
43
+ {id: 'DE', name: 'Germany'},
44
+ {id: 'Others', name: 'Others'}
45
+ ]
46
+ }
47
+ }, {
48
+ module : ZipCodeField,
49
+ countryField: 'country1',
50
+ labelText : 'Munich',
51
+ name : 'page11.zipcodefield1',
52
+ required : true,
53
+ style : {marginLeft: '10px', maxWidth: '300px'},
54
+ value : '80796'
55
+ }]
41
56
  }, {
42
- module : ZipCodeField,
43
- countryField: 'country',
44
- labelText : 'Page 11 Field 2',
45
- name : 'page11.field2'
57
+ ntype : 'container',
58
+ layout: {ntype: 'hbox', align: 'stretch'},
59
+
60
+ items: [{
61
+ module : ZipCodeField,
62
+ labelText: 'Munich',
63
+ name : 'page11.zipcodefield2',
64
+ reference: 'zipcodefield2',
65
+ required : true,
66
+ value : '80796'
67
+ }, {
68
+ module : CountryField,
69
+ editable : false,
70
+ forceSelection: true,
71
+ labelText : 'Country',
72
+ name : 'page11.countryfield2',
73
+ reference : 'country2',
74
+ style : {marginLeft: '10px', maxWidth: '300px'},
75
+ value : 'DE',
76
+ zipCodeField : 'zipcodefield2',
77
+
78
+ store: {
79
+ data: [
80
+ {id: 'DE', name: 'Germany'},
81
+ {id: 'Others', name: 'Others'}
82
+ ]
83
+ }
84
+ }]
46
85
  }]
47
86
  }
48
87
  }
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.6.10'
23
+ * @member {String} version='5.6.12'
24
24
  */
25
- version: '5.6.10'
25
+ version: '5.6.12'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.6.10",
3
+ "version": "5.6.12",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
  "neo-jsdoc-x": "^1.0.5",
58
58
  "postcss": "^8.4.23",
59
59
  "sass": "^1.62.1",
60
- "webpack": "^5.82.0",
60
+ "webpack": "^5.82.1",
61
61
  "webpack-cli": "^5.1.1",
62
62
  "webpack-dev-server": "4.15.0",
63
63
  "webpack-hook-plugin": "^1.0.7",
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '5.6.10'
239
+ * @default '5.6.12'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '5.6.10'
244
+ version: '5.6.12'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -0,0 +1,58 @@
1
+ import Select from '../../form/field/Select.mjs';
2
+
3
+ /**
4
+ * @class Neo.form.field.Country
5
+ * @extends Neo.form.field.Select
6
+ */
7
+ class Country extends Select {
8
+ static config = {
9
+ /**
10
+ * @member {String} className='Neo.form.field.Country'
11
+ * @protected
12
+ */
13
+ className: 'Neo.form.field.Country',
14
+ /**
15
+ * @member {String} ntype='countryfield'
16
+ * @protected
17
+ */
18
+ ntype: 'countryfield',
19
+ /**
20
+ * You can either pass a field instance or a field reference
21
+ * @member {Neo.form.field.Base|String|null} zipCodeField_=null
22
+ */
23
+ zipCodeField_: null
24
+ }
25
+
26
+ /**
27
+ * Triggered after the zipCodeField config got changed
28
+ * @param {Neo.form.field.Base|null} value
29
+ * @param {Neo.form.field.Base|null} oldValue
30
+ * @protected
31
+ */
32
+ afterSetZipCodeField(value, oldValue) {
33
+ if (value && value instanceof Neo.form.field.Base) {
34
+ value.countryField = this
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Triggered before the zipCodeField config gets changed
40
+ * @param {Neo.form.field.Base|String|null} value
41
+ * @param {Neo.form.field.Base|String|null} oldValue
42
+ * @returns {Neo.form.field.Base|null}
43
+ * @protected
44
+ */
45
+ beforeSetZipCodeField(value, oldValue) {
46
+ let me = this;
47
+
48
+ if (Neo.isString(value)) {
49
+ return me.up().getReference(value)
50
+ }
51
+
52
+ return value;
53
+ }
54
+ }
55
+
56
+ Neo.applyClassConfig(Country);
57
+
58
+ export default Country;
@@ -270,9 +270,16 @@ class Picker extends Text {
270
270
  // avoid breaking selection model cls updates
271
271
  await Neo.timeout(30);
272
272
 
273
- me.pickerIsMounted && picker.unmount();
273
+ if (me.pickerIsMounted) {
274
+ picker.unmount();
275
+
276
+ me.pickerIsMounted = false;
274
277
 
275
- me.pickerIsMounted = false;
278
+ Neo.main.addon.ScrollSync.unregister({
279
+ sourceId: me.id,
280
+ targetId: picker.id
281
+ })
282
+ }
276
283
  }
277
284
 
278
285
  /**
@@ -372,6 +379,11 @@ class Picker extends Text {
372
379
  });
373
380
 
374
381
  picker.render(true);
382
+
383
+ Neo.main.addon.ScrollSync.register({
384
+ sourceId: me.id,
385
+ targetId: picker.id
386
+ })
375
387
  }
376
388
  }
377
389
 
@@ -637,7 +637,7 @@ class Select extends Picker {
637
637
  cls: ['neo-input-field-wrapper'],
638
638
  cn : [{
639
639
  tag : 'input',
640
- autocomplete: 'off',
640
+ autocomplete: 'no',
641
641
  autocorrect : 'off',
642
642
  cls : ['neo-textfield-input', 'neo-typeahead-input'],
643
643
  id : me.getInputHintId(),
@@ -258,12 +258,13 @@ class Text extends Base {
258
258
 
259
259
  /**
260
260
  * Triggered after the autoComplete config got changed
261
+ * Chrome ignores a value of "off", so we stick to a different value instead
261
262
  * @param {Boolean} value
262
263
  * @param {Boolean} oldValue
263
264
  * @protected
264
265
  */
265
266
  afterSetAutoComplete(value, oldValue) {
266
- this.changeInputElKey('autocomplete', value ? null : 'off');
267
+ this.changeInputElKey('autocomplete', value ? null : 'no');
267
268
  }
268
269
 
269
270
  /**
@@ -93,24 +93,10 @@ class ZipCode extends Text {
93
93
  * @protected
94
94
  */
95
95
  beforeSetCountryField(value, oldValue) {
96
- let me = this,
97
- field;
96
+ let me = this;
98
97
 
99
98
  if (Neo.isString(value)) {
100
- field = me.up().getReference(value);
101
-
102
- /*
103
- * The related field could be at a higher index inside the items array
104
- * => Not being constructed when this logic triggers.
105
- * In this case we want to frequently check again until the field is found.
106
- */
107
- if (!field) {
108
- setTimeout(() => {
109
- me.countryField = value;
110
- }, 20)
111
- }
112
-
113
- return field
99
+ return me.up().getReference(value)
114
100
  }
115
101
 
116
102
  return value;
@@ -310,10 +310,13 @@ class DragDrop extends Base {
310
310
  }
311
311
 
312
312
  if (!me.dragProxyElement || me.alwaysFireDragMove) {
313
+ const originalEvent = event.detail.originalEvent;
313
314
  DomEvents.sendMessageToApp({
314
315
  ...me.getEventData(event),
315
316
  offsetX: me.offsetX,
316
317
  offsetY: me.offsetY,
318
+ screenX: originalEvent.screenX,
319
+ screenY: originalEvent.screenY,
317
320
  type : 'drag:move'
318
321
  });
319
322
  }
@@ -167,8 +167,6 @@ class GoogleMaps extends Base {
167
167
  let key = Neo.config.googleMapsApiKey,
168
168
  url = ' https://maps.googleapis.com/maps/api/js';
169
169
 
170
- window.foo = Neo.emptyFn;
171
-
172
170
  DomAccess.loadScript(`${url}?key=${key}&v=weekly&callback=Neo.emptyFn`).then(() => {
173
171
  console.log('GoogleMaps API loaded');
174
172
  })
@@ -30,13 +30,55 @@ class ScrollSync extends Base {
30
30
  singleton: true
31
31
  }
32
32
 
33
+ /**
34
+ * @member {Object} items=[]
35
+ * @protected
36
+ */
37
+ items = []
38
+
33
39
  /**
34
40
  * @param {Object} data
35
41
  * @param {String} data.sourceId
36
42
  * @param {String} data.targetId
37
43
  */
38
44
  register(data) {
39
- console.log('register', data)
45
+ let me = this,
46
+ items = me.items,
47
+ sourceId = data.sourceId,
48
+ targetId = data.targetId;
49
+
50
+ // ensure that there are no duplicate entries
51
+ me.removeItem(sourceId, targetId);
52
+
53
+ items.push({
54
+ source: {id: sourceId},
55
+ target: {id: targetId}
56
+ })
57
+
58
+ console.log('register', data, items)
59
+ }
60
+
61
+ /**
62
+ * @param {String} sourceId
63
+ * @param {String} targetId
64
+ * @returns {Boolean}
65
+ */
66
+ removeItem(sourceId, targetId) {
67
+ let items = this.items,
68
+ i = 0,
69
+ len = items.length,
70
+ item;
71
+
72
+ for (; i < len; i++) {
73
+ item = items[i];
74
+
75
+ if (item.source.id === sourceId && item.target.id === targetId) {
76
+ items.splice(i, 1);
77
+ return true
78
+ }
79
+ }
80
+
81
+ return false
40
82
  }
41
83
 
42
84
  /**
@@ -45,7 +87,7 @@ class ScrollSync extends Base {
45
87
  * @param {String} data.targetId
46
88
  */
47
89
  unregister(data) {
48
- console.log('unregister', data)
90
+ this.removeItem(data.sourceId, data.targetId)
49
91
  }
50
92
  }
51
93