neo.mjs 8.43.0 → 9.0.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.
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/colors/view/ViewportController.mjs +2 -6
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/ViewportController.mjs +3 -3
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/ContentComponent.mjs +5 -5
- package/apps/portal/view/learn/MainContainerController.mjs +0 -23
- package/apps/sharedcovid/view/MainContainerController.mjs +4 -13
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/button/base/MainContainer.mjs +9 -1
- package/examples/component/multiWindowCoronaGallery/ViewportController.mjs +4 -11
- package/examples/component/multiWindowHelix/ViewportController.mjs +1 -7
- package/package.json +5 -5
- package/src/DefaultConfig.mjs +2 -2
- package/src/button/Base.mjs +28 -7
- package/src/component/Base.mjs +43 -86
- package/src/component/wrapper/AmChart.mjs +4 -3
- package/src/container/Base.mjs +15 -3
- package/src/controller/Component.mjs +4 -106
- package/src/core/Base.mjs +15 -2
- package/src/core/Observable.mjs +9 -11
- package/src/data/Model.mjs +9 -0
- package/src/data/RecordFactory.mjs +1 -1
- package/src/form/field/Text.mjs +3 -1
- package/src/grid/Container.mjs +2 -4
- package/src/grid/VerticalScrollbar.mjs +3 -2
- package/src/grid/View.mjs +37 -45
- package/src/grid/column/AnimatedChange.mjs +1 -1
- package/src/grid/column/Component.mjs +14 -5
- package/src/grid/header/Button.mjs +6 -17
- package/src/main/DomEvents.mjs +26 -1
- package/src/manager/DomEvent.mjs +21 -22
- package/src/selection/Model.mjs +14 -11
- package/src/selection/grid/BaseModel.mjs +155 -2
- package/src/selection/grid/CellColumnModel.mjs +7 -11
- package/src/selection/grid/CellColumnRowModel.mjs +7 -11
- package/src/selection/grid/CellModel.mjs +5 -4
- package/src/selection/grid/CellRowModel.mjs +22 -30
- package/src/selection/grid/ColumnModel.mjs +7 -11
- package/src/selection/grid/RowModel.mjs +21 -35
- package/src/state/Provider.mjs +3 -8
- package/src/tab/Container.mjs +17 -1
- package/src/table/Container.mjs +34 -68
- package/src/table/View.mjs +51 -3
- package/src/table/header/Button.mjs +7 -18
- package/src/util/Function.mjs +3 -1
- package/src/util/VDom.mjs +4 -4
package/src/table/Container.mjs
CHANGED
@@ -232,6 +232,29 @@ class Container extends BaseContainer {
|
|
232
232
|
}
|
233
233
|
}
|
234
234
|
|
235
|
+
/**
|
236
|
+
* Triggered after the store config got changed
|
237
|
+
* @param {Number} value
|
238
|
+
* @param {Number} oldValue
|
239
|
+
* @protected
|
240
|
+
*/
|
241
|
+
afterSetStore(value, oldValue) {
|
242
|
+
let me = this,
|
243
|
+
listeners = {
|
244
|
+
filter: me.onStoreFilter,
|
245
|
+
load : me.onStoreLoad,
|
246
|
+
scope : me
|
247
|
+
};
|
248
|
+
|
249
|
+
value ?.on(listeners);
|
250
|
+
oldValue?.un(listeners);
|
251
|
+
|
252
|
+
// in case we dynamically change the store, the view needs to get the new reference
|
253
|
+
if (me.view) {
|
254
|
+
me.view.store = value
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
235
258
|
/**
|
236
259
|
* Triggered after the useCustomScrollbars config got changed
|
237
260
|
* @param {Boolean} value
|
@@ -293,36 +316,13 @@ class Container extends BaseContainer {
|
|
293
316
|
|
294
317
|
/**
|
295
318
|
* Triggered before the store config gets changed.
|
296
|
-
* @param {Neo.data.Store} value
|
297
|
-
* @param {Neo.data.Store}
|
319
|
+
* @param {Object|Neo.data.Store|null} value
|
320
|
+
* @param {Neo.data.Store} oldValue
|
298
321
|
* @protected
|
299
322
|
*/
|
300
323
|
beforeSetStore(value, oldValue) {
|
301
|
-
oldValue?.destroy();
|
302
|
-
|
303
324
|
if (value) {
|
304
|
-
|
305
|
-
|
306
|
-
listeners = {
|
307
|
-
filter : me.onStoreFilter,
|
308
|
-
load : me.onStoreLoad,
|
309
|
-
recordChange: me.onStoreRecordChange,
|
310
|
-
scope : me
|
311
|
-
};
|
312
|
-
|
313
|
-
if (value instanceof Store) {
|
314
|
-
value.on(listeners);
|
315
|
-
value.getCount() > 0 && me.onStoreLoad(value.items)
|
316
|
-
} else {
|
317
|
-
value = ClassSystemUtil.beforeSetInstance(value, Store, {
|
318
|
-
listeners
|
319
|
-
})
|
320
|
-
}
|
321
|
-
|
322
|
-
// in case we dynamically change the store, the view needs to get the new reference
|
323
|
-
if (me.view) {
|
324
|
-
me.view.store = value
|
325
|
-
}
|
325
|
+
value = ClassSystemUtil.beforeSetInstance(value, Store)
|
326
326
|
}
|
327
327
|
|
328
328
|
return value
|
@@ -405,19 +405,6 @@ class Container extends BaseContainer {
|
|
405
405
|
return columns
|
406
406
|
}
|
407
407
|
|
408
|
-
/**
|
409
|
-
*
|
410
|
-
*/
|
411
|
-
createViewData() {
|
412
|
-
let me = this;
|
413
|
-
|
414
|
-
me.view.createViewData();
|
415
|
-
|
416
|
-
if (me.useCustomScrollbars && me.scrollbarsCssApplied === false) {
|
417
|
-
me.applyCustomScrollbarsCss()
|
418
|
-
}
|
419
|
-
}
|
420
|
-
|
421
408
|
/**
|
422
409
|
* @override
|
423
410
|
* @returns {*}
|
@@ -459,50 +446,29 @@ class Container extends BaseContainer {
|
|
459
446
|
|
460
447
|
me.store.sort(opts);
|
461
448
|
me.removeSortingCss(opts.property);
|
462
|
-
me.onStoreLoad(
|
449
|
+
opts.direction && me.view.onStoreLoad()
|
463
450
|
}
|
464
451
|
|
465
452
|
/**
|
466
453
|
*
|
467
454
|
*/
|
468
455
|
onStoreFilter() {
|
469
|
-
this.onStoreLoad(
|
456
|
+
this.onStoreLoad()
|
470
457
|
}
|
471
458
|
|
472
459
|
/**
|
473
|
-
* @param {Object[]} data
|
474
460
|
* @protected
|
475
461
|
*/
|
476
|
-
onStoreLoad(
|
462
|
+
onStoreLoad() {
|
477
463
|
let me = this;
|
478
464
|
|
479
|
-
if (me.
|
480
|
-
me.
|
481
|
-
|
482
|
-
if (me.store.sorters.length < 1) {
|
483
|
-
me.removeSortingCss()
|
484
|
-
}
|
485
|
-
} else {
|
486
|
-
me.on('rendered', () => {
|
487
|
-
me.timeout(50).then(() => {
|
488
|
-
me.createViewData()
|
489
|
-
})
|
490
|
-
}, me, {once: true})
|
465
|
+
if (me.useCustomScrollbars && me.scrollbarsCssApplied === false) {
|
466
|
+
me.applyCustomScrollbarsCss()
|
491
467
|
}
|
492
|
-
}
|
493
468
|
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
* @param {Object} opts
|
498
|
-
* @param {String} opts.field The name of the field which got changed
|
499
|
-
* @param {Neo.data.Model} opts.model The model instance of the changed record
|
500
|
-
* @param {*} opts.oldValue
|
501
|
-
* @param {Object} opts.record
|
502
|
-
* @param {*} opts.value
|
503
|
-
*/
|
504
|
-
onStoreRecordChange(opts) {
|
505
|
-
this.view.onStoreRecordChange(opts)
|
469
|
+
if (me.store.sorters?.length < 1) {
|
470
|
+
me.removeSortingCss()
|
471
|
+
}
|
506
472
|
}
|
507
473
|
|
508
474
|
/**
|
package/src/table/View.mjs
CHANGED
@@ -56,9 +56,9 @@ class View extends Component {
|
|
56
56
|
*/
|
57
57
|
selectedRecordField: 'annotations.selected',
|
58
58
|
/**
|
59
|
-
* @member {Neo.data.Store|null}
|
59
|
+
* @member {Neo.data.Store|null} store_=null
|
60
60
|
*/
|
61
|
-
|
61
|
+
store_: null,
|
62
62
|
/**
|
63
63
|
* @member {Boolean} useRowRecordIds=true
|
64
64
|
*/
|
@@ -112,6 +112,25 @@ class View extends Component {
|
|
112
112
|
this.rendered && value.register(this)
|
113
113
|
}
|
114
114
|
|
115
|
+
/**
|
116
|
+
* Triggered after the store config got changed
|
117
|
+
* @param {Number} value
|
118
|
+
* @param {Number} oldValue
|
119
|
+
* @protected
|
120
|
+
*/
|
121
|
+
afterSetStore(value, oldValue) {
|
122
|
+
let me = this,
|
123
|
+
listeners = {
|
124
|
+
filter : me.onStoreFilter,
|
125
|
+
load : me.onStoreLoad,
|
126
|
+
recordChange: me.onStoreRecordChange,
|
127
|
+
scope : me
|
128
|
+
};
|
129
|
+
|
130
|
+
oldValue?.un(listeners);
|
131
|
+
value ?.on(listeners);
|
132
|
+
}
|
133
|
+
|
115
134
|
/**
|
116
135
|
* @param {Object} data
|
117
136
|
* @param {String} [data.cellId]
|
@@ -145,6 +164,8 @@ class View extends Component {
|
|
145
164
|
fieldValue = ''
|
146
165
|
}
|
147
166
|
|
167
|
+
me.bindCallback(column.renderer, 'renderer', column.rendererScope || tableContainer, column);
|
168
|
+
|
148
169
|
rendererOutput = column.renderer.call(column.rendererScope || tableContainer, {
|
149
170
|
column,
|
150
171
|
columnIndex,
|
@@ -523,6 +544,33 @@ class View extends Component {
|
|
523
544
|
this.fireRowEvent(data, 'rowDoubleClick')
|
524
545
|
}
|
525
546
|
|
547
|
+
/**
|
548
|
+
*
|
549
|
+
*/
|
550
|
+
onStoreFilter() {
|
551
|
+
this.onStoreLoad()
|
552
|
+
}
|
553
|
+
|
554
|
+
/**
|
555
|
+
* @param {Object[]} data
|
556
|
+
* @protected
|
557
|
+
*/
|
558
|
+
onStoreLoad(data) {
|
559
|
+
let me = this;
|
560
|
+
|
561
|
+
me.createViewData();
|
562
|
+
|
563
|
+
if (me.mounted) {
|
564
|
+
me.timeout(50).then(() => {
|
565
|
+
Neo.main.DomAccess.scrollTo({
|
566
|
+
direction: 'top',
|
567
|
+
id : me.vdom.id,
|
568
|
+
value : 0
|
569
|
+
})
|
570
|
+
})
|
571
|
+
}
|
572
|
+
}
|
573
|
+
|
526
574
|
/**
|
527
575
|
* Gets triggered after changing the value of a record field.
|
528
576
|
* E.g. myRecord.foo = 'bar';
|
@@ -531,7 +579,7 @@ class View extends Component {
|
|
531
579
|
* @param {Neo.data.Model} opts.model The model instance of the changed record
|
532
580
|
* @param {Object} opts.record
|
533
581
|
*/
|
534
|
-
onStoreRecordChange({fields,
|
582
|
+
onStoreRecordChange({fields, record}) {
|
535
583
|
let me = this,
|
536
584
|
fieldNames = fields.map(field => field.name),
|
537
585
|
needsUpdate = false,
|
@@ -197,25 +197,11 @@ class Button extends BaseButton {
|
|
197
197
|
* @param {Boolean} oldValue
|
198
198
|
* @protected
|
199
199
|
*/
|
200
|
-
|
200
|
+
afterSetSortable(value, oldValue) {
|
201
201
|
let me = this,
|
202
202
|
{cls} = me;
|
203
203
|
|
204
|
-
|
205
|
-
NeoArray.remove(cls, 'neo-sort-hidden');
|
206
|
-
|
207
|
-
me.addDomListeners({
|
208
|
-
click: me.onButtonClick,
|
209
|
-
scope: me
|
210
|
-
})
|
211
|
-
} else {
|
212
|
-
NeoArray.add(cls, 'neo-sort-hidden');
|
213
|
-
|
214
|
-
me.removeDomListeners({
|
215
|
-
click: me.onButtonClick,
|
216
|
-
scope: me
|
217
|
-
})
|
218
|
-
}
|
204
|
+
NeoArray.toggle(cls, 'neo-sort-hidden', !value);
|
219
205
|
|
220
206
|
me.cls = cls;
|
221
207
|
me.update()
|
@@ -354,9 +340,10 @@ class Button extends BaseButton {
|
|
354
340
|
}
|
355
341
|
|
356
342
|
/**
|
343
|
+
* @param {Object} data
|
357
344
|
* @protected
|
358
345
|
*/
|
359
|
-
|
346
|
+
onClick(data) {
|
360
347
|
let me = this,
|
361
348
|
map;
|
362
349
|
|
@@ -374,7 +361,9 @@ class Button extends BaseButton {
|
|
374
361
|
}
|
375
362
|
}
|
376
363
|
|
377
|
-
me.isSorted = map[me.isSorted + '']
|
364
|
+
me.isSorted = map[me.isSorted + ''];
|
365
|
+
|
366
|
+
super.onClick(data)
|
378
367
|
}
|
379
368
|
|
380
369
|
/**
|
package/src/util/Function.mjs
CHANGED
@@ -135,10 +135,12 @@ export function intercept(target, targetMethodName, interceptFunction, scope, pr
|
|
135
135
|
* @returns {Object}
|
136
136
|
*/
|
137
137
|
export function resolveCallback(fn, scope=this) {
|
138
|
-
if (
|
138
|
+
if (Neo.isString(fn)) {
|
139
139
|
if (!scope[fn] && fn.startsWith('up.')) {
|
140
140
|
fn = fn.slice(3);
|
141
141
|
while (!scope[fn] && (scope = scope.parent));
|
142
|
+
} else {
|
143
|
+
scope = scope.getController?.()?.getHandlerScope(fn, null) || scope
|
142
144
|
}
|
143
145
|
|
144
146
|
fn = scope[fn]
|
package/src/util/VDom.mjs
CHANGED
@@ -393,10 +393,10 @@ class VDom extends Base {
|
|
393
393
|
}
|
394
394
|
|
395
395
|
if (childNodes) {
|
396
|
-
cn
|
397
|
-
cn
|
398
|
-
i
|
399
|
-
len
|
396
|
+
cn = childNodes.map(item => VDom.getVdom(item));
|
397
|
+
cn = cn.filter(item => item.removeDom !== true);
|
398
|
+
i = 0;
|
399
|
+
len = cn?.length || 0;
|
400
400
|
|
401
401
|
for (; i < len; i++) {
|
402
402
|
if (vnode.childNodes) {
|