@aurodesignsystem-dev/auro-formkit 0.0.0-pr1144.2 → 0.0.0-pr1145.0
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/components/checkbox/demo/api.min.js +66 -2
- package/components/checkbox/demo/index.min.js +66 -2
- package/components/checkbox/dist/index.js +66 -2
- package/components/checkbox/dist/registered.js +66 -2
- package/components/combobox/demo/api.md +229 -37
- package/components/combobox/demo/api.min.js +212 -9
- package/components/combobox/demo/index.md +104 -0
- package/components/combobox/demo/index.min.js +212 -9
- package/components/combobox/dist/auro-combobox.d.ts +17 -0
- package/components/combobox/dist/index.js +212 -9
- package/components/combobox/dist/registered.js +212 -9
- package/components/counter/demo/api.min.js +66 -2
- package/components/counter/demo/index.min.js +66 -2
- package/components/counter/dist/index.js +66 -2
- package/components/counter/dist/registered.js +66 -2
- package/components/datepicker/demo/api.min.js +193 -9
- package/components/datepicker/demo/index.min.js +193 -9
- package/components/datepicker/dist/index.js +193 -9
- package/components/datepicker/dist/registered.js +193 -9
- package/components/input/demo/api.md +1 -1
- package/components/input/demo/api.min.js +125 -7
- package/components/input/demo/index.min.js +125 -7
- package/components/input/dist/base-input.d.ts +12 -1
- package/components/input/dist/index.js +125 -7
- package/components/input/dist/registered.js +125 -7
- package/components/radio/demo/api.md +0 -1
- package/components/radio/demo/api.min.js +69 -31
- package/components/radio/demo/index.min.js +69 -31
- package/components/radio/dist/auro-radio-group.d.ts +0 -14
- package/components/radio/dist/index.js +69 -31
- package/components/radio/dist/registered.js +69 -31
- package/components/select/demo/api.min.js +66 -2
- package/components/select/demo/index.min.js +66 -2
- package/components/select/dist/index.js +66 -2
- package/components/select/dist/registered.js +66 -2
- package/package.json +1 -1
|
@@ -944,6 +944,52 @@ class AuroFormValidation {
|
|
|
944
944
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
945
945
|
}
|
|
946
946
|
]
|
|
947
|
+
},
|
|
948
|
+
combobox: {
|
|
949
|
+
filter: [
|
|
950
|
+
{
|
|
951
|
+
check: (e) => {
|
|
952
|
+
|
|
953
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
954
|
+
if (e.behavior !== 'filter') return false;
|
|
955
|
+
|
|
956
|
+
// Get the current input value
|
|
957
|
+
const currentInputValue = e.input.value;
|
|
958
|
+
|
|
959
|
+
// Skip validation if the input has no value
|
|
960
|
+
if (!currentInputValue) return false;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Let's check if the option selected and combobox value match.
|
|
964
|
+
*/
|
|
965
|
+
|
|
966
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
967
|
+
if (!e.optionSelected) return true;
|
|
968
|
+
|
|
969
|
+
// Guard Clause: If there is no value fail the validation
|
|
970
|
+
if (!e.value) return true;
|
|
971
|
+
|
|
972
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
973
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
977
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
978
|
+
*/
|
|
979
|
+
|
|
980
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
981
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
982
|
+
|
|
983
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
984
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
985
|
+
|
|
986
|
+
// If all the checks passed the validation passes
|
|
987
|
+
return false;
|
|
988
|
+
},
|
|
989
|
+
validity: 'valueMissing',
|
|
990
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
991
|
+
}
|
|
992
|
+
]
|
|
947
993
|
}
|
|
948
994
|
};
|
|
949
995
|
|
|
@@ -952,6 +998,8 @@ class AuroFormValidation {
|
|
|
952
998
|
elementType = 'input';
|
|
953
999
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
954
1000
|
elementType = 'counter';
|
|
1001
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
1002
|
+
elementType = 'combobox';
|
|
955
1003
|
}
|
|
956
1004
|
|
|
957
1005
|
if (elementType) {
|
|
@@ -1130,6 +1178,15 @@ class AuroFormValidation {
|
|
|
1130
1178
|
}
|
|
1131
1179
|
}
|
|
1132
1180
|
|
|
1181
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1182
|
+
|
|
1183
|
+
if (isCombobox) {
|
|
1184
|
+
|
|
1185
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1186
|
+
hasValue = elem.input.value?.length > 0;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1133
1190
|
if (!hasValue && elem.required && elem.touched) {
|
|
1134
1191
|
elem.validity = 'valueMissing';
|
|
1135
1192
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1138,6 +1195,11 @@ class AuroFormValidation {
|
|
|
1138
1195
|
this.validateElementAttributes(elem);
|
|
1139
1196
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1140
1197
|
this.validateElementAttributes(elem);
|
|
1198
|
+
} else if (isCombobox) {
|
|
1199
|
+
this.validateElementAttributes(elem);
|
|
1200
|
+
|
|
1201
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1202
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1141
1203
|
}
|
|
1142
1204
|
}
|
|
1143
1205
|
|
|
@@ -1145,8 +1207,8 @@ class AuroFormValidation {
|
|
|
1145
1207
|
|
|
1146
1208
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1147
1209
|
|
|
1148
|
-
// Don't reset combobox validity if
|
|
1149
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1210
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1211
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1150
1212
|
|
|
1151
1213
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1152
1214
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1219,6 +1281,8 @@ class AuroFormValidation {
|
|
|
1219
1281
|
if (input.validationMessage.length > 0) {
|
|
1220
1282
|
elem.errorMessage = input.validationMessage;
|
|
1221
1283
|
}
|
|
1284
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1285
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1222
1286
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1223
1287
|
const firstInput = this.inputElements[0];
|
|
1224
1288
|
|
|
@@ -936,6 +936,52 @@ class AuroFormValidation {
|
|
|
936
936
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
937
937
|
}
|
|
938
938
|
]
|
|
939
|
+
},
|
|
940
|
+
combobox: {
|
|
941
|
+
filter: [
|
|
942
|
+
{
|
|
943
|
+
check: (e) => {
|
|
944
|
+
|
|
945
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
946
|
+
if (e.behavior !== 'filter') return false;
|
|
947
|
+
|
|
948
|
+
// Get the current input value
|
|
949
|
+
const currentInputValue = e.input.value;
|
|
950
|
+
|
|
951
|
+
// Skip validation if the input has no value
|
|
952
|
+
if (!currentInputValue) return false;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Let's check if the option selected and combobox value match.
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
959
|
+
if (!e.optionSelected) return true;
|
|
960
|
+
|
|
961
|
+
// Guard Clause: If there is no value fail the validation
|
|
962
|
+
if (!e.value) return true;
|
|
963
|
+
|
|
964
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
965
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
969
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
973
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
974
|
+
|
|
975
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
976
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
977
|
+
|
|
978
|
+
// If all the checks passed the validation passes
|
|
979
|
+
return false;
|
|
980
|
+
},
|
|
981
|
+
validity: 'valueMissing',
|
|
982
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
983
|
+
}
|
|
984
|
+
]
|
|
939
985
|
}
|
|
940
986
|
};
|
|
941
987
|
|
|
@@ -944,6 +990,8 @@ class AuroFormValidation {
|
|
|
944
990
|
elementType = 'input';
|
|
945
991
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
946
992
|
elementType = 'counter';
|
|
993
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
994
|
+
elementType = 'combobox';
|
|
947
995
|
}
|
|
948
996
|
|
|
949
997
|
if (elementType) {
|
|
@@ -1122,6 +1170,15 @@ class AuroFormValidation {
|
|
|
1122
1170
|
}
|
|
1123
1171
|
}
|
|
1124
1172
|
|
|
1173
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1174
|
+
|
|
1175
|
+
if (isCombobox) {
|
|
1176
|
+
|
|
1177
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1178
|
+
hasValue = elem.input.value?.length > 0;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1125
1182
|
if (!hasValue && elem.required && elem.touched) {
|
|
1126
1183
|
elem.validity = 'valueMissing';
|
|
1127
1184
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1130,6 +1187,11 @@ class AuroFormValidation {
|
|
|
1130
1187
|
this.validateElementAttributes(elem);
|
|
1131
1188
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1132
1189
|
this.validateElementAttributes(elem);
|
|
1190
|
+
} else if (isCombobox) {
|
|
1191
|
+
this.validateElementAttributes(elem);
|
|
1192
|
+
|
|
1193
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1194
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1133
1195
|
}
|
|
1134
1196
|
}
|
|
1135
1197
|
|
|
@@ -1137,8 +1199,8 @@ class AuroFormValidation {
|
|
|
1137
1199
|
|
|
1138
1200
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1139
1201
|
|
|
1140
|
-
// Don't reset combobox validity if
|
|
1141
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1202
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1203
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1142
1204
|
|
|
1143
1205
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1144
1206
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1211,6 +1273,8 @@ class AuroFormValidation {
|
|
|
1211
1273
|
if (input.validationMessage.length > 0) {
|
|
1212
1274
|
elem.errorMessage = input.validationMessage;
|
|
1213
1275
|
}
|
|
1276
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1277
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1214
1278
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1215
1279
|
const firstInput = this.inputElements[0];
|
|
1216
1280
|
|
|
@@ -889,6 +889,52 @@ class AuroFormValidation {
|
|
|
889
889
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
890
890
|
}
|
|
891
891
|
]
|
|
892
|
+
},
|
|
893
|
+
combobox: {
|
|
894
|
+
filter: [
|
|
895
|
+
{
|
|
896
|
+
check: (e) => {
|
|
897
|
+
|
|
898
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
899
|
+
if (e.behavior !== 'filter') return false;
|
|
900
|
+
|
|
901
|
+
// Get the current input value
|
|
902
|
+
const currentInputValue = e.input.value;
|
|
903
|
+
|
|
904
|
+
// Skip validation if the input has no value
|
|
905
|
+
if (!currentInputValue) return false;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Let's check if the option selected and combobox value match.
|
|
909
|
+
*/
|
|
910
|
+
|
|
911
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
912
|
+
if (!e.optionSelected) return true;
|
|
913
|
+
|
|
914
|
+
// Guard Clause: If there is no value fail the validation
|
|
915
|
+
if (!e.value) return true;
|
|
916
|
+
|
|
917
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
918
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
922
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
923
|
+
*/
|
|
924
|
+
|
|
925
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
926
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
927
|
+
|
|
928
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
929
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
930
|
+
|
|
931
|
+
// If all the checks passed the validation passes
|
|
932
|
+
return false;
|
|
933
|
+
},
|
|
934
|
+
validity: 'valueMissing',
|
|
935
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
936
|
+
}
|
|
937
|
+
]
|
|
892
938
|
}
|
|
893
939
|
};
|
|
894
940
|
|
|
@@ -897,6 +943,8 @@ class AuroFormValidation {
|
|
|
897
943
|
elementType = 'input';
|
|
898
944
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
899
945
|
elementType = 'counter';
|
|
946
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
947
|
+
elementType = 'combobox';
|
|
900
948
|
}
|
|
901
949
|
|
|
902
950
|
if (elementType) {
|
|
@@ -1075,6 +1123,15 @@ class AuroFormValidation {
|
|
|
1075
1123
|
}
|
|
1076
1124
|
}
|
|
1077
1125
|
|
|
1126
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1127
|
+
|
|
1128
|
+
if (isCombobox) {
|
|
1129
|
+
|
|
1130
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1131
|
+
hasValue = elem.input.value?.length > 0;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1078
1135
|
if (!hasValue && elem.required && elem.touched) {
|
|
1079
1136
|
elem.validity = 'valueMissing';
|
|
1080
1137
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1083,6 +1140,11 @@ class AuroFormValidation {
|
|
|
1083
1140
|
this.validateElementAttributes(elem);
|
|
1084
1141
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1085
1142
|
this.validateElementAttributes(elem);
|
|
1143
|
+
} else if (isCombobox) {
|
|
1144
|
+
this.validateElementAttributes(elem);
|
|
1145
|
+
|
|
1146
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1147
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1086
1148
|
}
|
|
1087
1149
|
}
|
|
1088
1150
|
|
|
@@ -1090,8 +1152,8 @@ class AuroFormValidation {
|
|
|
1090
1152
|
|
|
1091
1153
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1092
1154
|
|
|
1093
|
-
// Don't reset combobox validity if
|
|
1094
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1155
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1156
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1095
1157
|
|
|
1096
1158
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1097
1159
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1164,6 +1226,8 @@ class AuroFormValidation {
|
|
|
1164
1226
|
if (input.validationMessage.length > 0) {
|
|
1165
1227
|
elem.errorMessage = input.validationMessage;
|
|
1166
1228
|
}
|
|
1229
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1230
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1167
1231
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1168
1232
|
const firstInput = this.inputElements[0];
|
|
1169
1233
|
|
|
@@ -889,6 +889,52 @@ class AuroFormValidation {
|
|
|
889
889
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
890
890
|
}
|
|
891
891
|
]
|
|
892
|
+
},
|
|
893
|
+
combobox: {
|
|
894
|
+
filter: [
|
|
895
|
+
{
|
|
896
|
+
check: (e) => {
|
|
897
|
+
|
|
898
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
899
|
+
if (e.behavior !== 'filter') return false;
|
|
900
|
+
|
|
901
|
+
// Get the current input value
|
|
902
|
+
const currentInputValue = e.input.value;
|
|
903
|
+
|
|
904
|
+
// Skip validation if the input has no value
|
|
905
|
+
if (!currentInputValue) return false;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Let's check if the option selected and combobox value match.
|
|
909
|
+
*/
|
|
910
|
+
|
|
911
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
912
|
+
if (!e.optionSelected) return true;
|
|
913
|
+
|
|
914
|
+
// Guard Clause: If there is no value fail the validation
|
|
915
|
+
if (!e.value) return true;
|
|
916
|
+
|
|
917
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
918
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
922
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
923
|
+
*/
|
|
924
|
+
|
|
925
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
926
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
927
|
+
|
|
928
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
929
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
930
|
+
|
|
931
|
+
// If all the checks passed the validation passes
|
|
932
|
+
return false;
|
|
933
|
+
},
|
|
934
|
+
validity: 'valueMissing',
|
|
935
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
936
|
+
}
|
|
937
|
+
]
|
|
892
938
|
}
|
|
893
939
|
};
|
|
894
940
|
|
|
@@ -897,6 +943,8 @@ class AuroFormValidation {
|
|
|
897
943
|
elementType = 'input';
|
|
898
944
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
899
945
|
elementType = 'counter';
|
|
946
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
947
|
+
elementType = 'combobox';
|
|
900
948
|
}
|
|
901
949
|
|
|
902
950
|
if (elementType) {
|
|
@@ -1075,6 +1123,15 @@ class AuroFormValidation {
|
|
|
1075
1123
|
}
|
|
1076
1124
|
}
|
|
1077
1125
|
|
|
1126
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1127
|
+
|
|
1128
|
+
if (isCombobox) {
|
|
1129
|
+
|
|
1130
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1131
|
+
hasValue = elem.input.value?.length > 0;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1078
1135
|
if (!hasValue && elem.required && elem.touched) {
|
|
1079
1136
|
elem.validity = 'valueMissing';
|
|
1080
1137
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1083,6 +1140,11 @@ class AuroFormValidation {
|
|
|
1083
1140
|
this.validateElementAttributes(elem);
|
|
1084
1141
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1085
1142
|
this.validateElementAttributes(elem);
|
|
1143
|
+
} else if (isCombobox) {
|
|
1144
|
+
this.validateElementAttributes(elem);
|
|
1145
|
+
|
|
1146
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1147
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1086
1148
|
}
|
|
1087
1149
|
}
|
|
1088
1150
|
|
|
@@ -1090,8 +1152,8 @@ class AuroFormValidation {
|
|
|
1090
1152
|
|
|
1091
1153
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1092
1154
|
|
|
1093
|
-
// Don't reset combobox validity if
|
|
1094
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1155
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1156
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1095
1157
|
|
|
1096
1158
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1097
1159
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1164,6 +1226,8 @@ class AuroFormValidation {
|
|
|
1164
1226
|
if (input.validationMessage.length > 0) {
|
|
1165
1227
|
elem.errorMessage = input.validationMessage;
|
|
1166
1228
|
}
|
|
1229
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1230
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1167
1231
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1168
1232
|
const firstInput = this.inputElements[0];
|
|
1169
1233
|
|