neo.mjs 8.41.2 → 8.43.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/BarChartComponent.mjs +1 -1
- package/apps/colors/view/{TableContainer.mjs → GridContainer.mjs} +21 -22
- package/apps/colors/view/HeaderToolbar.mjs +3 -3
- package/apps/colors/view/Viewport.mjs +5 -3
- package/apps/colors/view/ViewportController.mjs +10 -10
- package/apps/covid/neo-config.json +2 -1
- package/apps/covid/view/MainContainerController.mjs +47 -39
- package/apps/covid/view/TableContainerController.mjs +20 -4
- package/apps/covid/view/country/Table.mjs +3 -3
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/sharedcovid/neo-config.json +1 -0
- package/apps/sharedcovid/view/MainContainerController.mjs +58 -50
- package/apps/sharedcovid/view/TableContainerController.mjs +20 -3
- package/apps/sharedcovid/view/country/Table.mjs +3 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/coronaGallery/Viewport.mjs +4 -2
- package/examples/component/coronaGallery/neo-config.json +2 -1
- package/examples/component/coronaHelix/MainContainer.mjs +4 -2
- package/examples/component/coronaHelix/neo-config.json +2 -1
- package/examples/component/multiWindowCoronaGallery/neo-config.json +1 -0
- package/examples/component/toast/MainContainer.mjs +1 -0
- package/examples/component/toast/MainContainerController.mjs +3 -1
- package/examples/grid/animatedRowSorting/Viewport.mjs +4 -3
- package/examples/grid/cellEditing/MainContainer.mjs +6 -5
- package/examples/grid/nestedRecordFields/Viewport.mjs +1 -14
- package/examples/grid/nestedRecordFields/ViewportController.mjs +27 -4
- package/package.json +2 -2
- package/resources/scss/src/apps/colors/GridContainer.scss +68 -0
- package/resources/scss/src/grid/header/Toolbar.scss +2 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/collection/Base.mjs +2 -2
- package/src/component/Toast.mjs +5 -4
- package/src/component/wrapper/AmChart.mjs +1 -1
- package/src/container/Base.mjs +4 -2
- package/src/controller/Component.mjs +12 -4
- package/src/draggable/toolbar/SortZone.mjs +12 -9
- package/src/grid/Container.mjs +4 -2
- package/src/grid/column/Base.mjs +2 -1
- package/src/grid/column/Component.mjs +5 -3
- package/src/manager/Component.mjs +19 -10
- package/src/selection/Model.mjs +4 -0
- package/src/util/Logger.mjs +1 -1
- package/resources/scss/src/apps/colors/TableContainer.scss +0 -66
@@ -0,0 +1,68 @@
|
|
1
|
+
@use "sass:color";
|
2
|
+
|
3
|
+
$base-color: #1c60a0;
|
4
|
+
|
5
|
+
.colors-grid-container.neo-grid-container {
|
6
|
+
width: 100%;
|
7
|
+
|
8
|
+
.neo-grid-header-toolbar {
|
9
|
+
.neo-grid-header-button {
|
10
|
+
&:not(:first-child) {
|
11
|
+
width: 10%;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
.neo-grid-row .neo-grid-cell {
|
17
|
+
&.color-1 {
|
18
|
+
background-color: $base-color;
|
19
|
+
}
|
20
|
+
|
21
|
+
&.color-2 {
|
22
|
+
background-color: color.adjust($base-color, $lightness: 5%);
|
23
|
+
}
|
24
|
+
|
25
|
+
&.color-3 {
|
26
|
+
background-color: color.adjust($base-color, $lightness: 10%);
|
27
|
+
}
|
28
|
+
|
29
|
+
&.color-4 {
|
30
|
+
background-color: color.adjust($base-color, $lightness: 15%);
|
31
|
+
}
|
32
|
+
|
33
|
+
&.color-5 {
|
34
|
+
background-color: color.adjust($base-color, $lightness: 20%);
|
35
|
+
}
|
36
|
+
|
37
|
+
&.color-6 {
|
38
|
+
background-color: color.adjust($base-color, $lightness: 25%);
|
39
|
+
}
|
40
|
+
|
41
|
+
&.color-7 {
|
42
|
+
background-color: color.adjust($base-color, $lightness: 30%);
|
43
|
+
}
|
44
|
+
|
45
|
+
&.color-8 {
|
46
|
+
background-color: color.adjust($base-color, $lightness: 35%);
|
47
|
+
}
|
48
|
+
|
49
|
+
&.color-9 {
|
50
|
+
background-color: color.adjust($base-color, $lightness: 40%);
|
51
|
+
}
|
52
|
+
|
53
|
+
&.color-10 {
|
54
|
+
background-color: color.adjust($base-color, $lightness: 45%);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
.neo-grid-view {
|
59
|
+
.neo-grid-row {
|
60
|
+
&:hover {
|
61
|
+
.neo-grid-cell {
|
62
|
+
background-color: #d0aa72;
|
63
|
+
color : #2b2b2b;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -263,12 +263,12 @@ const DefaultConfig = {
|
|
263
263
|
useVdomWorker: true,
|
264
264
|
/**
|
265
265
|
* buildScripts/injectPackageVersion.mjs will update this value
|
266
|
-
* @default '8.
|
266
|
+
* @default '8.43.0'
|
267
267
|
* @memberOf! module:Neo
|
268
268
|
* @name config.version
|
269
269
|
* @type String
|
270
270
|
*/
|
271
|
-
version: '8.
|
271
|
+
version: '8.43.0'
|
272
272
|
};
|
273
273
|
|
274
274
|
Object.assign(DefaultConfig, {
|
package/src/collection/Base.mjs
CHANGED
@@ -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
|
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) {
|
package/src/component/Toast.mjs
CHANGED
@@ -11,6 +11,7 @@ import ToastManager from '../manager/Toast.mjs';
|
|
11
11
|
// mandatory
|
12
12
|
appName : this.component.appName,
|
13
13
|
msg : 'Alarm was set to 11:30 for journey into Neo development',
|
14
|
+
windowId : this.component.windowId
|
14
15
|
// optional defaults
|
15
16
|
closable : true, // false
|
16
17
|
iconCls : 'fa fa-bell', // null
|
@@ -102,16 +103,16 @@ class Toast extends Component {
|
|
102
103
|
* @member {String|null} title=null
|
103
104
|
*/
|
104
105
|
vdom:
|
105
|
-
{cn: [
|
106
|
-
cls: 'neo-toast-inner', cn: [
|
106
|
+
{cn: [
|
107
|
+
{cls: 'neo-toast-inner', cn: [
|
107
108
|
{cls: ['neo-toast-icon'], removeDom: true},
|
108
109
|
{cls: 'neo-toast-text', cn: [
|
109
110
|
{cls: ['neo-toast-title'], removeDom: true},
|
110
111
|
{cls: 'neo-toast-msg'}
|
111
112
|
]},
|
112
113
|
{cls: ['neo-toast-close', 'fa', 'fa-close'], removeDom: true}
|
113
|
-
]
|
114
|
-
|
114
|
+
]}
|
115
|
+
]}
|
115
116
|
}
|
116
117
|
|
117
118
|
/**
|
@@ -54,7 +54,7 @@ class AmChart extends Component {
|
|
54
54
|
* @member {Object} _vdom
|
55
55
|
*/
|
56
56
|
_vdom:
|
57
|
-
{style: {position: 'relative'
|
57
|
+
{style: {position: 'relative'}, cn: [
|
58
58
|
{style: {position: 'absolute', height: '100%', width: '100%'}, cn: [
|
59
59
|
{style: {color:'red',height: '100%'}}
|
60
60
|
]}
|
package/src/container/Base.mjs
CHANGED
@@ -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 = {
|
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') {
|
@@ -167,10 +167,10 @@ class Component extends Base {
|
|
167
167
|
*/
|
168
168
|
parseConfig(component=this.component) {
|
169
169
|
let me = this,
|
170
|
-
{handler, listeners, reference, validator} = component,
|
170
|
+
{handler, listeners, reference, renderer, validator} = component,
|
171
171
|
eventHandler, handlerScope;
|
172
172
|
|
173
|
-
if (handler &&
|
173
|
+
if (handler && Neo.isString(handler)) {
|
174
174
|
handlerScope = me.getHandlerScope(handler, component);
|
175
175
|
|
176
176
|
// If the handler name was not resolved in the Component itself, bind it
|
@@ -192,7 +192,7 @@ class Component extends Base {
|
|
192
192
|
listeners[key].fn = handlerScope[eventHandler].bind(handlerScope)
|
193
193
|
}
|
194
194
|
} else {
|
195
|
-
value
|
195
|
+
value?.forEach?.(listener => {
|
196
196
|
if (Neo.isObject(listener) && listener.hasOwnProperty('fn') && Neo.isString(listener.fn)) {
|
197
197
|
eventHandler = listener.fn;
|
198
198
|
handlerScope = me.getHandlerScope(eventHandler, component);
|
@@ -208,7 +208,15 @@ class Component extends Base {
|
|
208
208
|
}
|
209
209
|
});
|
210
210
|
|
211
|
-
if (Neo.isString(
|
211
|
+
if (renderer && Neo.isString(renderer)) {
|
212
|
+
handlerScope = me.getHandlerScope(renderer);
|
213
|
+
|
214
|
+
if (handlerScope) {
|
215
|
+
component.renderer = handlerScope[renderer].bind(handlerScope)
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
if (validator && Neo.isString(validator)) {
|
212
220
|
handlerScope = me.getHandlerScope(validator);
|
213
221
|
|
214
222
|
if (!handlerScope) {
|
@@ -115,8 +115,9 @@ class SortZone extends DragZone {
|
|
115
115
|
await me.timeout(10);
|
116
116
|
|
117
117
|
if (owner.sortable) {
|
118
|
-
ownerStyle.height
|
119
|
-
ownerStyle.
|
118
|
+
ownerStyle.height = me.ownerStyle.height || null;
|
119
|
+
ownerStyle.minWidth = me.ownerStyle.minWidth || null;
|
120
|
+
ownerStyle.width = me.ownerStyle.width || null;
|
120
121
|
|
121
122
|
owner.style = ownerStyle;
|
122
123
|
|
@@ -254,7 +255,7 @@ class SortZone extends DragZone {
|
|
254
255
|
dragElement : VDomUtil.find(owner.vdom, button.id).vdom,
|
255
256
|
dragProxyConfig : {...me.dragProxyConfig, cls: [...owner.cls]},
|
256
257
|
indexMap : indexMap,
|
257
|
-
ownerStyle : {height: ownerStyle.height, width: ownerStyle.width},
|
258
|
+
ownerStyle : {height: ownerStyle.height, minWidth: ownerStyle.minWidth, width: ownerStyle.width},
|
258
259
|
reversedLayoutDirection: layout.direction === 'column-reverse' || layout.direction === 'row-reverse',
|
259
260
|
sortDirection : layout.direction?.includes('column') ? 'vertical' : 'horizontal',
|
260
261
|
startIndex : index
|
@@ -274,12 +275,14 @@ class SortZone extends DragZone {
|
|
274
275
|
owner.getDomRect([owner.id].concat(owner.items.map(e => e.id))).then(itemRects => {
|
275
276
|
me.ownerRect = itemRects[0];
|
276
277
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
278
|
+
// The only reason we are adjusting the toolbar style is that there might be no min-height or min-width present.
|
279
|
+
// => Removing items from the layout could trigger a change in size otherwise
|
280
|
+
owner.style = {
|
281
|
+
...ownerStyle,
|
282
|
+
height : `${itemRects[0].height}px`,
|
283
|
+
minWidth: `${itemRects[0].width}px`,
|
284
|
+
width : `${itemRects[0].width}px`
|
285
|
+
};
|
283
286
|
|
284
287
|
itemRects.shift();
|
285
288
|
|
package/src/grid/Container.mjs
CHANGED
@@ -459,7 +459,9 @@ class GridContainer extends BaseContainer {
|
|
459
459
|
parent : me,
|
460
460
|
windowId: me.windowId,
|
461
461
|
...column
|
462
|
-
})
|
462
|
+
});
|
463
|
+
|
464
|
+
me.getController()?.parseConfig(columns[index])
|
463
465
|
});
|
464
466
|
|
465
467
|
me.items[0].items = headerButtons;
|
@@ -610,7 +612,7 @@ class GridContainer extends BaseContainer {
|
|
610
612
|
* @protected
|
611
613
|
*/
|
612
614
|
removeSortingCss(dataField) {
|
613
|
-
this.headerToolbar
|
615
|
+
this.headerToolbar?.items.forEach(column => {
|
614
616
|
if (column.dataField !== dataField) {
|
615
617
|
column.removeSortingCss()
|
616
618
|
}
|
package/src/grid/column/Base.mjs
CHANGED
@@ -59,7 +59,8 @@ class Column extends Base {
|
|
59
59
|
* @protected
|
60
60
|
*/
|
61
61
|
beforeSetRenderer(value, oldValue) {
|
62
|
-
return
|
62
|
+
// If no fn is found inside the parent tree, return the plain value for view controllers to match
|
63
|
+
return resolveCallback(value, this).fn || value
|
63
64
|
}
|
64
65
|
|
65
66
|
/**
|
@@ -104,12 +104,14 @@ class Component extends Column {
|
|
104
104
|
windowId
|
105
105
|
});
|
106
106
|
|
107
|
-
view.getController() ?.parseConfig(component);
|
108
|
-
view.getStateProvider()?.parseConfig(component);
|
109
|
-
|
110
107
|
me.map.set(id, component)
|
111
108
|
}
|
112
109
|
|
110
|
+
// The componentConfig can contain bindings into a view controller, e.g. a button handler = 'editButtonHandler'
|
111
|
+
// componentConfig.set(component) can revert these, so we need a parseConfig() for each change.
|
112
|
+
view.getController() ?.parseConfig(component);
|
113
|
+
view.getStateProvider()?.parseConfig(component);
|
114
|
+
|
113
115
|
view.updateDepth = -1;
|
114
116
|
|
115
117
|
return component.createVdomReference()
|
@@ -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.
|
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 {
|
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
|
-
|
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.
|
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.
|
381
|
+
component = this.get(component)
|
373
382
|
}
|
374
383
|
|
375
384
|
let parents = [];
|
376
385
|
|
377
386
|
while (component?.parentId) {
|
378
|
-
component = this.
|
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.
|
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.
|
537
|
+
component = this.get(component.parentId);
|
529
538
|
|
530
539
|
if (!component) {
|
531
540
|
return returnFirstMatch ? null : returnArray
|
package/src/selection/Model.mjs
CHANGED
@@ -112,6 +112,9 @@ class Model extends Base {
|
|
112
112
|
if (!silent) {
|
113
113
|
view.update();
|
114
114
|
|
115
|
+
view.parent?.onDeselect?.(); // grid.Container & table.Container
|
116
|
+
view.onDeselect?.();
|
117
|
+
|
115
118
|
me.fire('selectionChange', {
|
116
119
|
selection: itemCollection
|
117
120
|
})
|
@@ -249,6 +252,7 @@ class Model extends Base {
|
|
249
252
|
view.update()
|
250
253
|
}
|
251
254
|
|
255
|
+
view.parent?.onSelect?.(items); // grid.Container & table.Container
|
252
256
|
view.onSelect?.(items);
|
253
257
|
|
254
258
|
me.fire('selectionChange', {
|
package/src/util/Logger.mjs
CHANGED
@@ -1,66 +0,0 @@
|
|
1
|
-
@use "sass:color";
|
2
|
-
|
3
|
-
$base-color: #1c60a0;
|
4
|
-
|
5
|
-
.colors-table-container.neo-table-container {
|
6
|
-
width: 100%;
|
7
|
-
|
8
|
-
.color-1 {
|
9
|
-
background-color: $base-color;
|
10
|
-
}
|
11
|
-
|
12
|
-
.color-2 {
|
13
|
-
background-color: color.adjust($base-color, $lightness: 5%);
|
14
|
-
}
|
15
|
-
|
16
|
-
.color-3 {
|
17
|
-
background-color: color.adjust($base-color, $lightness: 10%);
|
18
|
-
}
|
19
|
-
|
20
|
-
.color-4 {
|
21
|
-
background-color: color.adjust($base-color, $lightness: 15%);
|
22
|
-
}
|
23
|
-
|
24
|
-
.color-5 {
|
25
|
-
background-color: color.adjust($base-color, $lightness: 20%);
|
26
|
-
}
|
27
|
-
|
28
|
-
.color-6 {
|
29
|
-
background-color: color.adjust($base-color, $lightness: 25%);
|
30
|
-
}
|
31
|
-
|
32
|
-
.color-7 {
|
33
|
-
background-color: color.adjust($base-color, $lightness: 30%);
|
34
|
-
}
|
35
|
-
|
36
|
-
.color-8 {
|
37
|
-
background-color: color.adjust($base-color, $lightness: 35%);
|
38
|
-
}
|
39
|
-
|
40
|
-
.color-9 {
|
41
|
-
background-color: color.adjust($base-color, $lightness: 40%);
|
42
|
-
}
|
43
|
-
|
44
|
-
.color-10 {
|
45
|
-
background-color: color.adjust($base-color, $lightness: 45%);
|
46
|
-
}
|
47
|
-
|
48
|
-
.neo-index-column {
|
49
|
-
max-width: 40px;
|
50
|
-
min-width: 40px;
|
51
|
-
width : 40px;
|
52
|
-
}
|
53
|
-
|
54
|
-
.neo-table-view {
|
55
|
-
.neo-table-row {
|
56
|
-
&:hover .neo-table-cell {
|
57
|
-
background-color: #d0aa72;
|
58
|
-
color : #2b2b2b;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
td, th {
|
64
|
-
min-width: 10%;
|
65
|
-
}
|
66
|
-
}
|