neo.mjs 4.0.54 → 4.0.57
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
CHANGED
|
@@ -36,6 +36,14 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
&.neo-invalid:not(.neo-disabled, .neo-has-content) {
|
|
40
|
+
.neo-label-wrapper {
|
|
41
|
+
.neo-center-border {
|
|
42
|
+
border-top-color: v(textfield-border-color-invalid);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
&.label-bottom {
|
|
40
48
|
align-items : start;
|
|
41
49
|
flex-direction: column-reverse;
|
package/src/form/Container.mjs
CHANGED
|
@@ -137,6 +137,22 @@ class Container extends BaseContainer {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Updates the invalid state for all fields, which have updateValidationIndicators() implemented.
|
|
143
|
+
* This can be useful for create entity forms which show up "clean", when pressing a submit button.
|
|
144
|
+
*/
|
|
145
|
+
updateValidationIndicators() {
|
|
146
|
+
let fields = this.getFields(),
|
|
147
|
+
form = this.component,
|
|
148
|
+
vdom = form.vdom;
|
|
149
|
+
|
|
150
|
+
fields.forEach(item => {
|
|
151
|
+
item.updateValidationIndicators?.(); // silent update
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
form.vdom = vdom;
|
|
155
|
+
}
|
|
140
156
|
}
|
|
141
157
|
|
|
142
158
|
Neo.applyClassConfig(Container);
|
package/src/form/field/Text.mjs
CHANGED
|
@@ -10,6 +10,12 @@ import VNodeUtil from '../../util/VNode.mjs';
|
|
|
10
10
|
* @extends Neo.form.field.Base
|
|
11
11
|
*/
|
|
12
12
|
class Text extends Base {
|
|
13
|
+
/**
|
|
14
|
+
* Set this value to false, in case a field should display errors up front
|
|
15
|
+
* @member {Boolean} validBeforeMount=true
|
|
16
|
+
*/
|
|
17
|
+
validBeforeMount = true
|
|
18
|
+
|
|
13
19
|
static getStaticConfig() {return {
|
|
14
20
|
/**
|
|
15
21
|
* Valid values for autoCapitalize
|
|
@@ -877,19 +883,17 @@ class Text extends Base {
|
|
|
877
883
|
onFocusLeave(data) {
|
|
878
884
|
let me = this,
|
|
879
885
|
centerBorderEl = me.getCenterBorderEl(), // labelPosition: 'inline'
|
|
880
|
-
|
|
881
|
-
vdom;
|
|
886
|
+
vdom = me.vdom;
|
|
882
887
|
|
|
883
|
-
|
|
888
|
+
me.updateValidationIndicators();
|
|
889
|
+
|
|
890
|
+
NeoArray.remove(me._cls, 'neo-focus');
|
|
884
891
|
|
|
885
892
|
if (centerBorderEl && me.isEmpty()) {
|
|
886
|
-
me._cls = cls; // silent update
|
|
887
|
-
vdom = me.vdom;
|
|
888
893
|
delete centerBorderEl.width;
|
|
889
|
-
me.vdom = vdom;
|
|
890
|
-
} else {
|
|
891
|
-
me.cls = cls;
|
|
892
894
|
}
|
|
895
|
+
|
|
896
|
+
me.vdom = vdom;
|
|
893
897
|
}
|
|
894
898
|
|
|
895
899
|
/**
|
|
@@ -1023,10 +1027,12 @@ class Text extends Base {
|
|
|
1023
1027
|
let me = this,
|
|
1024
1028
|
vdom = me.vdom;
|
|
1025
1029
|
|
|
1026
|
-
|
|
1030
|
+
if (!(me.validBeforeMount && !me.mounted)) {
|
|
1031
|
+
NeoArray[!me.isValid() ? 'add' : 'remove'](me._cls, 'neo-invalid');
|
|
1027
1032
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1033
|
+
if (!silent) {
|
|
1034
|
+
me.vdom = vdom;
|
|
1035
|
+
}
|
|
1030
1036
|
}
|
|
1031
1037
|
}
|
|
1032
1038
|
}
|