typed-controls 0.12.9 → 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 +55 -52
- package/package.json +20 -13
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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
root[root.globalModuleName] = factory();
|
|
18
18
|
}
|
|
19
19
|
root.globalModuleName = null;
|
|
20
|
-
})(/*jshint -W040 */this, 'TypedControls', function() {
|
|
20
|
+
})(/*jshint -W040 */this, 'TypedControls', function() { // eslint-disable-line max-statements
|
|
21
21
|
/*jshint +W040 */
|
|
22
22
|
|
|
23
23
|
/*jshint -W004 */
|
|
@@ -29,8 +29,8 @@ TypedControls.ENABLE_SIGNALS = false;
|
|
|
29
29
|
TypedControls.SIGNAL_NO_DATA='--';
|
|
30
30
|
TypedControls.SIGNAL_UNKNOWN_DATA='//';
|
|
31
31
|
|
|
32
|
-
var likeAr = require('like-ar');
|
|
33
|
-
var DialogPromise = require('dialog-promise');
|
|
32
|
+
var likeAr = require('like-ar'); // eslint-disable-line global-require
|
|
33
|
+
var DialogPromise = require('dialog-promise'); // eslint-disable-line global-require
|
|
34
34
|
|
|
35
35
|
TypedControls.enablePasteCorrections=true;
|
|
36
36
|
TypedControls.doubleClickExpands=false;
|
|
@@ -72,11 +72,11 @@ TypedControls.i18n.messages.es={
|
|
|
72
72
|
|
|
73
73
|
TypedControls.messages = TypedControls.i18n.messages.en;
|
|
74
74
|
|
|
75
|
-
var changing = require('best-globals').changing;
|
|
76
|
-
var jsToHtml = require('js-to-html');
|
|
77
|
-
var TypeStore = require('type-store');
|
|
78
|
-
var Big = require('big.js');
|
|
79
|
-
var Pikaday = require('pikaday');
|
|
75
|
+
var changing = require('best-globals').changing; // eslint-disable-line global-require
|
|
76
|
+
var jsToHtml = require('js-to-html'); // eslint-disable-line global-require
|
|
77
|
+
var TypeStore = require('type-store'); // eslint-disable-line global-require
|
|
78
|
+
var Big = require('big.js'); // eslint-disable-line global-require
|
|
79
|
+
var Pikaday = require('pikaday'); // eslint-disable-line global-require
|
|
80
80
|
|
|
81
81
|
var html=jsToHtml.html;
|
|
82
82
|
// var coalesce = bestGlobals.coalesce;
|
|
@@ -113,8 +113,9 @@ TypedControls.createForm = function createForm(formInfo, data){
|
|
|
113
113
|
|
|
114
114
|
TypedControls.normalOnBlurListener = function normalOnBlurListener(event){
|
|
115
115
|
if(!this.updatingSuspended){
|
|
116
|
-
|
|
116
|
+
// validate before converting: an invalid input must be marked as an error, not throw from getTypedValue
|
|
117
117
|
if(this.validateWhileInput()){
|
|
118
|
+
var currentValue=this.getTypedValue();
|
|
118
119
|
if(!bestGlobals.sameValue(this.previousValue, currentValue)){
|
|
119
120
|
this.dispatchEvent(new CustomEvent('update'));
|
|
120
121
|
this.previousValue=currentValue;
|
|
@@ -196,7 +197,7 @@ BestControls.div = {
|
|
|
196
197
|
let paste = (event.clipboardData || window.clipboardData).getData('text');
|
|
197
198
|
paste = paste.replace(/\u00A0/g,' ');
|
|
198
199
|
var element = event.target;
|
|
199
|
-
if(element && (element.tagName
|
|
200
|
+
if(element && (element.tagName === "INPUT" || element.tagName === "TEXTAREA")){
|
|
200
201
|
var start = element.selectionStart;
|
|
201
202
|
element.setRangeText(paste);
|
|
202
203
|
var pos = (start||0) + paste.length
|
|
@@ -217,7 +218,7 @@ BestControls.div = {
|
|
|
217
218
|
var element = this;
|
|
218
219
|
if(event.which>=32){
|
|
219
220
|
var typer = this.controledType;
|
|
220
|
-
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
|
|
221
222
|
if(typer.rejectedChar(theChar)){
|
|
222
223
|
if(element.expander && element.expander.autoExpand){
|
|
223
224
|
if(!element.displayingExpander){
|
|
@@ -238,6 +239,8 @@ BestControls.div = {
|
|
|
238
239
|
]
|
|
239
240
|
};
|
|
240
241
|
|
|
242
|
+
var lastCharAndTrailingNewLines = /([^\n]|^)\n+$/;
|
|
243
|
+
|
|
241
244
|
BestControls.text = {
|
|
242
245
|
translates:{true:{
|
|
243
246
|
'\n': '\u21b5'
|
|
@@ -264,7 +267,7 @@ BestControls.text = {
|
|
|
264
267
|
return '';
|
|
265
268
|
}else{
|
|
266
269
|
if(typedValue!=null){
|
|
267
|
-
return typedValue.replace(
|
|
270
|
+
return typedValue.replace(lastCharAndTrailingNewLines,'$1');
|
|
268
271
|
}
|
|
269
272
|
return typedValue;
|
|
270
273
|
}
|
|
@@ -284,7 +287,7 @@ BestControls.text = {
|
|
|
284
287
|
listeners:{
|
|
285
288
|
'keypress': function onKeyPressListenerForText(event){
|
|
286
289
|
if(this.value===''){
|
|
287
|
-
if(event.keyCode == 32){
|
|
290
|
+
if(event.keyCode == 32){ // eslint-disable-line eqeqeq
|
|
288
291
|
if(!this.valueEmpty){
|
|
289
292
|
this.valueEmpty = true;
|
|
290
293
|
event.preventDefault();
|
|
@@ -341,7 +344,7 @@ BestControls.text_no_empty = {
|
|
|
341
344
|
BestControls.number = {
|
|
342
345
|
adapters:{
|
|
343
346
|
setValidatedTypedValue: function setValidatedTypedValuePrettyNumber(typedValue){
|
|
344
|
-
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)
|
|
345
348
|
this.value='';
|
|
346
349
|
}else{
|
|
347
350
|
this.valueAsNumber = typedValue;
|
|
@@ -351,7 +354,7 @@ BestControls.number = {
|
|
|
351
354
|
}
|
|
352
355
|
},
|
|
353
356
|
getTypedValue: function getTypedValue(){
|
|
354
|
-
return isNaN(this.valueAsNumber)||this.value==''?null:this.valueAsNumber;
|
|
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)
|
|
355
358
|
},
|
|
356
359
|
// setTypedValue: function setTypedValue(value){
|
|
357
360
|
// this.valueAsNumber=value;
|
|
@@ -361,10 +364,10 @@ BestControls.number = {
|
|
|
361
364
|
'blur': TypedControls.normalOnBlurListener,
|
|
362
365
|
'keydown': function onKeyPressListenerForDiv(event){
|
|
363
366
|
var typer = this.controledType||{typeInfo:{}};
|
|
364
|
-
if(TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName
|
|
367
|
+
if(TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName !== 'text' || TypedControls.ENABLE_SIGNALS4ALL){
|
|
365
368
|
var theKey=event.keyCode;
|
|
366
369
|
// subtract or dash key
|
|
367
|
-
if((theKey==109 || theKey==189) && (this.previousKey==109 || this.previousKey==189)){
|
|
370
|
+
if((theKey==109 || theKey==189) && (this.previousKey==109 || this.previousKey==189)){ // eslint-disable-line eqeqeq
|
|
368
371
|
var valueNoData;
|
|
369
372
|
if('valueNoData' in typer.typeInfo){
|
|
370
373
|
valueNoData=typer.typeInfo.valueNoData;
|
|
@@ -375,7 +378,7 @@ BestControls.number = {
|
|
|
375
378
|
event.preventDefault();
|
|
376
379
|
}
|
|
377
380
|
//divide key or forward slash
|
|
378
|
-
if((theKey==111 || theKey==191) && (this.previousKey==111 || this.previousKey==191)){
|
|
381
|
+
if((theKey==111 || theKey==191) && (this.previousKey==111 || this.previousKey==191)){ // eslint-disable-line eqeqeq
|
|
379
382
|
var valueUnknownData;
|
|
380
383
|
if('valueUnknownData' in typer.typeInfo){
|
|
381
384
|
valueUnknownData=typer.typeInfo.valueUnknownData;
|
|
@@ -445,7 +448,7 @@ BestControls.boolean = {
|
|
|
445
448
|
}else{
|
|
446
449
|
var value = this.getPlainValue();
|
|
447
450
|
var falseInitials={'n':true,'N':true,'0':true,'2':true,'F':true,'f':true,'\u043d':true,'\u041d':true};
|
|
448
|
-
if(value==null || value.trim()==''){
|
|
451
|
+
if (value == null || value.trim() == ''){ // eslint-disable-line eqeqeq
|
|
449
452
|
return null;
|
|
450
453
|
}else{
|
|
451
454
|
return !falseInitials[value.trim()[0]];
|
|
@@ -476,11 +479,11 @@ BestControls.boolean = {
|
|
|
476
479
|
listeners:{
|
|
477
480
|
'keydown': function onKeyDownListenerForBoolean(event){
|
|
478
481
|
if(this.type==='checkbox' && (
|
|
479
|
-
event.keyCode == 8 || //backspace
|
|
480
|
-
event.keyCode == 46 || //delete/Supr
|
|
481
|
-
event.keyCode == 109 || //'-'/minus in keypad
|
|
482
|
-
event.keyCode == 189 || //'-'/minus in keyboard
|
|
483
|
-
event.keyCode == 190 //'.'/period in keyboard
|
|
482
|
+
event.keyCode == 8 || // eslint-disable-line eqeqeq -- //backspace
|
|
483
|
+
event.keyCode == 46 || // eslint-disable-line eqeqeq -- //delete/Supr
|
|
484
|
+
event.keyCode == 109 || // eslint-disable-line eqeqeq -- //'-'/minus in keypad
|
|
485
|
+
event.keyCode == 189 || // eslint-disable-line eqeqeq -- //'-'/minus in keyboard
|
|
486
|
+
event.keyCode == 190 // eslint-disable-line eqeqeq -- //'.'/period in keyboard
|
|
484
487
|
)){
|
|
485
488
|
this.checked = false;
|
|
486
489
|
this.indeterminate = true;
|
|
@@ -489,7 +492,7 @@ BestControls.boolean = {
|
|
|
489
492
|
},
|
|
490
493
|
'click': function onClickListenerForBoolean(event){
|
|
491
494
|
if(this.type==='checkbox'){
|
|
492
|
-
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
|
|
493
496
|
// Safari 5.1.7 and other old browsers doesn't set activeElement
|
|
494
497
|
this.focus();
|
|
495
498
|
}
|
|
@@ -525,7 +528,7 @@ BestControls.date = {
|
|
|
525
528
|
if(!(typedValue instanceof Date)){
|
|
526
529
|
throw new Error('Not a date in input');
|
|
527
530
|
// }else if(!(/[0 ]0:00:00/.test(typedValue.toLocaleString("local", {hour12:false})))){
|
|
528
|
-
}else if(typedValue.getTime()
|
|
531
|
+
}else if(typedValue.getTime() !== new Date(typedValue.getFullYear(), typedValue.getMonth(), typedValue.getDate()).getTime()){
|
|
529
532
|
throw new Error('date must be an absolute date without time '+typedValue+' <> '+new Date(typedValue.getFullYear(), typedValue.getMonth(), typedValue.getDate()));
|
|
530
533
|
}
|
|
531
534
|
}
|
|
@@ -570,7 +573,7 @@ BestControls.date = {
|
|
|
570
573
|
listeners:{
|
|
571
574
|
'blur': TypedControls.normalOnBlurListener,
|
|
572
575
|
'keydown': function onKeyDownListenerForDate(event){
|
|
573
|
-
if(event.keyCode == 72) { // key h
|
|
576
|
+
if(event.keyCode == 72) { // eslint-disable-line eqeqeq -- key h
|
|
574
577
|
var now=new Date();
|
|
575
578
|
this.controledType.setTypedValue(new Date(now.getFullYear(),now.getMonth(),now.getDate()));
|
|
576
579
|
event.preventDefault();
|
|
@@ -585,7 +588,7 @@ BestControls.date = {
|
|
|
585
588
|
};
|
|
586
589
|
|
|
587
590
|
function markActive(element, display){
|
|
588
|
-
while(element && element.tagName
|
|
591
|
+
while (element && element.tagName !== 'BODY') {
|
|
589
592
|
if(element.getAttribute('display-if-active')){
|
|
590
593
|
element.setAttribute('display-is-active',display?'1':'0');
|
|
591
594
|
}
|
|
@@ -612,7 +615,7 @@ var BestControls_enum = {
|
|
|
612
615
|
if(typedValue==null){
|
|
613
616
|
return null;
|
|
614
617
|
}
|
|
615
|
-
if(this.controledType.typeName
|
|
618
|
+
if (this.controledType.typeName === 'bigint') {
|
|
616
619
|
typedValue = Number(typedValue);
|
|
617
620
|
}
|
|
618
621
|
return typedValue;
|
|
@@ -690,7 +693,7 @@ TypedControls.path={
|
|
|
690
693
|
img:''
|
|
691
694
|
};
|
|
692
695
|
|
|
693
|
-
TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
696
|
+
TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){ // eslint-disable-line complexity, max-statements
|
|
694
697
|
// typeInfo = TypedControls.completeTypeInfo(typeInfo);
|
|
695
698
|
if(typeof typerOrTypeInfo === 'string'){
|
|
696
699
|
throw new Error("obsolete typeName in adaptElement "+typerOrTypeInfo);
|
|
@@ -705,7 +708,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
705
708
|
var typedControlsOptionGroup=domElement.getAttribute("typed-controls-option-group");
|
|
706
709
|
domElement.controledType = typer;
|
|
707
710
|
var bestControl=BestControls.div;
|
|
708
|
-
if(domElement.tagName
|
|
711
|
+
if (domElement.tagName === 'INPUT' && domElement.type === 'number') {
|
|
709
712
|
bestControl=BestControls.number;
|
|
710
713
|
}
|
|
711
714
|
if(typedControlsOptionGroup){
|
|
@@ -733,10 +736,10 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
733
736
|
}
|
|
734
737
|
}
|
|
735
738
|
inputElement.addEventListener('keydown',function(){
|
|
736
|
-
if(TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName
|
|
739
|
+
if (TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName !== 'text' || TypedControls.ENABLE_SIGNALS4ALL) {
|
|
737
740
|
var theKey=event.keyCode;
|
|
738
741
|
// subtract or dash key
|
|
739
|
-
if((theKey==109 || theKey==189) && (this.previousKey==109 || this.previousKey==189)){
|
|
742
|
+
if((theKey==109 || theKey==189) && (this.previousKey==109 || this.previousKey==189)){ // eslint-disable-line eqeqeq
|
|
740
743
|
var valueNoData;
|
|
741
744
|
if('valueNoData' in typer.typeInfo){
|
|
742
745
|
valueNoData=typer.typeInfo.valueNoData;
|
|
@@ -748,7 +751,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
748
751
|
event.preventDefault();
|
|
749
752
|
}
|
|
750
753
|
//divide key or forward slash
|
|
751
|
-
if((theKey==111 || theKey==191) && (this.previousKey==111 || this.previousKey==191)){
|
|
754
|
+
if ((theKey == 111 || theKey == 191) && (this.previousKey == 111 || this.previousKey == 191)) { // eslint-disable-line eqeqeq
|
|
752
755
|
var valueUnknownData;
|
|
753
756
|
if('valueUnknownData' in typer.typeInfo){
|
|
754
757
|
valueUnknownData=typer.typeInfo.valueUnknownData;
|
|
@@ -802,7 +805,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
802
805
|
});
|
|
803
806
|
});
|
|
804
807
|
var radioChilds=domElement.querySelectorAll('input[type=radio]');
|
|
805
|
-
if(radioChilds.length
|
|
808
|
+
if (radioChilds.length !== typer.typeInfo.options.length) {
|
|
806
809
|
throw new Error('invalid options in options control');
|
|
807
810
|
}
|
|
808
811
|
domElement.disable=function(disabled){
|
|
@@ -819,8 +822,8 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
819
822
|
domElement.setValidatedTypedValue=BestControls_enum.adapters.setValidatedTypedValue;
|
|
820
823
|
domElement.refreshState=BestControls_enum.adapters.refreshState;
|
|
821
824
|
}else{
|
|
822
|
-
domElement.dataAttr=domElement.tagName==='INPUT' || domElement.tagName==='TEXTAREA'?'value':'textContent';
|
|
823
|
-
if(domElement.dataAttr
|
|
825
|
+
domElement.dataAttr=domElement.tagName === 'INPUT' || domElement.tagName === 'TEXTAREA' ? 'value' : 'textContent';
|
|
826
|
+
if (domElement.dataAttr === 'textContent') {
|
|
824
827
|
domElement.ritchHtmlContent=true;
|
|
825
828
|
}
|
|
826
829
|
if(domElement.getAttribute("typed-controls-direct-input") && domElement.getAttribute("typed-controls-direct-input")==='true'){
|
|
@@ -835,7 +838,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
835
838
|
};
|
|
836
839
|
}
|
|
837
840
|
var editable=function(typer, expander, domElement){
|
|
838
|
-
return ((typer.typeInfo.editable == null || typer.typeInfo.editable) && (domElement.contentEditable
|
|
841
|
+
return ((typer.typeInfo.editable == null || typer.typeInfo.editable) && (domElement.contentEditable ==='true' || !domElement.disabled || domElement.editOnlyFromList) || expander.whenReadOnly)
|
|
839
842
|
}
|
|
840
843
|
var expander = TypedControls.Expanders.find(function(expander){
|
|
841
844
|
var typer = domElement.controledType;
|
|
@@ -902,7 +905,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
902
905
|
domElement.displayExpander = displayExpander;
|
|
903
906
|
if(TypedControls.doubleClickExpands){
|
|
904
907
|
domElement.addEventListener('dblclick',function(){
|
|
905
|
-
if(domElement.textContent==''){
|
|
908
|
+
if (domElement.textContent == '') { // eslint-disable-line eqeqeq
|
|
906
909
|
displayExpander(event);
|
|
907
910
|
}
|
|
908
911
|
});
|
|
@@ -927,8 +930,8 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
927
930
|
});
|
|
928
931
|
domElement.addEventListener('keydown', function(event){
|
|
929
932
|
var domElement = this;
|
|
930
|
-
if(event.keyCode == 120 && !event.shiftKey && !event.ctrlKey && !event.altKey
|
|
931
|
-
|| event.which == 40 && !event.shiftKey && !event.ctrlKey && event.altKey
|
|
933
|
+
if(event.keyCode == 120 && !event.shiftKey && !event.ctrlKey && !event.altKey // eslint-disable-line eqeqeq
|
|
934
|
+
|| event.which == 40 && !event.shiftKey && !event.ctrlKey && event.altKey // eslint-disable-line eqeqeq
|
|
932
935
|
){ //F9 alt down
|
|
933
936
|
if(!domElement.updatingSuspended){
|
|
934
937
|
displayExpander(event);
|
|
@@ -941,7 +944,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
941
944
|
return this[this.dataAttr]===''?this.controledType.emptyValue:this[this.dataAttr];
|
|
942
945
|
};
|
|
943
946
|
domElement.setPlainValue = function setPlainValue(plainValue){
|
|
944
|
-
if(this.tagName
|
|
947
|
+
if (this.tagName === 'INPUT' && this.type === 'number') {
|
|
945
948
|
// alert('aca')
|
|
946
949
|
}
|
|
947
950
|
this[this.dataAttr] = plainValue;
|
|
@@ -961,7 +964,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
961
964
|
domElement.validateWhileInput = function validateWhileInput(){
|
|
962
965
|
var plainValue = this.getPlainValue();
|
|
963
966
|
var typer = this.controledType||{typeInfo:{}};
|
|
964
|
-
if(TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName
|
|
967
|
+
if (TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName !== 'text' || TypedControls.ENABLE_SIGNALS4ALL) {
|
|
965
968
|
/* NO DATA SIGNAL */
|
|
966
969
|
var valueNoData;
|
|
967
970
|
if('valueNoData' in typer.typeInfo){
|
|
@@ -1036,16 +1039,16 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
1036
1039
|
}
|
|
1037
1040
|
var typer=self.controledType;
|
|
1038
1041
|
var setSignal = function(){
|
|
1039
|
-
if(TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName
|
|
1040
|
-
var plainValue = typedValue && typer.typeInfo.typeName
|
|
1041
|
-
if(plainValue
|
|
1042
|
-
(self.controledType.typeInfo.valueUnknownData && self.controledType.typeInfo.valueUnknownData == plainValue)){
|
|
1042
|
+
if (TypedControls.ENABLE_SIGNALS && typer.typeInfo.typeName !== 'text' || TypedControls.ENABLE_SIGNALS4ALL) {
|
|
1043
|
+
var plainValue = typedValue && typer.typeInfo.typeName === 'date' ? typedValue.toLocaleDateString() : typedValue;
|
|
1044
|
+
if(plainValue === TypedControls.SIGNAL_UNKNOWN_DATA || plainValue === TypedControls.VALUE_UNKNOWN_DATA ||
|
|
1045
|
+
(self.controledType.typeInfo.valueUnknownData && self.controledType.typeInfo.valueUnknownData == plainValue)){ // eslint-disable-line eqeqeq
|
|
1043
1046
|
self.setAttribute('typed-controls-signal-unknown-data','1');
|
|
1044
1047
|
}else{
|
|
1045
1048
|
self.removeAttribute('typed-controls-signal-unknown-data');
|
|
1046
1049
|
}
|
|
1047
|
-
if(plainValue
|
|
1048
|
-
(self.controledType.typeInfo.valueNoData && self.controledType.typeInfo.valueNoData == plainValue)){
|
|
1050
|
+
if(plainValue === TypedControls.SIGNAL_NO_DATA || plainValue === TypedControls.VALUE_NO_DATA ||
|
|
1051
|
+
(self.controledType.typeInfo.valueNoData && self.controledType.typeInfo.valueNoData == plainValue)){ // eslint-disable-line eqeqeq
|
|
1049
1052
|
self.setAttribute('typed-controls-signal-no-data','1');
|
|
1050
1053
|
}else{
|
|
1051
1054
|
self.removeAttribute('typed-controls-signal-no-data');
|
|
@@ -1068,7 +1071,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
1068
1071
|
}
|
|
1069
1072
|
var setup = self.dialogPromiseSetup;
|
|
1070
1073
|
if(setup && !isSameValue && !setup.ignoreValues.find(function(value){
|
|
1071
|
-
return value==typedValue;
|
|
1074
|
+
return value==typedValue; // eslint-disable-line eqeqeq
|
|
1072
1075
|
})){
|
|
1073
1076
|
switch(setup.dialogType){
|
|
1074
1077
|
case 'alertPromise':
|
|
@@ -1083,7 +1086,7 @@ TypedControls.adaptElement = function adaptElement(domElement, typerOrTypeInfo){
|
|
|
1083
1086
|
case 'promptPromise':
|
|
1084
1087
|
setup.preDialogFun(self, typedValue).then(function(){
|
|
1085
1088
|
promptPromise(setup.message,setup.opts).then(function(text){
|
|
1086
|
-
if(setup.expectedValue && text == setup.expectedValue){
|
|
1089
|
+
if(setup.expectedValue && text == setup.expectedValue){ // eslint-disable-line eqeqeq
|
|
1087
1090
|
setTypedValueFun();
|
|
1088
1091
|
}
|
|
1089
1092
|
}).catch(function(err){
|
|
@@ -1203,7 +1206,7 @@ if(window.miniMenuPromise){
|
|
|
1203
1206
|
TypedControls.Expanders.push({
|
|
1204
1207
|
whenType: function(typedControl){
|
|
1205
1208
|
var typer = typedControl.controledType;
|
|
1206
|
-
return typer.typeInfo.typeName
|
|
1209
|
+
return typer.typeInfo.typeName === 'date';
|
|
1207
1210
|
},
|
|
1208
1211
|
img:'lookdown-calendar.png',
|
|
1209
1212
|
dialogInput: function(typedControl){
|
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.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/typed-controls",
|
|
@@ -34,28 +34,28 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"best-globals": "^2.2.3",
|
|
37
|
-
"js-to-html": "^1.5.
|
|
38
|
-
"like-ar": "^0.5.
|
|
37
|
+
"js-to-html": "^1.5.4",
|
|
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
|
-
"esprima": "^4.0.1",
|
|
46
45
|
"expect.js": "^0.3.1",
|
|
47
46
|
"express-useragent": "^2.2.3",
|
|
48
|
-
"json4all": "^1.4.
|
|
47
|
+
"json4all": "^1.4.8",
|
|
49
48
|
"mocha": "^12.0.3",
|
|
50
49
|
"moment": "^2.31.0",
|
|
51
50
|
"nyc": "^18.0.0",
|
|
52
|
-
"require-bro": "^0.4.
|
|
53
|
-
"qa-control": "^0.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
51
|
+
"require-bro": "^0.4.2",
|
|
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"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"castellano": "~0.1.
|
|
58
|
+
"castellano": "~0.1.8",
|
|
59
59
|
"dialog-promise": "~0.11.1"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
@@ -74,13 +74,20 @@
|
|
|
74
74
|
"all": "npm test && qa-control . -v",
|
|
75
75
|
"report": "nyc report"
|
|
76
76
|
},
|
|
77
|
+
"nyc": {
|
|
78
|
+
"reporter": [
|
|
79
|
+
"lcov",
|
|
80
|
+
"text"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
77
83
|
"qa-control": {
|
|
78
|
-
"coverage":
|
|
84
|
+
"coverage": 30,
|
|
79
85
|
"run-in": "both",
|
|
80
86
|
"type": "lib",
|
|
81
87
|
"gha": "all",
|
|
82
88
|
"silenced": [
|
|
83
89
|
"eslint_warnings_in_file_1"
|
|
84
|
-
]
|
|
90
|
+
],
|
|
91
|
+
"sonar": true
|
|
85
92
|
}
|
|
86
93
|
}
|