neo.mjs 8.11.0 → 8.13.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/TableContainer.mjs +1 -1
- package/apps/covid/Util.mjs +9 -9
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/sharedcovid/Util.mjs +2 -2
- package/examples/ConfigurationViewport.mjs +1 -7
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/covid/Util.mjs +3 -3
- package/examples/table/covid/Util.mjs +2 -2
- package/package.json +2 -2
- package/resources/scss/src/draggable/DragProxyComponent.scss +9 -0
- package/resources/scss/src/draggable/grid/header/toolbar/SortZone.scss +16 -0
- package/resources/scss/src/draggable/table/header/toolbar/SortZone.scss +32 -0
- package/resources/scss/src/grid/header/Toolbar.scss +0 -1
- package/resources/scss/src/table/header/Button.scss +0 -4
- package/resources/scss/theme-dark/draggable/grid/header/toolbar/SortZone.scss +3 -0
- package/resources/scss/theme-dark/draggable/table/header/toolbar/SortZone.scss +3 -0
- package/resources/scss/theme-light/draggable/grid/header/toolbar/SortZone.scss +3 -0
- package/resources/scss/theme-light/draggable/table/header/toolbar/SortZone.scss +3 -0
- package/resources/scss/theme-neo-light/draggable/grid/header/toolbar/SortZone.scss +3 -0
- package/resources/scss/theme-neo-light/draggable/table/header/toolbar/SortZone.scss +3 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +2 -6
- package/src/draggable/grid/header/toolbar/SortZone.mjs +74 -0
- package/src/draggable/table/header/toolbar/SortZone.mjs +70 -0
- package/src/draggable/toolbar/SortZone.mjs +23 -14
- package/src/grid/View.mjs +19 -21
- package/src/grid/header/Button.mjs +7 -115
- package/src/grid/header/Toolbar.mjs +32 -0
- package/src/main/DomAccess.mjs +1 -1
- package/src/main/DomEvents.mjs +10 -50
- package/src/main/addon/AmCharts.mjs +28 -9
- package/src/main/addon/DragDrop.mjs +9 -20
- package/src/main/mixin/DeltaUpdates.mjs +13 -7
- package/src/selection/grid/BaseModel.mjs +1 -1
- package/src/selection/grid/RowModel.mjs +57 -18
- package/src/selection/table/BaseModel.mjs +1 -1
- package/src/selection/table/RowModel.mjs +57 -17
- package/src/table/Container.mjs +6 -6
- package/src/table/View.mjs +28 -26
- package/src/table/header/Button.mjs +7 -111
- package/src/table/header/Toolbar.mjs +34 -2
- package/src/util/Rectangle.mjs +1 -1
package/apps/ServiceWorker.mjs
CHANGED
@@ -57,7 +57,7 @@ class TableContainer extends Container {
|
|
57
57
|
dock : 'left',
|
58
58
|
minWidth : 40,
|
59
59
|
text : '#',
|
60
|
-
renderer : data => ({cls: ['neo-index-column', 'neo-table-cell'], html: data.
|
60
|
+
renderer : data => ({cls: ['neo-index-column', 'neo-table-cell'], html: data.rowIndex + 1}),
|
61
61
|
width : 40
|
62
62
|
}],
|
63
63
|
currentChar;
|
package/apps/covid/Util.mjs
CHANGED
@@ -40,7 +40,7 @@ class Util extends Base {
|
|
40
40
|
let value = data.value;
|
41
41
|
|
42
42
|
if (!Neo.isNumber(value)) {
|
43
|
-
return value || 'N/A'
|
43
|
+
return value || 'N/A'
|
44
44
|
}
|
45
45
|
|
46
46
|
value = Math.round(value / 100);
|
@@ -48,7 +48,7 @@ class Util extends Base {
|
|
48
48
|
|
49
49
|
value = value.toFixed(2) + ' %';
|
50
50
|
|
51
|
-
return value.toLocaleString(Util.locales)
|
51
|
+
return value.toLocaleString(Util.locales)
|
52
52
|
}
|
53
53
|
|
54
54
|
/**
|
@@ -67,7 +67,7 @@ class Util extends Base {
|
|
67
67
|
|
68
68
|
value = value.toLocaleString(Util.locales);
|
69
69
|
|
70
|
-
return typeof color !== 'string' ? value : `<span style="color:${color};">${value}</span
|
70
|
+
return typeof color !== 'string' ? value : `<span style="color:${color};">${value}</span>`
|
71
71
|
}
|
72
72
|
|
73
73
|
/**
|
@@ -136,25 +136,25 @@ class Util extends Base {
|
|
136
136
|
let path = `../../../../resources_pub/images/flaticon/country_flags/png/${imageName}.png`;
|
137
137
|
|
138
138
|
if (Neo.config.environment !== 'development') {
|
139
|
-
path = `../../${path}
|
139
|
+
path = `../../${path}`
|
140
140
|
}
|
141
141
|
|
142
|
-
return path
|
142
|
+
return path
|
143
143
|
}
|
144
144
|
|
145
|
-
return `https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/images/flaticon/country_flags/png/${imageName}.png
|
145
|
+
return `https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/images/flaticon/country_flags/png/${imageName}.png`
|
146
146
|
}
|
147
147
|
|
148
148
|
/**
|
149
149
|
* @param {Object} data
|
150
|
-
* @param {Number} data.
|
150
|
+
* @param {Number} data.rowIndex
|
151
151
|
* @returns {Object}
|
152
152
|
*/
|
153
153
|
static indexRenderer(data) {
|
154
154
|
return {
|
155
155
|
cls : ['neo-index-column', 'neo-table-cell'],
|
156
|
-
html: data.
|
157
|
-
}
|
156
|
+
html: data.rowIndex + 1
|
157
|
+
}
|
158
158
|
}
|
159
159
|
}
|
160
160
|
|
package/apps/portal/index.html
CHANGED
@@ -147,13 +147,13 @@ class Util extends Base {
|
|
147
147
|
|
148
148
|
/**
|
149
149
|
* @param {Object} data
|
150
|
-
* @param {Number} data.
|
150
|
+
* @param {Number} data.rowIndex
|
151
151
|
* @returns {Object}
|
152
152
|
*/
|
153
153
|
static indexRenderer(data) {
|
154
154
|
return {
|
155
155
|
cls : ['neo-index-column', 'neo-table-cell'],
|
156
|
-
html: data.
|
156
|
+
html: data.rowIndex + 1
|
157
157
|
}
|
158
158
|
}
|
159
159
|
}
|
@@ -208,13 +208,7 @@ class ConfigurationViewport extends Viewport {
|
|
208
208
|
if (target === 'cmp') {
|
209
209
|
me.exampleComponent.theme = newTheme
|
210
210
|
} else {
|
211
|
-
|
212
|
-
id : me.id, // the viewport can get imported into other apps, so an id makes sense for scoping
|
213
|
-
cls: {
|
214
|
-
add : [newTheme],
|
215
|
-
remove: [oldTheme]
|
216
|
-
}
|
217
|
-
})
|
211
|
+
me.app.mainView.theme = newTheme
|
218
212
|
}
|
219
213
|
}
|
220
214
|
}
|
@@ -147,13 +147,13 @@ class Util extends Base {
|
|
147
147
|
|
148
148
|
/**
|
149
149
|
* @param {Object} data
|
150
|
-
* @param {Number} data.
|
150
|
+
* @param {Number} data.rowIndex
|
151
151
|
* @returns {Object}
|
152
152
|
*/
|
153
153
|
static indexRenderer(data) {
|
154
154
|
return {
|
155
|
-
cls : ['neo-index-column', 'neo-
|
156
|
-
html: data.
|
155
|
+
cls : ['neo-index-column', 'neo-table-cell'],
|
156
|
+
html: data.rowIndex + 1
|
157
157
|
}
|
158
158
|
}
|
159
159
|
}
|
@@ -147,13 +147,13 @@ class Util extends Base {
|
|
147
147
|
|
148
148
|
/**
|
149
149
|
* @param {Object} data
|
150
|
-
* @param {Number} data.
|
150
|
+
* @param {Number} data.rowIndex
|
151
151
|
* @returns {Object}
|
152
152
|
*/
|
153
153
|
static indexRenderer(data) {
|
154
154
|
return {
|
155
155
|
cls : ['neo-index-column', 'neo-table-cell'],
|
156
|
-
html: data.
|
156
|
+
html: data.rowIndex + 1
|
157
157
|
}
|
158
158
|
}
|
159
159
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.13.0",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"envinfo": "^7.14.0",
|
55
55
|
"fs-extra": "^11.3.0",
|
56
56
|
"highlightjs-line-numbers.js": "^2.9.0",
|
57
|
-
"inquirer": "^12.3.
|
57
|
+
"inquirer": "^12.3.3",
|
58
58
|
"marked": "^15.0.6",
|
59
59
|
"monaco-editor": "0.50.0",
|
60
60
|
"neo-jsdoc": "1.0.1",
|
@@ -1,3 +1,12 @@
|
|
1
|
+
body:has(.neo-is-dragging) {
|
2
|
+
cursor: move !important;
|
3
|
+
|
4
|
+
// We can not put pointer-events: none on the same level as cursor, since it prevents cursor changes
|
5
|
+
* {
|
6
|
+
pointer-events: none !important;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
1
10
|
.neo-dragproxy {
|
2
11
|
pointer-events : none;
|
3
12
|
position : absolute !important;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.neo-grid-header-toolbar {
|
2
|
+
&.neo-dragproxy {
|
3
|
+
height: 30px !important; // Hack to increase the height by the border-bottom height (29 + 1)
|
4
|
+
|
5
|
+
.neo-button {
|
6
|
+
border-right: 1px solid var(--grid-container-border-color);
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
&.neo-is-dragging {
|
11
|
+
.neo-button {
|
12
|
+
border-right: 1px solid var(--grid-container-border-color); // Would be missing for the last button otherwise
|
13
|
+
opacity : var(--grid-header-button-opacity-is-dragging);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.neo-table-container:has(.neo-is-dragging) {
|
2
|
+
border-top-width: 1px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.neo-table-header-toolbar {
|
6
|
+
&.neo-dragproxy {
|
7
|
+
border-bottom: 1px solid var(--table-container-border-color);
|
8
|
+
height : 31px !important; // Hack to increase the height by the border-bottom height (29 + 1)
|
9
|
+
padding: 0 0 1px 0;
|
10
|
+
|
11
|
+
.neo-table-header-button {
|
12
|
+
border-right: 1px solid var(--table-container-border-color);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
&.neo-is-dragging {
|
17
|
+
height: 32px !important;
|
18
|
+
|
19
|
+
.neo-table-header-button {
|
20
|
+
border-right: 1px solid var(--table-container-border-color); // Would be missing for the last button otherwise
|
21
|
+
opacity : var(--table-header-button-opacity-is-dragging);
|
22
|
+
}
|
23
|
+
|
24
|
+
.neo-draggable {
|
25
|
+
background-color : unset;
|
26
|
+
height : 32px !important;
|
27
|
+
transition-duration : 200ms;
|
28
|
+
transition-property : left, top;
|
29
|
+
transition-timing-function: ease-out;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -262,12 +262,12 @@ const DefaultConfig = {
|
|
262
262
|
useVdomWorker: true,
|
263
263
|
/**
|
264
264
|
* buildScripts/injectPackageVersion.mjs will update this value
|
265
|
-
* @default '8.
|
265
|
+
* @default '8.13.0'
|
266
266
|
* @memberOf! module:Neo
|
267
267
|
* @name config.version
|
268
268
|
* @type String
|
269
269
|
*/
|
270
|
-
version: '8.
|
270
|
+
version: '8.13.0'
|
271
271
|
};
|
272
272
|
|
273
273
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -331,7 +331,7 @@ class Component extends Base {
|
|
331
331
|
*/
|
332
332
|
style_: null,
|
333
333
|
/**
|
334
|
-
* You can pass
|
334
|
+
* You can pass a used theme directly to any component,
|
335
335
|
* to style specific component trees differently from your main view.
|
336
336
|
* @member {String|null} theme_=null
|
337
337
|
*/
|
@@ -1119,11 +1119,7 @@ class Component extends Base {
|
|
1119
1119
|
}
|
1120
1120
|
}
|
1121
1121
|
|
1122
|
-
|
1123
|
-
me.needsVdomUpdate = true
|
1124
|
-
} else if (me.mounted) {
|
1125
|
-
me.updateCls(value, oldValue)
|
1126
|
-
}
|
1122
|
+
me.update()
|
1127
1123
|
}
|
1128
1124
|
|
1129
1125
|
/**
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import BaseSortZone from '../../../toolbar/SortZone.mjs';
|
2
|
+
import NeoArray from '../../../../util/Array.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.draggable.grid.header.toolbar.SortZone
|
6
|
+
* @extends Neo.draggable.toolbar.SortZone
|
7
|
+
*/
|
8
|
+
class SortZone extends BaseSortZone {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.draggable.grid.header.toolbar.SortZone'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.draggable.grid.header.toolbar.SortZone',
|
15
|
+
/**
|
16
|
+
* @member {String} ntype='grid-header-toolbar-sortzone'
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
ntype: 'grid-header-toolbar-sortzone',
|
20
|
+
/**
|
21
|
+
* @member {String|null} itemMargin=null
|
22
|
+
* @protected
|
23
|
+
*/
|
24
|
+
itemMargin: '1px',
|
25
|
+
/**
|
26
|
+
* @member {Boolean} moveVertical=false
|
27
|
+
*/
|
28
|
+
moveVertical: false
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @param {Neo.util.Rectangle} rect
|
33
|
+
* @param {Neo.util.Rectangle} parentRect
|
34
|
+
*/
|
35
|
+
adjustProxyRectToParent(rect, parentRect) {
|
36
|
+
rect.x = rect.x - parentRect.x - 1;
|
37
|
+
rect.y = rect.y - parentRect.y - 1
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @param {Number} fromIndex
|
42
|
+
* @param {Number} toIndex
|
43
|
+
*/
|
44
|
+
moveTo(fromIndex, toIndex) {
|
45
|
+
super.moveTo(fromIndex, toIndex);
|
46
|
+
|
47
|
+
// It is crucial to use _columns to not get a shallow copy
|
48
|
+
NeoArray.move(this.owner.parent._columns, fromIndex, toIndex);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @param {Object} data
|
53
|
+
*/
|
54
|
+
async onDragEnd(data) {
|
55
|
+
await super.onDragEnd(data);
|
56
|
+
|
57
|
+
let {owner} = this;
|
58
|
+
|
59
|
+
owner.items.forEach((item, index) => {
|
60
|
+
item.vdom['aria-colindex'] = index + 1; // 1 based
|
61
|
+
});
|
62
|
+
|
63
|
+
owner.updateDepth = 2;
|
64
|
+
owner.update();
|
65
|
+
|
66
|
+
await owner.passSizeToView();
|
67
|
+
|
68
|
+
await this.timeout(20);
|
69
|
+
|
70
|
+
owner.parent.view.createViewData()
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
export default Neo.setupClass(SortZone);
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import BaseSortZone from '../../../toolbar/SortZone.mjs';
|
2
|
+
import NeoArray from '../../../../util/Array.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.draggable.table.header.toolbar.SortZone
|
6
|
+
* @extends Neo.draggable.toolbar.SortZone
|
7
|
+
*/
|
8
|
+
class SortZone extends BaseSortZone {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.draggable.table.header.toolbar.SortZone'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.draggable.table.header.toolbar.SortZone',
|
15
|
+
/**
|
16
|
+
* @member {String} ntype='table-header-toolbar-sortzone'
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
ntype: 'table-header-toolbar-sortzone',
|
20
|
+
/**
|
21
|
+
* @member {String|null} itemMargin=null
|
22
|
+
* @protected
|
23
|
+
*/
|
24
|
+
itemMargin: '-2px 1px 1px 1px',
|
25
|
+
/**
|
26
|
+
* @member {Boolean} moveVertical=false
|
27
|
+
*/
|
28
|
+
moveVertical: false,
|
29
|
+
/**
|
30
|
+
* @member {Number} offsetY=0
|
31
|
+
*/
|
32
|
+
offsetY: 5
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @param {Neo.util.Rectangle} rect
|
37
|
+
* @param {Neo.util.Rectangle} parentRect
|
38
|
+
*/
|
39
|
+
adjustProxyRectToParent(rect, parentRect) {
|
40
|
+
rect.x = rect.x - parentRect.x - 1;
|
41
|
+
rect.y = rect.y - parentRect.y
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @param {Number} fromIndex
|
46
|
+
* @param {Number} toIndex
|
47
|
+
*/
|
48
|
+
moveTo(fromIndex, toIndex) {
|
49
|
+
super.moveTo(fromIndex, toIndex);
|
50
|
+
|
51
|
+
// It is crucial to use _columns to not get a shallow copy
|
52
|
+
NeoArray.move(this.owner.parent._columns, fromIndex, toIndex);
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @param {Object} data
|
57
|
+
*/
|
58
|
+
async onDragEnd(data) {
|
59
|
+
await super.onDragEnd(data);
|
60
|
+
|
61
|
+
let {owner} = this;
|
62
|
+
|
63
|
+
owner.updateDepth = 2;
|
64
|
+
owner.update();
|
65
|
+
|
66
|
+
owner.parent.view.createViewData()
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
export default Neo.setupClass(SortZone);
|
@@ -31,6 +31,11 @@ class SortZone extends DragZone {
|
|
31
31
|
* @protected
|
32
32
|
*/
|
33
33
|
indexMap: null,
|
34
|
+
/**
|
35
|
+
* @member {String|null} itemMargin=null
|
36
|
+
* @protected
|
37
|
+
*/
|
38
|
+
itemMargin: null,
|
34
39
|
/**
|
35
40
|
* @member {Array|null} itemRects=null
|
36
41
|
* @protected
|
@@ -96,11 +101,12 @@ class SortZone extends DragZone {
|
|
96
101
|
owner.style = ownerStyle;
|
97
102
|
|
98
103
|
owner.items.forEach((item, index) => {
|
99
|
-
itemStyle = item.
|
104
|
+
itemStyle = item.wrapperStyle || {};
|
100
105
|
|
101
106
|
Object.assign(itemStyle, {
|
102
107
|
height : itemStyles[index].height || null,
|
103
108
|
left : null,
|
109
|
+
margin : null,
|
104
110
|
position: null,
|
105
111
|
top : null,
|
106
112
|
width : itemStyles[index].width || null
|
@@ -110,7 +116,7 @@ class SortZone extends DragZone {
|
|
110
116
|
itemStyle.visibility = null
|
111
117
|
}
|
112
118
|
|
113
|
-
item.
|
119
|
+
item.wrapperStyle = itemStyle
|
114
120
|
});
|
115
121
|
|
116
122
|
if (me.startIndex !== me.currentIndex) {
|
@@ -202,8 +208,8 @@ class SortZone extends DragZone {
|
|
202
208
|
indexMap[index] = index;
|
203
209
|
|
204
210
|
itemStyles.push({
|
205
|
-
height: item.style?.height,
|
206
|
-
width : item.style?.width
|
211
|
+
height: item.height ? `${item.height}px` : item.style?.height,
|
212
|
+
width : item.width ? `${item.width}px` : item.style?.width
|
207
213
|
})
|
208
214
|
});
|
209
215
|
|
@@ -221,12 +227,15 @@ class SortZone extends DragZone {
|
|
221
227
|
me.itemRects = itemRects;
|
222
228
|
|
223
229
|
owner.items.forEach((item, index) => {
|
224
|
-
itemStyle = item.
|
230
|
+
itemStyle = item.wrapperStyle || {};
|
225
231
|
rect = itemRects[index];
|
226
232
|
|
227
|
-
|
233
|
+
me.adjustProxyRectToParent?.(rect, me.ownerRect);
|
234
|
+
|
235
|
+
item.wrapperStyle = Object.assign(itemStyle, {
|
228
236
|
height : `${rect.height}px`,
|
229
237
|
left : `${rect.left}px`,
|
238
|
+
margin : me.itemMargin,
|
230
239
|
position: 'absolute',
|
231
240
|
top : `${rect.top}px`,
|
232
241
|
width : `${rect.width}px`
|
@@ -235,9 +244,9 @@ class SortZone extends DragZone {
|
|
235
244
|
|
236
245
|
// we need to add a short (1 frame) delay to ensure the item has switched to an absolute position
|
237
246
|
me.timeout(5).then(() => {
|
238
|
-
itemStyle = button.
|
247
|
+
itemStyle = button.wrapperStyle || {};
|
239
248
|
itemStyle.visibility = 'hidden';
|
240
|
-
button.
|
249
|
+
button.wrapperStyle = itemStyle
|
241
250
|
})
|
242
251
|
})
|
243
252
|
}
|
@@ -288,14 +297,14 @@ class SortZone extends DragZone {
|
|
288
297
|
* @param {Object} rect
|
289
298
|
*/
|
290
299
|
updateItem(index, rect) {
|
291
|
-
let me
|
292
|
-
item
|
293
|
-
{
|
300
|
+
let me = this,
|
301
|
+
item = me.owner.items[me.indexMap[index]],
|
302
|
+
{wrapperStyle} = item;
|
294
303
|
|
295
|
-
|
296
|
-
|
304
|
+
wrapperStyle.left = `${rect.left}px`;
|
305
|
+
wrapperStyle.top = `${rect.top}px`;
|
297
306
|
|
298
|
-
item.
|
307
|
+
item.wrapperStyle = wrapperStyle
|
299
308
|
}
|
300
309
|
}
|
301
310
|
|