neo.mjs 5.14.1 → 5.14.3
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/examples/ServiceWorker.mjs +2 -2
- package/examples/button/base/MainContainer.mjs +1 -0
- package/examples/component/timer/MainContainerController.mjs +2 -2
- package/examples/component/toast/MainContainerController.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/examples/button/base/MainContainer.scss +7 -0
- package/src/DefaultConfig.mjs +4 -4
- package/src/button/Base.mjs +2 -2
- package/src/calendar/view/week/Component.mjs +1 -1
- package/src/component/Base.mjs +1 -1
- package/src/container/AccordionItem.mjs +19 -15
- package/src/container/Dialog.mjs +7 -6
- package/src/controller/Application.mjs +1 -1
- package/src/core/Base.mjs +25 -0
- package/src/core/Util.mjs +0 -9
- package/src/dialog/Base.mjs +5 -5
- package/src/draggable/toolbar/SortZone.mjs +3 -3
- package/src/form/field/Picker.mjs +1 -1
- package/src/list/Base.mjs +4 -0
- package/src/main/addon/ScrollSync.mjs +1 -1
- package/src/menu/Model.mjs +3 -0
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -63,12 +63,12 @@ const DefaultConfig = {
|
|
63
63
|
/**
|
64
64
|
* In case you are using the GoogleAnalytics main thread addon or useGoogleAnalytics: true,
|
65
65
|
* you can change the gtag id here. Required for the online examples (gh pages)
|
66
|
-
* @default '
|
66
|
+
* @default 'G-DJ13071C55'
|
67
67
|
* @memberOf! module:Neo
|
68
68
|
* @name config.gtagId
|
69
69
|
* @type String
|
70
70
|
*/
|
71
|
-
gtagId: '
|
71
|
+
gtagId: 'G-DJ13071C55',
|
72
72
|
/**
|
73
73
|
* Flag for running on https://neomjs.github.io/pages/
|
74
74
|
* => to use local images paths instead of raw.githubusercontent.com
|
@@ -245,12 +245,12 @@ const DefaultConfig = {
|
|
245
245
|
useVdomWorker: true,
|
246
246
|
/**
|
247
247
|
* buildScripts/injectPackageVersion.mjs will update this value
|
248
|
-
* @default '5.14.
|
248
|
+
* @default '5.14.3'
|
249
249
|
* @memberOf! module:Neo
|
250
250
|
* @name config.version
|
251
251
|
* @type String
|
252
252
|
*/
|
253
|
-
version: '5.14.
|
253
|
+
version: '5.14.3'
|
254
254
|
};
|
255
255
|
|
256
256
|
Object.assign(DefaultConfig, {
|
package/src/button/Base.mjs
CHANGED
@@ -481,7 +481,7 @@ class Base extends Component {
|
|
481
481
|
delete rippleWrapper.removeDom;
|
482
482
|
me.update();
|
483
483
|
|
484
|
-
await
|
484
|
+
await me.timeout(1);
|
485
485
|
|
486
486
|
rippleEl.style.animation = `ripple ${rippleEffectDuration}ms linear`;
|
487
487
|
me.update();
|
@@ -507,7 +507,7 @@ class Base extends Component {
|
|
507
507
|
menuList.hidden = hidden;
|
508
508
|
|
509
509
|
if (!hidden) {
|
510
|
-
await
|
510
|
+
await this.timeout(50);
|
511
511
|
menuList.focus()
|
512
512
|
}
|
513
513
|
}
|
package/src/component/Base.mjs
CHANGED
@@ -53,18 +53,19 @@ class AccordionContainer extends Base {
|
|
53
53
|
* @protected
|
54
54
|
*/
|
55
55
|
createItems() {
|
56
|
-
|
57
|
-
items = me.items,
|
58
|
-
title = me.title;
|
59
|
-
let iconCls = me.iconCls || ['no-icon'],
|
56
|
+
let me = this,
|
60
57
|
arrowCls = me.arrowCls || 'fa-caret-down',
|
58
|
+
iconCls = me.iconCls || ['no-icon'],
|
59
|
+
items = me.items,
|
60
|
+
title = me.title,
|
61
61
|
header, content;
|
62
62
|
|
63
63
|
if (!Neo.isArray(iconCls)) {
|
64
|
-
iconCls = iconCls.split(' ')
|
64
|
+
iconCls = iconCls.split(' ')
|
65
65
|
}
|
66
|
+
|
66
67
|
if (!Neo.isArray(arrowCls)) {
|
67
|
-
arrowCls = arrowCls.split(' ')
|
68
|
+
arrowCls = arrowCls.split(' ')
|
68
69
|
}
|
69
70
|
|
70
71
|
header = Neo.create({
|
@@ -85,6 +86,7 @@ class AccordionContainer extends Base {
|
|
85
86
|
cls : ['fa', ...arrowCls]
|
86
87
|
}]
|
87
88
|
});
|
89
|
+
|
88
90
|
content = {
|
89
91
|
ntype : 'container',
|
90
92
|
flag : 'content',
|
@@ -98,7 +100,7 @@ class AccordionContainer extends Base {
|
|
98
100
|
|
99
101
|
me.addDomListeners([
|
100
102
|
{click: me.onExpandClick, delegate: 'neo-accordion-header-arrow'}
|
101
|
-
])
|
103
|
+
])
|
102
104
|
}
|
103
105
|
|
104
106
|
/**
|
@@ -106,15 +108,15 @@ class AccordionContainer extends Base {
|
|
106
108
|
* @param {Boolean} isExpanded
|
107
109
|
*/
|
108
110
|
afterSetExpanded(isExpanded) {
|
109
|
-
|
110
|
-
|
111
|
-
|
111
|
+
let me = this,
|
112
|
+
cls = me.cls,
|
113
|
+
fn = isExpanded ? 'add' : 'remove';
|
112
114
|
|
113
115
|
NeoArray[fn](cls, 'neo-expanded');
|
114
116
|
me.cls = cls;
|
115
117
|
|
116
118
|
// Ensure scrollbars are not flipping in and out
|
117
|
-
|
119
|
+
me.timeout(450).then(() => {
|
118
120
|
NeoArray[fn](cls, 'neo-scrollable');
|
119
121
|
me.cls = cls;
|
120
122
|
})
|
@@ -133,7 +135,9 @@ class AccordionContainer extends Base {
|
|
133
135
|
if (iconEl) {
|
134
136
|
let cls = iconEl.cls;
|
135
137
|
|
136
|
-
if (!Neo.isArray(newValue))
|
138
|
+
if (!Neo.isArray(newValue)) {
|
139
|
+
newValue = newValue.split(' ')
|
140
|
+
}
|
137
141
|
|
138
142
|
NeoArray.remove(cls, oldValue);
|
139
143
|
NeoArray.add(cls, newValue);
|
@@ -158,9 +162,9 @@ class AccordionContainer extends Base {
|
|
158
162
|
* Otherwise we set this.expanded to the new value.
|
159
163
|
*/
|
160
164
|
onExpandClick() {
|
161
|
-
|
162
|
-
|
163
|
-
|
165
|
+
let me = this,
|
166
|
+
currentState = me.expanded,
|
167
|
+
parent = me.up('accordion');
|
164
168
|
|
165
169
|
if (parent.ntype === 'accordion') {
|
166
170
|
parent.childExpandChange({
|
package/src/container/Dialog.mjs
CHANGED
@@ -93,7 +93,7 @@ class Dialog extends Base {
|
|
93
93
|
|
94
94
|
iconNode.removeDom = !value || value === '';
|
95
95
|
this.update();
|
96
|
-
}
|
96
|
+
}
|
97
97
|
|
98
98
|
/**
|
99
99
|
* Triggered after the title config got changed
|
@@ -104,7 +104,7 @@ class Dialog extends Base {
|
|
104
104
|
afterSetTitle(value, oldValue) {
|
105
105
|
this.headerToolbar?.down({flag: 'panel-header-title'}).set({
|
106
106
|
text: value
|
107
|
-
})
|
107
|
+
})
|
108
108
|
}
|
109
109
|
|
110
110
|
/**
|
@@ -149,7 +149,7 @@ class Dialog extends Base {
|
|
149
149
|
hidden: !me.title,
|
150
150
|
text : me.title
|
151
151
|
}, ...me.headerConfig.items || []],
|
152
|
-
|
152
|
+
|
153
153
|
...headerConfigCopy
|
154
154
|
});
|
155
155
|
|
@@ -190,11 +190,12 @@ class Dialog extends Base {
|
|
190
190
|
*/
|
191
191
|
async show(modal = true) {
|
192
192
|
let me = this;
|
193
|
-
|
193
|
+
|
194
|
+
await me.timeout(20);
|
194
195
|
|
195
196
|
Neo.main.addon.Dialog[modal ? 'showModal': 'show']({
|
196
|
-
|
197
|
-
|
197
|
+
appName: me.appName,
|
198
|
+
id : me.id
|
198
199
|
});
|
199
200
|
}
|
200
201
|
}
|
@@ -88,7 +88,7 @@ class Application extends Base {
|
|
88
88
|
let me = this;
|
89
89
|
|
90
90
|
// short delay to ensure changes from onHashChange() got applied
|
91
|
-
await
|
91
|
+
await me.timeout(Neo.config.hash ? 200 : 10);
|
92
92
|
|
93
93
|
Logger.addContextMenuListener(me.mainView);
|
94
94
|
|
package/src/core/Base.mjs
CHANGED
@@ -79,6 +79,13 @@ class Base {
|
|
79
79
|
module: null
|
80
80
|
}
|
81
81
|
|
82
|
+
/**
|
83
|
+
* Internal cache for all timeout ids when using this.timeout()
|
84
|
+
* @member {Number[]} timeoutIds=[]
|
85
|
+
* @private
|
86
|
+
*/
|
87
|
+
#timeoutIds = []
|
88
|
+
|
82
89
|
/**
|
83
90
|
* Applies the observable mixin if needed, grants remote access if needed.
|
84
91
|
* @param {Object} config={}
|
@@ -240,6 +247,10 @@ class Base {
|
|
240
247
|
destroy() {
|
241
248
|
let me = this;
|
242
249
|
|
250
|
+
me.#timeoutIds.forEach(id => {
|
251
|
+
clearTimeout(id)
|
252
|
+
});
|
253
|
+
|
243
254
|
if (Base.instanceManagerAvailable === true) {
|
244
255
|
Neo.manager.Instance.unregister(me)
|
245
256
|
} else if (Neo.idMap) {
|
@@ -503,6 +514,20 @@ class Base {
|
|
503
514
|
return false
|
504
515
|
}
|
505
516
|
|
517
|
+
/**
|
518
|
+
* Stores timeoutIds internally, so that destroy() can clear them if needed
|
519
|
+
* @param {Number} time in milliseconds
|
520
|
+
* @returns {Promise<any>}
|
521
|
+
*/
|
522
|
+
timeout(time) {
|
523
|
+
return new Promise(resolve => {
|
524
|
+
let timeoutIds = this.#timeoutIds,
|
525
|
+
timeoutId = setTimeout(() => {timeoutIds.splice(timeoutIds.indexOf(timeoutId, 1)); resolve()}, time);
|
526
|
+
|
527
|
+
timeoutIds.push(timeoutId)
|
528
|
+
})
|
529
|
+
}
|
530
|
+
|
506
531
|
/**
|
507
532
|
* <p>Enhancing the toString() method, e.g.</p>
|
508
533
|
* `Neo.create('Neo.button.Base').toString() => "[object Neo.button.Base (neo-button-1)]"`
|
package/src/core/Util.mjs
CHANGED
@@ -199,14 +199,6 @@ class Util extends Base {
|
|
199
199
|
return typeof value === 'string';
|
200
200
|
}
|
201
201
|
|
202
|
-
/**
|
203
|
-
* @param {Number} time in milliseconds
|
204
|
-
* @returns {Promise<unknown>}
|
205
|
-
*/
|
206
|
-
static timeout(time) {
|
207
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
208
|
-
}
|
209
|
-
|
210
202
|
/**
|
211
203
|
* Converts any iterable (strings, numeric indices and a length property) into a true array
|
212
204
|
* @param {Object|String} iterable
|
@@ -246,7 +238,6 @@ Neo.applyFromNs(Neo, Util, {
|
|
246
238
|
isNumber : 'isNumber',
|
247
239
|
isObject : 'isObject',
|
248
240
|
isString : 'isString',
|
249
|
-
timeout : 'timeout',
|
250
241
|
toArray : 'toArray'
|
251
242
|
}, true);
|
252
243
|
|
package/src/dialog/Base.mjs
CHANGED
@@ -298,7 +298,7 @@ class Base extends Panel {
|
|
298
298
|
|
299
299
|
me.closeOrHide(false);
|
300
300
|
|
301
|
-
await
|
301
|
+
await me.timeout(30);
|
302
302
|
|
303
303
|
await Neo.currentWorker.promiseMessage('main', {
|
304
304
|
action: 'updateDom',
|
@@ -314,7 +314,7 @@ class Base extends Panel {
|
|
314
314
|
}]
|
315
315
|
});
|
316
316
|
|
317
|
-
await
|
317
|
+
await me.timeout(250);
|
318
318
|
|
319
319
|
await Neo.currentWorker.promiseMessage('main', {
|
320
320
|
action: 'updateDom',
|
@@ -340,7 +340,7 @@ class Base extends Panel {
|
|
340
340
|
parentId: 'document.body'
|
341
341
|
});
|
342
342
|
|
343
|
-
await
|
343
|
+
await me.timeout(30);
|
344
344
|
|
345
345
|
await Neo.currentWorker.promiseMessage('main', {
|
346
346
|
action: 'updateDom',
|
@@ -357,9 +357,9 @@ class Base extends Panel {
|
|
357
357
|
}]
|
358
358
|
});
|
359
359
|
|
360
|
-
await
|
360
|
+
await me.timeout(200);
|
361
361
|
|
362
|
-
me.show(false)
|
362
|
+
me.show(false)
|
363
363
|
}
|
364
364
|
|
365
365
|
/**
|
@@ -82,14 +82,14 @@ class SortZone extends DragZone {
|
|
82
82
|
* @param {Object} data
|
83
83
|
*/
|
84
84
|
async onDragEnd(data) {
|
85
|
-
await Neo.timeout(10);
|
86
|
-
|
87
85
|
let me = this,
|
88
86
|
owner = me.owner,
|
89
87
|
itemStyles = me.itemStyles,
|
90
88
|
ownerStyle = owner.style || {},
|
91
89
|
itemStyle;
|
92
90
|
|
91
|
+
await me.timeout(10);
|
92
|
+
|
93
93
|
if (owner.sortable) {
|
94
94
|
ownerStyle.height = me.ownerStyle.height || null;
|
95
95
|
ownerStyle.width = me.ownerStyle.width || null;
|
@@ -127,7 +127,7 @@ class SortZone extends DragZone {
|
|
127
127
|
startIndex : -1
|
128
128
|
});
|
129
129
|
|
130
|
-
await
|
130
|
+
await me.timeout(30);
|
131
131
|
|
132
132
|
me.dragEnd(data); // we do not want to trigger the super class call here
|
133
133
|
}
|
package/src/list/Base.mjs
CHANGED