neo.mjs 4.7.5 → 4.7.6
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/form/field/text/MainContainer.mjs +6 -0
- package/package.json +1 -1
- package/resources/scss/src/form/field/Text.scss +9 -0
- package/resources/scss/theme-dark/form/field/Text.scss +7 -1
- package/resources/scss/theme-light/form/field/Text.scss +7 -1
- package/src/form/field/Range.mjs +2 -2
- package/src/form/field/Text.mjs +67 -9
@@ -150,6 +150,12 @@ class MainContainer extends ConfigurationViewport {
|
|
150
150
|
labelText: 'spellCheck',
|
151
151
|
listeners: {change: me.onConfigChange.bind(me, 'spellCheck')},
|
152
152
|
style : {marginTop: '10px'}
|
153
|
+
}, {
|
154
|
+
module : TextField,
|
155
|
+
labelText: 'subLabelText',
|
156
|
+
listeners: {change: me.onConfigChange.bind(me, 'subLabelText')},
|
157
|
+
style : {marginTop: '10px'},
|
158
|
+
value : me.exampleComponent.subLabelText
|
153
159
|
}, {
|
154
160
|
module : NumberField,
|
155
161
|
labelText: 'width',
|
package/package.json
CHANGED
@@ -356,4 +356,13 @@
|
|
356
356
|
flex : 0 0 auto;
|
357
357
|
user-select: none;
|
358
358
|
}
|
359
|
+
|
360
|
+
.neo-textfield-sublabel {
|
361
|
+
color : v(textfield-sublabel-color);
|
362
|
+
display : inline-block;
|
363
|
+
flex : 0 0 auto;
|
364
|
+
font-size : v(textfield-sublabel-font-size);
|
365
|
+
margin : v(textfield-sublabel-margin);
|
366
|
+
user-select: none;
|
367
|
+
}
|
359
368
|
}
|
@@ -25,7 +25,10 @@ $neoMap: map-merge($neoMap, (
|
|
25
25
|
'textfield-opacity-disabled' : #{neo(neo-disabled-opacity)},
|
26
26
|
'textfield-opacity-readonly' : 1,
|
27
27
|
'textfield-outline-active' : none,
|
28
|
-
'textfield-outline-hovered' : none
|
28
|
+
'textfield-outline-hovered' : none,
|
29
|
+
'textfield-sublabel-color' : #999,
|
30
|
+
'textfield-sublabel-font-size' : 12px,
|
31
|
+
'textfield-sublabel-margin' : 0 0 5px
|
29
32
|
));
|
30
33
|
|
31
34
|
@if $useCssVars == true {
|
@@ -57,5 +60,8 @@ $neoMap: map-merge($neoMap, (
|
|
57
60
|
--textfield-opacity-readonly : #{neo(textfield-opacity-readonly)};
|
58
61
|
--textfield-outline-active : #{neo(textfield-outline-active)};
|
59
62
|
--textfield-outline-hovered : #{neo(textfield-outline-hovered)};
|
63
|
+
--textfield-sublabel-color : #{neo(textfield-sublabel-color)};
|
64
|
+
--textfield-sublabel-font-size : #{neo(textfield-sublabel-font-size)};
|
65
|
+
--textfield-sublabel-margin : #{neo(textfield-sublabel-margin)};
|
60
66
|
}
|
61
67
|
}
|
@@ -25,7 +25,10 @@ $neoMap: map-merge($neoMap, (
|
|
25
25
|
'textfield-opacity-disabled' : #{neo(neo-disabled-opacity)},
|
26
26
|
'textfield-opacity-readonly' : 1,
|
27
27
|
'textfield-outline-active' : none,
|
28
|
-
'textfield-outline-hovered' : none
|
28
|
+
'textfield-outline-hovered' : none,
|
29
|
+
'textfield-sublabel-color' : #666,
|
30
|
+
'textfield-sublabel-font-size' : 12px,
|
31
|
+
'textfield-sublabel-margin' : 0 0 5px
|
29
32
|
));
|
30
33
|
|
31
34
|
@if $useCssVars == true {
|
@@ -57,5 +60,8 @@ $neoMap: map-merge($neoMap, (
|
|
57
60
|
--textfield-opacity-readonly : #{neo(textfield-opacity-readonly)};
|
58
61
|
--textfield-outline-active : #{neo(textfield-outline-active)};
|
59
62
|
--textfield-outline-hovered : #{neo(textfield-outline-hovered)};
|
63
|
+
--textfield-sublabel-color : #{neo(textfield-sublabel-color)};
|
64
|
+
--textfield-sublabel-font-size : #{neo(textfield-sublabel-font-size)};
|
65
|
+
--textfield-sublabel-margin : #{neo(textfield-sublabel-margin)};
|
60
66
|
}
|
61
67
|
}
|
package/src/form/field/Range.mjs
CHANGED
@@ -52,13 +52,13 @@ class Range extends Number {
|
|
52
52
|
super.construct(config);
|
53
53
|
|
54
54
|
let me = this,
|
55
|
-
inputEl = me.vdom.cn[
|
55
|
+
inputEl = me.vdom.cn[2];
|
56
56
|
|
57
57
|
if (me.useInputEvent) {
|
58
58
|
me.addDomListeners({
|
59
59
|
input: {
|
60
60
|
fn : me.onInputValueChange,
|
61
|
-
id : me.vdom.cn[
|
61
|
+
id : me.vdom.cn[2].id,
|
62
62
|
scope : me
|
63
63
|
}
|
64
64
|
});
|
package/src/form/field/Text.mjs
CHANGED
@@ -142,6 +142,18 @@ class Text extends Base {
|
|
142
142
|
* @member {Boolean|null} spellCheck_=false
|
143
143
|
*/
|
144
144
|
spellCheck_: false,
|
145
|
+
/**
|
146
|
+
* @member {String[]} subLabelBaseCls=['neo-textfield-sublabel']
|
147
|
+
*/
|
148
|
+
subLabelBaseCls: ['neo-textfield-sublabel'],
|
149
|
+
/**
|
150
|
+
* @member {String[]} subLabelCls_=[]
|
151
|
+
*/
|
152
|
+
subLabelCls_: [],
|
153
|
+
/**
|
154
|
+
* @member {String} subLabelText_=null
|
155
|
+
*/
|
156
|
+
subLabelText_: null,
|
145
157
|
/**
|
146
158
|
* @member {Object|Object[]|null} triggers_=null
|
147
159
|
*/
|
@@ -152,6 +164,7 @@ class Text extends Base {
|
|
152
164
|
_vdom:
|
153
165
|
{cn: [
|
154
166
|
{tag: 'label', cls: [], style: {}},
|
167
|
+
{tag: 'label', cls: []},
|
155
168
|
{tag: 'input', cls: ['neo-textfield-input'], flag: 'neo-real-input', style: {}},
|
156
169
|
{cls: ['neo-textfield-error'], removeDom: true}
|
157
170
|
]}
|
@@ -327,17 +340,18 @@ class Text extends Base {
|
|
327
340
|
* @protected
|
328
341
|
*/
|
329
342
|
afterSetLabelPosition(value, oldValue) {
|
330
|
-
let me
|
331
|
-
cls
|
332
|
-
|
343
|
+
let me = this,
|
344
|
+
cls = me.cls,
|
345
|
+
vdom = me.vdom,
|
346
|
+
centerBorderElCls, isEmpty;
|
347
|
+
|
348
|
+
vdom.cn[1].removeDom = value !== 'top' ? true : !Boolean(me.subLabelText);
|
333
349
|
|
334
350
|
NeoArray.remove(cls, 'label-' + oldValue);
|
335
351
|
NeoArray.add(cls, 'label-' + value);
|
336
352
|
me.cls = cls; // todo: silent update if needed
|
337
353
|
|
338
354
|
if (oldValue === 'inline') {
|
339
|
-
vdom = me.vdom;
|
340
|
-
|
341
355
|
vdom.cn[0] = me.getLabelEl(); // remove the wrapper
|
342
356
|
|
343
357
|
vdom.cn[0].removeDom = me.hideLabel;
|
@@ -521,6 +535,39 @@ class Text extends Base {
|
|
521
535
|
this.changeInputElKey('spellcheck', Neo.isBoolean(value) ? value : null);
|
522
536
|
}
|
523
537
|
|
538
|
+
/**
|
539
|
+
* Triggered after the subLabelCls config got changed
|
540
|
+
* @param {String[]} value
|
541
|
+
* @param {String[]} oldValue
|
542
|
+
* @protected
|
543
|
+
*/
|
544
|
+
afterSetSubLabelCls(value, oldValue) {
|
545
|
+
let me = this,
|
546
|
+
cls = me.vdom.cn[1].cls;
|
547
|
+
|
548
|
+
NeoArray.remove(cls, oldValue);
|
549
|
+
NeoArray.add(cls, value);
|
550
|
+
|
551
|
+
me.update();
|
552
|
+
}
|
553
|
+
|
554
|
+
/**
|
555
|
+
* Triggered after the subLabelText config got changed
|
556
|
+
* @param {String|null} value
|
557
|
+
* @param {String|null} oldValue
|
558
|
+
* @protected
|
559
|
+
*/
|
560
|
+
afterSetSubLabelText(value, oldValue) {
|
561
|
+
let me = this,
|
562
|
+
showLabel = me.labelPosition === 'top',
|
563
|
+
subLabel = me.vdom.cn[1];
|
564
|
+
|
565
|
+
subLabel.html = value;
|
566
|
+
subLabel.removeDom = !showLabel;
|
567
|
+
|
568
|
+
me.update();
|
569
|
+
}
|
570
|
+
|
524
571
|
/**
|
525
572
|
* Triggered after the triggers config got changed
|
526
573
|
* @param {Object[]} value
|
@@ -530,7 +577,7 @@ class Text extends Base {
|
|
530
577
|
afterSetTriggers(value, oldValue) {
|
531
578
|
let me = this,
|
532
579
|
vdom = me.vdom,
|
533
|
-
inputEl = vdom.cn[
|
580
|
+
inputEl = vdom.cn[2], // inputEl or inputWrapperEl
|
534
581
|
preTriggers = [],
|
535
582
|
postTriggers = [],
|
536
583
|
width;
|
@@ -558,7 +605,7 @@ class Text extends Base {
|
|
558
605
|
|
559
606
|
if (inputEl.tag === 'input') {
|
560
607
|
// wrap the input tag
|
561
|
-
vdom.cn[
|
608
|
+
vdom.cn[2] = {
|
562
609
|
cls : ['neo-input-wrapper'],
|
563
610
|
cn : [...preTriggers, inputEl, ...postTriggers],
|
564
611
|
id : me.getInputWrapperId(),
|
@@ -573,8 +620,8 @@ class Text extends Base {
|
|
573
620
|
if (inputEl.tag !== 'input') {
|
574
621
|
// replacing the input wrapper div with the input tag
|
575
622
|
width = inputEl.width;
|
576
|
-
vdom.cn[
|
577
|
-
vdom.cn[
|
623
|
+
vdom.cn[2] = me.getInputEl();
|
624
|
+
vdom.cn[2].width = width;
|
578
625
|
}
|
579
626
|
}
|
580
627
|
|
@@ -673,6 +720,17 @@ class Text extends Base {
|
|
673
720
|
return this.beforeSetEnumValue(value, oldValue, 'labelPosition');
|
674
721
|
}
|
675
722
|
|
723
|
+
/**
|
724
|
+
* Triggered before the subLabelCls config gets changed
|
725
|
+
* @param {String[]} value
|
726
|
+
* @param {String[]} oldValue
|
727
|
+
* @returns {String[]}
|
728
|
+
* @protected
|
729
|
+
*/
|
730
|
+
beforeSetSubLabelCls(value, oldValue) {
|
731
|
+
return NeoArray.union(value || [], this.subLabelBaseCls);
|
732
|
+
}
|
733
|
+
|
676
734
|
/**
|
677
735
|
* Triggered before the triggers config gets changed
|
678
736
|
* @param {Object|Object[]} value
|