neo.mjs 8.43.1 → 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/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 -67
- 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,35 +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
|
-
} else {
|
316
|
-
value = ClassSystemUtil.beforeSetInstance(value, Store, {
|
317
|
-
listeners
|
318
|
-
})
|
319
|
-
}
|
320
|
-
|
321
|
-
// in case we dynamically change the store, the view needs to get the new reference
|
322
|
-
if (me.view) {
|
323
|
-
me.view.store = value
|
324
|
-
}
|
325
|
+
value = ClassSystemUtil.beforeSetInstance(value, Store)
|
325
326
|
}
|
326
327
|
|
327
328
|
return value
|
@@ -404,19 +405,6 @@ class Container extends BaseContainer {
|
|
404
405
|
return columns
|
405
406
|
}
|
406
407
|
|
407
|
-
/**
|
408
|
-
*
|
409
|
-
*/
|
410
|
-
createViewData() {
|
411
|
-
let me = this;
|
412
|
-
|
413
|
-
me.view.createViewData();
|
414
|
-
|
415
|
-
if (me.useCustomScrollbars && me.scrollbarsCssApplied === false) {
|
416
|
-
me.applyCustomScrollbarsCss()
|
417
|
-
}
|
418
|
-
}
|
419
|
-
|
420
408
|
/**
|
421
409
|
* @override
|
422
410
|
* @returns {*}
|
@@ -458,50 +446,29 @@ class Container extends BaseContainer {
|
|
458
446
|
|
459
447
|
me.store.sort(opts);
|
460
448
|
me.removeSortingCss(opts.property);
|
461
|
-
me.onStoreLoad(
|
449
|
+
opts.direction && me.view.onStoreLoad()
|
462
450
|
}
|
463
451
|
|
464
452
|
/**
|
465
453
|
*
|
466
454
|
*/
|
467
455
|
onStoreFilter() {
|
468
|
-
this.onStoreLoad(
|
456
|
+
this.onStoreLoad()
|
469
457
|
}
|
470
458
|
|
471
459
|
/**
|
472
|
-
* @param {Object[]} data
|
473
460
|
* @protected
|
474
461
|
*/
|
475
|
-
onStoreLoad(
|
462
|
+
onStoreLoad() {
|
476
463
|
let me = this;
|
477
464
|
|
478
|
-
if (me.
|
479
|
-
me.
|
480
|
-
|
481
|
-
if (me.store.sorters.length < 1) {
|
482
|
-
me.removeSortingCss()
|
483
|
-
}
|
484
|
-
} else {
|
485
|
-
me.on('rendered', () => {
|
486
|
-
me.timeout(50).then(() => {
|
487
|
-
me.createViewData()
|
488
|
-
})
|
489
|
-
}, me, {once: true})
|
465
|
+
if (me.useCustomScrollbars && me.scrollbarsCssApplied === false) {
|
466
|
+
me.applyCustomScrollbarsCss()
|
490
467
|
}
|
491
|
-
}
|
492
468
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
* @param {Object} opts
|
497
|
-
* @param {String} opts.field The name of the field which got changed
|
498
|
-
* @param {Neo.data.Model} opts.model The model instance of the changed record
|
499
|
-
* @param {*} opts.oldValue
|
500
|
-
* @param {Object} opts.record
|
501
|
-
* @param {*} opts.value
|
502
|
-
*/
|
503
|
-
onStoreRecordChange(opts) {
|
504
|
-
this.view.onStoreRecordChange(opts)
|
469
|
+
if (me.store.sorters?.length < 1) {
|
470
|
+
me.removeSortingCss()
|
471
|
+
}
|
505
472
|
}
|
506
473
|
|
507
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) {
|