@aurodesignsystem/auro-formkit 5.7.0 → 5.8.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/CHANGELOG.md +12 -22
- 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 +230 -38
- package/components/combobox/demo/api.min.js +155 -6
- package/components/combobox/demo/index.md +104 -0
- package/components/combobox/demo/index.min.js +155 -6
- package/components/combobox/dist/auro-combobox.d.ts +18 -1
- package/components/combobox/dist/index.js +155 -6
- package/components/combobox/dist/registered.js +155 -6
- package/components/counter/demo/api.min.js +69 -5
- package/components/counter/demo/index.min.js +69 -5
- package/components/counter/dist/index.js +69 -5
- package/components/counter/dist/registered.js +69 -5
- package/components/datepicker/demo/api.md +40 -0
- package/components/datepicker/demo/api.min.js +173 -10
- package/components/datepicker/demo/index.min.js +173 -10
- package/components/datepicker/dist/auro-calendar-cell.d.ts +6 -0
- package/components/datepicker/dist/auro-datepicker.d.ts +8 -0
- package/components/datepicker/dist/index.js +173 -10
- package/components/datepicker/dist/registered.js +173 -10
- package/components/input/demo/api.min.js +67 -3
- package/components/input/demo/index.min.js +67 -3
- package/components/input/dist/index.js +67 -3
- package/components/input/dist/registered.js +67 -3
- package/components/radio/demo/api.min.js +97 -5
- package/components/radio/demo/index.min.js +97 -5
- package/components/radio/dist/auro-radio-group.d.ts +14 -0
- package/components/radio/dist/index.js +97 -5
- package/components/radio/dist/registered.js +97 -5
- package/components/select/demo/api.min.js +67 -3
- package/components/select/demo/index.min.js +67 -3
- package/components/select/dist/index.js +67 -3
- package/components/select/dist/registered.js +67 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
# [5.
|
|
1
|
+
# [5.8.0](https://github.com/AlaskaAirlines/auro-formkit/compare/v5.7.0...v5.8.0) (2025-10-31)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
* [#
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* add outline color to error border in datepicker [#1189](https://github.com/AlaskaAirlines/auro-formkit/issues/1189) ([cda56f1](https://github.com/AlaskaAirlines/auro-formkit/commit/cda56f13e3129554f552304551bf13310183803d))
|
|
7
|
+
* add outline color to error border in select [#1189](https://github.com/AlaskaAirlines/auro-formkit/issues/1189) ([13e4038](https://github.com/AlaskaAirlines/auro-formkit/commit/13e4038db850c0683149a15687786bd63fdee575))
|
|
8
|
+
* adjust vertical alignment for buttons and quantity label in auro counterto match figma designs [#1173](https://github.com/AlaskaAirlines/auro-formkit/issues/1173) ([cb61272](https://github.com/AlaskaAirlines/auro-formkit/commit/cb61272dafcdc70af93e2c061982462a9266e4c7))
|
|
9
|
+
* combo box now correctly captures floated validation messages from input ([f86b87a](https://github.com/AlaskaAirlines/auro-formkit/commit/f86b87a4d7d9e15101bc9fdc51fce65759f77d4f))
|
|
10
|
+
* combo box now correctly syncs its validity state with input when input validity is updated ([44c3ffd](https://github.com/AlaskaAirlines/auro-formkit/commit/44c3ffdb369681d5c8a6d49b8627dd9a0d518ff2))
|
|
11
|
+
* replace incorrect `elem.persistValue` reference with correct `elem.persistInput` ([47eb89c](https://github.com/AlaskaAirlines/auro-formkit/commit/47eb89cc8e293e6ead96b0ff98e097613fc7fafd))
|
|
12
|
+
* resolve layout issue with snowflake layout when input is errored and the user hovers ([111c28c](https://github.com/AlaskaAirlines/auro-formkit/commit/111c28cc18ff645e2f238cb1eb19663a4f0ed31c))
|
|
13
|
+
* value of input is now correctly checked when `persistInput` is not set on combo boxes ([a845ac9](https://github.com/AlaskaAirlines/auro-formkit/commit/a845ac9ea280d6bc57a443aa83a08187e4e06699))
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
### Features
|
|
13
17
|
|
|
14
|
-
*
|
|
15
|
-
* add
|
|
16
|
-
*
|
|
17
|
-
* add `appearance` deprecate `ondark` on datepicker [#1150](https://github.com/AlaskaAirlines/auro-formkit/issues/1150) ([d769459](https://github.com/AlaskaAirlines/auro-formkit/commit/d769459531128637b8adb2c8b890a00d779a73ea))
|
|
18
|
-
* add `appearance` deprecate `ondark` on dropdown [#1147](https://github.com/AlaskaAirlines/auro-formkit/issues/1147) ([9ba364a](https://github.com/AlaskaAirlines/auro-formkit/commit/9ba364ab41c8d7db5c046affa67b6722d8712e97))
|
|
19
|
-
* add `appearance` deprecate `ondark` on input [#1148](https://github.com/AlaskaAirlines/auro-formkit/issues/1148) ([82a63a8](https://github.com/AlaskaAirlines/auro-formkit/commit/82a63a80248a4433bafcc96d1d80a0eaec974f10))
|
|
20
|
-
* add `appearance` deprecate `ondark` on radio [#1154](https://github.com/AlaskaAirlines/auro-formkit/issues/1154) ([b8279ec](https://github.com/AlaskaAirlines/auro-formkit/commit/b8279ec6ac5093faccdbc66dbd7e7ccba98583b2))
|
|
21
|
-
* add `appearance` deprecate `ondark` on select [#1152](https://github.com/AlaskaAirlines/auro-formkit/issues/1152) ([e7f6938](https://github.com/AlaskaAirlines/auro-formkit/commit/e7f69388efb0228e9f00abd91789ea4a5d1e0e88))
|
|
22
|
-
* add slots for custom aria-labels in counter [#1163](https://github.com/AlaskaAirlines/auro-formkit/issues/1163) ([8d9b313](https://github.com/AlaskaAirlines/auro-formkit/commit/8d9b313a6dea83bb2519006c134d87533466b9a1))
|
|
23
|
-
* add slots for custom aria-labels in datepicker [#1164](https://github.com/AlaskaAirlines/auro-formkit/issues/1164) ([4059bec](https://github.com/AlaskaAirlines/auro-formkit/commit/4059bec0dc0ce13fbd22c70a37575e3004e405a1))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Performance Improvements
|
|
27
|
-
|
|
28
|
-
* update `auro-button` and `auro-icon` ([c035d79](https://github.com/AlaskaAirlines/auro-formkit/commit/c035d79bd499e384442f756ac089b25935080f03))
|
|
29
|
-
* update auro-button import paths ([7dd3b66](https://github.com/AlaskaAirlines/auro-formkit/commit/7dd3b6603cf5e3f9385ee2a81a5833085cea6dcc))
|
|
30
|
-
* update to latest dependencies ([b62f1bb](https://github.com/AlaskaAirlines/auro-formkit/commit/b62f1bbe653944ed0187aa4fe234d4896cbe6eb9))
|
|
18
|
+
* [#680](https://github.com/AlaskaAirlines/auro-formkit/issues/680) add reference dates functionality to datepicker component ([09399ec](https://github.com/AlaskaAirlines/auro-formkit/commit/09399ec2509b7f5cdddd83ccf04465a4b67e4561))
|
|
19
|
+
* add filter behavior to combo box ([10f627b](https://github.com/AlaskaAirlines/auro-formkit/commit/10f627b9e83de9e8e50b6344665074e0a2ddf07c))
|
|
20
|
+
* hide legened element if legned slot is not being set and the required attribute is true [#1143](https://github.com/AlaskaAirlines/auro-formkit/issues/1143) ([dbf447f](https://github.com/AlaskaAirlines/auro-formkit/commit/dbf447fb46c212e285d0dea693bab5900068d080))
|
|
31
21
|
|
|
32
22
|
### Changelog
|
|
33
23
|
|
|
@@ -969,6 +969,52 @@ class AuroFormValidation {
|
|
|
969
969
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
970
970
|
}
|
|
971
971
|
]
|
|
972
|
+
},
|
|
973
|
+
combobox: {
|
|
974
|
+
filter: [
|
|
975
|
+
{
|
|
976
|
+
check: (e) => {
|
|
977
|
+
|
|
978
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
979
|
+
if (e.behavior !== 'filter') return false;
|
|
980
|
+
|
|
981
|
+
// Get the current input value
|
|
982
|
+
const currentInputValue = e.input.value;
|
|
983
|
+
|
|
984
|
+
// Skip validation if the input has no value
|
|
985
|
+
if (!currentInputValue) return false;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Let's check if the option selected and combobox value match.
|
|
989
|
+
*/
|
|
990
|
+
|
|
991
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
992
|
+
if (!e.optionSelected) return true;
|
|
993
|
+
|
|
994
|
+
// Guard Clause: If there is no value fail the validation
|
|
995
|
+
if (!e.value) return true;
|
|
996
|
+
|
|
997
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
998
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
1002
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
1003
|
+
*/
|
|
1004
|
+
|
|
1005
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
1006
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
1007
|
+
|
|
1008
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
1009
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
1010
|
+
|
|
1011
|
+
// If all the checks passed the validation passes
|
|
1012
|
+
return false;
|
|
1013
|
+
},
|
|
1014
|
+
validity: 'valueMissing',
|
|
1015
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
1016
|
+
}
|
|
1017
|
+
]
|
|
972
1018
|
}
|
|
973
1019
|
};
|
|
974
1020
|
|
|
@@ -977,6 +1023,8 @@ class AuroFormValidation {
|
|
|
977
1023
|
elementType = 'input';
|
|
978
1024
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
979
1025
|
elementType = 'counter';
|
|
1026
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
1027
|
+
elementType = 'combobox';
|
|
980
1028
|
}
|
|
981
1029
|
|
|
982
1030
|
if (elementType) {
|
|
@@ -1163,6 +1211,15 @@ class AuroFormValidation {
|
|
|
1163
1211
|
}
|
|
1164
1212
|
}
|
|
1165
1213
|
|
|
1214
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1215
|
+
|
|
1216
|
+
if (isCombobox) {
|
|
1217
|
+
|
|
1218
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1219
|
+
hasValue = elem.input.value?.length > 0;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1166
1223
|
if (!hasValue && elem.required && elem.touched) {
|
|
1167
1224
|
elem.validity = 'valueMissing';
|
|
1168
1225
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1171,6 +1228,11 @@ class AuroFormValidation {
|
|
|
1171
1228
|
this.validateElementAttributes(elem);
|
|
1172
1229
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1173
1230
|
this.validateElementAttributes(elem);
|
|
1231
|
+
} else if (isCombobox) {
|
|
1232
|
+
this.validateElementAttributes(elem);
|
|
1233
|
+
|
|
1234
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1235
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1174
1236
|
}
|
|
1175
1237
|
}
|
|
1176
1238
|
|
|
@@ -1178,8 +1240,8 @@ class AuroFormValidation {
|
|
|
1178
1240
|
|
|
1179
1241
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1180
1242
|
|
|
1181
|
-
// Don't reset combobox validity if
|
|
1182
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1243
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1244
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1183
1245
|
|
|
1184
1246
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1185
1247
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1252,6 +1314,8 @@ class AuroFormValidation {
|
|
|
1252
1314
|
if (input.validationMessage.length > 0) {
|
|
1253
1315
|
elem.errorMessage = input.validationMessage;
|
|
1254
1316
|
}
|
|
1317
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1318
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1255
1319
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1256
1320
|
const firstInput = this.inputElements[0];
|
|
1257
1321
|
|
|
@@ -961,6 +961,52 @@ class AuroFormValidation {
|
|
|
961
961
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
962
962
|
}
|
|
963
963
|
]
|
|
964
|
+
},
|
|
965
|
+
combobox: {
|
|
966
|
+
filter: [
|
|
967
|
+
{
|
|
968
|
+
check: (e) => {
|
|
969
|
+
|
|
970
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
971
|
+
if (e.behavior !== 'filter') return false;
|
|
972
|
+
|
|
973
|
+
// Get the current input value
|
|
974
|
+
const currentInputValue = e.input.value;
|
|
975
|
+
|
|
976
|
+
// Skip validation if the input has no value
|
|
977
|
+
if (!currentInputValue) return false;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Let's check if the option selected and combobox value match.
|
|
981
|
+
*/
|
|
982
|
+
|
|
983
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
984
|
+
if (!e.optionSelected) return true;
|
|
985
|
+
|
|
986
|
+
// Guard Clause: If there is no value fail the validation
|
|
987
|
+
if (!e.value) return true;
|
|
988
|
+
|
|
989
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
990
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
994
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
995
|
+
*/
|
|
996
|
+
|
|
997
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
998
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
999
|
+
|
|
1000
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
1001
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
1002
|
+
|
|
1003
|
+
// If all the checks passed the validation passes
|
|
1004
|
+
return false;
|
|
1005
|
+
},
|
|
1006
|
+
validity: 'valueMissing',
|
|
1007
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
1008
|
+
}
|
|
1009
|
+
]
|
|
964
1010
|
}
|
|
965
1011
|
};
|
|
966
1012
|
|
|
@@ -969,6 +1015,8 @@ class AuroFormValidation {
|
|
|
969
1015
|
elementType = 'input';
|
|
970
1016
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
971
1017
|
elementType = 'counter';
|
|
1018
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
1019
|
+
elementType = 'combobox';
|
|
972
1020
|
}
|
|
973
1021
|
|
|
974
1022
|
if (elementType) {
|
|
@@ -1155,6 +1203,15 @@ class AuroFormValidation {
|
|
|
1155
1203
|
}
|
|
1156
1204
|
}
|
|
1157
1205
|
|
|
1206
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1207
|
+
|
|
1208
|
+
if (isCombobox) {
|
|
1209
|
+
|
|
1210
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1211
|
+
hasValue = elem.input.value?.length > 0;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1158
1215
|
if (!hasValue && elem.required && elem.touched) {
|
|
1159
1216
|
elem.validity = 'valueMissing';
|
|
1160
1217
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1163,6 +1220,11 @@ class AuroFormValidation {
|
|
|
1163
1220
|
this.validateElementAttributes(elem);
|
|
1164
1221
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1165
1222
|
this.validateElementAttributes(elem);
|
|
1223
|
+
} else if (isCombobox) {
|
|
1224
|
+
this.validateElementAttributes(elem);
|
|
1225
|
+
|
|
1226
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1227
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1166
1228
|
}
|
|
1167
1229
|
}
|
|
1168
1230
|
|
|
@@ -1170,8 +1232,8 @@ class AuroFormValidation {
|
|
|
1170
1232
|
|
|
1171
1233
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1172
1234
|
|
|
1173
|
-
// Don't reset combobox validity if
|
|
1174
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1235
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1236
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1175
1237
|
|
|
1176
1238
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1177
1239
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1244,6 +1306,8 @@ class AuroFormValidation {
|
|
|
1244
1306
|
if (input.validationMessage.length > 0) {
|
|
1245
1307
|
elem.errorMessage = input.validationMessage;
|
|
1246
1308
|
}
|
|
1309
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1310
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1247
1311
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1248
1312
|
const firstInput = this.inputElements[0];
|
|
1249
1313
|
|
|
@@ -914,6 +914,52 @@ class AuroFormValidation {
|
|
|
914
914
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
915
915
|
}
|
|
916
916
|
]
|
|
917
|
+
},
|
|
918
|
+
combobox: {
|
|
919
|
+
filter: [
|
|
920
|
+
{
|
|
921
|
+
check: (e) => {
|
|
922
|
+
|
|
923
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
924
|
+
if (e.behavior !== 'filter') return false;
|
|
925
|
+
|
|
926
|
+
// Get the current input value
|
|
927
|
+
const currentInputValue = e.input.value;
|
|
928
|
+
|
|
929
|
+
// Skip validation if the input has no value
|
|
930
|
+
if (!currentInputValue) return false;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Let's check if the option selected and combobox value match.
|
|
934
|
+
*/
|
|
935
|
+
|
|
936
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
937
|
+
if (!e.optionSelected) return true;
|
|
938
|
+
|
|
939
|
+
// Guard Clause: If there is no value fail the validation
|
|
940
|
+
if (!e.value) return true;
|
|
941
|
+
|
|
942
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
943
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
947
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
948
|
+
*/
|
|
949
|
+
|
|
950
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
951
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
952
|
+
|
|
953
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
954
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
955
|
+
|
|
956
|
+
// If all the checks passed the validation passes
|
|
957
|
+
return false;
|
|
958
|
+
},
|
|
959
|
+
validity: 'valueMissing',
|
|
960
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
961
|
+
}
|
|
962
|
+
]
|
|
917
963
|
}
|
|
918
964
|
};
|
|
919
965
|
|
|
@@ -922,6 +968,8 @@ class AuroFormValidation {
|
|
|
922
968
|
elementType = 'input';
|
|
923
969
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
924
970
|
elementType = 'counter';
|
|
971
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
972
|
+
elementType = 'combobox';
|
|
925
973
|
}
|
|
926
974
|
|
|
927
975
|
if (elementType) {
|
|
@@ -1108,6 +1156,15 @@ class AuroFormValidation {
|
|
|
1108
1156
|
}
|
|
1109
1157
|
}
|
|
1110
1158
|
|
|
1159
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1160
|
+
|
|
1161
|
+
if (isCombobox) {
|
|
1162
|
+
|
|
1163
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1164
|
+
hasValue = elem.input.value?.length > 0;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1111
1168
|
if (!hasValue && elem.required && elem.touched) {
|
|
1112
1169
|
elem.validity = 'valueMissing';
|
|
1113
1170
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1116,6 +1173,11 @@ class AuroFormValidation {
|
|
|
1116
1173
|
this.validateElementAttributes(elem);
|
|
1117
1174
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1118
1175
|
this.validateElementAttributes(elem);
|
|
1176
|
+
} else if (isCombobox) {
|
|
1177
|
+
this.validateElementAttributes(elem);
|
|
1178
|
+
|
|
1179
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1180
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1119
1181
|
}
|
|
1120
1182
|
}
|
|
1121
1183
|
|
|
@@ -1123,8 +1185,8 @@ class AuroFormValidation {
|
|
|
1123
1185
|
|
|
1124
1186
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1125
1187
|
|
|
1126
|
-
// Don't reset combobox validity if
|
|
1127
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1188
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1189
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1128
1190
|
|
|
1129
1191
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1130
1192
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1197,6 +1259,8 @@ class AuroFormValidation {
|
|
|
1197
1259
|
if (input.validationMessage.length > 0) {
|
|
1198
1260
|
elem.errorMessage = input.validationMessage;
|
|
1199
1261
|
}
|
|
1262
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1263
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1200
1264
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1201
1265
|
const firstInput = this.inputElements[0];
|
|
1202
1266
|
|
|
@@ -914,6 +914,52 @@ class AuroFormValidation {
|
|
|
914
914
|
message: e => e.getAttribute('setCustomValidityRangeUnderflow') || ''
|
|
915
915
|
}
|
|
916
916
|
]
|
|
917
|
+
},
|
|
918
|
+
combobox: {
|
|
919
|
+
filter: [
|
|
920
|
+
{
|
|
921
|
+
check: (e) => {
|
|
922
|
+
|
|
923
|
+
// Guard Clause: If the behavior is not 'filter', skip this validation
|
|
924
|
+
if (e.behavior !== 'filter') return false;
|
|
925
|
+
|
|
926
|
+
// Get the current input value
|
|
927
|
+
const currentInputValue = e.input.value;
|
|
928
|
+
|
|
929
|
+
// Skip validation if the input has no value
|
|
930
|
+
if (!currentInputValue) return false;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Let's check if the option selected and combobox value match.
|
|
934
|
+
*/
|
|
935
|
+
|
|
936
|
+
// Guard Clause: If there is no option selected fail the validation
|
|
937
|
+
if (!e.optionSelected) return true;
|
|
938
|
+
|
|
939
|
+
// Guard Clause: If there is no value fail the validation
|
|
940
|
+
if (!e.value) return true;
|
|
941
|
+
|
|
942
|
+
// Guard Clause: If the selected option's value doesn't match the input value fail the validation
|
|
943
|
+
if (e.optionSelected.value !== e.value) return true;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Now let's make sure the user hasn't change the value in the input after selecting an option.
|
|
947
|
+
* This is to make sure there's no user confusion if they select an option but then change the value to something else.
|
|
948
|
+
*/
|
|
949
|
+
|
|
950
|
+
// Guard Clause: If the current input value doesn't match the option selected value fail the validation
|
|
951
|
+
if (currentInputValue && currentInputValue !== e.optionSelected.value) return true;
|
|
952
|
+
|
|
953
|
+
// Guard Clause: If the current input value doesn't match the combobox value fail the validation
|
|
954
|
+
if (currentInputValue && currentInputValue !== e.value) return true;
|
|
955
|
+
|
|
956
|
+
// If all the checks passed the validation passes
|
|
957
|
+
return false;
|
|
958
|
+
},
|
|
959
|
+
validity: 'valueMissing',
|
|
960
|
+
message: e => e.getAttribute('setCustomValidityValueMissingFilter') || e.setCustomValidity || ''
|
|
961
|
+
}
|
|
962
|
+
]
|
|
917
963
|
}
|
|
918
964
|
};
|
|
919
965
|
|
|
@@ -922,6 +968,8 @@ class AuroFormValidation {
|
|
|
922
968
|
elementType = 'input';
|
|
923
969
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group')) {
|
|
924
970
|
elementType = 'counter';
|
|
971
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
|
|
972
|
+
elementType = 'combobox';
|
|
925
973
|
}
|
|
926
974
|
|
|
927
975
|
if (elementType) {
|
|
@@ -1108,6 +1156,15 @@ class AuroFormValidation {
|
|
|
1108
1156
|
}
|
|
1109
1157
|
}
|
|
1110
1158
|
|
|
1159
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1160
|
+
|
|
1161
|
+
if (isCombobox) {
|
|
1162
|
+
|
|
1163
|
+
if (!elem.persistInput || elem.behavior === "filter") {
|
|
1164
|
+
hasValue = elem.input.value?.length > 0;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1111
1168
|
if (!hasValue && elem.required && elem.touched) {
|
|
1112
1169
|
elem.validity = 'valueMissing';
|
|
1113
1170
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
@@ -1116,6 +1173,11 @@ class AuroFormValidation {
|
|
|
1116
1173
|
this.validateElementAttributes(elem);
|
|
1117
1174
|
} else if (hasValue && (this.runtimeUtils.elementMatch(elem, 'auro-counter') || this.runtimeUtils.elementMatch(elem, 'auro-counter-group'))) {
|
|
1118
1175
|
this.validateElementAttributes(elem);
|
|
1176
|
+
} else if (isCombobox) {
|
|
1177
|
+
this.validateElementAttributes(elem);
|
|
1178
|
+
|
|
1179
|
+
// Don't run extra validation for cases where the combobox is not being used as a filter
|
|
1180
|
+
validationShouldRun = elem.behavior !== 'filter';
|
|
1119
1181
|
}
|
|
1120
1182
|
}
|
|
1121
1183
|
|
|
@@ -1123,8 +1185,8 @@ class AuroFormValidation {
|
|
|
1123
1185
|
|
|
1124
1186
|
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
1125
1187
|
|
|
1126
|
-
// Don't reset combobox validity if
|
|
1127
|
-
if (!isCombobox || isCombobox && !elem.
|
|
1188
|
+
// Don't reset combobox validity if persistInput is set since we can't use the input value to validate
|
|
1189
|
+
if (!isCombobox || isCombobox && !elem.persistInput) {
|
|
1128
1190
|
|
|
1129
1191
|
// run validation on all inputs since we're going to use them to set the validity of this component
|
|
1130
1192
|
this.auroInputElements.forEach(input => input.validate());
|
|
@@ -1197,6 +1259,8 @@ class AuroFormValidation {
|
|
|
1197
1259
|
if (input.validationMessage.length > 0) {
|
|
1198
1260
|
elem.errorMessage = input.validationMessage;
|
|
1199
1261
|
}
|
|
1262
|
+
} else if (this.runtimeUtils.elementMatch(elem, 'auro-combobox') && elem.errorMessage === '') {
|
|
1263
|
+
elem.errorMessage = elem.input?.inputElement?.validationMessage;
|
|
1200
1264
|
} else if (this.inputElements?.length > 0 && elem.errorMessage === '') {
|
|
1201
1265
|
const firstInput = this.inputElements[0];
|
|
1202
1266
|
|