neo.mjs 6.6.5 → 6.7.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.6.5'
23
+ * @member {String} version='6.7.1'
24
24
  */
25
- version: '6.6.5'
25
+ version: '6.7.1'
26
26
  }
27
27
 
28
28
  /**
@@ -1,8 +1,14 @@
1
- import Button from '../src/button/Base.mjs';
2
- import Container from '../src/container/Base.mjs';
3
- import NeoArray from '../src/util/Array.mjs';
4
- import Panel from '../src/container/Panel.mjs';
5
- import Viewport from '../src/container/Viewport.mjs';
1
+ import Button from '../src/button/Base.mjs';
2
+ import Container from '../src/container/Base.mjs';
3
+ import {bindAppend} from '../src/util/Function.mjs';
4
+ import Panel from '../src/container/Panel.mjs';
5
+ import Viewport from '../src/container/Viewport.mjs';
6
+
7
+ // add custom themes here
8
+ const themes = [
9
+ {name: 'neo-theme-dark', label: 'Theme Dark'},
10
+ {name: 'neo-theme-light', label: 'Theme Light'}
11
+ ]
6
12
 
7
13
  /**
8
14
  * Base class for example Apps which should be configurable
@@ -112,8 +118,7 @@ class ConfigurationViewport extends Viewport {
112
118
 
113
119
  items: [...me.configurationComponents, {
114
120
  module : Button,
115
- handler: me.onSwitchTheme.bind(me, 'cmp'),
116
- id : me.id + '_cmp_' + 'switchThemeButton',
121
+ handler: bindAppend(me.onSwitchTheme, me, 'cmp'),
117
122
  style : {marginTop: '20px'},
118
123
  text : theme === 'neo-theme-dark' ? 'Theme Light' : 'Theme Dark',
119
124
  width : 100
@@ -172,24 +177,26 @@ class ConfigurationViewport extends Viewport {
172
177
  }
173
178
 
174
179
  /**
180
+ * @param {Object} data
175
181
  * @param {String} target
176
182
  */
