neo.mjs 8.12.0 → 8.14.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/realworld2/view/article/PreviewList.mjs +2 -2
- package/apps/sharedcovid/Util.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/covid/Util.mjs +3 -3
- package/examples/grid/nestedRecordFields/Viewport.mjs +27 -4
- package/examples/table/container/MainContainer.mjs +4 -4
- package/examples/table/covid/Util.mjs +3 -3
- package/examples/table/nestedRecordFields/Viewport.mjs +2 -2
- package/package.json +2 -2
- package/resources/scss/src/draggable/DragProxyComponent.scss +4 -1
- package/resources/scss/src/draggable/grid/header/toolbar/SortZone.scss +25 -2
- package/src/DefaultConfig.mjs +2 -2
- package/src/Neo.mjs +1 -1
- package/src/calendar/view/YearComponent.mjs +2 -2
- package/src/calendar/view/month/Component.mjs +1 -1
- package/src/calendar/view/week/EventDragZone.mjs +32 -29
- package/src/calendar/view/week/plugin/DragDrop.mjs +21 -21
- package/src/component/Base.mjs +29 -61
- package/src/component/DateSelector.mjs +1 -1
- package/src/component/Gallery.mjs +1 -1
- package/src/component/Helix.mjs +1 -1
- package/src/data/Model.mjs +0 -8
- package/src/draggable/DragZone.mjs +11 -5
- package/src/draggable/grid/header/toolbar/SortZone.mjs +111 -0
- package/src/draggable/list/DragZone.mjs +2 -2
- package/src/draggable/tab/header/toolbar/SortZone.mjs +2 -2
- package/src/draggable/toolbar/DragZone.mjs +3 -3
- package/src/draggable/toolbar/SortZone.mjs +2 -2
- package/src/draggable/tree/DragZone.mjs +2 -2
- package/src/grid/Container.mjs +2 -18
- package/src/grid/View.mjs +59 -44
- package/src/grid/header/Button.mjs +7 -6
- package/src/grid/header/Toolbar.mjs +4 -8
- package/src/main/DomAccess.mjs +1 -1
- package/src/main/addon/AmCharts.mjs +28 -9
- package/src/main/mixin/DeltaUpdates.mjs +13 -7
- package/src/selection/grid/RowModel.mjs +59 -20
- package/src/selection/table/RowModel.mjs +57 -17
- package/src/table/View.mjs +18 -16
- package/src/table/header/Button.mjs +7 -6
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
|
}
|
@@ -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
|
}
|
@@ -32,13 +32,19 @@ class Viewport extends BaseViewport {
|
|
32
32
|
style : {marginBottom: '1em'},
|
33
33
|
|
34
34
|
items: ['->', {
|
35
|
+
handler: 'up.onSwitchDragModeButtonClick',
|
36
|
+
iconCls: 'far fa-square',
|
37
|
+
style : {marginRight: '1em'},
|
38
|
+
text : 'Drag column headers only'
|
39
|
+
}, {
|
35
40
|
handler: 'up.onSwitchThemeButtonClick',
|
36
41
|
iconCls: 'fas fa-sun',
|
37
42
|
text : 'Light Theme'
|
38
43
|
}]
|
39
44
|
}, {
|
40
|
-
module: GridContainer,
|
41
|
-
bind
|
45
|
+
module : GridContainer,
|
46
|
+
bind : {store : 'stores.mainStore'},
|
47
|
+
reference: 'grid',
|
42
48
|
|
43
49
|
columnDefaults: {
|
44
50
|
width: 200
|
@@ -108,10 +114,10 @@ class Viewport extends BaseViewport {
|
|
108
114
|
/**
|
109
115
|
* @param {Object} data
|
110
116
|
*/
|
111
|
-
editRenderer({column, gridContainer,
|
117
|
+
editRenderer({column, gridContainer, record, rowIndex}) {
|
112
118
|
let me = this,
|
113
119
|
{appName, windowId} = me,
|
114
|
-
widgetId = `${column.id}-widget-${
|
120
|
+
widgetId = `${column.id}-widget-${rowIndex}`,
|
115
121
|
button = (column.widgetMap || (column.widgetMap = {}))[widgetId] || (column.widgetMap[widgetId] = Neo.create({
|
116
122
|
module : Button,
|
117
123
|
appName,
|
@@ -127,6 +133,23 @@ class Viewport extends BaseViewport {
|
|
127
133
|
return button.createVdomReference()
|
128
134
|
}
|
129
135
|
|
136
|
+
/**
|
137
|
+
* @param {Object} data
|
138
|
+
*/
|
139
|
+
onSwitchDragModeButtonClick(data) {
|
140
|
+
let button = data.component,
|
141
|
+
grid = this.getReference('grid'),
|
142
|
+
{sortZone} = grid.headerToolbar;
|
143
|
+
|
144
|
+
if (button.iconCls === 'fas fa-check') {
|
145
|
+
button.set({iconCls: 'far fa-square'});
|
146
|
+
sortZone.moveColumnContent = true
|
147
|
+
} else {
|
148
|
+
button.set({iconCls: 'fas fa-check'});
|
149
|
+
sortZone.moveColumnContent = false
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
130
153
|
/**
|
131
154
|
* @param {Object} data
|
132
155
|
*/
|
@@ -127,10 +127,10 @@ class MainContainer extends ConfigurationViewport {
|
|
127
127
|
{
|
128
128
|
dataField: 'edit',
|
129
129
|
text : 'Edit Action',
|
130
|
-
renderer({column,
|
130
|
+
renderer({column, rowIndex}) {
|
131
131
|
const
|
132
132
|
me = this,
|
133
|
-
widgetId = `${column.id}-widget-${
|
133
|
+
widgetId = `${column.id}-widget-${rowIndex}`,
|
134
134
|
button = (column.widgetMap || (column.widgetMap = {}))[widgetId] || (column.widgetMap[widgetId] = Neo.create({
|
135
135
|
module : Button,
|
136
136
|
appName : me.appName,
|
@@ -146,10 +146,10 @@ class MainContainer extends ConfigurationViewport {
|
|
146
146
|
}, {
|
147
147
|
dataField: 'menu',
|
148
148
|
text : 'Menu',
|
149
|
-
renderer({column, record,
|
149
|
+
renderer({column, record, rowIndex}) {
|
150
150
|
const
|
151
151
|
me = this,
|
152
|
-
widgetId = `${column.id}-widget-${
|
152
|
+
widgetId = `${column.id}-widget-${rowIndex}`,
|
153
153
|
button = (column.widgetMap || (column.widgetMap = {}))[widgetId] || (column.widgetMap[widgetId] = Neo.create('Neo.button.Base', {
|
154
154
|
ntype : 'button',
|
155
155
|
appName : me.appName,
|
@@ -133,7 +133,7 @@ class Util extends Base {
|
|
133
133
|
imageName = map[imageName] || imageName;
|
134
134
|
|
135
135
|
if (Neo.config.isGitHubPages) {
|
136
|
-
let path = `../../../../
|
136
|
+
let path = `../../../../resources_pub/images/flaticon/country_flags/png/${imageName}.png`;
|
137
137
|
|
138
138
|
if (Neo.config.environment !== 'development') {
|
139
139
|
path = `../../${path}`
|
@@ -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
|
}
|
@@ -104,10 +104,10 @@ class Viewport extends BaseViewport {
|
|
104
104
|
/**
|
105
105
|
* @param {Object} data
|
106
106
|
*/
|
107
|
-
editRenderer({column,
|
107
|
+
editRenderer({column, record, rowIndex, tableContainer}) {
|
108
108
|
let me = this,
|
109
109
|
{appName, windowId} = me,
|
110
|
-
widgetId = `${column.id}-widget-${
|
110
|
+
widgetId = `${column.id}-widget-${rowIndex}`,
|
111
111
|
button = (column.widgetMap || (column.widgetMap = {}))[widgetId] || (column.widgetMap[widgetId] = Neo.create({
|
112
112
|
module : Button,
|
113
113
|
appName,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.14.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.
|
57
|
+
"inquirer": "^12.4.1",
|
58
58
|
"marked": "^15.0.6",
|
59
59
|
"monaco-editor": "0.50.0",
|
60
60
|
"neo-jsdoc": "1.0.1",
|
@@ -1,9 +1,11 @@
|
|
1
1
|
body:has(.neo-is-dragging) {
|
2
|
-
cursor: move !important;
|
2
|
+
cursor : move !important;
|
3
|
+
user-select: none !important;
|
3
4
|
|
4
5
|
// We can not put pointer-events: none on the same level as cursor, since it prevents cursor changes
|
5
6
|
* {
|
6
7
|
pointer-events: none !important;
|
8
|
+
user-select : none !important;
|
7
9
|
}
|
8
10
|
}
|
9
11
|
|
@@ -13,6 +15,7 @@ body:has(.neo-is-dragging) {
|
|
13
15
|
transform : none !important;
|
14
16
|
transition-duration: 0ms;
|
15
17
|
transition-property: none;
|
18
|
+
user-select : none !important;
|
16
19
|
will-change : left, top;
|
17
20
|
z-index : 1000;
|
18
21
|
|
@@ -1,5 +1,22 @@
|
|
1
|
-
.neo-grid-
|
2
|
-
|
1
|
+
.neo-grid-container {
|
2
|
+
&:has(.neo-is-dragging) {
|
3
|
+
.neo-grid-cell {
|
4
|
+
opacity : .8;
|
5
|
+
transition: left 200ms ease-out;
|
6
|
+
|
7
|
+
&:last-child {
|
8
|
+
border-right-width : 1px;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
.neo-dragproxy {
|
15
|
+
.neo-grid-container {
|
16
|
+
border: none;
|
17
|
+
}
|
18
|
+
|
19
|
+
.neo-grid-header-toolbar {
|
3
20
|
height: 30px !important; // Hack to increase the height by the border-bottom height (29 + 1)
|
4
21
|
|
5
22
|
.neo-button {
|
@@ -7,6 +24,12 @@
|
|
7
24
|
}
|
8
25
|
}
|
9
26
|
|
27
|
+
.neo-grid-row {
|
28
|
+
position: unset;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
.neo-grid-header-toolbar {
|
10
33
|
&.neo-is-dragging {
|
11
34
|
.neo-button {
|
12
35
|
border-right: 1px solid var(--grid-container-border-color); // Would be missing for the last button otherwise
|
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.14.0'
|
266
266
|
* @memberOf! module:Neo
|
267
267
|
* @name config.version
|
268
268
|
* @type String
|
269
269
|
*/
|
270
|
-
version: '8.
|
270
|
+
version: '8.14.0'
|
271
271
|
};
|
272
272
|
|
273
273
|
Object.assign(DefaultConfig, {
|
package/src/Neo.mjs
CHANGED
@@ -701,7 +701,7 @@ function autoGenerateGetSet(proto, key) {
|
|
701
701
|
// every set call has to delete the matching symbol
|
702
702
|
delete me[configSymbol][key];
|
703
703
|
|
704
|
-
if (key !== 'items') {
|
704
|
+
if (key !== 'items' && key !== 'vnode') {
|
705
705
|
value = Neo.clone(value, true, true)
|
706
706
|
}
|
707
707
|
|
@@ -509,7 +509,7 @@ class YearComponent extends Component {
|
|
509
509
|
vdom.cn[1].cn[0].cn[scrollFromTop ? 'unshift' : 'push'](vdom.cn[0]);
|
510
510
|
vdom.cn.splice(0, 1);
|
511
511
|
|
512
|
-
me.promiseUpdate(
|
512
|
+
me.promiseUpdate().then(() => {
|
513
513
|
y = scrollFromTop ? -data.height : 0;
|
514
514
|
vdom.cn[0].cn[0].style.transform = `translateY(${y}px)`;
|
515
515
|
me.update();
|
@@ -779,7 +779,7 @@ class YearComponent extends Component {
|
|
779
779
|
|
780
780
|
me.isUpdating = true;
|
781
781
|
|
782
|
-
me.promiseUpdate(
|
782
|
+
me.promiseUpdate().then(() => {
|
783
783
|
me.isUpdating = false
|
784
784
|
})
|
785
785
|
}
|
@@ -689,7 +689,7 @@ class Component extends BaseComponent {
|
|
689
689
|
week.header && container.cn.unshift(week.header)
|
690
690
|
}
|
691
691
|
|
692
|
-
me.promiseUpdate(
|
692
|
+
me.promiseUpdate().then(() => {
|
693
693
|
Neo.main.DomAccess.scrollTo({
|
694
694
|
direction: 'top',
|
695
695
|
id : me.vdom.cn[1].id,
|
@@ -156,8 +156,10 @@ class EventDragZone extends DragZone {
|
|
156
156
|
|
157
157
|
/**
|
158
158
|
* @param {Object} data
|
159
|
+
* @param {Boolean} createComponent=true
|
160
|
+
* @returns {Object|Neo.draggable.DragProxyComponent}
|
159
161
|
*/
|
160
|
-
createDragProxy(data) {
|
162
|
+
async createDragProxy(data, createComponent=true) {
|
161
163
|
let me = this,
|
162
164
|
component = Neo.getComponent(me.getDragElementRoot().id) || me.owner,
|
163
165
|
vdom = me.dragProxyConfig?.vdom,
|
@@ -199,7 +201,11 @@ class EventDragZone extends DragZone {
|
|
199
201
|
width : `${data.width}px`
|
200
202
|
});
|
201
203
|
|
202
|
-
|
204
|
+
if (createComponent) {
|
205
|
+
return me.dragProxy = Neo.create(config)
|
206
|
+
}
|
207
|
+
|
208
|
+
return config
|
203
209
|
}
|
204
210
|
|
205
211
|
/**
|
@@ -491,35 +497,32 @@ class EventDragZone extends DragZone {
|
|
491
497
|
/**
|
492
498
|
* @param {Object} data
|
493
499
|
*/
|
494
|
-
dragStart(data) {
|
495
|
-
let me
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
eventDuration = (me.eventRecord.endDate - me.eventRecord.startDate) / 60 / 1000;
|
500
|
-
offsetX = data.clientX - rects[0].left;
|
500
|
+
async dragStart(data) {
|
501
|
+
let me = this,
|
502
|
+
rects = await me.owner.getDomRect([me.getDragElementRoot().id, data.path[1].id]),
|
503
|
+
eventDuration = (me.eventRecord.endDate - me.eventRecord.startDate) / 60 / 1000,
|
504
|
+
offsetX = data.clientX - rects[0].left,
|
501
505
|
offsetY = data.clientY - rects[0].top;
|
502
506
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
})
|
507
|
+
Object.assign(me, {
|
508
|
+
columnHeight : rects[1].height,
|
509
|
+
columnTop : rects[1].top,
|
510
|
+
dragElementRect: rects[0],
|
511
|
+
eventDuration : Math.round(eventDuration / me.intervalSize) * me.intervalSize,
|
512
|
+
offsetX,
|
513
|
+
offsetY
|
514
|
+
});
|
515
|
+
|
516
|
+
await me.createDragProxy(rects[0]);
|
517
|
+
|
518
|
+
me.fire('dragStart', {
|
519
|
+
dragElementRect: rects[0],
|
520
|
+
id : me.id,
|
521
|
+
offsetX,
|
522
|
+
offsetY
|
523
|
+
});
|
524
|
+
|
525
|
+
me.dragMove(data)
|
523
526
|
}
|
524
527
|
|
525
528
|
/**
|
@@ -175,7 +175,7 @@ class DragDrop extends Base {
|
|
175
175
|
/**
|
176
176
|
* @param {Object} data
|
177
177
|
*/
|
178
|
-
onColumnDragStart(data) {
|
178
|
+
async onColumnDragStart(data) {
|
179
179
|
let me = this;
|
180
180
|
|
181
181
|
if (me.isActiveCalendar() && me.isTopLevelColumn(data.targetPath)) {
|
@@ -214,26 +214,26 @@ class DragDrop extends Base {
|
|
214
214
|
me[newRecordSymbol] = record;
|
215
215
|
|
216
216
|
// wait until the new event got mounted
|
217
|
-
me.timeout(50)
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
}
|
217
|
+
await me.timeout(50);
|
218
|
+
|
219
|
+
eventId = owner.getEventId(record.id);
|
220
|
+
dragElement = VDomUtil.find(owner.vdom, eventId).vdom;
|
221
|
+
|
222
|
+
eventDragZone = me.getEventDragZone({
|
223
|
+
dragElement,
|
224
|
+
enableResizingAcrossOppositeEdge: true,
|
225
|
+
eventRecord : record,
|
226
|
+
proxyParentId : data.path[0].id
|
227
|
+
});
|
228
|
+
|
229
|
+
owner.getPlugin(me.resizablePluginType).onDragStart(data);
|
230
|
+
await eventDragZone.dragStart(data);
|
231
|
+
|
232
|
+
await me.timeout(50);
|
233
|
+
|
234
|
+
me.isDragging && Neo.applyDeltas(me.appName, {
|
235
|
+
id : eventId,
|
236
|
+
style: {opacity: 0}
|
237
237
|
})
|
238
238
|
}
|
239
239
|
}
|