neo.mjs 4.4.15 → 4.4.17
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/examples/component/wrapper/googleMaps/MainContainer.mjs +8 -6
- package/examples/component/wrapper/googleMaps/MainContainerController.mjs +3 -3
- package/examples/component/wrapper/googleMaps/MapComponent.mjs +4 -12
- package/examples/component/wrapper/googleMaps/{MarkerPopup.mjs → MarkerDialog.mjs} +7 -7
- package/package.json +1 -1
- package/resources/scss/src/form/field/Select.scss +1 -0
- package/resources/scss/theme-dark/form/field/Select.scss +2 -2
- package/src/component/Base.mjs +26 -0
- package/src/container/Base.mjs +1 -1
- package/src/data/RecordFactory.mjs +8 -0
- package/src/data/Store.mjs +8 -2
- package/src/dialog/Toast.mjs +28 -0
- package/src/form/field/Picker.mjs +5 -5
- package/src/form/field/trigger/Base.mjs +1 -1
- package/src/manager/ToastDialog.mjs +29 -0
- package/src/toolbar/Base.mjs +1 -1
- package/examples/component/wrapper/googleMaps/MapComponentController.mjs +0 -26
@@ -1,7 +1,7 @@
|
|
1
|
-
import Button from '../../../../
|
2
|
-
import NumberField from '../../../../
|
3
|
-
import Toolbar from '../../../../
|
4
|
-
import Viewport from '../../../../
|
1
|
+
import Button from '../../../../src/button/Base.mjs';
|
2
|
+
import NumberField from '../../../../src/form/field/Number.mjs';
|
3
|
+
import Toolbar from '../../../../src/toolbar/Base.mjs';
|
4
|
+
import Viewport from '../../../../src/container/Viewport.mjs';
|
5
5
|
import MapComponent from "./MapComponent.mjs";
|
6
6
|
import MainContainerController from './MainContainerController.mjs';
|
7
7
|
|
@@ -19,6 +19,7 @@ class MainContainer extends Viewport {
|
|
19
19
|
items: [{
|
20
20
|
module : MapComponent,
|
21
21
|
flex : 1,
|
22
|
+
listeners: {zoomChange: 'onMapZoomChange'},
|
22
23
|
reference: 'google-maps-component'
|
23
24
|
}, {
|
24
25
|
module: Toolbar,
|
@@ -32,10 +33,11 @@ class MainContainer extends Viewport {
|
|
32
33
|
text : 'Fly to San Fran'
|
33
34
|
}, {
|
34
35
|
module : Button,
|
35
|
-
handler: '
|
36
|
+
handler: 'onFlyToIcelandButtonClick',
|
36
37
|
height : 27,
|
37
38
|
iconCls: 'fa-solid fa-plane',
|
38
|
-
|
39
|
+
style : {marginLeft: '10px'},
|
40
|
+
text : 'Fly to Iceland'
|
39
41
|
}, {
|
40
42
|
module : NumberField,
|
41
43
|
clearToOriginalValue: true,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import ComponentController from '../../../../
|
1
|
+
import ComponentController from '../../../../src/controller/Component.mjs';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* @class Neo.examples.component.wrapper.googleMaps.MainContainerController
|
@@ -23,14 +23,14 @@ class MainContainerController extends ComponentController {
|
|
23
23
|
/**
|
24
24
|
* @param {Object} data
|
25
25
|
*/
|
26
|
-
|
26
|
+
onFlyToIcelandButtonClick(data) {
|
27
27
|
this.getReference('google-maps-component').panTo({ lat: 64.963051,lng: -19.020835})
|
28
28
|
}
|
29
29
|
|
30
30
|
/**
|
31
31
|
* @param {Object} data
|
32
32
|
*/
|
33
|
-
|
33
|
+
onMapZoomChange(data) {
|
34
34
|
this.getReference('zoom-field').value = data.value;
|
35
35
|
}
|
36
36
|
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import GoogleMapsComponent
|
2
|
-
import
|
3
|
-
import MarkerPopup from "./MarkerPopup.mjs";
|
1
|
+
import GoogleMapsComponent from '../../../../src/component/wrapper/GoogleMaps.mjs';
|
2
|
+
import MarkerDialog from './MarkerDialog.mjs';
|
4
3
|
|
5
4
|
/**
|
6
5
|
* @class Neo.examples.component.wrapper.googleMaps.MapComponent
|
@@ -11,8 +10,6 @@ class MapComponent extends GoogleMapsComponent {
|
|
11
10
|
className: 'Neo.examples.component.wrapper.googleMaps.MapComponent',
|
12
11
|
ntype: 'worldmap',
|
13
12
|
|
14
|
-
controller: MapComponentController,
|
15
|
-
|
16
13
|
// Center the map initially to Island
|
17
14
|
center: {
|
18
15
|
lat: 64.963051,
|
@@ -51,18 +48,13 @@ class MapComponent extends GoogleMapsComponent {
|
|
51
48
|
|
52
49
|
me.disabled = true;
|
53
50
|
|
54
|
-
me.dialog = Neo.create(
|
51
|
+
me.dialog = Neo.create(MarkerDialog, {
|
55
52
|
appName : me.appName,
|
56
53
|
record : record,
|
57
54
|
domEvent : data.domEvent,
|
58
55
|
boundaryContainerId : me.id
|
59
56
|
});
|
60
|
-
}
|
61
|
-
|
62
|
-
// todo Not working
|
63
|
-
// listeners: {
|
64
|
-
// zoomChange: 'onMapZoomChance'
|
65
|
-
// }
|
57
|
+
}
|
66
58
|
}}
|
67
59
|
|
68
60
|
construct(config) {
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import DialogBase from '../../../../
|
1
|
+
import DialogBase from '../../../../src/dialog/Base.mjs';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @class Neo.examples.component.wrapper.googleMaps.
|
5
|
-
* @extends Neo.
|
4
|
+
* @class Neo.examples.component.wrapper.googleMaps.MarkerDialog
|
5
|
+
* @extends Neo.dialog.Base
|
6
6
|
*/
|
7
|
-
class
|
7
|
+
class MarkerDialog extends DialogBase {
|
8
8
|
static getConfig() {return {
|
9
|
-
className: 'Neo.examples.component.wrapper.googleMaps.
|
9
|
+
className: 'Neo.examples.component.wrapper.googleMaps.MarkerDialog',
|
10
10
|
|
11
11
|
// turn off dragging and resizing
|
12
12
|
draggable : false,
|
@@ -108,6 +108,6 @@ class MarkerPopup extends DialogBase {
|
|
108
108
|
}
|
109
109
|
}
|
110
110
|
|
111
|
-
Neo.applyClassConfig(
|
111
|
+
Neo.applyClassConfig(MarkerDialog);
|
112
112
|
|
113
|
-
export default
|
113
|
+
export default MarkerDialog;
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@ $neoMap: map-merge($neoMap, (
|
|
4
4
|
'selectfield-list-search-background-color' : inherit,
|
5
5
|
'selectfield-list-search-color' : #fff,
|
6
6
|
'selectfield-list-search-color-selected' : #000,
|
7
|
-
'selectfield-picker-container-border' :
|
7
|
+
'selectfield-picker-container-border' : 1px solid #bbb,
|
8
8
|
'selectfield-picker-container-border-radius': 0
|
9
9
|
));
|
10
10
|
|
@@ -18,4 +18,4 @@ $neoMap: map-merge($neoMap, (
|
|
18
18
|
--selectfield-picker-container-border : #{neo(selectfield-picker-container-border)};
|
19
19
|
--selectfield-picker-container-border-radius: #{neo(selectfield-picker-container-border-radius)};
|
20
20
|
}
|
21
|
-
}
|
21
|
+
}
|
package/src/component/Base.mjs
CHANGED
@@ -265,6 +265,12 @@ class Base extends CoreBase {
|
|
265
265
|
* @member {Array|Object} tooltips_=null
|
266
266
|
*/
|
267
267
|
tooltips_: null,
|
268
|
+
/**
|
269
|
+
* Add 'primary' and other attributes to make it
|
270
|
+
* an outstanding design
|
271
|
+
* @member {String|null} ui_=null
|
272
|
+
*/
|
273
|
+
ui_: null,
|
268
274
|
/**
|
269
275
|
* The component vnode tree. Available after the component got rendered.
|
270
276
|
* @member {Object} vnode_=null
|
@@ -648,6 +654,26 @@ class Base extends CoreBase {
|
|
648
654
|
}
|
649
655
|
}
|
650
656
|
|
657
|
+
/**
|
658
|
+
* For styling purposes only.
|
659
|
+
* To define button styles or component styles,
|
660
|
+
* this will add a css class: neo-ntype-value
|
661
|
+
* @param {String|null} value
|
662
|
+
* @param {String|null} oldValue
|
663
|
+
*/
|
664
|
+
afterSetUi(value, oldValue) {
|
665
|
+
let me = this,
|
666
|
+
cls = me.cls;
|
667
|
+
|
668
|
+
NeoArray.remove(cls, `neo-${me.ntype}-${oldValue}`);
|
669
|
+
|
670
|
+
if (value && value !== '') {
|
671
|
+
NeoArray.add(cls, `neo-${me.ntype}-${value}`);
|
672
|
+
}
|
673
|
+
|
674
|
+
me.cls = cls;
|
675
|
+
}
|
676
|
+
|
651
677
|
/**
|
652
678
|
* Triggered after the vdom config got changed
|
653
679
|
* @param {Object} value
|
package/src/container/Base.mjs
CHANGED
@@ -188,7 +188,7 @@ class Base extends Component {
|
|
188
188
|
createItem(item, index) {
|
189
189
|
let me = this,
|
190
190
|
config = {appName: me.appName, parentId: me.id, parentIndex: index},
|
191
|
-
defaults = me.itemDefaults,
|
191
|
+
defaults = {...me.itemDefaults},
|
192
192
|
lazyLoadItem, module;
|
193
193
|
|
194
194
|
if (defaults) {
|
@@ -235,6 +235,14 @@ class RecordFactory extends Base {
|
|
235
235
|
* @returns {*}
|
236
236
|
*/
|
237
237
|
parseRecordValue(record, field, value, recordConfig=null) {
|
238
|
+
if (field.calculate) {
|
239
|
+
return field.calculate(record, field, recordConfig);
|
240
|
+
}
|
241
|
+
|
242
|
+
if (field.convert) {
|
243
|
+
value = field.convert(value);
|
244
|
+
}
|
245
|
+
|
238
246
|
let fieldName = field.name,
|
239
247
|
mapping = field.mapping,
|
240
248
|
maxLength = field.maxLength,
|
package/src/data/Store.mjs
CHANGED
@@ -95,6 +95,12 @@ class Store extends Base {
|
|
95
95
|
* @member {Boolean} remoteSort=false
|
96
96
|
*/
|
97
97
|
remoteSort: false,
|
98
|
+
/**
|
99
|
+
* Add a path to the root of your data.
|
100
|
+
* If the responseRoot is 'data' this is optional.
|
101
|
+
* @member {String} responseRoot='data'
|
102
|
+
*/
|
103
|
+
responseRoot: 'data',
|
98
104
|
/**
|
99
105
|
* @member {Number} totalCount=0
|
100
106
|
*/
|
@@ -340,9 +346,9 @@ class Store extends Base {
|
|
340
346
|
}).catch(err => {
|
341
347
|
console.log('Error for Neo.Xhr.request', err, me.id);
|
342
348
|
}).then(data => {
|
343
|
-
me.data =
|
349
|
+
me.data = Neo.ns(me.responseRoot, false, data.json) || data.json;
|
344
350
|
// we do not need to fire a load event => onCollectionMutate()
|
345
|
-
})
|
351
|
+
})
|
346
352
|
}
|
347
353
|
}
|
348
354
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import Base from './Base.mjs';
|
2
|
+
import ToastManager from '../manager/ToastDialog.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.dialog.Toast
|
6
|
+
* @extends Neo.dialog.Base
|
7
|
+
*/
|
8
|
+
class Toast extends Base {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.dialog.Toast'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.dialog.Toast'
|
15
|
+
}}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @param {Object} config
|
19
|
+
*/
|
20
|
+
construct(config) {
|
21
|
+
super.construct(config);
|
22
|
+
ToastManager.register(this);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
Neo.applyClassConfig(Toast);
|
27
|
+
|
28
|
+
export default Toast;
|
@@ -93,15 +93,14 @@ class Picker extends Text {
|
|
93
93
|
inputRect = rects[1],
|
94
94
|
triggerRect = rects[0],
|
95
95
|
vdom = me.picker.vdom,
|
96
|
-
width = me.matchPickerWidth ?
|
96
|
+
width = me.matchPickerWidth ? inputRect.width : me.pickerWidth;
|
97
97
|
|
98
98
|
me.pickerWidth = width;
|
99
99
|
|
100
100
|
vdom.style = vdom.style || {};
|
101
101
|
|
102
102
|
Object.assign(vdom.style, {
|
103
|
-
|
104
|
-
top : `${triggerRect.top + triggerRect.height + 1}px`,
|
103
|
+
top : `${inputRect.bottom + 1}px`,
|
105
104
|
width: `${width}px`
|
106
105
|
});
|
107
106
|
|
@@ -141,9 +140,10 @@ class Picker extends Text {
|
|
141
140
|
* @param {Function} [callbackScope]
|
142
141
|
*/
|
143
142
|
getClientRectsThenShow(callback, callbackScope) {
|
144
|
-
let me
|
143
|
+
let me = this,
|
144
|
+
triggerId = me.getTriggerId('picker');
|
145
145
|
|
146
|
-
me.getDomRect([
|
146
|
+
me.getDomRect([triggerId, me.getInputWrapperId(), 'body']).then(data => {
|
147
147
|
me.clientRects = data;
|
148
148
|
me.showPicker(callback, callbackScope);
|
149
149
|
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import Base from '../manager/Base.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.manager.ToastDialog
|
5
|
+
* @extends Neo.manager.Base
|
6
|
+
* @singleton
|
7
|
+
*/
|
8
|
+
class ToastDialog extends Base {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.manager.ToastDialog'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.manager.ToastDialog',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} singleton=true
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
singleton: true
|
20
|
+
}}
|
21
|
+
}
|
22
|
+
|
23
|
+
Neo.applyClassConfig(ToastDialog);
|
24
|
+
|
25
|
+
let instance = Neo.create(ToastDialog);
|
26
|
+
|
27
|
+
Neo.applyToGlobalNs(instance);
|
28
|
+
|
29
|
+
export default instance;
|
package/src/toolbar/Base.mjs
CHANGED
@@ -1,26 +0,0 @@
|
|
1
|
-
import ComponentController from '../../../../node_modules/neo.mjs/src/controller/Component.mjs';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @class Neo.examples.component.wrapper.googleMaps.MainContainerController
|
5
|
-
* @extends Neo.controller.Component
|
6
|
-
*/
|
7
|
-
class MapComponentController extends ComponentController {
|
8
|
-
static getConfig() {return {
|
9
|
-
/**
|
10
|
-
* @member {String} className='Neo.examples.component.wrapper.googleMaps.MapComponentController'
|
11
|
-
* @protected
|
12
|
-
*/
|
13
|
-
className: 'Neo.examples.component.wrapper.googleMaps.MapComponentController'
|
14
|
-
}}
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @param {Object} data
|
18
|
-
*/
|
19
|
-
onMapZoomChance(data) {
|
20
|
-
this.getReference('zoom-field').value = data.value;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
Neo.applyClassConfig(MapComponentController);
|
25
|
-
|
26
|
-
export default MapComponentController;
|