177
- onSwitchTheme(target) {
178
- let me = this,
179
- button = Neo.getComponent(me.id + (target !== 'cmp' ? '__' : '_cmp_') + 'switchThemeButton'),
180
- newTheme, oldTheme;
181
-
182
- if (button.text === 'Theme Light') {
183
- newTheme = 'neo-theme-light';
184
- oldTheme = 'neo-theme-dark';
185
-
186
- button.text = 'Theme Dark';
187
- } else {
188
- newTheme = 'neo-theme-dark';
189
- oldTheme = 'neo-theme-light';
190
-
191
- button.text = 'Theme Light';
192
- }
183
+ onSwitchTheme(data, target) {
184
+ let me = this,
185
+ button = data.component,
186
+ countThemes = themes.length,
187
+ newTheme, oldIndex, oldTheme, themeIndex;
188
+
189
+ themes.forEach((theme, index) => {
190
+ if (button.text === theme.label) {
191
+ newTheme = theme.name;
192
+ themeIndex = index;
193
+ }
194
+ });
195
+
196
+ oldIndex = (themeIndex + 1) % countThemes;
197
+ oldTheme = themes[oldIndex].name;
198
+
199
+ button.text = themes[oldIndex].label;
193
200
 
194
201
  if (target === 'cmp') {
195
202
  me.exampleComponent.theme = newTheme;
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.6.5'
23
+ * @member {String} version='6.7.1'
24
24
  */
25
- version: '6.6.5'
25
+ version: '6.7.1'
26
26
  }
27
27
 
28
28
  /**
@@ -44,11 +44,12 @@ class DemoDialog extends Dialog {
44
44
  })()
45
45
  }
46
46
  }, {
47
- module : Button,
48
- handler: me.createDialog.bind(me),
49
- iconCls: 'fa fa-window-maximize',
50
- text : 'Create new modal Dialog',
51
- }];
47
+ module : Button,
48
+ handler : me.createDialog.bind(me),
49
+ iconCls : 'fa fa-window-maximize',
50
+ reference: 'create-second-dialog-button',
51
+ text : 'Create new modal Dialog',
52
+ }]
52
53
  }
53
54
 
54
55
  /**
@@ -63,16 +64,16 @@ class DemoDialog extends Dialog {
63
64
  appName : me.appName,
64
65
  boundaryContainerId: me.boundaryContainerId,
65
66
  listeners : {close: me.onWindowClose, scope: me},
66
- modal : true
67
+ modal : true,
68
+ title : 'Second Dialog'
67
69
  });
68
70
  }
69
71
 
72
+ /**
73
+ *
74
+ */
70
75
  onWindowClose() {
71
- let button = this.down({
72
- text: 'Create new modal Dialog'
73
- });
74
-
75
- button.disabled = false;
76
+ this.getReference('create-second-dialog-button').disabled = false;
76
77
  }
77
78
  }
78
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "6.6.5",
3
+ "version": "6.7.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "@fortawesome/fontawesome-free": "^6.4.2",
46
46
  "@material/mwc-button": "^0.27.0",
47
47
  "@material/mwc-textfield": "^0.27.0",
48
- "autoprefixer": "^10.4.15",
48
+ "autoprefixer": "^10.4.16",
49
49
  "chalk": "^5.3.0",
50
50
  "clean-webpack-plugin": "^4.0.0",
51
51
  "commander": "^11.0.0",
@@ -57,7 +57,7 @@
57
57
  "neo-jsdoc": "1.0.1",
58
58
  "neo-jsdoc-x": "1.0.5",
59
59
  "postcss": "^8.4.30",
60
- "sass": "^1.67.0",
60
+ "sass": "^1.68.0",
61
61
  "showdown": "^2.1.0",
62
62
  "webpack": "^5.88.2",
63
63
  "webpack-cli": "^5.1.4",
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '6.6.5'
239
+ * @default '6.7.1'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '6.6.5'
244
+ version: '6.7.1'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -2050,13 +2050,17 @@ class Base extends CoreBase {
2050
2050
  * Placeholder method for util.VDom.syncVdomIds to allow overriding (disabling) it
2051
2051
  * @param {Neo.vdom.VNode} [vnode=this.vnode]
2052
2052
  * @param {Object} [vdom=this.vdom]
2053
+ * @param {Boolean} force=false
2053
2054
  */
2054
- syncVdomIds(vnode=this.vnode, vdom=this.vdom) {
2055
- VDomUtil.syncVdomIds(vnode, vdom)
2055
+ syncVdomIds(vnode=this.vnode, vdom=this.vdom, force=false) {
2056
+ VDomUtil.syncVdomIds(vnode, vdom, force)
2056
2057
  }
2057
2058
 
2058
2059
  /**
2059
- * Placeholder method for util.VDom.syncVdomIds to allow overriding (disabling) it
2060
+ * In case a component receives a new vnode, we want to do:
2061
+ * - sync the vdom ids
2062
+ * - setting rendered to true for child components
2063
+ * - updating the parent component to ensure that the vnode tree stays persistent
2060
2064
  * @param {Neo.vdom.VNode} [vnode=this.vnode]
2061
2065
  */
2062
2066
  syncVnodeTree(vnode=this.vnode) {
@@ -156,7 +156,7 @@ class DateSelector extends Component {
156
156
  me.addDomListeners([
157
157
  {click: me.onComponentClick, scope: me},
158
158
  {wheel: me.onComponentWheel, scope: me}
159
- ]);
159
+ ])
160
160
  }
161
161
 
162
162
  /**
@@ -176,12 +176,12 @@ class DateSelector extends Component {
176
176
 
177
177
  if (monthIncrement !== 0) { // gets used when month & year changed as well
178
178
  method = 'changeMonth';
179
- methodParams = [monthIncrement, yearIncrement];
179
+ methodParams = [monthIncrement, yearIncrement]
180
180
  } else if (yearIncrement !== 0) {
181
181
  method = 'changeYear';
182
- methodParams = [yearIncrement];
182
+ methodParams = [yearIncrement]
183
183
  } else if (dayIncrement !== 0) {
184
- me.selectionModel.select(me.id + '__' + DateUtil.convertToyyyymmdd(value));
184
+ me.selectionModel.select(me.id + '__' + DateUtil.convertToyyyymmdd(value))
185
185
  }
186
186
 
187
187
  if (method) {
@@ -189,10 +189,10 @@ class DateSelector extends Component {
189
189
  Neo.main.DomAccess.focus({
190
190
  id: me.id
191
191
  }).then(data => {
192
- me[method](...methodParams);
193
- });
192
+ me[method](...methodParams)
193
+ })
194
194
  } else {
195
- me[method](...methodParams);
195
+ me[method](...methodParams)
196
196
  }
197
197
  }
198
198
  } else if (value) {
@@ -209,7 +209,7 @@ class DateSelector extends Component {
209
209
  * @protected
210
210
  */
211
211
  afterSetDayNameFormat(value, oldValue) {
212
- this.updateHeaderDays(value, oldValue);
212
+ this.updateHeaderDays(value, oldValue)
213
213
  }
214
214
 
215
215
  /**
@@ -223,10 +223,10 @@ class DateSelector extends Component {
223
223
  let me = this;
224
224
 
225
225
  if (me.cachedUpdate && me.cachedUpdate !== new Date(`${me.value}T00:00:00.000Z`)) {
226
- me.afterSetValue(me.value, DateUtil.convertToyyyymmdd(me.cachedUpdate));
226
+ me.afterSetValue(me.value, DateUtil.convertToyyyymmdd(me.cachedUpdate))
227
227
  }
228
228
 
229
- me.cachedUpdate = null;
229
+ me.cachedUpdate = null
230
230
  }
231
231
  }
232
232
 
@@ -238,14 +238,14 @@ class DateSelector extends Component {
238
238
  */
239
239
  afterSetLocale(value, oldValue) {
240
240
  if (oldValue !== undefined) {
241
- let me = this,
242
- dt = new Intl.DateTimeFormat(me.locale, {month: 'short'});
241
+ let me = this,
242
+ dt = new Intl.DateTimeFormat(me.locale, {month: 'short'});
243
243
 
244
244
  me.updateHeaderDays(me.dayNameFormat, '', true);
245
245
 
246
246
  me.getHeaderMonthEl().html = dt.format(me.currentDate);
247
247
 
248
- me.update();
248
+ me.update()
249
249
  }
250
250
  }
251
251
 
@@ -279,8 +279,8 @@ class DateSelector extends Component {
279
279
  let me = this,
280
280
  cls = me.cls;
281
281
 
282
- NeoArray[value ? 'remove' : 'add'](cls, 'neo-hide-inner-borders');
283
- me.cls = cls;
282
+ NeoArray.toggle(cls, 'neo-hide-inner-borders', !value);
283
+ me.cls = cls
284
284
  }
285
285
 
286
286
  /**
@@ -313,9 +313,9 @@ class DateSelector extends Component {
313
313
 
314
314
  if (item.cls.includes('neo-weekend')) {
315
315
  if (value) {
316
- delete item.removeDom;
316
+ delete item.removeDom
317
317
  } else {
318
- item.removeDom = true;
318
+ item.removeDom = true
319
319
  }
320
320
  }
321
321
  }
@@ -366,7 +366,7 @@ class DateSelector extends Component {
366
366
  * @protected
367
367
  */
368
368
  afterSetWeekStartDay(value, oldValue) {
369
- oldValue !== undefined && this.recreateDayViewContent(false, false);
369
+ oldValue !== undefined && this.recreateDayViewContent(false, false)
370
370
  }
371
371
 
372
372
  /**
@@ -376,7 +376,7 @@ class DateSelector extends Component {
376
376
  * @protected
377
377
  */
378
378
  beforeSetDayNameFormat(value, oldValue) {
379
- return this.beforeSetEnumValue(value, oldValue, 'dayNameFormat', DateUtil.prototype.dayNameFormats);
379
+ return this.beforeSetEnumValue(value, oldValue, 'dayNameFormat', DateUtil.prototype.dayNameFormats)
380
380
  }
381
381
 
382
382
  /**
@@ -388,7 +388,7 @@ class DateSelector extends Component {
388
388
  beforeSetSelectionModel(value, oldValue) {
389
389
  oldValue && oldValue.destroy();
390
390
 
391
- return ClassSystemUtil.beforeSetInstance(value, DateSelectorModel);
391
+ return ClassSystemUtil.beforeSetInstance(value, DateSelectorModel)
392
392
  }
393
393
 
394
394
  /**
@@ -398,7 +398,7 @@ class DateSelector extends Component {
398
398
  * @protected
399
399
  */
400
400
  beforeSetWeekStartDay(value, oldValue) {
401
- return this.beforeSetEnumValue(value, oldValue, 'weekStartDay', DateUtil.prototype.weekStartDays);
401
+ return this.beforeSetEnumValue(value, oldValue, 'weekStartDay', DateUtil.prototype.weekStartDays)
402
402
  }
403
403
 
404
404
  /**
@@ -407,7 +407,7 @@ class DateSelector extends Component {
407
407
  * @protected
408
408
  */
409
409
  cacheUpdate(date=this.currentDate) {
410
- this.cachedUpdate = date;
410
+ this.cachedUpdate = date
411
411
  }
412
412
 
413
413
  /**
@@ -420,7 +420,7 @@ class DateSelector extends Component {
420
420
  headerMonthOpts, vdom, x;
421
421
 
422
422
  if (!me.useAnimations) {
423
- me.recreateContent(increment, yearIncrement);
423
+ me.recreateContent(increment, yearIncrement)
424
424
  } else {
425
425
  if (!me.isUpdating) {
426
426
  me.isUpdating = true;
@@ -440,7 +440,7 @@ class DateSelector extends Component {
440
440
  headerMonthOpts = me.updateHeaderMonth(increment, yearIncrement, true, data[1]);
441
441
 
442
442
  if (yearIncrement !== 0) {
443
- me.updateHeaderYear(increment, true);
443
+ me.updateHeaderYear(increment, true)
444
444
  }
445
445
 
446
446
  me.createDayViewContent(true, vdom.cn[2].cn[0].cn[0]);
@@ -455,12 +455,12 @@ class DateSelector extends Component {
455
455
  setTimeout(() => {
456
456
  me.changeMonthWrapperCallback(slideDirection);
457
457
  me.updateHeaderMonthWrapperCallback(headerMonthOpts);
458
- me.triggerVdomUpdate();
458
+ me.triggerVdomUpdate()
459
459
  }, 300);
460
460
  });
461
461
  });
462
462
  } else {
463
- me.cacheUpdate();
463
+ me.cacheUpdate()
464
464
  }
465
465
  }
466
466
  }
@@ -474,12 +474,11 @@ class DateSelector extends Component {
474
474
  */
475
475
  changeMonthTransitionCallback(opts) {
476
476
  let me = this,
477
- vdom = me.vdom,
478
477
  {data, slideDirection} = opts,
479
478
  x;
480
479
 
481
480
  x = slideDirection === 'right' ? -data.width : 0;
482
- vdom.cn[1].cn[0].style.transform = `translateX(${x}px)`;
481
+ me.vdom.cn[1].cn[0].style.transform = `translateX(${x}px)`
483
482
  }
484
483
 
485
484
  /**
@@ -488,10 +487,9 @@ class DateSelector extends Component {
488
487
  * @protected
489
488
  */
490
489
  changeMonthWrapperCallback(slideDirection) {
491
- let me = this,
492
- vdom = me.vdom;
490
+ let vdom = this.vdom;
493
491
 
494
- vdom.cn[1] = vdom.cn[1].cn[0].cn[slideDirection === 'right' ? 1 : 0];
492
+ vdom.cn[1] = vdom.cn[1].cn[0].cn[slideDirection === 'right' ? 1 : 0]
495
493
  }
496
494
 
497
495
  /**
@@ -502,7 +500,7 @@ class DateSelector extends Component {
502
500
  scrollFromTop, style, vdom, y;
503
501
 
504
502
  if (!me.useAnimations) {
505
- me.recreateContent(0, increment);
503
+ me.recreateContent(0, increment)
506
504
  } else {
507
505
  if (!me.isUpdating) {
508
506
  me.isUpdating = true;
@@ -540,12 +538,12 @@ class DateSelector extends Component {
540
538
 
541
539
  setTimeout(() => {
542
540
  vdom.cn[1] = vdom.cn[1].cn[0].cn[scrollFromTop ? 1 : 0];
543
- me.triggerVdomUpdate();
544
- }, 300);
541
+ me.triggerVdomUpdate()
542
+ }, 300)
545
543
  });
546
544
  });
547
545
  } else {
548
- me.cacheUpdate();
546
+ me.cacheUpdate()
549
547
  }
550
548
  }
551
549
  }
@@ -572,15 +570,15 @@ class DateSelector extends Component {
572
570
  day = date.getDay();
573
571
 
574
572
  if (!me.showWeekends && (day === 0 || day === 6)) {
575
- config.removeDom = true;
573
+ config.removeDom = true
576
574
  }
577
575
 
578
576
  row.cn.push(config);
579
577
 
580
- date.setDate(date.getDate() + 1);
578
+ date.setDate(date.getDate() + 1)
581
579
  }
582
580
 
583
- return row;
581
+ return row
584
582
  }
585
583
 
586
584
  /**
@@ -636,7 +634,7 @@ class DateSelector extends Component {
636
634
 
637
635
  if (dateDay === 0 || dateDay === 6) {
638
636
  if (!me.showWeekends) {
639
- config.removeDom = true;
637
+ config.removeDom = true
640
638
  }
641
639
 
642
640
  config.cls.push('neo-weekend');
@@ -685,37 +683,37 @@ class DateSelector extends Component {
685
683
  day = day.toString();
686
684
 
687
685
  if (day.length < 2) {
688
- day = '0' + day;
686
+ day = '0' + day
689
687
  }
690
688
 
691
689
  month = month.toString();
692
690
 
693
691
  if (month.length < 2) {
694
- month = '0' + month;
692
+ month = '0' + month
695
693
  }
696
694
 
697
- return this.id + '__' + year + '-' + month + '-' + day;
695
+ return this.id + '__' + year + '-' + month + '-' + day
698
696
  }
699
697
 
700
698
  /**
701
699
  * @returns {Object}
702
700
  */
703
701
  getCenterContentEl() {
704
- return this.vdom.cn[1];
702
+ return this.vdom.cn[1]
705
703
  }
706
704
 
707
705
  /**
708
706
  * @returns {Object}
709
707
  */
710
708
  getHeaderMonthEl() {
711
- return this.vdom.cn[0].cn[1].cn[0];
709
+ return this.vdom.cn[0].cn[1].cn[0]
712
710
  }
713
711
 
714
712
  /**
715
713
  * @returns {Object}
716
714
  */
717
715
  getHeaderYearEl() {
718
- return this.vdom.cn[0].cn[1].cn[1];
716
+ return this.vdom.cn[0].cn[1].cn[1]
719
717
  }
720
718
 
721
719
  /**
@@ -732,7 +730,7 @@ class DateSelector extends Component {
732
730
  // We want to always trigger a change event.
733
731
  // Reason: A form.field.Date can have a null value, and we want to select the current date.
734
732
  me._value = date;
735
- me.afterSetValue(date, null);
733
+ me.afterSetValue(date, null)
736
734
  }
737
735
 
738
736
  /**
@@ -743,14 +741,14 @@ class DateSelector extends Component {
743
741
  cls = data.path[0].cls,
744
742
  date, monthIncrement;
745
743
 
746
- if (cls.includes('neo-cell')) {me.onCellClick(data);}
747
- else if (cls.includes('neo-next-button')) {monthIncrement = 1;}
748
- else if (cls.includes('neo-prev-button')) {monthIncrement = -1;}
744
+ if (cls.includes('neo-cell')) {me.onCellClick(data)}
745
+ else if (cls.includes('neo-next-button')) {monthIncrement = 1}
746
+ else if (cls.includes('neo-prev-button')) {monthIncrement = -1}
749
747
 
750
748
  if (monthIncrement) {
751
749
  date = me.currentDate; // cloned
752
750
  date.setMonth(date.getMonth() + monthIncrement);
753
- me.value = DateUtil.convertToyyyymmdd(date);
751
+ me.value = DateUtil.convertToyyyymmdd(date)
754
752
  }
755
753
  }
756
754
 
@@ -765,21 +763,21 @@ class DateSelector extends Component {
765
763
  date, monthIncrement, yearIncrement;
766
764
 
767
765
  if (Math.abs(deltaY) >= Math.abs(deltaX)) {
768
- if (deltaY >= wheelDelta) {yearIncrement = 1;}
769
- else if (deltaY <= -wheelDelta) {yearIncrement = -1;}
766
+ if (deltaY >= wheelDelta) {yearIncrement = 1}
767
+ else if (deltaY <= -wheelDelta) {yearIncrement = -1}
770
768
  } else {
771
- if (deltaX >= wheelDelta) {monthIncrement = 1;}
772
- else if (deltaX <= -wheelDelta) {monthIncrement = -1;}
769
+ if (deltaX >= wheelDelta) {monthIncrement = 1}
770
+ else if (deltaX <= -wheelDelta) {monthIncrement = -1}
773
771
  }
774
772
 
775
773
  if (monthIncrement) {
776
774
  date = me.currentDate; // cloned
777
775
  date.setMonth(date.getMonth() + monthIncrement);
778
- me.value = DateUtil.convertToyyyymmdd(date);
776
+ me.value = DateUtil.convertToyyyymmdd(date)
779
777
  } else if (yearIncrement) {
780
778
  date = me.currentDate; // cloned
781
779
  date.setFullYear(date.getFullYear() + yearIncrement);
782
- me.value = DateUtil.convertToyyyymmdd(date);
780
+ me.value = DateUtil.convertToyyyymmdd(date)
783
781
  }
784
782
  }
785
783
 
@@ -828,9 +826,8 @@ class DateSelector extends Component {
828
826
  me.getCenterContentEl().cn = [];
829
827
  me.createDayViewContent(true);
830
828
 
831
- if (syncIds) {
832
- me.syncVdomIds()
833
- }
829
+ // using force => we do want to keep the same ids
830
+ syncIds && me.syncVdomIds(me.vnode, me.vdom, true);
834
831
 
835
832
  me.triggerVdomUpdate(silent)
836
833
  }
@@ -846,9 +843,9 @@ class DateSelector extends Component {
846
843
 
847
844
  me.isUpdating = true;
848
845
 
849
- me.promiseUpdate(me.vdom).then(() => {
850
- me.isUpdating = false;
851
- });
846
+ me.promiseUpdate().then(() => {
847
+ me.isUpdating = false
848
+ })
852
849
  }
853
850
  }
854
851
 
@@ -865,7 +862,6 @@ class DateSelector extends Component {
865
862
  if (oldValue !== undefined) {
866
863
  let centerEl = me.getCenterContentEl().cn[0],
867
864
  date = me.currentDate, // cloned
868
- vdom = me.vdom,
869
865
  i = 0,
870
866
  day, node;
871
867
 
@@ -879,15 +875,15 @@ class DateSelector extends Component {
879
875
  day = date.getDay();
880
876
 
881
877
  if (!me.showWeekends && (day === 0 || day === 6)) {
882
- node.removeDom = true;
878
+ node.removeDom = true
883
879
  } else {
884
- delete node.removeDom;
880
+ delete node.removeDom
885
881
  }
886
882
 
887
- date.setDate(date.getDate() + 1);
883
+ date.setDate(date.getDate() + 1)
888
884
  }
889
885
 
890
- me[silent ? '_vdom' : 'vdom'] = vdom;
886
+ !silent && me.update()
891
887
  }
892
888
  }
893
889
 
@@ -909,8 +905,8 @@ class DateSelector extends Component {
909
905
 
910
906
  if (!me.mounted || !me.useAnimations) {
911
907
  monthEl.html = currentMonth;
912
- !silent && me.update()
913
- return null;
908
+ !silent && me.update();
909
+ return null
914
910
  } else {
915
911
  y = slideDirection === 'top' ? 0 : -monthElDomRect.height;
916
912
 
@@ -941,14 +937,14 @@ class DateSelector extends Component {
941
937
  headerCenterEl.cn[0].cn[0].cn[slideDirection === 'top' ? 'unshift' : 'push'](headerCenterEl.cn[1]);
942
938
  headerCenterEl.cn.splice(1, 1);
943
939
 
944
- me[silent ? '_vdom' : 'vdom'] = vdom;
940
+ !silent && me.update();
945
941
 
946
942
  return {
947
943
  data: monthElDomRect,
948
944
  headerCenterEl,
949
945
  increment,
950
946
  yearIncrement
951
- };
947
+ }
952
948
  }
953
949
  }
954
950
 
@@ -967,7 +963,7 @@ class DateSelector extends Component {
967
963
  y;
968
964
 
969
965
  y = slideDirection === 'top' ? -data.height : 0;
970
- headerCenterEl.cn[0].cn[0].style.transform = `translateY(${y}px)`;
966
+ headerCenterEl.cn[0].cn[0].style.transform = `translateY(${y}px)`
971
967
  }
972
968
 
973
969
  /**
@@ -982,7 +978,7 @@ class DateSelector extends Component {
982
978
  let {headerCenterEl, increment, yearIncrement} = opts,
983
979
  slideDirection = yearIncrement > 0 ? 'bottom' : yearIncrement < 0 ? 'top' : increment < 0 ? 'top' : 'bottom';
984
980
 
985
- headerCenterEl.cn[0] = headerCenterEl.cn[0].cn[0].cn[slideDirection === 'top' ? 1 : 0];
981
+ headerCenterEl.cn[0] = headerCenterEl.cn[0].cn[0].cn[slideDirection === 'top' ? 1 : 0]
986
982
  }
987
983
 
988
984
  /**
@@ -13,8 +13,8 @@ class Base extends Component {
13
13
  * @static
14
14
  */
15
15
  static delayable = {
16
- fireChangeEvent : {type: 'debounce', timer: 300},
17
- fireUserChangeEvent: {type: 'debounce', timer: 300}
16
+ fireChangeEvent : {type: 'debounce', timer: 1000},
17
+ fireUserChangeEvent: {type: 'debounce', timer: 1000}
18
18
  }
19
19
 
20
20
  static config = {
@@ -27,6 +27,13 @@ class Breadcrumb extends Toolbar {
27
27
  * @member {String[]} baseCls=['neo-breadcrumb-toolbar','neo-toolbar']
28
28
  */
29
29
  baseCls: ['neo-breadcrumb-toolbar', 'neo-toolbar'],
30
+ /**
31
+ * @member {Object} itemDefaults={ntype:'button', ui: 'tertiary'}
32
+ */
33
+ itemDefaults: {
34
+ ntype: 'button',
35
+ ui : 'tertiary'
36
+ },
30
37
  /**
31
38
  * @member {Neo.data.Store|Object} store_=null
32
39
  */
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Append args instead of prepending them
3
+ * @param {Function} fn
3
4
  * @param {Object} scope
4
5
  * @returns {Function}
5
6
  */
6
- export function bindAppend(scope) {
7
- const fn = this,
8
- args = [].slice.call(arguments).slice(1);
7
+ export function bindAppend(fn, scope) {
8
+ const args = [].slice.call(arguments).slice(2);
9
9
 
10
10
  return function() {
11
11
  return fn.apply(scope, [].slice.call(arguments).concat(args))
package/src/util/VDom.mjs CHANGED
@@ -15,23 +15,23 @@ class VDom extends Base {
15
15
 
16
16
  /**
17
17
  * @param {Object} vdom
18
- * @param {Boolean} [removeIds=true]
18
+ * @param {Boolean} removeIds=true
19
19
  * @returns {Object} cloned vdom
20
20
  */
21
21
  static clone(vdom, removeIds=true) {
22
22
  const clone = Neo.clone(vdom, true);
23
23
 
24
24
  if (removeIds) {
25
- delete clone.id;
25
+ delete clone.id
26
26
  }
27
27
 
28
28
  if (clone.cn) {
29
29
  clone.cn.forEach((item, index) => {
30
- clone.cn[index] = VDom.clone(item, removeIds);
31
- });
30
+ clone.cn[index] = VDom.clone(item, removeIds)
31
+ })
32
32
  }
33
33
 
34
- return clone;
34
+ return clone
35
35
  }
36
36
 
37
37
  /**
@@ -64,39 +64,39 @@ class VDom extends Base {
64
64
  case 'cls':
65
65
  if (typeof value === 'string' && Neo.isArray(vdom[key])) {
66
66
  if (vdom[key].includes(value)) {
67
- matchArray.push(true);
67
+ matchArray.push(true)
68
68
  }
69
69
  } else if (typeof value === 'string' && typeof vdom[key] === 'string') {
70
70
  if (vdom[key] === value) {
71
- matchArray.push(true);
71
+ matchArray.push(true)
72
72
  }
73
73
  } else if (Neo.isArray(value) && Neo.isArray(vdom[key])) {
74
74
  // todo: either search the vdom array for all keys or compare if the arrays are equal.
75
- throw new Error('findVdomChild: cls matching not supported for target & source types of Arrays');
75
+ throw new Error('findVdomChild: cls matching not supported for target & source types of Arrays')
76
76
  }
77
77
  break;
78
78
  case 'style':
79
79
  if (typeof value === 'string' && typeof vdom[key] === 'string') {
80
80
  if (vdom[key] === value) {
81
- matchArray.push(true);
81
+ matchArray.push(true)
82
82
  }
83
83
  } else if (Neo.isObject(value) && Neo.isObject(vdom[key])) {
84
84
  Object.entries(value).forEach(([styleKey, styleValue]) => {
85
85
  if (!(vdom[key].hasOwnProperty(styleKey) && vdom[key][styleKey] === styleValue)) {
86
- styleMatch = false;
86
+ styleMatch = false
87
87
  }
88
88
  });
89
89
 
90
90
  if (styleMatch) {
91
- matchArray.push(true);
91
+ matchArray.push(true)
92
92
  }
93
93
  } else {
94
- throw new Error('findVdomChild: style matching not supported for mixed target & source types (Object VS String)');
94
+ throw new Error('findVdomChild: style matching not supported for mixed target & source types (Object VS String)')
95
95
  }
96
96
  break;
97
97
  default:
98
98
  if (vdom[key] === value) {
99
- matchArray.push(true);
99
+ matchArray.push(true)
100
100
  }
101
101
  break;
102
102
  }
@@ -118,13 +118,13 @@ class VDom extends Base {
118
118
  parentNode: subChild.parentNode,
119
119
  vdom : subChild.vdom
120
120
  };
121
- break;
121
+ break
122
122
  }
123
123
  }
124
124
  }
125
125
  }
126
126
 
127
- return child;
127
+ return child
128
128
  }
129
129
 
130
130
  /**
@@ -135,7 +135,7 @@ class VDom extends Base {
135
135
  */
136
136
  static getByFlag(vdom, flag) {
137
137
  let node = VDom.findVdomChild(vdom, {flag: flag});
138
- return node?.vdom;
138
+ return node?.vdom
139
139
  }
140
140
 
141
141
  /**
@@ -149,13 +149,13 @@ class VDom extends Base {
149
149
 
150
150
  childNodes.forEach(childNode => {
151
151
  if (childNode.id) {
152
- childIds.push(childNode.id);
152
+ childIds.push(childNode.id)
153
153
  }
154
154
 
155
- childIds = VDom.getChildIds(childNode, childIds);
155
+ childIds = VDom.getChildIds(childNode, childIds)
156
156
  });
157
157
 
158
- return childIds;
158
+ return childIds
159
159
  }
160
160
 
161
161
  /**
@@ -169,12 +169,12 @@ class VDom extends Base {
169
169
  if (vdom.cn) {
170
170
  vdom.cn.forEach(row => {
171
171
  if (row.cn?.[index]) {
172
- columnNodes.push(row.cn[index]);
172
+ columnNodes.push(row.cn[index])
173
173
  }
174
- });
174
+ })
175
175
  }
176
176
 
177
- return columnNodes;
177
+ return columnNodes
178
178
  }
179
179
 
180
180
  /**
@@ -183,7 +183,7 @@ class VDom extends Base {
183
183
  * @returns {Array}
184
184
  */
185
185
  static getColumnNodesIds(vdom, index) {
186
- return VDom.getColumnNodes(vdom, index).map(e => e.id);
186
+ return VDom.getColumnNodes(vdom, index).map(e => e.id)
187
187
  }
188
188
 
189
189
  /**
@@ -197,19 +197,19 @@ class VDom extends Base {
197
197
  matchArray = [];
198
198
 
199
199
  if (vdom.flag === flag) {
200
- matchArray.push(vdom);
200
+ matchArray.push(vdom)
201
201
  }
202
202
  }
203
203
 
204
204
  (vdom?.cn || []).forEach(childNode => {
205
205
  if (childNode.flag === flag) {
206
- matchArray.push(childNode);
206
+ matchArray.push(childNode)
207
207
  }
208
208
 
209
- matchArray = VDom.getFlags(childNode, flag, matchArray);
209
+ matchArray = VDom.getFlags(childNode, flag, matchArray)
210
210
  });
211
211
 
212
- return matchArray;
212
+ return matchArray
213
213
  }
214
214
 
215
215
  /**
@@ -224,7 +224,7 @@ class VDom extends Base {
224
224
  len = vdom.cn?.length || 0;
225
225
 
226
226
  if (vdom.id === id) {
227
- return [];
227
+ return []
228
228
  }
229
229
 
230
230
  for (; i < len; i++) {
@@ -232,15 +232,15 @@ class VDom extends Base {
232
232
 
233
233
  if (parents) {
234
234
  parents.push(vdom.cn[i]);
235
- break;
235
+ break
236
236
  }
237
237
  }
238
238
 
239
239
  if (topLevel && parents) {
240
- parents.push(vdom);
240
+ parents.push(vdom)
241
241
  }
242
242
 
243
- return parents;
243
+ return parents
244
244
  }
245
245
 
246
246
  /**
@@ -251,7 +251,7 @@ class VDom extends Base {
251
251
  * @returns {Boolean}
252
252
  */
253
253
  static insertAfterNode(vdom, nodeToInsert, targetNodeId) {
254
- return VDom.insertNode(vdom, nodeToInsert, targetNodeId, false);
254
+ return VDom.insertNode(vdom, nodeToInsert, targetNodeId, false)
255
255
  }
256
256
 
257
257
  /**
@@ -262,7 +262,7 @@ class VDom extends Base {
262
262
  * @returns {Boolean}
263
263
  */
264
264
  static insertBeforeNode(vdom, nodeToInsert, targetNodeId) {
265
- return VDom.insertNode(vdom, nodeToInsert, targetNodeId, true);
265
+ return VDom.insertNode(vdom, nodeToInsert, targetNodeId, true)
266
266
  }
267
267
 
268
268
  /**
@@ -275,7 +275,7 @@ class VDom extends Base {
275
275
  */
276
276
  static insertNode(vdom, nodeToInsert, targetNodeId, insertBefore) {
277
277
  if (Neo.isObject(targetNodeId)) {
278
- targetNodeId = targetNodeId.id;
278
+ targetNodeId = targetNodeId.id
279
279
  }
280
280
 
281
281
  let targetNode = VDom.findVdomChild(vdom, {id: targetNodeId}),
@@ -284,10 +284,10 @@ class VDom extends Base {
284
284
  if (targetNode) {
285
285
  index = insertBefore ? targetNode.index : targetNode.index + 1;
286
286
  targetNode.parentNode.cn.splice(index, 0, nodeToInsert);
287
- return true;
287
+ return true
288
288
  }
289
289
 
290
- return false;
290
+ return false
291
291
  }
292
292
 
293
293
  /**
@@ -301,10 +301,10 @@ class VDom extends Base {
301
301
 
302
302
  if (child) {
303
303
  child.parentNode.cn.splice(child.index, 1);
304
- return true;
304
+ return true
305
305
  }
306
306
 
307
- return false;
307
+ return false
308
308
  }
309
309
 
310
310
  /**
@@ -321,7 +321,7 @@ class VDom extends Base {
321
321
  childNode;
322
322
 
323
323
  if (vdom.id === id) {
324
- throw new Error('replaceVdomChild: target id matches the root vnode id: ' + id);
324
+ throw new Error('replaceVdomChild: target id matches the root vnode id: ' + id)
325
325
  }
326
326
 
327
327
  for (; i < len; i++) {
@@ -329,11 +329,11 @@ class VDom extends Base {
329
329
 
330
330
  if (childNode.id === id) {
331
331
  cn[i] = newChildNode;
332
- return true;
332
+ return true
333
333
  }
334
334
 
335
335
  if (VDom.replaceVdomChild(childNode, id, newChildNode)) {
336
- return true;
336
+ return true
337
337
  }
338
338
  }
339
339
 
@@ -345,16 +345,23 @@ class VDom extends Base {
345
345
  * so we need to sync them into the vdom.
346
346
  * @param {Neo.vdom.VNode} vnode
347
347
  * @param {Object} vdom
348
+ * @param {Boolean} force=false The force param will enforce overwriting different ids
348
349
  */
349
- static syncVdomIds(vnode, vdom) {
350
+ static syncVdomIds(vnode, vdom, force=false) {
350
351
  if (vnode && vdom) {
351
352
  let childNodes = vdom.cn,
352
353
  cn, i, len;
353
354
 
354
- // we only want to change vdom ids in case there is not already an own id
355
- // (think of adding & removing nodes in parallel)
356
- if (!vdom.id && vnode.id) {
357
- vdom.id = vnode.id;
355
+ if (force) {
356
+ if (vnode.id && vdom.id !== vnode.id) {
357
+ vdom.id = vnode.id
358
+ }
359
+ } else {
360
+ // we only want to change vdom ids in case there is not already an own id
361
+ // (think of adding & removing nodes in parallel)
362
+ if (!vdom.id && vnode.id) {
363
+ vdom.id = vnode.id
364
+ }
358
365
  }
359
366
 
360
367
  if (childNodes) {
@@ -364,7 +371,7 @@ class VDom extends Base {
364
371
 
365
372
  for (; i < len; i++) {
366
373
  if (vnode.childNodes) {
367
- VDom.syncVdomIds(vnode.childNodes[i], cn[i])
374
+ VDom.syncVdomIds(vnode.childNodes[i], cn[i], force)
368
375
  }
369
376
  }
370
377
  }