neo.mjs 6.5.10 → 6.6.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='6.5.10'
23
+ * @member {String} version='6.6.1'
24
24
  */
25
- version: '6.5.10'
25
+ version: '6.6.1'
26
26
  }
27
27
 
28
28
  /**
@@ -255,10 +255,10 @@ class MainContainerController extends ComponentController {
255
255
 
256
256
  console.log('onAppConnect', name);
257
257
 
258
- switch (name) {
258
+ switch(name) {
259
259
  case 'SharedCovidChart':
260
- view = me.getReference('controls-panel');
261
- parentView = Neo.getComponent(view.parentId);
260
+ view = me.getReference('controls-panel');
261
+ parentView = view.parent;
262
262
  parentView.storeReferences();
263
263
 
264
264
  toolbar = me.getReference('controls-panel-header');
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.5.10'
23
+ * @member {String} version='6.6.1'
24
24
  */
25
- version: '6.5.10'
25
+ version: '6.6.1'
26
26
  }
27
27
 
28
28
  /**
@@ -1,3 +1,4 @@
1
+ import Button from '../../src/button/Base.mjs';
1
2
  import Dialog from '../../src/dialog/Base.mjs';
2
3
  import SelectField from '../../src/form/field/Select.mjs';
3
4
 
@@ -13,9 +14,18 @@ class DemoDialog extends Dialog {
13
14
 
14
15
  wrapperStyle: {
15
16
  width : '40%'
16
- },
17
+ }
18
+ }
19
+
20
+ /**
21
+ * @param {Object} config
22
+ */
23
+ construct(config) {
24
+ super.construct(config);
25
+
26
+ const me = this;
17
27
 
18
- items : [{
28
+ me.items = [{
19
29
  module : SelectField,
20
30
  labelText: 'Select',
21
31
 
@@ -33,7 +43,36 @@ class DemoDialog extends Dialog {
33
43
  return result;
34
44
  })()
35
45
  }
36
- }]
46
+ }, {
47
+ module : Button,
48
+ handler: me.createDialog.bind(me),
49
+ iconCls: 'fa fa-window-maximize',
50
+ text : 'Create new modal Dialog',
51
+ }];
52
+ }
53
+
54
+ /**
55
+ * @param {Object} data
56
+ */
57
+ createDialog(data) {
58
+ let me = this;
59
+
60
+ data.component.disabled = true;
61
+
62
+ me.dialog = Neo.create(DemoDialog, {
63
+ appName : me.appName,
64
+ boundaryContainerId: me.boundaryContainerId,
65
+ listeners : {close: me.onWindowClose, scope: me},
66
+ modal : true
67
+ });
68
+ }
69
+
70
+ onWindowClose() {
71
+ let button = this.down({
72
+ text: 'Create new modal Dialog'
73
+ });
74
+
75
+ button.disabled = false;
37
76
  }
38
77
  }
39
78
 
@@ -50,6 +50,13 @@ class MainContainer extends Viewport {
50
50
  listeners : {change: me.onDragLimitChange, scope: me},
51
51
  style : {marginLeft: '3em'},
52
52
  valueLabelText: 'Limit Drag&Drop to the document.body'
53
+ }, {
54
+ module : CheckBox,
55
+ checked : true,
56
+ hideLabel : true,
57
+ hideValueLabel: false,
58
+ style : {marginLeft: '3em'},
59
+ valueLabelText: 'Modal'
53
60
  }, '->', {
54
61
  module : Button,
55
62
  handler: me.switchTheme.bind(me),
@@ -71,7 +78,8 @@ class MainContainer extends Viewport {
71
78
  animateTargetId : data.component.id,
72
79
  appName : me.appName,
73
80
  boundaryContainerId: me.boundaryContainerId,
74
- listeners : {close: me.onWindowClose, scope: me}
81
+ listeners : {close: me.onWindowClose, scope: me},
82
+ modal : me.down({ valueLabelText : 'Modal' }).checked
75
83
  });
76
84
  }
77
85
 
