neo.mjs 5.5.4 → 5.5.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/apps/ServiceWorker.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/form/field/CheckBox.scss +8 -0
- package/resources/scss/src/form/field/Text.scss +8 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/form/field/CheckBox.mjs +27 -4
- package/src/form/field/Text.mjs +28 -5
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -325,6 +325,14 @@
|
|
325
325
|
margin-top : .3em;
|
326
326
|
white-space: break-spaces;
|
327
327
|
word-break : break-word;
|
328
|
+
|
329
|
+
&.neo-absolute {
|
330
|
+
position: absolute;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
|
334
|
+
.neo-textfield-error-wrapper {
|
335
|
+
position: relative;
|
328
336
|
}
|
329
337
|
|
330
338
|
.neo-textfield-input {
|
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '5.5.
|
239
|
+
* @default '5.5.6'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '5.5.
|
244
|
+
version: '5.5.6'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
@@ -38,6 +38,11 @@ class CheckBox extends Base {
|
|
38
38
|
* @member {String|null} error_=null
|
39
39
|
*/
|
40
40
|
error_: null,
|
41
|
+
/**
|
42
|
+
* Useful for fields inside a css grid where errors should live outside the layout
|
43
|
+
* @member {Boolean} errorPositionAbsolute_=false
|
44
|
+
*/
|
45
|
+
errorPositionAbsolute_: false,
|
41
46
|
/**
|
42
47
|
* @member {Function} errorTextGroupRequired='Required'
|
43
48
|
*/
|
@@ -126,7 +131,9 @@ class CheckBox extends Base {
|
|
126
131
|
{tag: 'i', cls: ['neo-checkbox-icon']},
|
127
132
|
{tag: 'span', cls: ['neo-checkbox-value-label']}
|
128
133
|
]},
|
129
|
-
{cls: ['neo-error'], removeDom: true
|
134
|
+
{cls: ['neo-error-wrapper'], removeDom: true, cn: [
|
135
|
+
{cls: ['neo-error']}
|
136
|
+
]}
|
130
137
|
]}
|
131
138
|
}
|
132
139
|
|
@@ -189,6 +196,21 @@ class CheckBox extends Base {
|
|
189
196
|
this.updateError(value)
|
190
197
|
}
|
191
198
|
|
199
|
+
/**
|
200
|
+
* Triggered after the errorPositionAbsolute config got changed
|
201
|
+
* @param {Boolean} value
|
202
|
+
* @param {Boolean} oldValue
|
203
|
+
* @protected
|
204
|
+
*/
|
205
|
+
afterSetErrorPositionAbsolute(value, oldValue) {
|
206
|
+
let me = this,
|
207
|
+
cls = me.vdom.cn[1].cn[0].cls;
|
208
|
+
|
209
|
+
NeoArray[value ? 'add' : 'remove'](cls, 'neo-absolute');
|
210
|
+
|
211
|
+
me.update()
|
212
|
+
}
|
213
|
+
|
192
214
|
/**
|
193
215
|
* Triggered after the required groupRequired got changed
|
194
216
|
* @param {Boolean} value
|
@@ -463,7 +485,7 @@ class CheckBox extends Base {
|
|
463
485
|
let me = this,
|
464
486
|
cls = me.cls,
|
465
487
|
showError = value && me.showErrorTexts,
|
466
|
-
errorNode;
|
488
|
+
errorNode, errorWrapper;
|
467
489
|
|
468
490
|
if (!(me.clean && !me.mounted)) {
|
469
491
|
me._error = value; // silent update
|
@@ -471,7 +493,8 @@ class CheckBox extends Base {
|
|
471
493
|
NeoArray[value ? 'add' : 'remove'](cls, 'neo-invalid');
|
472
494
|
me.cls = cls;
|
473
495
|
|
474
|
-
|
496
|
+
errorWrapper = me.vdom.cn[1];
|
497
|
+
errorNode = errorWrapper.cn[0];
|
475
498
|
|
476
499
|
if (showError) {
|
477
500
|
errorNode.html = value;
|
@@ -479,7 +502,7 @@ class CheckBox extends Base {
|
|
479
502
|
delete errorNode.html;
|
480
503
|
}
|
481
504
|
|
482
|
-
|
505
|
+
errorWrapper.removeDom = !showError;
|
483
506
|
|
484
507
|
!silent && me.update()
|
485
508
|
}
|
package/src/form/field/Text.mjs
CHANGED
@@ -59,7 +59,7 @@ class Text extends Base {
|
|
59
59
|
*/
|
60
60
|
centerBorderElWidth: null,
|
61
61
|
/**
|
62
|
-
* True shows a clear trigger in case the field has a non
|
62
|
+
* True shows a clear trigger in case the field has a non-empty value.
|
63
63
|
* @member {Boolean} clearable_=true
|
64
64
|
*/
|
65
65
|
clearable_: true,
|
@@ -73,6 +73,11 @@ class Text extends Base {
|
|
73
73
|
* @member {String|null} error_=null
|
74
74
|
*/
|
75
75
|
error_: null,
|
76
|
+
/**
|
77
|
+
* Useful for fields inside a css grid where errors should live outside the layout
|
78
|
+
* @member {Boolean} errorPositionAbsolute_=false
|
79
|
+
*/
|
80
|
+
errorPositionAbsolute_: false,
|
76
81
|
/**
|
77
82
|
* data passes inputPattern, maxLength, minLength & valueLength properties
|
78
83
|
* @member {Function} errorTextInputPattern=data=>`Input pattern violation: ${data.inputPattern}`
|
@@ -190,7 +195,9 @@ class Text extends Base {
|
|
190
195
|
{tag: 'label', cls: [], style: {}},
|
191
196
|
{tag: 'label', cls: []},
|
192
197
|
{tag: 'input', cls: ['neo-textfield-input'], flag: 'neo-real-input', style: {}},
|
193
|
-
{cls: ['neo-textfield-error'], removeDom: true
|
198
|
+
{cls: ['neo-textfield-error-wrapper'], removeDom: true, cn: [
|
199
|
+
{cls: ['neo-textfield-error']}
|
200
|
+
]}
|
194
201
|
]}
|
195
202
|
}
|
196
203
|
|
@@ -294,6 +301,21 @@ class Text extends Base {
|
|
294
301
|
this.updateError(value)
|
295
302
|
}
|
296
303
|
|
304
|
+
/**
|
305
|
+
* Triggered after the errorPositionAbsolute config got changed
|
306
|
+
* @param {Boolean} value
|
307
|
+
* @param {Boolean} oldValue
|
308
|
+
* @protected
|
309
|
+
*/
|
310
|
+
afterSetErrorPositionAbsolute(value, oldValue) {
|
311
|
+
let me = this,
|
312
|
+
cls = VDomUtil.findVdomChild(me.vdom, {cls: 'neo-textfield-error'}).vdom.cls;
|
313
|
+
|
314
|
+
NeoArray[value ? 'add' : 'remove'](cls, 'neo-absolute');
|
315
|
+
|
316
|
+
me.update()
|
317
|
+
}
|
318
|
+
|
297
319
|
/**
|
298
320
|
* Triggered after the hideLabel config got changed
|
299
321
|
* @param {Boolean} value
|
@@ -1256,13 +1278,14 @@ class Text extends Base {
|
|
1256
1278
|
updateError(value, silent=false) {
|
1257
1279
|
let me = this,
|
1258
1280
|
cls = me.cls,
|
1259
|
-
errorNode;
|
1281
|
+
errorNode, errorWrapper;
|
1260
1282
|
|
1261
1283
|
if (!(me.clean && !me.mounted)) {
|
1262
1284
|
NeoArray[value ? 'add' : 'remove'](cls, 'neo-invalid');
|
1263
1285
|
me.cls = cls;
|
1264
1286
|
|
1265
|
-
|
1287
|
+
errorWrapper = VDomUtil.findVdomChild(me.vdom, {cls: 'neo-textfield-error-wrapper'}).vdom;
|
1288
|
+
errorNode = errorWrapper.cn[0];
|
1266
1289
|
|
1267
1290
|
if (value) {
|
1268
1291
|
errorNode.html = value;
|
@@ -1270,7 +1293,7 @@ class Text extends Base {
|
|
1270
1293
|
delete errorNode.html;
|
1271
1294
|
}
|
1272
1295
|
|
1273
|
-
|
1296
|
+
errorWrapper.removeDom = !value;
|
1274
1297
|
|
1275
1298
|
!silent && me.update()
|
1276
1299
|
}
|