neo.mjs 5.5.0 → 5.5.2
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/package.json +1 -1
- package/src/DefaultConfig.mjs +5 -6
- package/src/component/Base.mjs +28 -3
- package/src/component/DateSelector.mjs +10 -11
- package/src/form/field/Picker.mjs +3 -4
- package/src/main/addon/ScrollSync.mjs +58 -0
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -113,17 +113,16 @@ const DefaultConfig = {
|
|
113
113
|
logDeltaUpdates: false,
|
114
114
|
/**
|
115
115
|
* Add addons for the main thread
|
116
|
-
*
|
117
|
-
* (src/main/addon) contains all framework related options.
|
116
|
+
* ./src/main/addon/ contains all framework related options.
|
118
117
|
* You can also create your own addons within your workspace scope. Make sure to put them inside 'src/main/addon/'
|
119
118
|
* and prefix them with 'WS/' inside your neo-config.json file.
|
120
119
|
* Example: ['DragDrop', 'Stylesheet', 'WS/MyAddon']
|
121
|
-
* @default ['DragDrop','Stylesheet']
|
120
|
+
* @default ['DragDrop','ScrollSync','Stylesheet']
|
122
121
|
* @memberOf! module:Neo
|
123
122
|
* @name config.mainThreadAddons
|
124
123
|
* @type String[]
|
125
124
|
*/
|
126
|
-
mainThreadAddons: ['DragDrop', 'Stylesheet'],
|
125
|
+
mainThreadAddons: ['DragDrop', 'ScrollSync', 'Stylesheet'],
|
127
126
|
/**
|
128
127
|
* Pass the URL of a JSON-file, which contains the services and methods from your backend,
|
129
128
|
* which you want to expose to the client.
|
@@ -237,12 +236,12 @@ const DefaultConfig = {
|
|
237
236
|
useVdomWorker: true,
|
238
237
|
/**
|
239
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
240
|
-
* @default '5.5.
|
239
|
+
* @default '5.5.2'
|
241
240
|
* @memberOf! module:Neo
|
242
241
|
* @name config.version
|
243
242
|
* @type String
|
244
243
|
*/
|
245
|
-
version: '5.5.
|
244
|
+
version: '5.5.2'
|
246
245
|
};
|
247
246
|
|
248
247
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -1180,6 +1180,31 @@ class Base extends CoreBase {
|
|
1180
1180
|
return this.getConfigInstanceByNtype('model', ntype);
|
1181
1181
|
}
|
1182
1182
|
|
1183
|
+
/**
|
1184
|
+
* Calculate the real parentIndex inside the DOM
|
1185
|
+
* @returns {Number|undefined}
|
1186
|
+
*/
|
1187
|
+
getMountedParentIndex() {
|
1188
|
+
let parent = Neo.getComponent(this.parentId),
|
1189
|
+
items = parent?.items || [],
|
1190
|
+
i = 0,
|
1191
|
+
index = 0,
|
1192
|
+
len = items.length,
|
1193
|
+
item;
|
1194
|
+
|
1195
|
+
for (; i < len; i++) {
|
1196
|
+
item = items[i];
|
1197
|
+
|
1198
|
+
if (item === this) {
|
1199
|
+
return index
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
if (!item.hidden && item.hideMode === 'removeDom') {
|
1203
|
+
index++
|
1204
|
+
}
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
|
1183
1208
|
/**
|
1184
1209
|
* Get the parent components as an array
|
1185
1210
|
* @returns {Neo.component.Base[]}
|
@@ -1404,7 +1429,7 @@ class Base extends CoreBase {
|
|
1404
1429
|
id : me.id,
|
1405
1430
|
html : me.vnode.outerHTML,
|
1406
1431
|
parentId : me.parentId,
|
1407
|
-
parentIndex: me.
|
1432
|
+
parentIndex: me.getMountedParentIndex()
|
1408
1433
|
});
|
1409
1434
|
|
1410
1435
|
delete me.vdom.removeDom;
|
@@ -1626,8 +1651,8 @@ class Base extends CoreBase {
|
|
1626
1651
|
Neo.vdom.Helper.create({
|
1627
1652
|
appName : me.appName,
|
1628
1653
|
autoMount,
|
1629
|
-
parentId : autoMount ? me.parentId
|
1630
|
-
parentIndex: autoMount ? me.
|
1654
|
+
parentId : autoMount ? me.parentId : undefined,
|
1655
|
+
parentIndex: autoMount ? me.getMountedParentIndex() : undefined,
|
1631
1656
|
...me.vdom
|
1632
1657
|
}).then(data => {
|
1633
1658
|
me.onRender(data, useVdomWorker ? autoMount : false);
|
@@ -149,10 +149,6 @@ class DateSelector extends Component {
|
|
149
149
|
{click: me.onComponentClick, scope: me},
|
150
150
|
{wheel: me.onComponentWheel, scope: me}
|
151
151
|
]);
|
152
|
-
|
153
|
-
me.updateHeaderMonth(0, 0, true);
|
154
|
-
me.updateHeaderYear(0, true);
|
155
|
-
me.createDayViewContent(false);
|
156
152
|
}
|
157
153
|
|
158
154
|
/**
|
@@ -191,6 +187,10 @@ class DateSelector extends Component {
|
|
191
187
|
me[method](...methodParams);
|
192
188
|
}
|
193
189
|
}
|
190
|
+
} else if (value) {
|
191
|
+
me.updateHeaderMonth(0, 0, true);
|
192
|
+
me.updateHeaderYear(0, true);
|
193
|
+
me.recreateDayViewContent(false, false)
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
@@ -556,10 +556,10 @@ class DateSelector extends Component {
|
|
556
556
|
}
|
557
557
|
|
558
558
|
/**
|
559
|
-
* @param {Boolean} silent true to update the vdom silently
|
559
|
+
* @param {Boolean} silent=false true to update the vdom silently
|
560
560
|
* @param {Object} [containerEl]
|
561
561
|
*/
|
562
|
-
createDayViewContent(silent, containerEl) {
|
562
|
+
createDayViewContent(silent=false, containerEl) {
|
563
563
|
let me = this,
|
564
564
|
currentDate = me.currentDate,
|
565
565
|
currentDay = currentDate.getDate(),
|
@@ -572,7 +572,6 @@ class DateSelector extends Component {
|
|
572
572
|
daysInMonth = DateUtil.getDaysInMonth(currentDate),
|
573
573
|
firstDayInMonth = DateUtil.getFirstDayOfMonth(currentDate),
|
574
574
|
firstDayOffset = firstDayInMonth - me.weekStartDay,
|
575
|
-
vdom = me.vdom,
|
576
575
|
centerEl = containerEl || me.getCenterContentEl(),
|
577
576
|
columns = 7,
|
578
577
|
i = 0,
|
@@ -632,7 +631,7 @@ class DateSelector extends Component {
|
|
632
631
|
centerEl.cn.push(row);
|
633
632
|
}
|
634
633
|
|
635
|
-
|
634
|
+
!silent && me.update()
|
636
635
|
}
|
637
636
|
|
638
637
|
/**
|
@@ -697,7 +696,7 @@ class DateSelector extends Component {
|
|
697
696
|
date = DateUtil.convertToyyyymmdd(date);
|
698
697
|
|
699
698
|
// We want to always trigger a change event.
|
700
|
-
// Reason: A form.field.Date can have a null value and we want to select the current date.
|
699
|
+
// Reason: A form.field.Date can have a null value, and we want to select the current date.
|
701
700
|
me._value = date;
|
702
701
|
me.afterSetValue(date, null);
|
703
702
|
}
|
@@ -872,9 +871,9 @@ class DateSelector extends Component {
|
|
872
871
|
vdom = me.vdom,
|
873
872
|
headerCenterEl, y;
|
874
873
|
|
875
|
-
if (!me.
|
874
|
+
if (!me.mounted || !me.useAnimations) {
|
876
875
|
monthEl.html = currentMonth;
|
877
|
-
|
876
|
+
!silent && me.update()
|
878
877
|
return null;
|
879
878
|
} else {
|
880
879
|
y = slideDirection === 'top' ? 0 : -monthElDomRect.height;
|
@@ -2,7 +2,6 @@ import Container from '../../container/Base.mjs';
|
|
2
2
|
import NeoArray from '../../util/Array.mjs';
|
3
3
|
import PickerTrigger from './trigger/Picker.mjs';
|
4
4
|
import Text from './Text.mjs';
|
5
|
-
import VDomUtil from '../../util/VDom.mjs';
|
6
5
|
|
7
6
|
/**
|
8
7
|
* The abstract picker field provides an arrow down trigger which opens a floating container to provide
|
@@ -274,7 +273,7 @@ class Picker extends Text {
|
|
274
273
|
* @param {Object} data
|
275
274
|
* @protected
|
276
275
|
*/
|
277
|
-
onFocusEnter(data) {
|
276
|
+
onFocusEnter(data) {
|
278
277
|
super.onFocusEnter(data);
|
279
278
|
|
280
279
|
let me = this;
|
@@ -286,7 +285,7 @@ class Picker extends Text {
|
|
286
285
|
* @param {Object} data
|
287
286
|
* @protected
|
288
287
|
*/
|
289
|
-
onFocusLeave(data) {
|
288
|
+
onFocusLeave(data) {
|
290
289
|
let me = this,
|
291
290
|
insidePicker = false,
|
292
291
|
item;
|
@@ -307,7 +306,7 @@ class Picker extends Text {
|
|
307
306
|
/**
|
308
307
|
* @param {Object} data
|
309
308
|
*/
|
310
|
-
onInputClick(data) {
|
309
|
+
onInputClick(data) {
|
311
310
|
let me = this;
|
312
311
|
|
313
312
|
if (!me.editable) {
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import Base from '../../core/Base.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.main.addon.ScrollSync
|
5
|
+
* @extends Neo.core.Base
|
6
|
+
* @singleton
|
7
|
+
*/
|
8
|
+
class ScrollSync extends Base {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.main.addon.ScrollSync'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.main.addon.ScrollSync',
|
15
|
+
/**
|
16
|
+
* Remote method access for other workers
|
17
|
+
* @member {Object} remote={app: [//...]}
|
18
|
+
* @protected
|
19
|
+
*/
|
20
|
+
remote: {
|
21
|
+
app: [
|
22
|
+
'register',
|
23
|
+
'unregister'
|
24
|
+
]
|
25
|
+
},
|
26
|
+
/**
|
27
|
+
* @member {Boolean} singleton=true
|
28
|
+
* @protected
|
29
|
+
*/
|
30
|
+
singleton: true
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @param {Object} data
|
35
|
+
* @param {String} data.sourceId
|
36
|
+
* @param {String} data.targetId
|
37
|
+
*/
|
38
|
+
register(data) {
|
39
|
+
console.log('register', data)
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* @param {Object} data
|
44
|
+
* @param {String} data.sourceId
|
45
|
+
* @param {String} data.targetId
|
46
|
+
*/
|
47
|
+
unregister(data) {
|
48
|
+
console.log('unregister', data)
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
Neo.applyClassConfig(ScrollSync);
|
53
|
+
|
54
|
+
let instance = Neo.create(ScrollSync);
|
55
|
+
|
56
|
+
Neo.applyToGlobalNs(instance);
|
57
|
+
|
58
|
+
export default instance;
|