@@ -97,7 +97,7 @@ class MainContainer extends TabContainer {
97
97
  text : 'Move Fields',
98
98
  handler: function () {
99
99
  let field = Neo.getComponent('firstNameField'),
100
- parent = Neo.getComponent(field.parentId),
100
+ parent = field.parent,
101
101
  cn = parent.vdom.cn,
102
102
  tmp = cn[1];
103
103
 
@@ -114,7 +114,7 @@ class MainContainer extends TabContainer {
114
114
  text : 'Insert Textfield',
115
115
  handler: function () {
116
116
  let button = Neo.getComponent('firstNameField'),
117
- parent = Neo.getComponent(button.parentId);
117
+ parent = button.parent;
118
118
 
119
119
  // global variable for testing
120
120
  if (!this.fieldCount) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "6.5.10",
3
+ "version": "6.6.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,20 +17,33 @@
17
17
  }
18
18
  }
19
19
 
20
- .neo-dialog-wrapper {
21
- display : flex;
22
- position: absolute;
23
- z-index : 20; // ensure to be on top of table headers
20
+ .neo-dialog-modal-mask {
21
+ position : fixed;
22
+ top : 0;
23
+ left : 0;
24
+ bottom : 0;
25
+ right : 0;
26
+ background-color : rgba(100, 100, 100, 0.5);
27
+ backdrop-filter : blur(1px);
28
+ z-index : 1000;
29
+ }
24
30
 
25
- transition-duration : 200ms;
26
- transition-property : height, left, top, transform, width;
27
- transition-timing-function: ease-out;
31
+ .neo-dialog {
32
+ border : 1px solid var(--dialog-border-color);
33
+ display : flex;
34
+ flex-direction: column;
35
+
36
+ &.animated-hiding-showing {
37
+ transition-duration : 200ms;
38
+ transition-property : height, left, top, transform, width;
39
+ transition-timing-function: ease-out;
40
+ }
28
41
 
29
42
  &.neo-maximized {
30
43
  height : 98% !important;
31
44
  left : 1% !important;
32
45
  top : 1% !important;
33
- transform: none;
46
+ transform: none!important;
34
47
  width : 98% !important;
35
48
 
36
49
  &.neo-panel {
@@ -41,14 +54,6 @@
41
54
  }
42
55
  }
43
56
  }
44
- }
45
-
46
- .neo-dialog {
47
- border : 1px solid var(--dialog-border-color);
48
- display : flex;
49
- flex : 1 0 auto;
50
- flex-direction: column;
51
- position : relative;
52
57
 
53
58
  &.neo-panel {
54
59
  .neo-footer-toolbar {
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '6.5.10'
239
+ * @default '6.6.1'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '6.5.10'
244
+ version: '6.6.1'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -57,7 +57,7 @@ class SettingsContainer extends Container {
57
57
  me._style = style; // silent update
58
58
  me._vdom.style = style; // silent update
59
59
 
60
- Neo.getComponent(me.parentId).promiseUpdate().then(() => {
60
+ me.parent.promiseUpdate().then(() => {
61
61
  setTimeout(() => {
62
62
  me.collapsed = true;
63
63
 
@@ -145,7 +145,7 @@ class SettingsContainer extends Container {
145
145
 
146
146
  delete me.vdom.removeDom;
147
147
 
148
- Neo.getComponent(me.parentId).promiseUpdate().then(() => {
148
+ me.parent.promiseUpdate().then(() => {
149
149
  me.collapsed = false;
150
150
  me.mounted = true;
151
151
 
@@ -367,6 +367,14 @@ class Base extends CoreBase {
367
367
  this._listeners = value
368
368
  }
369
369
 
370
+ /**
371
+ * Convenience method to access the parent component
372
+ * @returns {Neo.component.Base|null}
373
+ */
374
+ get parent() {
375
+ return this.parentId !== 'document.body' ? Neo.getComponent(this.parentId) : null
376
+ }
377
+
370
378
  /**
371
379
  * True after the component render() method was called. Also fires the rendered event.
372
380
  * @member {Boolean} rendered=false
@@ -894,20 +902,24 @@ class Base extends CoreBase {
894
902
  * @returns {Promise<void>}
895
903
  */
896
904
  async alignTo(spec={}) {
897
- const me = this;
905
+ const
906
+ me = this,
907
+ align = {
908
+ ...me.align,
909
+ ...spec,
910
+ id : me.id,
911
+ configuredFlex : me.configuredFlex,
912
+ configuredWidth : me.configuredWidth,
913
+ configuredHeight : me.configuredHeight,
914
+ configuredMinWidth : me.configuredMinWidth,
915
+ configuredMinHeight : me.configuredMinHeight,
916
+ configuredMaxWidth : me.configuredMaxWidth,
917
+ configuredMaxHeight : me.configuredMaxHeight
918
+ };
898
919
 
899
- await Neo.main.DomAccess.align({
900
- ...me.align,
901
- ...spec,
902
- id : me.id,
903
- configuredFlex : me.configuredFlex,
904
- configuredWidth : me.configuredWidth,
905
- configuredHeight : me.configuredHeight,
906
- configuredMinWidth : me.configuredMinWidth,
907
- configuredMinHeight : me.configuredMinHeight,
908
- configuredMaxWidth : me.configuredMaxWidth,
909
- configuredMaxHeight : me.configuredMaxHeight
910
- });
920
+ if (align.target) {
921
+ await Neo.main.DomAccess.align(align);
922
+ }
911
923
  }
912
924
 
913
925
  /**
@@ -145,12 +145,13 @@ class Splitter extends Component {
145
145
  onDragEnd(data) {
146
146
  let me = this,
147
147
  style = me.style || {},
148
+ parent = me.parent,
148
149
  parentId = me.parentId,
149
150
  resizeNext = me.resizeTarget === 'next',
150
151
  size = me.size,
151
- index, newSize, sibling, parent;
152
+ index, newSize, sibling;
152
153
 
153
- Neo.getComponent(parentId).disabled = false;
154
+ parent.disabled = false;
154
155
 
155
156
  me.dragZone.dragEnd(data);
156
157
 
@@ -159,7 +160,6 @@ class Splitter extends Component {
159
160
  me.style = style;
160
161
 
161
162
  me.getDomRect(parentId).then(parentRect => {
162
- parent = Neo.getComponent(parentId);
163
163
  index = parent.indexOf(me);
164
164
  sibling = parent.items[resizeNext ? index + 1 :index - 1];
165
165
  style = sibling.style || {};
@@ -204,7 +204,7 @@ class Splitter extends Component {
204
204
  style = me.style || {},
205
205
  vertical = me.direction === 'vertical';
206
206
 
207
- Neo.getComponent(me.parentId).disabled = true;
207
+ me.parent.disabled = true;
208
208
 
209
209
  if (!me.dragZone) {
210
210
  me.dragZone = Neo.create({
@@ -93,17 +93,13 @@ class Component extends Base {
93
93
  * @returns {Neo.controller.Component|null}
94
94
  */
95
95
  getParent() {
96
- let me = this,
97
- parentComponent, parentId;
96
+ let me = this;
98
97
 
99
98
  if (me.parent) {
100
99
  return me.parent;
101
100
  }
102
101
 
103
- parentId = me.component.parentId;
104
- parentComponent = parentId && Neo.getComponent(parentId);
105
-
106
- return parentComponent?.getController() || null
102
+ return me.component.parent?.getController() || null
107
103
  }
108
104
 
109
105
  /**
package/src/core/Base.mjs CHANGED
@@ -11,13 +11,6 @@ const configSymbol = Symbol.for('configSymbol'),
11
11
  * @class Neo.core.Base
12
12
  */
13
13
  class Base {
14
- /**
15
- * Regex to grab the MethodName from an error
16
- * which is a second generation function
17
- * @member {RegExp} methodNameRegex
18
- * @static
19
- */
20
- static methodNameRegex = /\n.*\n\s+at\s+.*\.(\w+)\s+.*/
21
14
  /**
22
15
  * You can define methods which should get delayed
23
16
  * @example
@@ -32,6 +25,13 @@ class Base {
32
25
  * @static
33
26
  */
34
27
  static delayable = {}
28
+ /**
29
+ * Regex to grab the MethodName from an error
30
+ * which is a second generation function
31
+ * @member {RegExp} methodNameRegex
32
+ * @static
33
+ */
34
+ static methodNameRegex = /\n.*\n\s+at\s+.*\.(\w+)\s+.*/
35
35
  /**
36
36
  * True automatically applies the core.Observable mixin
37
37
  * @member {Boolean} observable=false