neo.mjs 4.4.16 → 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/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/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/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
|
@@ -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;
|