@aurodesignsystem/auro-formkit 3.3.0-beta.2 → 3.3.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 +23 -0
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.md +1 -0
- package/components/checkbox/demo/api.min.js +34 -5
- package/components/checkbox/demo/index.min.js +34 -5
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -0
- package/components/checkbox/dist/auro-checkbox.d.ts +6 -0
- package/components/checkbox/dist/index.js +34 -5
- package/components/checkbox/dist/registered.js +34 -5
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/api.min.js +77 -57
- package/components/combobox/demo/index.min.js +77 -57
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/dist/auro-combobox.d.ts +2 -10
- package/components/combobox/dist/index.js +77 -57
- package/components/combobox/dist/registered.js +77 -57
- package/components/counter/README.md +1 -1
- package/components/counter/demo/api.min.js +12 -5
- package/components/counter/demo/index.min.js +12 -5
- package/components/counter/demo/readme.md +1 -1
- package/components/counter/dist/index.js +12 -5
- package/components/counter/dist/registered.js +12 -5
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/api.min.js +54 -34
- package/components/datepicker/demo/index.min.js +54 -34
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/auro-datepicker.d.ts +8 -0
- package/components/datepicker/dist/index.js +54 -34
- package/components/datepicker/dist/registered.js +54 -34
- package/components/dropdown/README.md +1 -1
- package/components/dropdown/demo/readme.md +1 -1
- package/components/form/README.md +1 -1
- package/components/form/demo/readme.md +1 -1
- package/components/input/README.md +1 -1
- package/components/input/demo/api.min.js +26 -14
- package/components/input/demo/index.min.js +26 -14
- package/components/input/demo/readme.md +1 -1
- package/components/input/dist/base-input.d.ts +8 -0
- package/components/input/dist/index.js +26 -14
- package/components/input/dist/registered.js +26 -14
- package/components/menu/README.md +1 -1
- package/components/menu/demo/readme.md +1 -1
- package/components/radio/README.md +1 -1
- package/components/radio/demo/api.md +1 -0
- package/components/radio/demo/api.min.js +33 -9
- package/components/radio/demo/index.min.js +33 -9
- package/components/radio/demo/readme.md +1 -1
- package/components/radio/dist/auro-radio-group.d.ts +8 -0
- package/components/radio/dist/auro-radio.d.ts +5 -0
- package/components/radio/dist/index.js +33 -9
- package/components/radio/dist/registered.js +33 -9
- package/components/select/README.md +1 -1
- package/components/select/demo/api.min.js +25 -15
- package/components/select/demo/index.min.js +25 -15
- package/components/select/demo/readme.md +1 -1
- package/components/select/dist/auro-select.d.ts +8 -0
- package/components/select/dist/index.js +25 -15
- package/components/select/dist/registered.js +25 -15
- package/package.json +1 -1
|
@@ -1389,6 +1389,7 @@ class AuroFormValidation {
|
|
|
1389
1389
|
reset(elem) {
|
|
1390
1390
|
elem.validity = undefined;
|
|
1391
1391
|
elem.value = undefined;
|
|
1392
|
+
elem.touched = false;
|
|
1392
1393
|
|
|
1393
1394
|
// Resets the second value of the datepicker in range state
|
|
1394
1395
|
if (elem.valueEnd) {
|
|
@@ -1526,7 +1527,7 @@ class AuroFormValidation {
|
|
|
1526
1527
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
1527
1528
|
|
|
1528
1529
|
// Guard Clause: if the value is too short
|
|
1529
|
-
if (elem.value
|
|
1530
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
1530
1531
|
|
|
1531
1532
|
elem.validity = 'tooShort';
|
|
1532
1533
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1596,11 +1597,17 @@ class AuroFormValidation {
|
|
|
1596
1597
|
this.getAuroInputs(elem);
|
|
1597
1598
|
|
|
1598
1599
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1599
|
-
|
|
1600
|
+
let validationShouldRun =
|
|
1601
|
+
force ||
|
|
1602
|
+
(!elem.contains(document.activeElement) &&
|
|
1603
|
+
(elem.touched ||
|
|
1604
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1605
|
+
elem.validateOnInput;
|
|
1600
1606
|
|
|
1601
1607
|
if (elem.hasAttribute('error')) {
|
|
1602
1608
|
elem.validity = 'customError';
|
|
1603
1609
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1610
|
+
validationShouldRun = false;
|
|
1604
1611
|
} else if (validationShouldRun) {
|
|
1605
1612
|
elem.validity = 'valid';
|
|
1606
1613
|
elem.errorMessage = '';
|
|
@@ -1621,7 +1628,7 @@ class AuroFormValidation {
|
|
|
1621
1628
|
}
|
|
1622
1629
|
}
|
|
1623
1630
|
|
|
1624
|
-
if (!hasValue && elem.required) {
|
|
1631
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1625
1632
|
elem.validity = 'valueMissing';
|
|
1626
1633
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1627
1634
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1632,7 +1639,7 @@ class AuroFormValidation {
|
|
|
1632
1639
|
}
|
|
1633
1640
|
}
|
|
1634
1641
|
|
|
1635
|
-
if (this.auroInputElements?.length > 0) {
|
|
1642
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1636
1643
|
elem.validity = this.auroInputElements[0].validity;
|
|
1637
1644
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1638
1645
|
|
|
@@ -1711,7 +1718,7 @@ class AuroFormValidation {
|
|
|
1711
1718
|
}
|
|
1712
1719
|
}
|
|
1713
1720
|
} else {
|
|
1714
|
-
elem.errorMessage =
|
|
1721
|
+
elem.errorMessage = '';
|
|
1715
1722
|
}
|
|
1716
1723
|
}
|
|
1717
1724
|
}
|
|
@@ -1389,6 +1389,7 @@ class AuroFormValidation {
|
|
|
1389
1389
|
reset(elem) {
|
|
1390
1390
|
elem.validity = undefined;
|
|
1391
1391
|
elem.value = undefined;
|
|
1392
|
+
elem.touched = false;
|
|
1392
1393
|
|
|
1393
1394
|
// Resets the second value of the datepicker in range state
|
|
1394
1395
|
if (elem.valueEnd) {
|
|
@@ -1526,7 +1527,7 @@ class AuroFormValidation {
|
|
|
1526
1527
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
1527
1528
|
|
|
1528
1529
|
// Guard Clause: if the value is too short
|
|
1529
|
-
if (elem.value
|
|
1530
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
1530
1531
|
|
|
1531
1532
|
elem.validity = 'tooShort';
|
|
1532
1533
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1596,11 +1597,17 @@ class AuroFormValidation {
|
|
|
1596
1597
|
this.getAuroInputs(elem);
|
|
1597
1598
|
|
|
1598
1599
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1599
|
-
|
|
1600
|
+
let validationShouldRun =
|
|
1601
|
+
force ||
|
|
1602
|
+
(!elem.contains(document.activeElement) &&
|
|
1603
|
+
(elem.touched ||
|
|
1604
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1605
|
+
elem.validateOnInput;
|
|
1600
1606
|
|
|
1601
1607
|
if (elem.hasAttribute('error')) {
|
|
1602
1608
|
elem.validity = 'customError';
|
|
1603
1609
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1610
|
+
validationShouldRun = false;
|
|
1604
1611
|
} else if (validationShouldRun) {
|
|
1605
1612
|
elem.validity = 'valid';
|
|
1606
1613
|
elem.errorMessage = '';
|
|
@@ -1621,7 +1628,7 @@ class AuroFormValidation {
|
|
|
1621
1628
|
}
|
|
1622
1629
|
}
|
|
1623
1630
|
|
|
1624
|
-
if (!hasValue && elem.required) {
|
|
1631
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1625
1632
|
elem.validity = 'valueMissing';
|
|
1626
1633
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1627
1634
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1632,7 +1639,7 @@ class AuroFormValidation {
|
|
|
1632
1639
|
}
|
|
1633
1640
|
}
|
|
1634
1641
|
|
|
1635
|
-
if (this.auroInputElements?.length > 0) {
|
|
1642
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1636
1643
|
elem.validity = this.auroInputElements[0].validity;
|
|
1637
1644
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1638
1645
|
|
|
@@ -1711,7 +1718,7 @@ class AuroFormValidation {
|
|
|
1711
1718
|
}
|
|
1712
1719
|
}
|
|
1713
1720
|
} else {
|
|
1714
|
-
elem.errorMessage =
|
|
1721
|
+
elem.errorMessage = '';
|
|
1715
1722
|
}
|
|
1716
1723
|
}
|
|
1717
1724
|
}
|
|
@@ -110,7 +110,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
110
110
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
111
111
|
|
|
112
112
|
```html
|
|
113
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
113
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-counter/+esm"></script>
|
|
114
114
|
```
|
|
115
115
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
116
116
|
|
|
@@ -1342,6 +1342,7 @@ class AuroFormValidation {
|
|
|
1342
1342
|
reset(elem) {
|
|
1343
1343
|
elem.validity = undefined;
|
|
1344
1344
|
elem.value = undefined;
|
|
1345
|
+
elem.touched = false;
|
|
1345
1346
|
|
|
1346
1347
|
// Resets the second value of the datepicker in range state
|
|
1347
1348
|
if (elem.valueEnd) {
|
|
@@ -1479,7 +1480,7 @@ class AuroFormValidation {
|
|
|
1479
1480
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
1480
1481
|
|
|
1481
1482
|
// Guard Clause: if the value is too short
|
|
1482
|
-
if (elem.value
|
|
1483
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
1483
1484
|
|
|
1484
1485
|
elem.validity = 'tooShort';
|
|
1485
1486
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1549,11 +1550,17 @@ class AuroFormValidation {
|
|
|
1549
1550
|
this.getAuroInputs(elem);
|
|
1550
1551
|
|
|
1551
1552
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1552
|
-
|
|
1553
|
+
let validationShouldRun =
|
|
1554
|
+
force ||
|
|
1555
|
+
(!elem.contains(document.activeElement) &&
|
|
1556
|
+
(elem.touched ||
|
|
1557
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1558
|
+
elem.validateOnInput;
|
|
1553
1559
|
|
|
1554
1560
|
if (elem.hasAttribute('error')) {
|
|
1555
1561
|
elem.validity = 'customError';
|
|
1556
1562
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1563
|
+
validationShouldRun = false;
|
|
1557
1564
|
} else if (validationShouldRun) {
|
|
1558
1565
|
elem.validity = 'valid';
|
|
1559
1566
|
elem.errorMessage = '';
|
|
@@ -1574,7 +1581,7 @@ class AuroFormValidation {
|
|
|
1574
1581
|
}
|
|
1575
1582
|
}
|
|
1576
1583
|
|
|
1577
|
-
if (!hasValue && elem.required) {
|
|
1584
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1578
1585
|
elem.validity = 'valueMissing';
|
|
1579
1586
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1580
1587
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1585,7 +1592,7 @@ class AuroFormValidation {
|
|
|
1585
1592
|
}
|
|
1586
1593
|
}
|
|
1587
1594
|
|
|
1588
|
-
if (this.auroInputElements?.length > 0) {
|
|
1595
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1589
1596
|
elem.validity = this.auroInputElements[0].validity;
|
|
1590
1597
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1591
1598
|
|
|
@@ -1664,7 +1671,7 @@ class AuroFormValidation {
|
|
|
1664
1671
|
}
|
|
1665
1672
|
}
|
|
1666
1673
|
} else {
|
|
1667
|
-
elem.errorMessage =
|
|
1674
|
+
elem.errorMessage = '';
|
|
1668
1675
|
}
|
|
1669
1676
|
}
|
|
1670
1677
|
}
|
|
@@ -1342,6 +1342,7 @@ class AuroFormValidation {
|
|
|
1342
1342
|
reset(elem) {
|
|
1343
1343
|
elem.validity = undefined;
|
|
1344
1344
|
elem.value = undefined;
|
|
1345
|
+
elem.touched = false;
|
|
1345
1346
|
|
|
1346
1347
|
// Resets the second value of the datepicker in range state
|
|
1347
1348
|
if (elem.valueEnd) {
|
|
@@ -1479,7 +1480,7 @@ class AuroFormValidation {
|
|
|
1479
1480
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
1480
1481
|
|
|
1481
1482
|
// Guard Clause: if the value is too short
|
|
1482
|
-
if (elem.value
|
|
1483
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
1483
1484
|
|
|
1484
1485
|
elem.validity = 'tooShort';
|
|
1485
1486
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -1549,11 +1550,17 @@ class AuroFormValidation {
|
|
|
1549
1550
|
this.getAuroInputs(elem);
|
|
1550
1551
|
|
|
1551
1552
|
// Validate only if noValidate is not true and the input does not have focus
|
|
1552
|
-
|
|
1553
|
+
let validationShouldRun =
|
|
1554
|
+
force ||
|
|
1555
|
+
(!elem.contains(document.activeElement) &&
|
|
1556
|
+
(elem.touched ||
|
|
1557
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1558
|
+
elem.validateOnInput;
|
|
1553
1559
|
|
|
1554
1560
|
if (elem.hasAttribute('error')) {
|
|
1555
1561
|
elem.validity = 'customError';
|
|
1556
1562
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1563
|
+
validationShouldRun = false;
|
|
1557
1564
|
} else if (validationShouldRun) {
|
|
1558
1565
|
elem.validity = 'valid';
|
|
1559
1566
|
elem.errorMessage = '';
|
|
@@ -1574,7 +1581,7 @@ class AuroFormValidation {
|
|
|
1574
1581
|
}
|
|
1575
1582
|
}
|
|
1576
1583
|
|
|
1577
|
-
if (!hasValue && elem.required) {
|
|
1584
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1578
1585
|
elem.validity = 'valueMissing';
|
|
1579
1586
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1580
1587
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1585,7 +1592,7 @@ class AuroFormValidation {
|
|
|
1585
1592
|
}
|
|
1586
1593
|
}
|
|
1587
1594
|
|
|
1588
|
-
if (this.auroInputElements?.length > 0) {
|
|
1595
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1589
1596
|
elem.validity = this.auroInputElements[0].validity;
|
|
1590
1597
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1591
1598
|
|
|
@@ -1664,7 +1671,7 @@ class AuroFormValidation {
|
|
|
1664
1671
|
}
|
|
1665
1672
|
}
|
|
1666
1673
|
} else {
|
|
1667
|
-
elem.errorMessage =
|
|
1674
|
+
elem.errorMessage = '';
|
|
1668
1675
|
}
|
|
1669
1676
|
}
|
|
1670
1677
|
}
|
|
@@ -104,7 +104,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
104
104
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
105
105
|
|
|
106
106
|
```html
|
|
107
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.2
|
|
107
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@3.3.0-beta.2/auro-datepicker/+esm"></script>
|
|
108
108
|
```
|
|
109
109
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
110
110
|
|
|
@@ -787,6 +787,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
787
787
|
reset(elem) {
|
|
788
788
|
elem.validity = undefined;
|
|
789
789
|
elem.value = undefined;
|
|
790
|
+
elem.touched = false;
|
|
790
791
|
|
|
791
792
|
// Resets the second value of the datepicker in range state
|
|
792
793
|
if (elem.valueEnd) {
|
|
@@ -924,7 +925,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
924
925
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
925
926
|
|
|
926
927
|
// Guard Clause: if the value is too short
|
|
927
|
-
if (elem.value
|
|
928
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
928
929
|
|
|
929
930
|
elem.validity = 'tooShort';
|
|
930
931
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -994,11 +995,17 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
994
995
|
this.getAuroInputs(elem);
|
|
995
996
|
|
|
996
997
|
// Validate only if noValidate is not true and the input does not have focus
|
|
997
|
-
|
|
998
|
+
let validationShouldRun =
|
|
999
|
+
force ||
|
|
1000
|
+
(!elem.contains(document.activeElement) &&
|
|
1001
|
+
(elem.touched ||
|
|
1002
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
1003
|
+
elem.validateOnInput;
|
|
998
1004
|
|
|
999
1005
|
if (elem.hasAttribute('error')) {
|
|
1000
1006
|
elem.validity = 'customError';
|
|
1001
1007
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
1008
|
+
validationShouldRun = false;
|
|
1002
1009
|
} else if (validationShouldRun) {
|
|
1003
1010
|
elem.validity = 'valid';
|
|
1004
1011
|
elem.errorMessage = '';
|
|
@@ -1019,7 +1026,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1019
1026
|
}
|
|
1020
1027
|
}
|
|
1021
1028
|
|
|
1022
|
-
if (!hasValue && elem.required) {
|
|
1029
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
1023
1030
|
elem.validity = 'valueMissing';
|
|
1024
1031
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
1025
1032
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -1030,7 +1037,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1030
1037
|
}
|
|
1031
1038
|
}
|
|
1032
1039
|
|
|
1033
|
-
if (this.auroInputElements?.length > 0) {
|
|
1040
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
1034
1041
|
elem.validity = this.auroInputElements[0].validity;
|
|
1035
1042
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
1036
1043
|
|
|
@@ -1109,7 +1116,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
1109
1116
|
}
|
|
1110
1117
|
}
|
|
1111
1118
|
} else {
|
|
1112
|
-
elem.errorMessage =
|
|
1119
|
+
elem.errorMessage = '';
|
|
1113
1120
|
}
|
|
1114
1121
|
}
|
|
1115
1122
|
};
|
|
@@ -20758,6 +20765,7 @@ class AuroFormValidation {
|
|
|
20758
20765
|
reset(elem) {
|
|
20759
20766
|
elem.validity = undefined;
|
|
20760
20767
|
elem.value = undefined;
|
|
20768
|
+
elem.touched = false;
|
|
20761
20769
|
|
|
20762
20770
|
// Resets the second value of the datepicker in range state
|
|
20763
20771
|
if (elem.valueEnd) {
|
|
@@ -20895,7 +20903,7 @@ class AuroFormValidation {
|
|
|
20895
20903
|
} else if (elem.type === 'date' && elem.value?.length > 0) {
|
|
20896
20904
|
|
|
20897
20905
|
// Guard Clause: if the value is too short
|
|
20898
|
-
if (elem.value
|
|
20906
|
+
if (elem.value?.length < elem.lengthForType) {
|
|
20899
20907
|
|
|
20900
20908
|
elem.validity = 'tooShort';
|
|
20901
20909
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
@@ -20965,11 +20973,17 @@ class AuroFormValidation {
|
|
|
20965
20973
|
this.getAuroInputs(elem);
|
|
20966
20974
|
|
|
20967
20975
|
// Validate only if noValidate is not true and the input does not have focus
|
|
20968
|
-
|
|
20976
|
+
let validationShouldRun =
|
|
20977
|
+
force ||
|
|
20978
|
+
(!elem.contains(document.activeElement) &&
|
|
20979
|
+
(elem.touched ||
|
|
20980
|
+
(!elem.touched && typeof elem.value !== "undefined"))) ||
|
|
20981
|
+
elem.validateOnInput;
|
|
20969
20982
|
|
|
20970
20983
|
if (elem.hasAttribute('error')) {
|
|
20971
20984
|
elem.validity = 'customError';
|
|
20972
20985
|
elem.errorMessage = elem.setCustomValidityCustomError || elem.error || elem.setCustomValidity || '';
|
|
20986
|
+
validationShouldRun = false;
|
|
20973
20987
|
} else if (validationShouldRun) {
|
|
20974
20988
|
elem.validity = 'valid';
|
|
20975
20989
|
elem.errorMessage = '';
|
|
@@ -20990,7 +21004,7 @@ class AuroFormValidation {
|
|
|
20990
21004
|
}
|
|
20991
21005
|
}
|
|
20992
21006
|
|
|
20993
|
-
if (!hasValue && elem.required) {
|
|
21007
|
+
if (!hasValue && elem.required && elem.touched) {
|
|
20994
21008
|
elem.validity = 'valueMissing';
|
|
20995
21009
|
elem.errorMessage = elem.setCustomValidityValueMissing || elem.setCustomValidity || '';
|
|
20996
21010
|
} else if (this.runtimeUtils.elementMatch(elem, 'auro-input')) {
|
|
@@ -21001,7 +21015,7 @@ class AuroFormValidation {
|
|
|
21001
21015
|
}
|
|
21002
21016
|
}
|
|
21003
21017
|
|
|
21004
|
-
if (this.auroInputElements?.length > 0) {
|
|
21018
|
+
if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
|
|
21005
21019
|
elem.validity = this.auroInputElements[0].validity;
|
|
21006
21020
|
elem.errorMessage = this.auroInputElements[0].errorMessage;
|
|
21007
21021
|
|
|
@@ -21080,7 +21094,7 @@ class AuroFormValidation {
|
|
|
21080
21094
|
}
|
|
21081
21095
|
}
|
|
21082
21096
|
} else {
|
|
21083
|
-
elem.errorMessage =
|
|
21097
|
+
elem.errorMessage = '';
|
|
21084
21098
|
}
|
|
21085
21099
|
}
|
|
21086
21100
|
}
|
|
@@ -21131,6 +21145,7 @@ class BaseInput extends i$2 {
|
|
|
21131
21145
|
* @returns {void}
|
|
21132
21146
|
*/
|
|
21133
21147
|
privateDefaults() {
|
|
21148
|
+
this.touched = false;
|
|
21134
21149
|
this.util = new AuroInputUtilities();
|
|
21135
21150
|
this.validation = new AuroFormValidation();
|
|
21136
21151
|
this.inputIconName = undefined;
|
|
@@ -21492,6 +21507,18 @@ class BaseInput extends i$2 {
|
|
|
21492
21507
|
validity: {
|
|
21493
21508
|
type: String,
|
|
21494
21509
|
reflect: true
|
|
21510
|
+
},
|
|
21511
|
+
|
|
21512
|
+
/**
|
|
21513
|
+
* Indicates whether the input is in a dirty state (has been interacted with).
|
|
21514
|
+
* @type {boolean}
|
|
21515
|
+
* @default false
|
|
21516
|
+
* @private
|
|
21517
|
+
*/
|
|
21518
|
+
touched: {
|
|
21519
|
+
type: Boolean,
|
|
21520
|
+
reflect: true,
|
|
21521
|
+
attribute: false
|
|
21495
21522
|
}
|
|
21496
21523
|
};
|
|
21497
21524
|
}
|
|
@@ -21778,15 +21805,7 @@ class BaseInput extends i$2 {
|
|
|
21778
21805
|
*/
|
|
21779
21806
|
handleFocusin() {
|
|
21780
21807
|
|
|
21781
|
-
|
|
21782
|
-
* The input is considered to be in it's initial state based on
|
|
21783
|
-
* if this.value === undefined. The first time we interact with the
|
|
21784
|
-
* input manually, by applying focusin, we need to flag the
|
|
21785
|
-
* input as no longer in the initial state.
|
|
21786
|
-
*/
|
|
21787
|
-
if (this.value === undefined) {
|
|
21788
|
-
this.value = '';
|
|
21789
|
-
}
|
|
21808
|
+
this.touched = true;
|
|
21790
21809
|
}
|
|
21791
21810
|
|
|
21792
21811
|
/**
|
|
@@ -23361,6 +23380,7 @@ class AuroDatePicker extends i$2 {
|
|
|
23361
23380
|
this.calendarRenderUtil.updateCentralDate(this, new Date());
|
|
23362
23381
|
}
|
|
23363
23382
|
|
|
23383
|
+
this.touched = false;
|
|
23364
23384
|
this.disabled = false;
|
|
23365
23385
|
this.required = false;
|
|
23366
23386
|
this.onDark = false;
|
|
@@ -23692,6 +23712,18 @@ class AuroDatePicker extends i$2 {
|
|
|
23692
23712
|
*/
|
|
23693
23713
|
valueEnd: {
|
|
23694
23714
|
type: String
|
|
23715
|
+
},
|
|
23716
|
+
|
|
23717
|
+
/**
|
|
23718
|
+
* Indicates whether the datepicker is in a dirty state (has been interacted with).
|
|
23719
|
+
* @type {boolean}
|
|
23720
|
+
* @default false
|
|
23721
|
+
* @private
|
|
23722
|
+
*/
|
|
23723
|
+
touched: {
|
|
23724
|
+
type: Boolean,
|
|
23725
|
+
reflect: true,
|
|
23726
|
+
attribute: false
|
|
23695
23727
|
}
|
|
23696
23728
|
};
|
|
23697
23729
|
}
|
|
@@ -23968,27 +24000,15 @@ class AuroDatePicker extends i$2 {
|
|
|
23968
24000
|
configureDatepicker() {
|
|
23969
24001
|
this.addEventListener('focusin', () => {
|
|
23970
24002
|
|
|
23971
|
-
|
|
23972
|
-
* The datepicker is considered to be in it's initial state based on
|
|
23973
|
-
* if this.value === undefined. The first time we interact with the
|
|
23974
|
-
* datepicker manually, by applying focusin, we need to flag the
|
|
23975
|
-
* datepicker as no longer in the initial state.
|
|
23976
|
-
*/
|
|
23977
|
-
if (this.value === undefined) {
|
|
23978
|
-
this.value = '';
|
|
23979
|
-
}
|
|
23980
|
-
|
|
23981
|
-
if (this.valueEnd === undefined) {
|
|
23982
|
-
this.valueEnd = '';
|
|
23983
|
-
}
|
|
24003
|
+
this.touched = true;
|
|
23984
24004
|
});
|
|
23985
24005
|
|
|
23986
24006
|
this.addEventListener('focusout', (evt) => {
|
|
23987
|
-
if (!this.noValidate && !evt.detail.expanded && this.
|
|
24007
|
+
if (!this.noValidate && !evt.detail.expanded && this.touched) {
|
|
23988
24008
|
if (!this.contains(document.activeElement)) {
|
|
23989
24009
|
this.validation.validate(this.inputList[0]);
|
|
23990
24010
|
|
|
23991
|
-
if (this.inputList[1] && this.inputList[1].
|
|
24011
|
+
if (this.inputList[1] && this.inputList[1].touched) {
|
|
23992
24012
|
this.validation.validate(this.inputList[1]);
|
|
23993
24013
|
}
|
|
23994
24014
|
}
|