neo.mjs 8.41.2 → 8.42.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.41.2'
23
+ * @member {String} version='8.42.0'
24
24
  */
25
- version: '8.41.2'
25
+ version: '8.42.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.41.2'
110
+ html : 'v8.42.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.41.2'
23
+ * @member {String} version='8.42.0'
24
24
  */
25
- version: '8.41.2'
25
+ version: '8.42.0'
26
26
  }
27
27
 
28
28
  /**
@@ -23,9 +23,9 @@ class ViewportController extends Component {
23
23
  */
24
24
  editButtonHandler(data) {
25
25
  let me = this,
26
+ {dialog} = me,
26
27
  button = data.component,
27
- {appName, dialog, theme, windowId} = me,
28
- {record} = button;
28
+ {appName, record, theme, windowId} = button;
29
29
 
30
30
  if (!dialog) {
31
31
  import('./EditUserDialog.mjs').then(module => {
@@ -91,7 +91,7 @@ class ViewportController extends Component {
91
91
  onSwitchThemeButtonClick(data) {
92
92
  let me = this,
93
93
  button = data.component,
94
- isDarkTheme = me.theme !== 'neo-theme-light',
94
+ isDarkTheme = button.theme !== 'neo-theme-light',
95
95
  theme = isDarkTheme ? 'neo-theme-light' : 'neo-theme-dark';
96
96
 
97
97
  button.set({
@@ -99,7 +99,7 @@ class ViewportController extends Component {
99
99
  text : isDarkTheme ? 'Dark Theme' : 'Light Theme'
100
100
  });
101
101
 
102
- me.theme = theme;
102
+ me.component.theme = theme;
103
103
 
104
104
  if (me.dialog) {
105
105
  me.dialog.theme = theme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "8.41.2",
3
+ "version": "8.42.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "sass": "^1.86.3",
66
66
  "siesta-lite": "5.5.2",
67
67
  "url": "^0.11.4",
68
- "webpack": "^5.99.3",
68
+ "webpack": "^5.99.5",
69
69
  "webpack-cli": "^6.0.1",
70
70
  "webpack-dev-server": "^5.2.1",
71
71
  "webpack-hook-plugin": "^1.0.7",
@@ -263,12 +263,12 @@ const DefaultConfig = {
263
263
  useVdomWorker: true,
264
264
  /**
265
265
  * buildScripts/injectPackageVersion.mjs will update this value
266
- * @default '8.41.2'
266
+ * @default '8.42.0'
267
267
  * @memberOf! module:Neo
268
268
  * @name config.version
269
269
  * @type String
270
270
  */
271
- version: '8.41.2'
271
+ version: '8.42.0'
272
272
  };
273
273
 
274
274
  Object.assign(DefaultConfig, {
@@ -811,7 +811,7 @@ class Collection extends Base {
811
811
  /**
812
812
  * Returns the first item which matches the property and value
813
813
  * @param {Object|String} property
814
- * @param {String|Number} [value] Only required in case the first param is a string
814
+ * @param {Number|String} [value] Only required in case the first param is a string
815
815
  * @returns {Object} Returns the first found item or null
816
816
  */
817
817
  findFirst(property, value) {
@@ -828,7 +828,7 @@ class Collection extends Base {
828
828
 
829
829
  /**
830
830
  * Returns the object associated to the key, or null if there is none.
831
- * @param key
831
+ * @param {Number|String} key
832
832
  * @returns {Object|null}
833
833
  */
834
834
  get(key) {
@@ -303,7 +303,7 @@ class Container extends Component {
303
303
  createItem(item, index) {
304
304
  let me = this,
305
305
  config = {appName: me.appName, parentId: me.id, parentIndex: index, windowId: me.windowId},
306
- defaults = {theme: me.theme, ...me.itemDefaults},
306
+ defaults = {...me.itemDefaults},
307
307
  lazyLoadItem, module;
308
308
 
309
309
  if (defaults) {
@@ -319,6 +319,7 @@ class Container extends Component {
319
319
  switch (Neo.typeOf(item)) {
320
320
  case 'NeoClass': {
321
321
  item = Neo.create({
322
+ theme: item.config.theme || me.theme,
322
323
  ...defaults,
323
324
  module: item,
324
325
  ...config
@@ -350,7 +351,8 @@ class Container extends Component {
350
351
  lazyLoadItem = module && !module.isClass && Neo.isFunction(module);
351
352
 
352
353
  if (module && !lazyLoadItem) {
353
- item.className = module.prototype.className
354
+ item.className = module.prototype.className;
355
+ item.theme = defaults.theme || module.config.theme || me.theme
354
356
  }
355
357
 
356
358
  if (item.handlerScope === 'this') {
@@ -35,7 +35,7 @@ class Component extends Manager {
35
35
  let me = this;
36
36
 
37
37
  Neo.first = me.getFirst.bind(me); // alias
38
- Neo.getComponent = me.getById.bind(me) // alias
38
+ Neo.getComponent = me.get .bind(me) // alias
39
39
  }
40
40
 
41
41
  /**
@@ -157,7 +157,7 @@ class Component extends Manager {
157
157
  }
158
158
 
159
159
  /**
160
- * @param {Array} path
160
+ * @param {Object[]} path
161
161
  * @returns {String|null} the component id in case there is a match
162
162
  */
163
163
  findParentComponent(path) {
@@ -179,11 +179,20 @@ class Component extends Manager {
179
179
 
180
180
  /**
181
181
  * Returns the object associated to the key, or null if there is none.
182
- * @param key
182
+ * @param {Number|String} key
183
+ * @param {Boolean} [includeWrapperNodes=true]
183
184
  * @returns {Neo.component.Base|null}
184
185
  */
185
- get(key) {
186
- return this.wrapperNodes.get(key) || super.get(key)
186
+ get(key, includeWrapperNodes=true) {
187
+ if (includeWrapperNodes) {
188
+ let wrapperNode = this.wrapperNodes.get(key);
189
+
190
+ if (wrapperNode) {
191
+ return wrapperNode
192
+ }
193
+ }
194
+
195
+ return super.get(key)
187
196
  }
188
197
 
189
198
  /**
@@ -333,7 +342,7 @@ class Component extends Manager {
333
342
  let parentIds = [];
334
343
 
335
344
  while (component?.parentId) {
336
- component = this.getById(component.parentId);
345
+ component = this.get(component.parentId);
337
346
 
338
347
  if (component) {
339
348
  parentIds.push(component.id)
@@ -369,13 +378,13 @@ class Component extends Manager {
369
378
  */
370
379
  getParents(component) {
371
380
  if (Neo.isString(component)) {
372
- component = this.getById(component)
381
+ component = this.get(component)
373
382
  }
374
383
 
375
384
  let parents = [];
376
385
 
377
386
  while (component?.parentId) {
378
- component = this.getById(component.parentId);
387
+ component = this.get(component.parentId);
379
388
 
380
389
  if (component) {
381
390
  parents.push(component)
@@ -509,7 +518,7 @@ class Component extends Manager {
509
518
  * @returns {Neo.component.Base|Neo.component.Base[]|null}
510
519
  */
511
520
  up(componentId, config, returnFirstMatch=true) {
512
- let component = this.getById(componentId),
521
+ let component = this.get(componentId),
513
522
  returnArray = [],
514
523
  configArray, configLength, matchArray;
515
524
 
@@ -525,7 +534,7 @@ class Component extends Manager {
525
534
  configLength = configArray.length;
526
535
 
527
536
  while (component?.parentId) {
528
- component = this.getById(component.parentId);
537
+ component = this.get(component.parentId);
529
538
 
530
539
  if (!component) {
531
540
  return returnFirstMatch ? null : returnArray
@@ -163,7 +163,7 @@ class Logger extends Base {
163
163
  component;
164
164
 
165
165
  data.path.forEach(item => {
166
- component = Neo.getComponent(item.id);
166
+ component = Neo.getComponent(item.id, false);
167
167
 
168
168
  if (component) {
169
169
  if (!isGroupSet) {