neo.mjs 6.3.10 → 6.4.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/examples/ConfigurationViewport.mjs +21 -9
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/container/dialog/MainContainerController.mjs +20 -16
- package/examples/dialog/DemoDialog.mjs +24 -3
- package/examples/form/field/select/MainContainer.mjs +28 -6
- package/package.json +1 -1
- package/resources/scss/src/component/Base.scss +26 -0
- package/resources/scss/src/form/field/Picker.scss +0 -3
- package/resources/scss/src/menu/List.scss +4 -8
- package/resources/scss/theme-dark/menu/List.scss +2 -1
- package/resources/scss/theme-light/menu/List.scss +1 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/button/Base.mjs +41 -6
- package/src/component/Base.mjs +236 -44
- package/src/container/Dialog.mjs +3 -3
- package/src/core/Base.mjs +20 -0
- package/src/form/Container.mjs +2 -0
- package/src/form/field/Picker.mjs +30 -47
- package/src/form/field/Time.mjs +8 -8
- package/src/form/field/trigger/Base.mjs +1 -1
- package/src/form/field/trigger/CopyToClipboard.mjs +5 -1
- package/src/grid/View.mjs +5 -2
- package/src/grid/header/Button.mjs +10 -10
- package/src/list/Base.mjs +17 -14
- package/src/list/plugin/Animate.mjs +3 -3
- package/src/main/DomAccess.mjs +272 -28
- package/src/menu/List.mjs +35 -102
- package/src/table/Container.mjs +2 -2
- package/src/table/View.mjs +1 -0
- package/src/table/header/Button.mjs +21 -23
- package/src/tree/Accordion.mjs +1 -1
- package/src/util/Array.mjs +4 -18
- package/src/util/Css.mjs +6 -8
- package/src/util/HashHistory.mjs +10 -3
- package/src/util/Rectangle.mjs +444 -7
- package/test/siesta/siesta-node.js +2 -1
- package/test/siesta/siesta.js +1 -0
- package/test/siesta/tests/Rectangle.mjs +409 -0
@@ -44,10 +44,6 @@ class Picker extends Text {
|
|
44
44
|
Enter : 'onKeyDownEnter',
|
45
45
|
Escape: 'onKeyDownEscape'
|
46
46
|
},
|
47
|
-
/**
|
48
|
-
* @member {Boolean} matchPickerWidth=true
|
49
|
-
*/
|
50
|
-
matchPickerWidth: true,
|
51
47
|
/**
|
52
48
|
* @member {Object|null} picker=null
|
53
49
|
* @protected
|
@@ -75,9 +71,10 @@ class Picker extends Text {
|
|
75
71
|
pickerMaxHeight: 200,
|
76
72
|
/**
|
77
73
|
* The width of the picker container. Defaults to px.
|
78
|
-
*
|
74
|
+
* By default, the width of the picker matches the width of the input wrap element.
|
75
|
+
* @member {Number|null} pickerWidth=null
|
79
76
|
*/
|
80
|
-
pickerWidth:
|
77
|
+
pickerWidth: null,
|
81
78
|
/**
|
82
79
|
* @member {Boolean} showPickerOnFocus=false
|
83
80
|
* @protected
|
@@ -141,46 +138,46 @@ class Picker extends Text {
|
|
141
138
|
}
|
142
139
|
|
143
140
|
/**
|
144
|
-
*
|
141
|
+
* Triggered after the theme config got changed
|
142
|
+
* @param {String|null} value
|
143
|
+
* @param {String|null} oldValue
|
144
|
+
* @protected
|
145
145
|
*/
|
146
|
-
|
147
|
-
|
148
|
-
rects = me.clientRects,
|
149
|
-
inputRect = rects[1],
|
150
|
-
parentRect = rects[2],
|
151
|
-
triggerRect = rects[0],
|
152
|
-
vdom = me.picker.vdom,
|
153
|
-
width = me.matchPickerWidth ? inputRect.width : me.pickerWidth;
|
154
|
-
|
155
|
-
me.pickerWidth = width;
|
156
|
-
|
157
|
-
vdom.style = vdom.style || {};
|
158
|
-
|
159
|
-
Object.assign(vdom.style, {
|
160
|
-
left : `${inputRect.left}px`,
|
161
|
-
top : `${inputRect.bottom + 1}px`,
|
162
|
-
width: `${width}px`
|
163
|
-
});
|
146
|
+
afterSetTheme(value, oldValue) {
|
147
|
+
super.afterSetTheme(value, oldValue);
|
164
148
|
|
165
|
-
|
149
|
+
if (this.picker) {
|
150
|
+
this.picker.theme = value
|
151
|
+
}
|
166
152
|
}
|
167
153
|
|
168
154
|
/**
|
169
155
|
* @returns {Neo.container.Base}
|
170
156
|
*/
|
171
157
|
createPicker() {
|
172
|
-
|
158
|
+
const
|
159
|
+
me = this,
|
160
|
+
{ pickerWidth } = me,
|
173
161
|
pickerComponent = me.createPickerComponent();
|
174
162
|
|
175
163
|
return Neo.create(Container, {
|
164
|
+
parentId : 'document.body',
|
165
|
+
floating : true,
|
166
|
+
align : {
|
167
|
+
edgeAlign : pickerWidth ? 't0-b0' : 't-b',
|
168
|
+
matchSize : pickerWidth ? false : true,
|
169
|
+
axisLock : true,
|
170
|
+
target : me.getInputWrapperId()
|
171
|
+
},
|
176
172
|
appName : me.appName,
|
177
173
|
cls : ['neo-picker-container', 'neo-container'],
|
178
174
|
height : me.pickerHeight,
|
179
175
|
id : me.getPickerId(),
|
180
176
|
items : pickerComponent ? [pickerComponent] : [],
|
181
177
|
maxHeight: me.pickerMaxHeight,
|
178
|
+
theme : me.theme,
|
182
179
|
vdom : {cn: [], 'aria-activedescendant': me.id, tabIndex: -1},
|
183
|
-
width :
|
180
|
+
width : pickerWidth,
|
184
181
|
...me.pickerConfig,
|
185
182
|
|
186
183
|
// scoped to the field instance
|
@@ -225,20 +222,6 @@ class Picker extends Text {
|
|
225
222
|
super.destroy(...args);
|
226
223
|
}
|
227
224
|
|
228
|
-
/**
|
229
|
-
* @param {Function} [callback]
|
230
|
-
* @param {Object} [callbackScope]
|
231
|
-
*/
|
232
|
-
getClientRectsThenShow(callback, callbackScope) {
|
233
|
-
let me = this,
|
234
|
-
triggerId = me.getTriggerId('picker');
|
235
|
-
|
236
|
-
me.getDomRect([triggerId, me.getInputWrapperId(), me.parentId]).then(data => {
|
237
|
-
me.clientRects = data;
|
238
|
-
me.showPicker(callback, callbackScope);
|
239
|
-
});
|
240
|
-
}
|
241
|
-
|
242
225
|
/**
|
243
226
|
* Returns the picker instance and creates it in case it does not exist yet
|
244
227
|
* @returns {Neo.container.Base}
|
@@ -276,6 +259,7 @@ class Picker extends Text {
|
|
276
259
|
me.pickerIsMounted = false;
|
277
260
|
|
278
261
|
Neo.main.addon.ScrollSync.unregister({
|
262
|
+
appName : me.appName,
|
279
263
|
sourceId: me.id,
|
280
264
|
targetId: picker.id
|
281
265
|
})
|
@@ -291,7 +275,7 @@ class Picker extends Text {
|
|
291
275
|
|
292
276
|
let me = this;
|
293
277
|
|
294
|
-
me.showPickerOnFocus && !me.pickerIsMounted && me.
|
278
|
+
me.showPickerOnFocus && !me.pickerIsMounted && me.showPicker();
|
295
279
|
}
|
296
280
|
|
297
281
|
/**
|
@@ -330,7 +314,7 @@ class Picker extends Text {
|
|
330
314
|
* @protected
|
331
315
|
*/
|
332
316
|
onKeyDownEnter(data, callback, callbackScope) {
|
333
|
-
!this.pickerIsMounted && this.
|
317
|
+
!this.pickerIsMounted && this.showPicker(callback, callbackScope);
|
334
318
|
}
|
335
319
|
|
336
320
|
/**
|
@@ -361,8 +345,6 @@ class Picker extends Text {
|
|
361
345
|
if (!me.pickerIsMounting) {
|
362
346
|
me.pickerIsMounting = true;
|
363
347
|
|
364
|
-
me.applyClientRects(true);
|
365
|
-
|
366
348
|
listenerId = picker.on('mounted', () => {
|
367
349
|
picker.un('mounted', listenerId);
|
368
350
|
|
@@ -374,6 +356,7 @@ class Picker extends Text {
|
|
374
356
|
picker.render(true);
|
375
357
|
|
376
358
|
Neo.main.addon.ScrollSync.register({
|
359
|
+
appName : me.appName,
|
377
360
|
sourceId: me.id,
|
378
361
|
targetId: picker.id
|
379
362
|
})
|
@@ -389,7 +372,7 @@ class Picker extends Text {
|
|
389
372
|
if (me.pickerIsMounted) {
|
390
373
|
me.hidePicker();
|
391
374
|
} else {
|
392
|
-
me.
|
375
|
+
me.showPicker();
|
393
376
|
}
|
394
377
|
}
|
395
378
|
}
|
package/src/form/field/Time.mjs
CHANGED
@@ -296,12 +296,11 @@ class Time extends Picker {
|
|
296
296
|
let me = this;
|
297
297
|
|
298
298
|
Neo.main.DomAccess.focus({
|
299
|
-
|
299
|
+
appName: me.appName,
|
300
|
+
id : me.getInputElId()
|
300
301
|
}).then(() => {
|
301
|
-
|
302
|
-
|
303
|
-
}
|
304
|
-
});
|
302
|
+
callback?.apply(me)
|
303
|
+
})
|
305
304
|
}
|
306
305
|
|
307
306
|
/**
|
@@ -410,11 +409,12 @@ class Time extends Picker {
|
|
410
409
|
list.selectionModel.select(id);
|
411
410
|
|
412
411
|
if (!preventFocus) {
|
413
|
-
list.focus(id)
|
412
|
+
list.focus(id)
|
414
413
|
} else {
|
415
414
|
Neo.main.DomAccess.scrollIntoView({
|
416
|
-
|
417
|
-
|
415
|
+
appName: me.appName,
|
416
|
+
id : id
|
417
|
+
})
|
418
418
|
}
|
419
419
|
}
|
420
420
|
}
|
@@ -89,10 +89,14 @@ class CopyToClipboard extends Base {
|
|
89
89
|
* @param {Object} data
|
90
90
|
*/
|
91
91
|
onTriggerClick(data) {
|
92
|
+
let me = this;
|
93
|
+
|
92
94
|
Neo.main.DomAccess.selectNode({
|
93
|
-
|
95
|
+
appName: me.appName,
|
96
|
+
id : me.field.getInputEl().id
|
94
97
|
}).then(data => {
|
95
98
|
Neo.main.DomAccess.execCommand({
|
99
|
+
appName: me.appName,
|
96
100
|
command: 'copy'
|
97
101
|
});
|
98
102
|
});
|
package/src/grid/View.mjs
CHANGED
@@ -153,9 +153,12 @@ class View extends Component {
|
|
153
153
|
me.promiseUpdate().then(() => {
|
154
154
|
if (selectedRows?.length > 0) {
|
155
155
|
// this logic only works for selection.table.RowModel
|
156
|
-
Neo.main.DomAccess.scrollToTableRow({
|
156
|
+
Neo.main.DomAccess.scrollToTableRow({
|
157
|
+
appName: me.appName,
|
158
|
+
id : selectedRows[0]
|
159
|
+
})
|
157
160
|
}
|
158
|
-
})
|
161
|
+
})
|
159
162
|
}
|
160
163
|
|
161
164
|
/**
|
@@ -8,11 +8,11 @@ import NeoArray from '../../util/Array.mjs';
|
|
8
8
|
class Button extends BaseButton {
|
9
9
|
/**
|
10
10
|
* Valid values for align
|
11
|
-
* @member {String[]}
|
11
|
+
* @member {String[]} cellAlignValues: ['left', 'center', 'right']
|
12
12
|
* @protected
|
13
13
|
* @static
|
14
14
|
*/
|
15
|
-
static
|
15
|
+
static cellAlignValues = ['left', 'center', 'right']
|
16
16
|
|
17
17
|
static config = {
|
18
18
|
/**
|
@@ -25,15 +25,15 @@ class Button extends BaseButton {
|
|
25
25
|
* @protected
|
26
26
|
*/
|
27
27
|
ntype: 'grid-header-button',
|
28
|
-
/**
|
29
|
-
* Alignment of the matching table cells. Valid values are left, center, right
|
30
|
-
* @member {String} align_='left'
|
31
|
-
*/
|
32
|
-
align_: 'left',
|
33
28
|
/**
|
34
29
|
* @member {String[]} baseCls=['neo-grid-header-button']
|
35
30
|
*/
|
36
31
|
baseCls: ['neo-grid-header-button'],
|
32
|
+
/**
|
33
|
+
* Alignment of the matching table cells. Valid values are left, center, right
|
34
|
+
* @member {String} cellAlign_='left'
|
35
|
+
*/
|
36
|
+
cellAlign_: 'left',
|
37
37
|
/**
|
38
38
|
* @member {String} iconCls='fa fa-arrow-circle-up'
|
39
39
|
*/
|
@@ -109,13 +109,13 @@ class Button extends BaseButton {
|
|
109
109
|
}
|
110
110
|
|
111
111
|
/**
|
112
|
-
* Triggered before the
|
112
|
+
* Triggered before the cellAlign config gets changed
|
113
113
|
* @param {String} value
|
114
114
|
* @param {String} oldValue
|
115
115
|
* @protected
|
116
116
|
*/
|
117
|
-
|
118
|
-
return this.beforeSetEnumValue(value, oldValue, '
|
117
|
+
beforeSetCellAlign(value, oldValue) {
|
118
|
+
return this.beforeSetEnumValue(value, oldValue, 'cellAlign', 'cellAlignValues');
|
119
119
|
}
|
120
120
|
|
121
121
|
/**
|
package/src/list/Base.mjs
CHANGED
@@ -492,16 +492,16 @@ class Base extends Component {
|
|
492
492
|
}
|
493
493
|
|
494
494
|
/**
|
495
|
-
*
|
495
|
+
* @param args
|
496
496
|
*/
|
497
|
-
destroy() {
|
497
|
+
destroy(...args) {
|
498
498
|
let me = this;
|
499
499
|
|
500
500
|
me.selectionModel?.destroy();
|
501
501
|
|
502
502
|
me.autoDestroyStore && me.store?.destroy();
|
503
503
|
|
504
|
-
super.destroy();
|
504
|
+
super.destroy(...args);
|
505
505
|
}
|
506
506
|
|
507
507
|
/**
|
@@ -511,10 +511,13 @@ class Base extends Component {
|
|
511
511
|
focus(id) {
|
512
512
|
super.focus(id);
|
513
513
|
|
514
|
-
|
514
|
+
let me = this;
|
515
|
+
|
516
|
+
id && me.scrollIntoViewOnFocus && Neo.main.DomAccess.scrollIntoView({
|
517
|
+
appName : me.appName,
|
515
518
|
behavior: 'auto',
|
516
|
-
id : id ||
|
517
|
-
})
|
519
|
+
id : id || me.id
|
520
|
+
})
|
518
521
|
}
|
519
522
|
|
520
523
|
/**
|
@@ -542,14 +545,6 @@ class Base extends Component {
|
|
542
545
|
return headerlessIndex + delta;
|
543
546
|
}
|
544
547
|
|
545
|
-
/**
|
546
|
-
* @param {Number|String} recordId
|
547
|
-
* @returns {String}
|
548
|
-
*/
|
549
|
-
getItemId(recordId) {
|
550
|
-
return `${this.id}__${recordId}`;
|
551
|
-
}
|
552
|
-
|
553
548
|
/**
|
554
549
|
* Returns the index of a list item excluding item headers
|
555
550
|
* @param {Number} index
|
@@ -569,6 +564,14 @@ class Base extends Component {
|
|
569
564
|
return headerlessIndex;
|
570
565
|
}
|
571
566
|
|
567
|
+
/**
|
568
|
+
* @param {Number|String} recordId
|
569
|
+
* @returns {String}
|
570
|
+
*/
|
571
|
+
getItemId(recordId) {
|
572
|
+
return `${this.id}__${recordId}`;
|
573
|
+
}
|
574
|
+
|
572
575
|
/**
|
573
576
|
* @param {String} vnodeId
|
574
577
|
* @returns {String|Number} itemId
|
@@ -418,13 +418,13 @@ class Animate extends Base {
|
|
418
418
|
easing = me.transitionEasing,
|
419
419
|
id = me.owner.id;
|
420
420
|
|
421
|
-
deleteRule && CssUtil.deleteRules(`#${id} .neo-list-item`);
|
421
|
+
deleteRule && CssUtil.deleteRules(me.appName, `#${id} .neo-list-item`);
|
422
422
|
|
423
|
-
CssUtil.insertRules([
|
423
|
+
CssUtil.insertRules(me.appName, [
|
424
424
|
`#${id} .neo-list-item {`,
|
425
425
|
`transition: opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`,
|
426
426
|
'}'
|
427
|
-
].join(''))
|
427
|
+
].join(''))
|
428
428
|
}
|
429
429
|
}
|
430
430
|
|