@@ -3,7 +3,7 @@ import * as Survey from "survey-knockout";
3
3
import { SurveyPropertyTextEditor } from "./propertyModalEditor" ;
4
4
import {
5
5
SurveyPropertyEditorBase ,
6
- ISurveyObjectEditorOptions
6
+ ISurveyObjectEditorOptions ,
7
7
} from "./propertyEditorBase" ;
8
8
import { SurveyPropertyEditorFactory } from "./propertyEditorFactory" ;
9
9
import { EditableObject } from "./editableObject" ;
@@ -41,14 +41,14 @@ export class ConditionEditorItem {
41
41
titleLocation : "hidden" ,
42
42
showOptionsCaption : false ,
43
43
visible : false ,
44
- choices : [ "and" , "or" ]
44
+ choices : [ "and" , "or" ] ,
45
45
} ,
46
46
{
47
47
name : "questionName" ,
48
48
type : "dropdown" ,
49
49
titleLocation : "hidden" ,
50
50
startWithNewLine : false ,
51
- isRequired : true
51
+ isRequired : true ,
52
52
} ,
53
53
{
54
54
name : "operator" ,
@@ -57,9 +57,9 @@ export class ConditionEditorItem {
57
57
startWithNewLine : false ,
58
58
showOptionsCaption : false ,
59
59
isRequired : true ,
60
- enableIf : "{questionName} notempty"
61
- }
62
- ]
60
+ enableIf : "{questionName} notempty" ,
61
+ } ,
62
+ ] ,
63
63
} ;
64
64
this . survey = ! ! owner . options
65
65
? owner . options . createSurvey ( json , "conditionEditor" )
@@ -180,7 +180,7 @@ export class ConditionEditorItem {
180
180
) ;
181
181
if ( ! json ) {
182
182
json = {
183
- type : "text"
183
+ type : "text" ,
184
184
} ;
185
185
}
186
186
json . isRequired = true ;
@@ -768,7 +768,7 @@ export class SurveyPropertyConditionEditor extends SurveyPropertyTextEditor
768
768
var operand = op . expression ;
769
769
if ( operand == null || operand . getType ( ) != "variable" ) return false ;
770
770
var questionName = ( < Survey . Variable > operand ) . variable ;
771
- if ( ! this . getQuestionByName ( questionName ) ) return false ;
771
+ if ( ! this . isVariableInSurvey ( questionName ) ) return false ;
772
772
var item = new ConditionEditorItem ( this ) ;
773
773
item . questionName = questionName ;
774
774
item . operator = operator ;
@@ -836,119 +836,119 @@ SurveyPropertyEditorFactory.registerTypeForCellEditing("condition", "string");
836
836
var operations = [
837
837
{
838
838
value : "and" ,
839
- title : "logical 'and' operator"
839
+ title : "logical 'and' operator" ,
840
840
} ,
841
841
{
842
842
value : "&&" ,
843
- title : "logical 'and' operator"
843
+ title : "logical 'and' operator" ,
844
844
} ,
845
845
{
846
846
value : "or" ,
847
- title : "logical 'or' operator"
847
+ title : "logical 'or' operator" ,
848
848
} ,
849
849
{
850
850
value : "||" ,
851
- title : "logical 'or' operator"
851
+ title : "logical 'or' operator" ,
852
852
} ,
853
853
{
854
854
value : "empty" ,
855
- title : "returns true if the left operand is empty {questionName} empty"
855
+ title : "returns true if the left operand is empty {questionName} empty" ,
856
856
} ,
857
857
{
858
858
value : "notempty" ,
859
859
title :
860
- "returns true if the left operand is not empty {questionName} notempty"
860
+ "returns true if the left operand is not empty {questionName} notempty" ,
861
861
} ,
862
862
{
863
863
value : "=" ,
864
864
title :
865
- "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124"
865
+ "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124" ,
866
866
} ,
867
867
{
868
868
value : "==" ,
869
869
title :
870
- "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124"
870
+ "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124" ,
871
871
} ,
872
872
{
873
873
value : "equal" ,
874
874
title :
875
- "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124"
875
+ "returns true if two values are equal {questionName} = 5, {questionName} == 'abc', {questionName} equal 124" ,
876
876
} ,
877
877
{
878
878
value : "<>" ,
879
879
title :
880
- "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124"
880
+ "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124" ,
881
881
} ,
882
882
{
883
883
value : "!=" ,
884
884
title :
885
- "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124"
885
+ "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124" ,
886
886
} ,
887
887
{
888
888
value : "notequal" ,
889
889
title :
890
- "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124"
890
+ "returns true if two values are not equal {questionName} <> 5, {questionName} != 'abc', {questionName} notequal 124" ,
891
891
} ,
892
892
{
893
893
value : ">" ,
894
894
title :
895
- "returns true if the left operand greater then the second operand {questionName} > 2, {questionName} greater 'a'"
895
+ "returns true if the left operand greater then the second operand {questionName} > 2, {questionName} greater 'a'" ,
896
896
} ,
897
897
{
898
898
value : "greater" ,
899
899
title :
900
- "returns true if the left operand greater then the second operand {questionName} > 2, {questionName} greater 'a'"
900
+ "returns true if the left operand greater then the second operand {questionName} > 2, {questionName} greater 'a'" ,
901
901
} ,
902
902
{
903
903
value : "<" ,
904
904
title :
905
- "returns true if the left operand less then the second operand {questionName} < 2, {questionName} less 'a'"
905
+ "returns true if the left operand less then the second operand {questionName} < 2, {questionName} less 'a'" ,
906
906
} ,
907
907
{
908
908
value : "less" ,
909
909
title :
910
- "returns true if the left operand less then the second operand {questionName} < 2, {questionName} less 'a'"
910
+ "returns true if the left operand less then the second operand {questionName} < 2, {questionName} less 'a'" ,
911
911
} ,
912
912
{
913
913
value : ">=" ,
914
914
title :
915
- "returns true if the left operand equal or greater then the second operand {questionName} >= 2, {questionName} greaterorequal 'a'"
915
+ "returns true if the left operand equal or greater then the second operand {questionName} >= 2, {questionName} greaterorequal 'a'" ,
916
916
} ,
917
917
{
918
918
value : "greaterorequal" ,
919
919
title :
920
- "returns true if the left operand equal or greater then the second operand {questionName} >= 2, {questionName} greaterorequal 'a'"
920
+ "returns true if the left operand equal or greater then the second operand {questionName} >= 2, {questionName} greaterorequal 'a'" ,
921
921
} ,
922
922
{
923
923
value : "<=" ,
924
924
title :
925
- "returns true if the left operand equal or less then the second operand {questionName} <= 2, {questionName} lessorequal 'a'"
925
+ "returns true if the left operand equal or less then the second operand {questionName} <= 2, {questionName} lessorequal 'a'" ,
926
926
} ,
927
927
{
928
928
value : "lessorequal" ,
929
929
title :
930
- "returns true if the left operand equal or less then the second operand {questionName} <= 2, {questionName} lessorequal 'a'"
930
+ "returns true if the left operand equal or less then the second operand {questionName} <= 2, {questionName} lessorequal 'a'" ,
931
931
} ,
932
932
{
933
933
value : "contains" ,
934
934
title :
935
- "return true if the left operand is an array and it contains a value of the second operand {questionName} contains 'a'"
935
+ "return true if the left operand is an array and it contains a value of the second operand {questionName} contains 'a'" ,
936
936
} ,
937
937
{
938
938
value : "notcontains" ,
939
939
title :
940
- "return true if the left operand is an array and it does not contain a value of the second operand"
940
+ "return true if the left operand is an array and it does not contain a value of the second operand" ,
941
941
} ,
942
942
{
943
943
value : "anyof" ,
944
944
title :
945
- "return true if the left operand is an array and it contains any value of the second array operand"
945
+ "return true if the left operand is an array and it contains any value of the second array operand" ,
946
946
} ,
947
947
{
948
948
value : "allof" ,
949
949
title :
950
- "return true if the left operand is an array and it contains all values of the second array operand"
951
- }
950
+ "return true if the left operand is an array and it contains all values of the second array operand" ,
951
+ } ,
952
952
] ;
953
953
954
954
const createAnnotations = (
@@ -966,7 +966,7 @@ const createAnnotations = (
966
966
row : condition . match ( / \n / g) ? condition . match ( / \n / g) . length : 0 ,
967
967
column : column ,
968
968
text : conditionParser . error . code + " (" + column + ")" ,
969
- type : "error"
969
+ type : "error" ,
970
970
} ;
971
971
annotations . push ( annotation ) ;
972
972
}
@@ -984,7 +984,7 @@ export function doGetCompletions(
984
984
var completions = [ ] ;
985
985
var currentQuestion : Survey . Question = config . question ;
986
986
var usableQuestions = ( config . questions || [ ] ) . filter (
987
- q => q !== currentQuestion
987
+ ( q ) => q !== currentQuestion
988
988
) ;
989
989
if (
990
990
! ! usableQuestions ||
@@ -996,14 +996,14 @@ export function doGetCompletions(
996
996
currentQuestion instanceof Survey . MatrixDropdownColumn
997
997
) {
998
998
completions = currentQuestion . colOwner [ "columns" ]
999
- . filter ( e => e . name !== currentQuestion . name )
1000
- . map ( column => {
999
+ . filter ( ( e ) => e . name !== currentQuestion . name )
1000
+ . map ( ( column ) => {
1001
1001
return {
1002
1002
name : "" ,
1003
1003
value : "{row." + column . name + "}" ,
1004
1004
some : "" ,
1005
1005
meta : column . title ,
1006
- identifierRegex : ID_REGEXP
1006
+ identifierRegex : ID_REGEXP ,
1007
1007
} ;
1008
1008
} ) ;
1009
1009
} else if (
@@ -1012,22 +1012,22 @@ export function doGetCompletions(
1012
1012
) {
1013
1013
var panel : Survey . PanelModel = currentQuestion . data . panel ;
1014
1014
completions = panel . elements
1015
- . filter ( e => e . name !== currentQuestion . name )
1016
- . map ( element => {
1015
+ . filter ( ( e ) => e . name !== currentQuestion . name )
1016
+ . map ( ( element ) => {
1017
1017
return {
1018
1018
name : "" ,
1019
1019
value : "{panel." + element . name + "}" ,
1020
1020
some : "" ,
1021
1021
meta : element . name ,
1022
- identifierRegex : ID_REGEXP
1022
+ identifierRegex : ID_REGEXP ,
1023
1023
} ;
1024
1024
} ) ;
1025
1025
} else {
1026
1026
var operationsFiltered = operations . filter (
1027
- op => ! prefix || op . value . indexOf ( prefix ) !== - 1
1027
+ ( op ) => ! prefix || op . value . indexOf ( prefix ) !== - 1
1028
1028
) ;
1029
1029
var questionsFiltered = usableQuestions . filter (
1030
- op => ! prefix || op . name . indexOf ( prefix ) !== - 1
1030
+ ( op ) => ! prefix || op . name . indexOf ( prefix ) !== - 1
1031
1031
) ;
1032
1032
if ( currentQuestion instanceof Survey . MatrixDropdownColumn ) {
1033
1033
completions . push ( {
@@ -1037,7 +1037,7 @@ export function doGetCompletions(
1037
1037
meta : editorLocalization . editorLocalization . getString (
1038
1038
editorLocalization . defaultStrings . pe . aceEditorRowTitle
1039
1039
) ,
1040
- identifierRegex : ID_REGEXP
1040
+ identifierRegex : ID_REGEXP ,
1041
1041
} ) ;
1042
1042
} else if (
1043
1043
! ! currentQuestion &&
@@ -1050,30 +1050,30 @@ export function doGetCompletions(
1050
1050
meta : editorLocalization . editorLocalization . getString (
1051
1051
editorLocalization . defaultStrings . pe . aceEditorPanelTitle
1052
1052
) ,
1053
- identifierRegex : ID_REGEXP
1053
+ identifierRegex : ID_REGEXP ,
1054
1054
} ) ;
1055
1055
}
1056
1056
completions = completions
1057
1057
. concat (
1058
- questionsFiltered . map ( q => {
1058
+ questionsFiltered . map ( ( q ) => {
1059
1059
return {
1060
1060
completer : completer ,
1061
1061
name : "" ,
1062
1062
value : "{" + q . name + "}" ,
1063
1063
some : "" ,
1064
1064
meta : q . title ,
1065
- identifierRegex : ID_REGEXP
1065
+ identifierRegex : ID_REGEXP ,
1066
1066
} ;
1067
1067
} )
1068
1068
)
1069
1069
. concat (
1070
- operationsFiltered . map ( op => {
1070
+ operationsFiltered . map ( ( op ) => {
1071
1071
return {
1072
1072
name : "" ,
1073
1073
value : op . value ,
1074
1074
some : "" ,
1075
1075
meta : op . title ,
1076
- identifierRegex : ID_REGEXP
1076
+ identifierRegex : ID_REGEXP ,
1077
1077
} ;
1078
1078
} )
1079
1079
) ;
@@ -1162,12 +1162,12 @@ ko.bindingHandlers.aceEditor = {
1162
1162
"<div style='max-width: 300px; white-space: normal;'>" +
1163
1163
item . meta +
1164
1164
"</div>" ;
1165
- }
1165
+ } ,
1166
1166
} ;
1167
1167
langTools . setCompleters ( [ completer ] ) ;
1168
1168
editor . setOptions ( {
1169
1169
enableBasicAutocompletion : true ,
1170
- enableLiveAutocompletion : true
1170
+ enableLiveAutocompletion : true ,
1171
1171
} ) ;
1172
1172
1173
1173
ko . utils . domNodeDisposal . addDisposeCallback ( element , function ( ) {
@@ -1176,5 +1176,5 @@ ko.bindingHandlers.aceEditor = {
1176
1176
} ) ;
1177
1177
1178
1178
editor . focus ( ) ;
1179
- }
1179
+ } ,
1180
1180
} ;
0 commit comments