typed-controls 0.13.0 → 0.13.1
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/README.md +1 -0
- package/lib/typed-controls.js +7 -5
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ typed controls, widgets and others
|
|
|
5
5
|
[](https://npmjs.org/package/typed-controls)
|
|
6
6
|
[](https://github.com/codenautas/typed-controls/actions/workflows/build-and-test.yml)
|
|
7
7
|
[](https://coveralls.io/r/codenautas/typed-controls)
|
|
8
|
+
[](https://sonarcloud.io/summary/overall?id=codenautas_typed-controls)
|
|
8
9
|
[](https://github.com/codenautas/typed-controls/actions/workflows/qa-control.yml)
|
|
9
10
|
|
|
10
11
|
|
package/lib/typed-controls.js
CHANGED
|
@@ -218,7 +218,7 @@ BestControls.div = {
|
|
|
218
218
|
var element = this;
|
|
219
219
|
if(event.which>=32){
|
|
220
220
|
var typer = this.controledType;
|
|
221
|
-
var theChar = String.fromCharCode(event.which);
|
|
221
|
+
var theChar = String.fromCharCode(event.which); // eslint-disable-line unicorn/prefer-code-point -- String.fromCodePoint throws with some values that String.fromCharCode accepts
|
|
222
222
|
if(typer.rejectedChar(theChar)){
|
|
223
223
|
if(element.expander && element.expander.autoExpand){
|
|
224
224
|
if(!element.displayingExpander){
|
|
@@ -239,6 +239,8 @@ BestControls.div = {
|
|
|
239
239
|
]
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
+
var lastCharAndTrailingNewLines = /([^\n]|^)\n+$/;
|
|
243
|
+
|
|
242
244
|
BestControls.text = {
|
|
243
245
|
translates:{true:{
|
|
244
246
|
'\n': '\u21b5'
|
|
@@ -265,7 +267,7 @@ BestControls.text = {
|
|
|
265
267
|
return '';
|
|
266
268
|
}else{
|
|
267
269
|
if(typedValue!=null){
|
|
268
|
-
return typedValue.replace(
|
|
270
|
+
return typedValue.replace(lastCharAndTrailingNewLines,'$1');
|
|
269
271
|
}
|
|
270
272
|
return typedValue;
|
|
271
273
|
}
|
|
@@ -342,7 +344,7 @@ BestControls.text_no_empty = {
|
|
|
342
344
|
BestControls.number = {
|
|
343
345
|
adapters:{
|
|
344
346
|
setValidatedTypedValue: function setValidatedTypedValuePrettyNumber(typedValue){
|
|
345
|
-
if(isNaN(typedValue) || typedValue==null){
|
|
347
|
+
if(isNaN(typedValue) || typedValue==null){ // eslint-disable-line unicorn/prefer-number-properties -- isNaN converts typedValue to number (Number.isNaN does not)
|
|
346
348
|
this.value='';
|
|
347
349
|
}else{
|
|
348
350
|
this.valueAsNumber = typedValue;
|
|
@@ -352,7 +354,7 @@ BestControls.number = {
|
|
|
352
354
|
}
|
|
353
355
|
},
|
|
354
356
|
getTypedValue: function getTypedValue(){
|
|
355
|
-
return isNaN(this.valueAsNumber)||this.value==''?null:this.valueAsNumber; // eslint-disable-line eqeqeq
|
|
357
|
+
return isNaN(this.valueAsNumber)||this.value==''?null:this.valueAsNumber; // eslint-disable-line eqeqeq, unicorn/prefer-number-properties -- isNaN converts valueAsNumber to number (Number.isNaN does not)
|
|
356
358
|
},
|
|
357
359
|
// setTypedValue: function setTypedValue(value){
|
|
358
360
|
// this.valueAsNumber=value;
|
|
@@ -490,7 +492,7 @@ BestControls.boolean = {
|
|
|
490
492
|
},
|
|
491
493
|
'click': function onClickListenerForBoolean(event){
|
|
492
494
|
if(this.type==='checkbox'){
|
|
493
|
-
if(document.activeElement
|
|
495
|
+
if(document.activeElement!=this){ // eslint-disable-line eqeqeq -- with !== SonarQube reports a false positive (different types); here != compares the same: an element (or null) with the element of the control
|
|
494
496
|
// Safari 5.1.7 and other old browsers doesn't set activeElement
|
|
495
497
|
this.focus();
|
|
496
498
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typed-controls",
|
|
3
3
|
"description": "typed controls, widgets and others",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/typed-controls",
|
|
@@ -34,23 +34,25 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"best-globals": "^2.2.3",
|
|
37
|
-
"js-to-html": "^1.5.
|
|
37
|
+
"js-to-html": "^1.5.4",
|
|
38
38
|
"like-ar": "^0.5.6",
|
|
39
39
|
"pikaday": "^1.8.2",
|
|
40
|
-
"type-store": "^0.6.
|
|
40
|
+
"type-store": "^0.6.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"big.js": "^7.0.1",
|
|
44
44
|
"discrepances": "^0.3.3",
|
|
45
45
|
"expect.js": "^0.3.1",
|
|
46
46
|
"express-useragent": "^2.2.3",
|
|
47
|
-
"json4all": "^1.4.
|
|
47
|
+
"json4all": "^1.4.8",
|
|
48
48
|
"mocha": "^12.0.3",
|
|
49
49
|
"moment": "^2.31.0",
|
|
50
50
|
"nyc": "^18.0.0",
|
|
51
51
|
"require-bro": "^0.4.2",
|
|
52
|
-
"qa-control": "^0.
|
|
53
|
-
"server4test": "^2.1.
|
|
52
|
+
"qa-control": "^0.15.0",
|
|
53
|
+
"server4test": "^2.1.3",
|
|
54
|
+
"eslint-plugin-sonarjs": "^4.2.2",
|
|
55
|
+
"eslint-plugin-unicorn": "^79.0.0"
|
|
54
56
|
},
|
|
55
57
|
"optionalDependencies": {
|
|
56
58
|
"castellano": "~0.1.8",
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
"gha": "all",
|
|
86
88
|
"silenced": [
|
|
87
89
|
"eslint_warnings_in_file_1"
|
|
88
|
-
]
|
|
90
|
+
],
|
|
91
|
+
"sonar": true
|
|
89
92
|
}
|
|
90
93
|
}
|